-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.js
61 lines (50 loc) · 1.37 KB
/
test.js
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { exec } from 'child_process'
import test from 'node:test'
import assert from 'assert'
function run(...args) {
return new Promise((resolve, reject) => {
exec(...args, (err, stdout, stderr) => {
if (err) reject(err)
resolve({ stdout, stderr })
})
})
}
test('Node.js', async () => {
await run('node test/node-test.js')
})
test('Node.js (allow-natives-syntax)', async () => {
await run('node --allow-natives-syntax test/node-test.js')
})
test('Node.js (no-allow-natives-syntax)', async () => {
await run('node --no-allow-natives-syntax test/node-test.js')
})
test('Deno', async () => {
await assert.rejects(
() => run('deno run test/node-test.js')
)
})
test('Deno (faking Node.js)', async () => {
await assert.rejects(
() => run('deno run test/deno-test.js')
)
})
test('Deno (faking Node.js) (allow-natives-syntax)', async () => {
await assert.rejects(
() => run('deno run --v8-flags="--allow-natives-syntax" test/deno-test.js')
)
})
test('Deno (faking Node.js) (no-allow-natives-syntax)', async () => {
await assert.rejects(
() => run('deno run --v8-flags="--allow-natives-syntax" test/deno-test.js')
)
})
test('Bun', async () => {
await assert.rejects(
() => run('deno run test/node-test.js')
)
})
test('Bun (faking Node.js)', async () => {
await assert.rejects(
() => run('deno run test/deno-test.js')
)
})