-
Notifications
You must be signed in to change notification settings - Fork 29.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! module: unflag esm json modules
- Loading branch information
1 parent
2e3d3d5
commit 78335f9
Showing
2 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,28 @@ | ||
import '../common/index.mjs'; | ||
import { strictEqual } from 'assert'; | ||
import { path } from '../common/fixtures.mjs'; | ||
import { strictEqual, ok } from 'assert'; | ||
import { spawn } from 'child_process'; | ||
|
||
import secret from '../fixtures/experimental.json' assert { type: 'json' }; | ||
|
||
strictEqual(secret.ofLife, 42); | ||
|
||
// Test warning message | ||
const child = spawn(process.execPath, [ | ||
'--experimental-json-modules', | ||
path('/es-modules/json-modules.mjs'), | ||
]); | ||
|
||
let stderr = ''; | ||
child.stderr.setEncoding('utf8'); | ||
child.stderr.on('data', (data) => { | ||
stderr += data; | ||
}); | ||
child.on('close', (code, signal) => { | ||
strictEqual(code, 0); | ||
strictEqual(signal, null); | ||
ok(stderr.toString().includes( | ||
'ExperimentalWarning: Importing JSON modules is an experimental feature. ' + | ||
'This feature could change at any time' | ||
)); | ||
}); |