Skip to content

Commit 35494df

Browse files
committed
test: add test for convertPath
1 parent fa04fc2 commit 35494df

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/lib/rules/no-top-level-await.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,14 @@ new RuleTester({
100100
},
101101
],
102102
},
103+
// files field of `package.json` with convertPath
104+
{
105+
filename: fixture("simple-files/test/a.ts"),
106+
code: "const foo = await import('foo')",
107+
options: [
108+
{ convertPath: { "src/**/*": ["src/(.+).ts", "lib/$1.js"] } },
109+
],
110+
},
103111
// Unknown files
104112
{
105113
code: "const foo = await import('foo')",
@@ -206,5 +214,21 @@ new RuleTester({
206214
},
207215
],
208216
},
217+
// files field of `package.json` with convertPath
218+
{
219+
filename: fixture("simple-files/src/a.ts"),
220+
code: "const foo = await import('foo')",
221+
options: [
222+
{ convertPath: { "src/**/*": ["src/(.+).ts", "lib/$1.js"] } },
223+
],
224+
errors: [
225+
{
226+
message:
227+
"Top-level `await` is forbidden in published modules.",
228+
line: 1,
229+
column: 13,
230+
},
231+
],
232+
},
209233
],
210234
})

0 commit comments

Comments
 (0)