From c32bad87c55086c7ddab40a27ccd4656e8478800 Mon Sep 17 00:00:00 2001
From: Antoine du Hamel
Date: Thu, 17 Nov 2022 08:02:11 -0500
Subject: [PATCH] test: add lint rule to enforce trailing commas
Only activated on some subfolders to minimize the diff, ideally this
rule would be applied gradually to the entire codebase in follow-up
commits.
PR-URL: https://github.com/nodejs/node/pull/45468
Reviewed-By: Rich Trott
Reviewed-By: Yagiz Nizipli
Reviewed-By: James M Snell
Reviewed-By: Jiawen Geng
---
test/.eslintrc.yaml | 28 ++++++++
test/common/README.md | 8 +--
test/common/wpt/worker.js | 4 +-
test/doctool/test-apilinks.mjs | 4 +-
test/doctool/test-deprecation-codes.js | 4 +-
test/doctool/test-doctool-html.mjs | 10 +--
test/doctool/test-doctool-json.mjs | 64 +++++++++----------
test/doctool/test-make-doc.mjs | 6 +-
test/report/test-report-config.js | 4 +-
.../test-report-uncaught-exception-compat.js | 2 +-
.../test-tick-processor-builtin.js | 2 +-
.../test-tick-processor-cpp-core.js | 2 +-
...test-tick-processor-polyfill-brokenfile.js | 2 +-
.../test-tick-processor-preprocess-flag.js | 2 +-
.../test-tick-processor-unknown.js | 2 +-
test/tick-processor/tick-processor-base.js | 4 +-
test/tick-processor/util.js | 4 +-
test/wasi/test-wasi-initialize-validation.js | 30 ++++-----
test/wasi/test-wasi-not-started.js | 6 +-
test/wasi/test-wasi-start-validation.js | 30 ++++-----
test/wasi/test-wasi-symlinks.js | 4 +-
test/wasi/test-wasi.js | 10 +--
22 files changed, 130 insertions(+), 102 deletions(-)
diff --git a/test/.eslintrc.yaml b/test/.eslintrc.yaml
index b79009fb9c8591..7e931cdab977e3 100644
--- a/test/.eslintrc.yaml
+++ b/test/.eslintrc.yaml
@@ -8,6 +8,7 @@ rules:
multiline-comment-style: [error, separate-lines]
prefer-const: error
symbol-description: off
+ comma-dangle: [error, always-multiline]
no-restricted-syntax:
# Config copied from .eslintrc.js
@@ -68,3 +69,30 @@ rules:
# Global scoped methods and vars
globals:
WebAssembly: false
+
+overrides:
+ - files:
+ - addons/*/*.js
+ - async-hooks/*.js
+ - common/*.js
+ - es-module/*.js
+ - es-module/*.mjs
+ - internet/*.js
+ - js-native-api/*/*.js
+ - known_issues/*.js
+ - message/*.js
+ - node-api/*/*.js
+ - parallel/*.js
+ - parallel/*.mjs
+ - pseudo-tty/*.js
+ - pummel/*.js
+ - sequential/*.js
+ - sequential/*.mjs
+ rules:
+ comma-dangle: [error, {
+ arrays: always-multiline,
+ exports: only-multiline,
+ functions: only-multiline,
+ imports: only-multiline,
+ objects: only-multiline,
+ }]
diff --git a/test/common/README.md b/test/common/README.md
index ef86f59c656f7b..4d26e355d5480f 100644
--- a/test/common/README.md
+++ b/test/common/README.md
@@ -110,20 +110,20 @@ expectWarning('DeprecationWarning', [
expectWarning('DeprecationWarning', {
DEP0XXX: 'Foobar is deprecated',
- DEP0XX2: 'Baz is also deprecated'
+ DEP0XX2: 'Baz is also deprecated',
});
expectWarning({
DeprecationWarning: {
DEP0XXX: 'Foobar is deprecated',
- DEP0XX1: 'Baz is also deprecated'
+ DEP0XX1: 'Baz is also deprecated',
},
Warning: [
['Multiple array entries are fine', 'SpecialWarningCode'],
['No code is also fine'],
],
SingleEntry: ['This will also work', 'WarningCode'],
- SingleString: 'Single string entries without code will also work'
+ SingleString: 'Single string entries without code will also work',
});
```
@@ -720,7 +720,7 @@ validateSnapshotNodes('TLSWRAP', [
{ name: 'enc_out' },
{ name: 'enc_in' },
{ name: 'TLSWrap' },
- ]
+ ],
},
]);
```
diff --git a/test/common/wpt/worker.js b/test/common/wpt/worker.js
index 47e119c22dcd84..34368ab5c5beff 100644
--- a/test/common/wpt/worker.js
+++ b/test/common/wpt/worker.js
@@ -9,7 +9,7 @@ const resource = new ResourceLoader(workerData.wptPath);
global.self = global;
global.GLOBAL = {
isWindow() { return false; },
- isShadowRealm() { return false; }
+ isShadowRealm() { return false; },
};
global.require = require;
@@ -25,7 +25,7 @@ if (workerData.initScript) {
}
runInThisContext(workerData.harness.code, {
- filename: workerData.harness.filename
+ filename: workerData.harness.filename,
});
// eslint-disable-next-line no-undef
diff --git a/test/doctool/test-apilinks.mjs b/test/doctool/test-apilinks.mjs
index e3c334b19e7234..fbbfafc139b711 100644
--- a/test/doctool/test-apilinks.mjs
+++ b/test/doctool/test-apilinks.mjs
@@ -23,7 +23,7 @@ fs.readdirSync(apilinks).forEach((fixture) => {
execFileSync(
process.execPath,
[script, outputPath, input],
- { encoding: 'utf-8' }
+ { encoding: 'utf-8' },
);
const expectedLinks = JSON.parse(expectedContent);
@@ -38,6 +38,6 @@ fs.readdirSync(apilinks).forEach((fixture) => {
assert.strictEqual(
Object.keys(actualLinks).length, 0,
- `unexpected links returned ${JSON.stringify(actualLinks)}`
+ `unexpected links returned ${JSON.stringify(actualLinks)}`,
);
});
diff --git a/test/doctool/test-deprecation-codes.js b/test/doctool/test-deprecation-codes.js
index 8e7ea37d242aa5..1bc63babb3f026 100644
--- a/test/doctool/test-deprecation-codes.js
+++ b/test/doctool/test-deprecation-codes.js
@@ -10,7 +10,7 @@ const script = path.join(
'..',
'tools',
'doc',
- 'deprecationCodes.mjs'
+ 'deprecationCodes.mjs',
);
const mdPath = path.join(
@@ -19,7 +19,7 @@ const mdPath = path.join(
'..',
'doc',
'api',
- 'deprecations.md'
+ 'deprecations.md',
);
const cp = spawn(process.execPath, [script, mdPath], { encoding: 'utf-8', stdio: 'inherit' });
diff --git a/test/doctool/test-doctool-html.mjs b/test/doctool/test-doctool-html.mjs
index 6a64da42cfd5bc..9323548221b599 100644
--- a/test/doctool/test-doctool-html.mjs
+++ b/test/doctool/test-doctool-html.mjs
@@ -23,8 +23,8 @@ import {
const testLinksMapper = {
'foo': {
'command line options': 'cli.html#cli-options',
- 'web server': 'example.html'
- }
+ 'web server': 'example.html',
+ },
};
function toHTML({ input, filename, nodeVersion, versions }) {
@@ -58,7 +58,7 @@ const testData = [
'id="foo_static_method_buffer_from_array">' +
''
+ 'Reference/Global_Objects/Array" class="type"><Array>',
},
{
file: fixtures.path('doc_with_yaml.md'),
@@ -99,7 +99,7 @@ const testData = [
'" id="something">#' +
'' +
' ' +
- 'Describe Something
in more detail here.
'
+ 'Describe Something
in more detail here.
',
},
{
file: fixtures.path('sample_document.md'),
@@ -129,7 +129,7 @@ const testData = [
'See also#
Check' +
- 'out alsothis guide
'
+ 'out alsothis guide
',
},
{
file: fixtures.path('document_with_special_heading.md'),
diff --git a/test/doctool/test-doctool-json.mjs b/test/doctool/test-doctool-json.mjs
index eb1c9b2ea8cda2..7537dd46dab590 100644
--- a/test/doctool/test-doctool-json.mjs
+++ b/test/doctool/test-doctool-json.mjs
@@ -41,12 +41,12 @@ const testData = [
desc: '\n- fish
\n- fish
\n
\n' +
'',
type: 'module',
- displayName: 'Seussian Rhymes'
+ displayName: 'Seussian Rhymes',
}],
type: 'module',
- displayName: 'Sample Markdown'
- }]
- }
+ displayName: 'Sample Markdown',
+ }],
+ },
},
{
file: fixtures.path('order_of_end_tags_5873.md'),
@@ -68,18 +68,18 @@ const testData = [
params: [{
textRaw: '`array` {Array}',
name: 'array',
- type: 'Array'
- }]
+ type: 'Array',
+ }],
},
- ]
+ ],
}],
type: 'module',
- displayName: 'Subsection'
+ displayName: 'Subsection',
}],
type: 'module',
- displayName: 'Title'
- }]
- }
+ displayName: 'Title',
+ }],
+ },
},
{
file: fixtures.path('doc_with_yaml.md'),
@@ -96,12 +96,12 @@ const testData = [
name: 'foobar',
meta: {
added: ['v1.0.0'],
- changes: []
+ changes: [],
},
desc: 'Describe Foobar
in more detail ' +
'here.
',
type: 'module',
- displayName: 'Foobar'
+ displayName: 'Foobar',
},
{
textRaw: 'Foobar II',
@@ -113,12 +113,12 @@ const testData = [
'pr-url': 'https://github.com/nodejs/node/pull/3276',
'description': 'The `error` parameter can now be ' +
'an arrow function.' },
- ]
+ ],
},
desc: 'Describe Foobar II
in more detail ' +
'here. fg(1)
',
type: 'module',
- displayName: 'Foobar II'
+ displayName: 'Foobar II',
},
{
textRaw: 'Deprecated thingy',
@@ -126,12 +126,12 @@ const testData = [
meta: {
added: ['v1.0.0'],
deprecated: ['v2.0.0'],
- changes: []
+ changes: [],
},
desc: 'Describe Deprecated thingy
in more ' +
'detail here. fg(1p)
',
type: 'module',
- displayName: 'Deprecated thingy'
+ displayName: 'Deprecated thingy',
},
{
textRaw: 'Something',
@@ -139,14 +139,14 @@ const testData = [
desc: '\n' +
'Describe Something
in more detail here.
',
type: 'module',
- displayName: 'Something'
+ displayName: 'Something',
},
],
type: 'module',
- displayName: 'Sample Markdown with YAML info'
+ displayName: 'Sample Markdown with YAML info',
},
- ]
- }
+ ],
+ },
},
{
file: fixtures.path('doc_with_backticks_in_headings.md'),
@@ -160,7 +160,7 @@ const testData = [
properties: [
{
name: 'fullName',
- textRaw: '`Fqhqwhgads.fullName`'
+ textRaw: '`Fqhqwhgads.fullName`',
},
],
classMethods: [
@@ -168,18 +168,18 @@ const testData = [
name: 'again',
signatures: [
{
- params: []
+ params: [],
},
],
textRaw: 'Static method: `Fhqwhgads.again()`',
- type: 'classMethod'
+ type: 'classMethod',
},
],
classes: [
{
textRaw: 'Class: `ComeOn`',
type: 'class',
- name: 'ComeOn'
+ name: 'ComeOn',
},
],
ctors: [
@@ -187,11 +187,11 @@ const testData = [
name: 'Fhqwhgads',
signatures: [
{
- params: []
+ params: [],
},
],
textRaw: 'Constructor: `new Fhqwhgads()`',
- type: 'ctor'
+ type: 'ctor',
},
],
methods: [
@@ -199,7 +199,7 @@ const testData = [
textRaw: '`everybody.to(limit)`',
type: 'method',
name: 'to',
- signatures: [{ params: [] }]
+ signatures: [{ params: [] }],
},
],
events: [
@@ -207,14 +207,14 @@ const testData = [
textRaw: "Event: `'FHQWHfest'`",
type: 'event',
name: 'FHQWHfest',
- params: []
+ params: [],
},
],
type: 'module',
- displayName: 'Fhqwhgads'
+ displayName: 'Fhqwhgads',
},
- ]
- }
+ ],
+ },
},
];
diff --git a/test/doctool/test-make-doc.mjs b/test/doctool/test-make-doc.mjs
index 5771f4e1ce777f..33b949f06f92b0 100644
--- a/test/doctool/test-make-doc.mjs
+++ b/test/doctool/test-make-doc.mjs
@@ -21,7 +21,7 @@ const actualDocs = allDocs.filter(
(name) => {
const extension = path.extname(name);
return extension === '.html' || extension === '.json';
- }
+ },
);
for (const name of actualDocs) {
@@ -29,7 +29,7 @@ for (const name of actualDocs) {
assert.ok(
allMD.includes(name.replace(/\.\w+$/, '.md')),
- `Unexpected output: out/doc/api/${name}, remove and rerun.`
+ `Unexpected output: out/doc/api/${name}, remove and rerun.`,
);
}
@@ -66,6 +66,6 @@ for (const actualDoc of actualDocs) {
assert.notStrictEqual(
fs.statSync(new URL(`./${actualDoc}`, apiURL)).size,
0,
- `${actualDoc} is empty`
+ `${actualDoc} is empty`,
);
}
diff --git a/test/report/test-report-config.js b/test/report/test-report-config.js
index a8c0f70691e63f..dce58c5bfcd954 100644
--- a/test/report/test-report-config.js
+++ b/test/report/test-report-config.js
@@ -76,13 +76,13 @@ if (!common.isWindows) {
process.report.signal = 'foo';
}, {
code: 'ERR_UNKNOWN_SIGNAL',
- message: 'Unknown signal: foo'
+ message: 'Unknown signal: foo',
});
assert.throws(() => {
process.report.signal = 'sigusr1';
}, {
code: 'ERR_UNKNOWN_SIGNAL',
- message: 'Unknown signal: sigusr1 (signals must use all capital letters)'
+ message: 'Unknown signal: sigusr1 (signals must use all capital letters)',
});
assert.strictEqual(process.report.signal, 'SIGUSR2');
process.report.signal = 'SIGUSR1';
diff --git a/test/report/test-report-uncaught-exception-compat.js b/test/report/test-report-uncaught-exception-compat.js
index 91989f6ecda994..454a48fd484600 100644
--- a/test/report/test-report-uncaught-exception-compat.js
+++ b/test/report/test-report-uncaught-exception-compat.js
@@ -17,7 +17,7 @@ const child = childProcess.spawn(process.execPath, [
__filename,
'child',
], {
- cwd: tmpdir.path
+ cwd: tmpdir.path,
});
child.on('exit', common.mustCall((code) => {
assert.strictEqual(code, 1);
diff --git a/test/tick-processor/test-tick-processor-builtin.js b/test/tick-processor/test-tick-processor-builtin.js
index f01f0986682dc9..cdd24d48f60ab2 100644
--- a/test/tick-processor/test-tick-processor-builtin.js
+++ b/test/tick-processor/test-tick-processor-builtin.js
@@ -14,5 +14,5 @@ base.runTest({
this.ts = Date.now();
setImmediate(function() { new f(); });
};
- f();`
+ f();`,
});
diff --git a/test/tick-processor/test-tick-processor-cpp-core.js b/test/tick-processor/test-tick-processor-cpp-core.js
index 89943cca5c8329..9b578f9cbd962e 100644
--- a/test/tick-processor/test-tick-processor-cpp-core.js
+++ b/test/tick-processor/test-tick-processor-cpp-core.js
@@ -14,5 +14,5 @@ base.runTest({
require('vm').createContext({});
setImmediate(function() { f(); });
};
- f();`
+ f();`,
});
diff --git a/test/tick-processor/test-tick-processor-polyfill-brokenfile.js b/test/tick-processor/test-tick-processor-polyfill-brokenfile.js
index e5e13fd3db122f..2089325dff3e99 100644
--- a/test/tick-processor/test-tick-processor-polyfill-brokenfile.js
+++ b/test/tick-processor/test-tick-processor-polyfill-brokenfile.js
@@ -36,7 +36,7 @@ const proc = spawn(process.execPath, [
'--prof',
'-pe', code,
], {
- stdio: ['ignore', 'pipe', 'inherit']
+ stdio: ['ignore', 'pipe', 'inherit'],
});
let ticks = '';
diff --git a/test/tick-processor/test-tick-processor-preprocess-flag.js b/test/tick-processor/test-tick-processor-preprocess-flag.js
index b003f7c6b8b01f..15bc0fbad71de9 100644
--- a/test/tick-processor/test-tick-processor-preprocess-flag.js
+++ b/test/tick-processor/test-tick-processor-preprocess-flag.js
@@ -15,5 +15,5 @@ base.runTest({
setImmediate(function() { f(); });
};
f();`,
- profProcessFlags: ['--preprocess']
+ profProcessFlags: ['--preprocess'],
});
diff --git a/test/tick-processor/test-tick-processor-unknown.js b/test/tick-processor/test-tick-processor-unknown.js
index d5e6a9359e52eb..f7116a9d54d3de 100644
--- a/test/tick-processor/test-tick-processor-unknown.js
+++ b/test/tick-processor/test-tick-processor-unknown.js
@@ -21,5 +21,5 @@ base.runTest({
}
setImmediate(function() { f(); });
};
- f();`
+ f();`,
});
diff --git a/test/tick-processor/tick-processor-base.js b/test/tick-processor/tick-processor-base.js
index d9f23ae7d768f5..91307d16928889 100644
--- a/test/tick-processor/tick-processor-base.js
+++ b/test/tick-processor/tick-processor-base.js
@@ -17,7 +17,7 @@ function runTest(test) {
'--prof',
'-pe', test.code,
], {
- stdio: [ 'ignore', 'pipe', 'inherit' ]
+ stdio: [ 'ignore', 'pipe', 'inherit' ],
});
let ticks = '';
@@ -39,7 +39,7 @@ function match(pattern, parent, ticks, flags = []) {
...flags,
LOG_FILE,
], {
- stdio: [ 'ignore', 'pipe', 'inherit' ]
+ stdio: [ 'ignore', 'pipe', 'inherit' ],
});
let out = '';
diff --git a/test/tick-processor/util.js b/test/tick-processor/util.js
index d25a2a7dcb132e..6d118b7c38bc66 100644
--- a/test/tick-processor/util.js
+++ b/test/tick-processor/util.js
@@ -6,7 +6,7 @@ const {
isSunOS,
isAIX,
isLinuxPPCBE,
- isFreeBSD
+ isFreeBSD,
} = require('../common');
module.exports = {
@@ -14,5 +14,5 @@ module.exports = {
isSunOS ||
isAIX ||
isLinuxPPCBE ||
- isFreeBSD
+ isFreeBSD,
};
diff --git a/test/wasi/test-wasi-initialize-validation.js b/test/wasi/test-wasi-initialize-validation.js
index 6506e1ac4a79e3..f1279a6009433d 100644
--- a/test/wasi/test-wasi-initialize-validation.js
+++ b/test/wasi/test-wasi-initialize-validation.js
@@ -18,8 +18,8 @@ const bufferSource = fixtures.readSync('simple.wasm');
() => { wasi.initialize(); },
{
code: 'ERR_INVALID_ARG_TYPE',
- message: /"instance" argument must be of type object/
- }
+ message: /"instance" argument must be of type object/,
+ },
);
}
@@ -34,8 +34,8 @@ const bufferSource = fixtures.readSync('simple.wasm');
() => { wasi.initialize(instance); },
{
code: 'ERR_INVALID_ARG_TYPE',
- message: /"instance\.exports" property must be of type object/
- }
+ message: /"instance\.exports" property must be of type object/,
+ },
);
}
@@ -57,8 +57,8 @@ const bufferSource = fixtures.readSync('simple.wasm');
() => { wasi.initialize(instance); },
{
code: 'ERR_INVALID_ARG_TYPE',
- message: /"instance\.exports\._initialize" property must be of type function/
- }
+ message: /"instance\.exports\._initialize" property must be of type function/,
+ },
);
}
@@ -75,7 +75,7 @@ const bufferSource = fixtures.readSync('simple.wasm');
_initialize() {},
memory: new WebAssembly.Memory({ initial: 1 }),
};
- }
+ },
});
assert.throws(
() => { wasi.initialize(instance); },
@@ -83,7 +83,7 @@ const bufferSource = fixtures.readSync('simple.wasm');
code: 'ERR_INVALID_ARG_TYPE',
message: 'The "instance.exports._start" property must be' +
' undefined. Received function _start',
- }
+ },
);
}
@@ -94,14 +94,14 @@ const bufferSource = fixtures.readSync('simple.wasm');
const instance = await WebAssembly.instantiate(wasm);
Object.defineProperty(instance, 'exports', {
- get() { return { _initialize() {} }; }
+ get() { return { _initialize() {} }; },
});
assert.throws(
() => { wasi.initialize(instance); },
{
code: 'ERR_INVALID_ARG_TYPE',
- message: /"instance\.exports\.memory" property must be a WebAssembly\.Memory object/
- }
+ message: /"instance\.exports\.memory" property must be a WebAssembly\.Memory object/,
+ },
);
}
@@ -139,17 +139,17 @@ const bufferSource = fixtures.readSync('simple.wasm');
get() {
return {
_initialize() {},
- memory: new WebAssembly.Memory({ initial: 1 })
+ memory: new WebAssembly.Memory({ initial: 1 }),
};
- }
+ },
});
wasi.initialize(instance);
assert.throws(
() => { wasi.initialize(instance); },
{
code: 'ERR_WASI_ALREADY_STARTED',
- message: /^WASI instance has already started$/
- }
+ message: /^WASI instance has already started$/,
+ },
);
}
})().then(common.mustCall());
diff --git a/test/wasi/test-wasi-not-started.js b/test/wasi/test-wasi-not-started.js
index 0dde5495112497..28da4fa41b657f 100644
--- a/test/wasi/test-wasi-not-started.js
+++ b/test/wasi/test-wasi-not-started.js
@@ -8,7 +8,7 @@ if (process.argv[2] === 'wasi-child') {
const { WASI } = require('wasi');
const wasi = new WASI({
- args: ['foo', '-bar', '--baz=value']
+ args: ['foo', '-bar', '--baz=value'],
});
const importObject = { wasi_snapshot_preview1: wasi.wasiImport };
@@ -21,7 +21,7 @@ if (process.argv[2] === 'wasi-child') {
}, {
name: 'Error',
code: 'ERR_WASI_NOT_STARTED',
- message: 'wasi.start() has not been called'
+ message: 'wasi.start() has not been called',
});
} else {
const assert = require('assert');
@@ -32,7 +32,7 @@ if (process.argv[2] === 'wasi-child') {
__filename,
'wasi-child',
], {
- env: { ...process.env, NODE_DEBUG_NATIVE: 'wasi' }
+ env: { ...process.env, NODE_DEBUG_NATIVE: 'wasi' },
});
assert.strictEqual(child.signal, null);
assert.strictEqual(child.status, 0);
diff --git a/test/wasi/test-wasi-start-validation.js b/test/wasi/test-wasi-start-validation.js
index 016479f412f678..01bd1a2bb63624 100644
--- a/test/wasi/test-wasi-start-validation.js
+++ b/test/wasi/test-wasi-start-validation.js
@@ -18,8 +18,8 @@ const bufferSource = fixtures.readSync('simple.wasm');
() => { wasi.start(); },
{
code: 'ERR_INVALID_ARG_TYPE',
- message: /"instance" argument must be of type object/
- }
+ message: /"instance" argument must be of type object/,
+ },
);
}
@@ -34,8 +34,8 @@ const bufferSource = fixtures.readSync('simple.wasm');
() => { wasi.start(instance); },
{
code: 'ERR_INVALID_ARG_TYPE',
- message: /"instance\.exports" property must be of type object/
- }
+ message: /"instance\.exports" property must be of type object/,
+ },
);
}
@@ -54,8 +54,8 @@ const bufferSource = fixtures.readSync('simple.wasm');
() => { wasi.start(instance); },
{
code: 'ERR_INVALID_ARG_TYPE',
- message: /"instance\.exports\._start" property must be of type function/
- }
+ message: /"instance\.exports\._start" property must be of type function/,
+ },
);
}
@@ -72,7 +72,7 @@ const bufferSource = fixtures.readSync('simple.wasm');
_initialize() {},
memory: new WebAssembly.Memory({ initial: 1 }),
};
- }
+ },
});
assert.throws(
() => { wasi.start(instance); },
@@ -80,7 +80,7 @@ const bufferSource = fixtures.readSync('simple.wasm');
code: 'ERR_INVALID_ARG_TYPE',
message: 'The "instance.exports._initialize" property must be' +
' undefined. Received function _initialize',
- }
+ },
);
}
@@ -91,14 +91,14 @@ const bufferSource = fixtures.readSync('simple.wasm');
const instance = await WebAssembly.instantiate(wasm);
Object.defineProperty(instance, 'exports', {
- get() { return { _start() {} }; }
+ get() { return { _start() {} }; },
});
assert.throws(
() => { wasi.start(instance); },
{
code: 'ERR_INVALID_ARG_TYPE',
- message: /"instance\.exports\.memory" property must be a WebAssembly\.Memory object/
- }
+ message: /"instance\.exports\.memory" property must be a WebAssembly\.Memory object/,
+ },
);
}
@@ -136,17 +136,17 @@ const bufferSource = fixtures.readSync('simple.wasm');
get() {
return {
_start() {},
- memory: new WebAssembly.Memory({ initial: 1 })
+ memory: new WebAssembly.Memory({ initial: 1 }),
};
- }
+ },
});
wasi.start(instance);
assert.throws(
() => { wasi.start(instance); },
{
code: 'ERR_WASI_ALREADY_STARTED',
- message: /^WASI instance has already started$/
- }
+ message: /^WASI instance has already started$/,
+ },
);
}
})().then(common.mustCall());
diff --git a/test/wasi/test-wasi-symlinks.js b/test/wasi/test-wasi-symlinks.js
index c2f29e539a5ed8..7f6d9302dedf0a 100644
--- a/test/wasi/test-wasi-symlinks.js
+++ b/test/wasi/test-wasi-symlinks.js
@@ -14,8 +14,8 @@ if (process.argv[2] === 'wasi-child') {
env: process.env,
preopens: {
'/sandbox': process.argv[4],
- '/tmp': process.argv[5]
- }
+ '/tmp': process.argv[5],
+ },
});
const importObject = { wasi_snapshot_preview1: wasi.wasiImport };
const modulePath = path.join(wasmDir, `${process.argv[3]}.wasm`);
diff --git a/test/wasi/test-wasi.js b/test/wasi/test-wasi.js
index b514de731adf85..949fc77e97a7a3 100644
--- a/test/wasi/test-wasi.js
+++ b/test/wasi/test-wasi.js
@@ -18,8 +18,8 @@ if (process.argv[2] === 'wasi-child') {
env: process.env,
preopens: {
'/sandbox': fixtures.path('wasi'),
- '/tmp': tmpdir.path
- }
+ '/tmp': tmpdir.path,
+ },
});
const importObject = { wasi_snapshot_preview1: wasi.wasiImport };
const modulePath = path.join(wasmDir, `${process.argv[3]}.wasm`);
@@ -41,8 +41,8 @@ if (process.argv[2] === 'wasi-child') {
env: {
...process.env,
NODE_DEBUG_NATIVE: 'wasi',
- NODE_PLATFORM: process.platform
- }
+ NODE_PLATFORM: process.platform,
+ },
};
if (options.stdin !== undefined)
@@ -89,7 +89,7 @@ if (process.argv[2] === 'wasi-child') {
runWASI({ test: 'read_file', stdout: `hello from input.txt${checkoutEOL}` });
runWASI({
test: 'read_file_twice',
- stdout: `hello from input.txt${checkoutEOL}hello from input.txt${checkoutEOL}`
+ stdout: `hello from input.txt${checkoutEOL}hello from input.txt${checkoutEOL}`,
});
runWASI({ test: 'stat' });
runWASI({ test: 'write_file' });