-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
Expand file tree
/
Copy pathtest-build-sea-invalid-boolean-fields.js
More file actions
95 lines (88 loc) Β· 2.38 KB
/
test-build-sea-invalid-boolean-fields.js
File metadata and controls
95 lines (88 loc) Β· 2.38 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// This tests --build-sea when boolean fields have invalid types.
'use strict';
require('../common');
const tmpdir = require('../common/tmpdir');
const { skipIfBuildSEAIsNotSupported } = require('../common/sea');
const { writeFileSync } = require('fs');
const { spawnSyncAndAssert } = require('../common/child_process');
skipIfBuildSEAIsNotSupported();
// Test: Invalid "disableExperimentalSEAWarning" type (should be Boolean)
{
tmpdir.refresh();
const config = tmpdir.resolve('invalid-disableExperimentalSEAWarning.json');
writeFileSync(config, `
{
"main": "bundle.js",
"output": "sea",
"disableExperimentalSEAWarning": "true"
}
`, 'utf8');
spawnSyncAndAssert(
process.execPath,
['--build-sea', config], {
cwd: tmpdir.path,
}, {
status: 1,
stderr: /"disableExperimentalSEAWarning" field of .*invalid-disableExperimentalSEAWarning\.json is not a Boolean/,
});
}
// Test: Invalid "useSnapshot" type (should be Boolean)
{
tmpdir.refresh();
const config = tmpdir.resolve('invalid-useSnapshot.json');
writeFileSync(config, `
{
"main": "bundle.js",
"output": "sea",
"useSnapshot": "false"
}
`, 'utf8');
spawnSyncAndAssert(
process.execPath,
['--build-sea', config], {
cwd: tmpdir.path,
}, {
status: 1,
stderr: /"useSnapshot" field of .*invalid-useSnapshot\.json is not a Boolean/,
});
}
// Test: Invalid "useCodeCache" type (should be Boolean)
{
tmpdir.refresh();
const config = tmpdir.resolve('invalid-useCodeCache.json');
writeFileSync(config, `
{
"main": "bundle.js",
"output": "sea",
"useCodeCache": 1
}
`, 'utf8');
spawnSyncAndAssert(
process.execPath,
['--build-sea', config], {
cwd: tmpdir.path,
}, {
status: 1,
stderr: /"useCodeCache" field of .*invalid-useCodeCache\.json is not a Boolean/,
});
}
// Test: Invalid "allowDynamicImportFromFileSystem" type (should be Boolean)
{
tmpdir.refresh();
const config = tmpdir.resolve('invalid-allowDynamicImportFromFileSystem.json');
writeFileSync(config, `
{
"main": "bundle.js",
"output": "sea",
"allowDynamicImportFromFileSystem": "true"
}
`, 'utf8');
spawnSyncAndAssert(
process.execPath,
['--build-sea', config], {
cwd: tmpdir.path,
}, {
status: 1,
stderr: /"allowDynamicImportFromFileSystem" field of .*invalid-allowDynamicImportFromFileSystem\.json is not a Boolean/,
});
}