Skip to content

Commit

Permalink
ci: import relative path to work around windows
Browse files Browse the repository at this point in the history
  • Loading branch information
evanw committed Mar 1, 2021
1 parent 2a371b6 commit 0b60424
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions scripts/js-api-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -1338,9 +1338,13 @@ export {
outExtension: { '.js': '.mjs' },
chunkNames: 'chunks/[hash]/[name]',
})
const result1 = await import(path.join(outdir, 'entry1.mjs'))
const result2 = await import(path.join(outdir, 'entry2.mjs'))
const result3 = await import(path.join(outdir, 'entry3.mjs'))

// This needs to use relative paths to avoid breaking on Windows.
// Importing by absolute path doesn't work on Windows in node.
const result1 = await import('./' + path.relative(__dirname, path.join(outdir, 'entry1.mjs')))
const result2 = await import('./' + path.relative(__dirname, path.join(outdir, 'entry2.mjs')))
const result3 = await import('./' + path.relative(__dirname, path.join(outdir, 'entry3.mjs')))

assert.strictEqual(await result1.default(), 'shared1shared2');
assert.strictEqual(await result2.default(), 'shared2shared3');
assert.strictEqual(await result3.default(), 'shared3shared1');
Expand Down

0 comments on commit 0b60424

Please sign in to comment.