Accept RangeError from Buffer.concat() revalidation.
Remove oversized Buffer.from() cases that make Node.js allocate 4 GiB.
Expect empty Buffer.fill() values to fail.
Use fs.rm() for recursive removal under Node.js.
Check non-enumerable fs.Stats date properties directly.
Use distinct readlink fixtures for concurrently run test cases.
Known failures for js_test --binary=node are limited to module
resolution in import and XML module tests for v25.2.1 on linux.
Buffer.concat(list);
} catch (e) {
- if (e instanceof TypeError) {
+ if (e instanceof TypeError || e instanceof RangeError) {
return 'SUCCESS';
}
{ buf: Buffer.from('abc'), value: Buffer.from('def'), expected: 'def' },
{ buf: Buffer.from('abc'), value: Buffer.from('def'), detach_value: true,
exception: 'TypeError: detached buffer' },
- { buf: Buffer.from('abc'), value: Buffer.from(''), expected: '\0\0\0' },
- { buf: Buffer.from('abc'), value_from_buf: [1, 1], expected: '\0\0\0' },
+ { buf: Buffer.from('abc'), value: Buffer.from(''),
+ exception: 'TypeError: value argument must not be empty' },
+ { buf: Buffer.from('abc'), value_from_buf: [1, 1],
+ exception: 'TypeError: value argument must not be empty' },
{ buf: Buffer.from('def'),
value: Buffer.from(new Uint8Array([0x60, 0x61, 0x62, 0x63]).buffer, 1),
expected: 'abc' },
{ args: [{length:3, 0:0x62, 1:0x75, 2:0x66}], expected: 'buf' },
{ args: [[-1, 1, 255, 22323, -Infinity, Infinity, NaN]], fmt: "hex", expected: 'ff01ff33000000' },
{ args: [{length:5, 0:'A'.charCodeAt(0), 2:'X', 3:NaN, 4:0xfd}], fmt: "hex", expected: '41000000fd' },
- { args: [{length: 0x100000000}], exception: 'RangeError: invalid index' },
- { args: [{length: 0x100000001}], exception: 'RangeError: invalid index' },
{ args: [[1, 2, 0.23, '5', 'A']], fmt: "hex", expected: '0102000500' },
{ args: [new Uint8Array([0xff, 0xde, 0xba])], fmt: "hex", expected: 'ffdeba' },
}
let readlink_tests = () => [
- { args: [`${test_dir}/symlink`],
+ { args: ["@symlink"],
check: (data) => data.endsWith("test/fs/ascii") },
- { args: [`${test_dir}/symlink`, {encoding:'buffer'}],
+ { args: ["@symlink", {encoding:'buffer'}],
check: (data) => data instanceof Buffer },
- { args: [`${test_dir}/symlink`, {encoding:'hex'}],
+ { args: ["@symlink", {encoding:'hex'}],
check: (data) => data.endsWith("746573742f66732f6173636969") },
];
{ args: ["test/fs/ascii"],
check: (st) => contains(Object.keys(st),
- [ "atime", "atimeMs", "birthtime", "birthtimeMs",
- "blksize", "blocks", "ctime", "ctimeMs", "dev",
- "gid", "ino", "mode", "mtime", "mtimeMs","nlink",
+ [ "atimeMs", "birthtimeMs", "blksize", "blocks",
+ "ctimeMs", "dev", "gid", "ino", "mode", "mtimeMs", "nlink",
"rdev", "size", "uid" ]) },
+ { args: ["test/fs/ascii"],
+ check: (st) => ["atime", "birthtime", "ctime", "mtime"].every(p => {
+ if (!(st[p] instanceof Date)) {
+ throw Error(`${p} is not an instance of Date`);
+ }
+
+ return true;
+ }) },
{ args: ["test/fs/ascii"],
check: (st) => Object.keys(st).every(p => {
var isNode = () => process.argv[0].includes('node');
+var rmdirRecursive = (path) => isNode()
+ ? fs.rmSync(path, { recursive: true, force: true })
+ : fs.rmdirSync(path, { recursive: true });
+
let stages = [];
var testSync = () => new Promise((resolve, reject) => {
} catch (e) {
}
try {
- fs.rmdirSync(root + dname, { recursive: true });
+ rmdirRecursive(root + dname);
} catch (e) {
}
}
fs.mkdirSync(root + dname, { mode: 0 });
- fs.rmdirSync(root + dname, { recursive: true });
+ fs.rmdirSync(root + dname);
setContent(root + dname, path);
- fs.rmdirSync(root + dname, { recursive: true });
+ rmdirRecursive(root + dname);
try {
fs.accessSync(root + dname);