-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
Expand file tree
/
Copy pathtest-runner-no-isolation.mjs
More file actions
38 lines (33 loc) · 1.12 KB
/
test-runner-no-isolation.mjs
File metadata and controls
38 lines (33 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { allowGlobals, mustCall, mustNotCall } from '../common/index.mjs';
import * as fixtures from '../common/fixtures.mjs';
import assert from 'node:assert';
import { run } from 'node:test';
const stream = run({
files: [
fixtures.path('test-runner', 'no-isolation', 'one.test.js'),
fixtures.path('test-runner', 'no-isolation', 'two.test.js'),
],
isolation: 'none',
});
const file1 = fixtures.path('test-runner', 'no-isolation', 'one.test.js');
const file2 = fixtures.path('test-runner', 'no-isolation', 'two.test.js');
stream.on('test:fail', mustNotCall());
stream.on('test:pass', mustCall(6));
// eslint-disable-next-line no-unused-vars
for await (const _ of stream);
allowGlobals(globalThis.GLOBAL_ORDER);
assert.deepStrictEqual(globalThis.GLOBAL_ORDER, [
'suite one',
'suite two',
`before one: ${file1}`,
'beforeEach one: suite one - test',
'suite one - test',
'afterEach one: suite one - test',
`after one: ${file1}`,
`before two: ${file2}`,
'before suite two: suite two',
'beforeEach two: suite two - test',
'suite two - test',
'afterEach two: suite two - test',
`after two: ${file2}`,
]);