node/test/es-module/test-esm-imports-deprecations.mjs
Guy Bedford 15f10515e3 module: fix segment deprecation for imports field
PR-URL: https://github.com/nodejs/node/pull/44883
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-10-13 07:31:31 -07:00

28 lines
725 B
JavaScript

// Flags: --pending-deprecation
import { mustCall } from '../common/index.mjs';
import assert from 'assert';
let curWarning = 0;
const expectedWarnings = [
'Use of deprecated double slash',
'Use of deprecated double slash',
'./sub//null',
'./sub/////null',
'./sub//internal/test',
'./sub//internal//test',
'#subpath/////internal',
'#subpath//asdf.asdf',
'#subpath/as//df.asdf',
'./sub//null',
'./sub/////null',
'./sub//internal/test',
'./sub//internal//test',
'#subpath/////internal',
];
process.addListener('warning', mustCall((warning) => {
assert(warning.stack.includes(expectedWarnings[curWarning++]), warning.stack);
}, expectedWarnings.length));
await import('./test-esm-imports.mjs');