node/test/es-module/test-esm-pkgname.mjs
Francesco Trotta 8ac9aef8b1 lib: fix regular expression to detect / and \
Fixes #40305

PR-URL: https://github.com/nodejs/node/pull/40325
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
2021-10-21 14:55:00 +00:00

21 lines
599 B
JavaScript

import { mustCall } from '../common/index.mjs';
import { strictEqual } from 'assert';
import { importFixture } from '../fixtures/pkgexports.mjs';
importFixture('as%2Ff').catch(mustCall((err) => {
strictEqual(err.code, 'ERR_INVALID_MODULE_SPECIFIER');
}));
importFixture('as%5Cf').catch(mustCall((err) => {
strictEqual(err.code, 'ERR_INVALID_MODULE_SPECIFIER');
}));
importFixture('as\\df').catch(mustCall((err) => {
strictEqual(err.code, 'ERR_INVALID_MODULE_SPECIFIER');
}));
importFixture('@as@df').catch(mustCall((err) => {
strictEqual(err.code, 'ERR_INVALID_MODULE_SPECIFIER');
}));