Skip to content

Commit

Permalink
add a test that should fail on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
evanw committed Jul 26, 2021
1 parent 025d64e commit 955c6d6
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions scripts/js-api-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,30 @@ let buildTests = {
}
},

async windowsBackslashPathTest({ esbuild, testDir }) {
let entry = path.join(testDir, 'entry.js');
let nested = path.join(testDir, 'nested.js');
let outfile = path.join(testDir, 'out.js');

// On Windows, backslash and forward slash should be treated the same
fs.writeFileSync(entry, `
import "./${path.basename(nested)}"
import ".${path.sep}${path.basename(nested)}"
`);
fs.writeFileSync(nested, `console.log('once')`);

const result = await esbuild.build({
entryPoints: [entry],
outfile,
bundle: true,
write: false,
minify: true,
format: 'esm',
})

assert.strictEqual(result.outputFiles[0].text, 'console.log("once");\n')
},

async workingDirTest({ esbuild, testDir }) {
let aDir = path.join(testDir, 'a');
let bDir = path.join(testDir, 'b');
Expand Down

0 comments on commit 955c6d6

Please sign in to comment.