Skip to content

Commit 36db7df

Browse files
committed
Add long multiline test with comment
1 parent d58232e commit 36db7df

File tree

3 files changed

+47
-1
lines changed

3 files changed

+47
-1
lines changed

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

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,21 @@ const errTemplate = (specifier, name, namedImports, defaultName) =>
1414
const expectedMultiLine = errTemplate('./fail.cjs', 'comeOn',
1515
'{ comeOn, everybody }');
1616

17+
const expectedLongMultiLine = errTemplate('./fail.cjs', 'comeOn',
18+
'{\n' +
19+
' comeOn,\n' +
20+
' one,\n' +
21+
' two,\n' +
22+
' three,\n' +
23+
' four,\n' +
24+
' five,\n' +
25+
' six,\n' +
26+
' seven,\n' +
27+
' eight,\n' +
28+
' nine,\n' +
29+
' ten\n' +
30+
'}');
31+
1732
const expectedRelative = errTemplate('./fail.cjs', 'comeOn', '{ comeOn }');
1833

1934
const expectedRenamed = errTemplate('./fail.cjs', 'comeOn',
@@ -61,7 +76,14 @@ rejects(async () => {
6176
}, {
6277
name: 'SyntaxError',
6378
message: expectedMultiLine,
64-
}, 'should correctly format named imports across multiple lines');
79+
}, 'should correctly format named multi-line imports');
80+
81+
rejects(async () => {
82+
await import(`${fixtureBase}/long-multi-line.mjs`);
83+
}, {
84+
name: 'SyntaxError',
85+
message: expectedLongMultiLine,
86+
}, 'should correctly format named very long multi-line imports');
6587

6688
rejects(async () => {
6789
await import(`${fixtureBase}/json-hack.mjs`);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
module.exports = {
22
comeOn: 'fhqwhgads',
33
everybody: 'to the limit',
4+
one: 1,
5+
two: 2,
6+
three: 3,
7+
four: 4,
8+
five: 5,
9+
six: 6,
10+
seven: 7,
11+
eight: 8,
12+
nine: 9,
13+
ten: 10,
414
};
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import {
2+
comeOn,
3+
// everybody,
4+
one,
5+
two,
6+
three,
7+
four,
8+
five,
9+
six,
10+
seven,
11+
eight,
12+
nine,
13+
ten,
14+
} from "./fail.cjs";

0 commit comments

Comments
 (0)