-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc: add warning for esm specifier resolution
- Loading branch information
1 parent
24fc302
commit 46cd892
Showing
4 changed files
with
37 additions
and
12 deletions.
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
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
24 changes: 24 additions & 0 deletions
24
test/es-module/test-esm-specifiers-legacy-flag-warning.mjs
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { mustCall } from '../common/index.mjs'; | ||
import { fileURL } from '../common/fixtures.mjs'; | ||
import { match, strictEqual } from 'assert'; | ||
import { spawn } from 'child_process'; | ||
import { execPath } from 'process'; | ||
|
||
// Verify experimental warning is printed | ||
const child = spawn(execPath, [ | ||
'--experimental-specifier-resolution=node', | ||
'--input-type=module', | ||
'--eval', | ||
`import ${JSON.stringify(fileURL('es-module-specifiers', 'package-type-module'))}`, | ||
]); | ||
|
||
let stderr = ''; | ||
child.stderr.setEncoding('utf8'); | ||
child.stderr.on('data', (data) => { | ||
stderr += data; | ||
}); | ||
child.on('close', mustCall((code, signal) => { | ||
strictEqual(code, 0); | ||
strictEqual(signal, null); | ||
match(stderr, /ExperimentalWarning: The Node\.js specifier resolution flag is experimental/); | ||
})); |