Skip to content

Commit 4b00aaf

Browse files
committed
style: resolve linter complaints
1 parent ecadaac commit 4b00aaf

File tree

2 files changed

+23
-22
lines changed

2 files changed

+23
-22
lines changed

test/es-module/test-esm-import-meta-main-eval.mjs

+8-8
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ function wrapScriptInUrlWorker(script) {
3232
`;
3333
}
3434

35-
describe("import.meta.main in evaluated scripts", () => {
36-
it("should evaluate true in evaluated script", async () => {
35+
describe('import.meta.main in evaluated scripts', () => {
36+
it('should evaluate true in evaluated script', async () => {
3737
const result = await spawnPromisified(
3838
process.execPath,
3939
['--input-type=module', '--eval', importMetaMainScript],
@@ -44,9 +44,9 @@ describe("import.meta.main in evaluated scripts", () => {
4444
code: 0,
4545
signal: null,
4646
});
47-
})
47+
});
4848

49-
it("should evaluate true in worker instantiated with module source by evaluated script", async () => {
49+
it('should evaluate true in worker instantiated with module source by evaluated script', async () => {
5050
const result = await spawnPromisified(
5151
process.execPath,
5252
['--input-type=module', '--eval', wrapScriptInEvalWorker(importMetaMainScript)],
@@ -57,9 +57,9 @@ describe("import.meta.main in evaluated scripts", () => {
5757
code: 0,
5858
signal: null,
5959
});
60-
})
60+
});
6161

62-
it("should evaluate true in worker instantiated with `data:` URL by evaluated script", async () => {
62+
it('should evaluate true in worker instantiated with `data:` URL by evaluated script', async () => {
6363
const result = await spawnPromisified(
6464
process.execPath,
6565
['--input-type=module', '--eval', wrapScriptInUrlWorker(importMetaMainScript)],
@@ -70,5 +70,5 @@ describe("import.meta.main in evaluated scripts", () => {
7070
code: 0,
7171
signal: null,
7272
});
73-
})
74-
})
73+
});
74+
});
+15-14
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import '../common/index.mjs';
12
import tmpdir from '../common/tmpdir.js';
23
import assert from 'node:assert/strict';
34
import { once } from 'node:events';
@@ -13,23 +14,23 @@ function convertScriptSourceToDataUrl(script) {
1314
return new URL(`data:text/javascript,${encodeURIComponent(script)}`);
1415
}
1516

16-
describe("Worker threads should not be able to access internal modules", () => {
17+
describe('Worker threads should not be able to access internal modules', () => {
1718
before(() => tmpdir.refresh());
1819

19-
test("worker instantiated with module file path", async () => {
20+
test('worker instantiated with module file path', async () => {
2021
const moduleFilepath = tmpdir.resolve('test-worker-internal-modules.mjs');
2122
await fs.writeFile(moduleFilepath, accessInternalsSource);
22-
const w = new Worker(moduleFilepath)
23-
await assert.rejects(once(w, "exit"))
24-
})
23+
const w = new Worker(moduleFilepath);
24+
await assert.rejects(once(w, 'exit'), { code: 'ERR_UNKNOWN_BUILTIN_MODULE' });
25+
});
2526

26-
test("worker instantiated with module source", async () => {
27-
const w = new Worker(accessInternalsSource, { eval: true })
28-
await assert.rejects(once(w, "exit"))
29-
})
27+
test('worker instantiated with module source', async () => {
28+
const w = new Worker(accessInternalsSource, { eval: true });
29+
await assert.rejects(once(w, 'exit'), { code: 'ERR_UNKNOWN_BUILTIN_MODULE' });
30+
});
3031

31-
test("worker instantiated with data: URL", async () => {
32-
const w = new Worker(convertScriptSourceToDataUrl(accessInternalsSource))
33-
await assert.rejects(once(w, "exit"))
34-
})
35-
})
32+
test('worker instantiated with data: URL', async () => {
33+
const w = new Worker(convertScriptSourceToDataUrl(accessInternalsSource));
34+
await assert.rejects(once(w, 'exit'), { code: 'ERR_UNKNOWN_BUILTIN_MODULE' });
35+
});
36+
});

0 commit comments

Comments
 (0)