Skip to content

Commit 2f42366

Browse files
committed
Make error messages for CommonJS named exports in entry point tests Windows/Linux agnostic
1 parent 0453f66 commit 2f42366

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎test/es-module/test-esm-cjs-named-error.mjs‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@ await assert.rejects(async () => {
8181
const entryPoint = fixtures.path('es-modules', 'package-cjs-named-error', 'single-quote.mjs');
8282
const { code, stderr } = await spawnPromisified(execPath, [entryPoint]);
8383
assert.strictEqual(code, 1);
84-
assert.ok(stderr.includes(expectedRelative), 'entry point should show the CommonJS named export hint');
84+
assert.ok(stderr.includes("Named export 'comeOn' not found."),
85+
'entry point should show the missing named export');
86+
assert.ok(stderr.includes('CommonJS modules can always be imported via the default export'),
87+
'entry point should show the CommonJS named export hint');
88+
assert.ok(stderr.includes("import pkg from './fail.cjs';"),
89+
'entry point hint should recommend the default import');
90+
assert.ok(stderr.includes('const { comeOn } = pkg;'),
91+
'entry point hint should show the named import as destructuring');
8592
assert.ok(stderr.includes("import { comeOn } from './fail.cjs';"),
8693
'entry point error should include the source import statement');

0 commit comments

Comments
 (0)