mirror of https://github.com/nodejs/node.git
23 lines
656 B
JavaScript
23 lines
656 B
JavaScript
import { mustCall } from '../common/index.mjs';
|
|
import assert from 'assert';
|
|
import fixtures from '../common/fixtures.js';
|
|
import { pathToFileURL } from 'url';
|
|
|
|
const selfDeprecatedFolders =
|
|
fixtures.path('/es-modules/self-deprecated-folders/main.js');
|
|
|
|
let curWarning = 0;
|
|
const expectedWarnings = [
|
|
'"./" in the "exports" field',
|
|
'"#self/" in the "imports" field'
|
|
];
|
|
|
|
process.addListener('warning', mustCall((warning) => {
|
|
assert(warning.stack.includes(expectedWarnings[curWarning++]), warning.stack);
|
|
}, expectedWarnings.length));
|
|
|
|
(async () => {
|
|
await import(pathToFileURL(selfDeprecatedFolders));
|
|
})()
|
|
.catch((err) => console.error(err));
|