details: https://github.com/nginx/njs/commit/4ee93af07245da8750feeaf6a1a1b965f40c63c4 branches: master commit: 4ee93af07245da8750feeaf6a1a1b965f40c63c4 user: Dmitry Volyntsev <xei...@nginx.com> date: Tue, 25 Feb 2025 23:05:31 -0800 description: Test262: improved compatibility with node.js for fs/methods.t.mjs.
--- test/fs/methods.t.mjs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test/fs/methods.t.mjs b/test/fs/methods.t.mjs index 705c1b5a..72e42cb9 100644 --- a/test/fs/methods.t.mjs +++ b/test/fs/methods.t.mjs @@ -21,6 +21,10 @@ function p(args, default_opts) { return params; } +function has_quickjs() { + return (typeof njs != 'undefined' && njs.engine == 'QuickJS'); +} + function promisify(f) { return function (...args) { return new Promise((resolve, reject) => { @@ -116,7 +120,7 @@ let readfile_tests = () => [ return true; } }, - { args: ["test/fs/non_utf8", "utf8"], expected: "��", skip() { return njs && njs.engine == 'QuickJS'; } }, + { args: ["test/fs/non_utf8", "utf8"], expected: "��", skip: () => has_quickjs() }, { args: ["test/fs/non_utf8", {encoding: "hex"}], expected: "8080" }, { args: ["test/fs/non_utf8", "base64"], expected: "gIA=" }, { args: ["test/fs/ascii", "utf8"], expected: "x".repeat(600) }, @@ -219,7 +223,7 @@ let writefile_tests = () => [ { args: ["@", Buffer.from("XYZ"), {encoding: "utf8", mode: 0o666}], expected: Buffer.from("XYZ") }, { args: ["@", new DataView(Buffer.alloc(3).fill(66).buffer)], - expected: Buffer.from("BBB"), skip() { return njs && njs.engine == 'QuickJS'; } }, + expected: Buffer.from("BBB"), skip: () => has_quickjs() }, { args: ["@", new Uint8Array(Buffer.from("ABCD"))], expected: Buffer.from("ABCD")}, { args: ["@", "XYZ"], expected: Buffer.from("XYZ")}, @@ -309,7 +313,7 @@ let append_tests = () => [ { args: ["@", Buffer.from("XYZ"), {encoding: "utf8", mode: 0o666}], expected: Buffer.from("XYZXYZ") }, { args: ["@", new DataView(Buffer.alloc(3).fill(66).buffer)], - expected: Buffer.from("BBBBBB"), skip() { return njs && njs.engine == 'QuickJS'; } }, + expected: Buffer.from("BBBBBB"), skip: () => has_quickjs() }, { args: ["@", new Uint8Array(Buffer.from("ABCD"))], expected: Buffer.from("ABCDABCD")}, { args: ["@", "XYZ"], expected: Buffer.from("XYZXYZ")}, _______________________________________________ nginx-devel mailing list nginx-devel@nginx.org https://mailman.nginx.org/mailman/listinfo/nginx-devel