-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
esm: emit experimental warnings in common place
PR-URL: #42314 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
- Loading branch information
1 parent
8bb04f5
commit eea25dc
Showing
5 changed files
with
56 additions
and
35 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
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,32 @@ | ||
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 warnings are printed | ||
for ( | ||
const [experiment, arg] of [ | ||
[/Custom ESM Loaders/, `--experimental-loader=${fileURL('es-module-loaders', 'hooks-custom.mjs')}`], | ||
[/Network Imports/, '--experimental-network-imports'], | ||
[/specifier resolution/, '--experimental-specifier-resolution=node'], | ||
] | ||
) { | ||
const input = `import ${JSON.stringify(fileURL('es-module-loaders', 'module-named-exports.mjs'))}`; | ||
const child = spawn(execPath, [ | ||
arg, | ||
'--input-type=module', | ||
'--eval', | ||
input, | ||
]); | ||
|
||
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/); | ||
match(stderr, experiment); | ||
})); | ||
} |
24 changes: 0 additions & 24 deletions
24
test/es-module/test-esm-specifiers-legacy-flag-warning.mjs
This file was deleted.
Oops, something went wrong.