-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
test.js
31 lines (26 loc) · 1.01 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
import test from 'ava';
import isBuiltinModule from './index.js';
test('main', t => {
t.true(isBuiltinModule('fs'));
t.true(isBuiltinModule('console'));
t.true(isBuiltinModule('punycode'));
t.true(isBuiltinModule('fs/promises'));
t.true(isBuiltinModule('assert/strict'));
t.false(isBuiltinModule('fs/unknown'));
t.false(isBuiltinModule('fs/promises/unknown'));
t.false(isBuiltinModule('fs/promises?query=1'));
t.true(isBuiltinModule('node:fs'));
t.true(isBuiltinModule('node:fs/promises'));
t.false(isBuiltinModule('punycode/'));
t.false(isBuiltinModule('unicorn'));
t.false(isBuiltinModule('unknown'));
t.false(isBuiltinModule('FS'));
t.false(isBuiltinModule('nodE:fs'));
t.false(isBuiltinModule('node:fS'));
t.false(isBuiltinModule('fsnode:'));
t.false(isBuiltinModule('node:unknown'));
t.false(isBuiltinModule('node:node:fs'));
t.false(isBuiltinModule('node:/fs'));
t.false(isBuiltinModule('file:fs/promises'));
t.false(isBuiltinModule('data:text/javascript;utf-8,export {default} from "fs";'));
});