allow an empty plugin array in "buildSync" (#499)

This commit is contained in:
Evan Wallace
2020-11-01 13:19:09 -08:00
parent 676df72569
commit 43081ce9a8
2 changed files with 23 additions and 1 deletions

View File

@@ -27,6 +27,28 @@ let pluginTests = {
}
},
async emptyArray({ esbuild, testDir }) {
const input = path.join(testDir, 'in.js')
const output = path.join(testDir, 'out.js')
await writeFileAsync(input, `export default 123`)
await esbuild.build({
entryPoints: [input], bundle: true, outfile: output, format: 'cjs', plugins: [],
})
const result = require(output)
assert.strictEqual(result.default, 123)
},
async emptyArrayWithBuildSync({ esbuild, testDir }) {
const input = path.join(testDir, 'in.js')
const output = path.join(testDir, 'out.js')
await writeFileAsync(input, `export default 123`)
esbuild.buildSync({
entryPoints: [input], bundle: true, outfile: output, format: 'cjs', plugins: [],
})
const result = require(output)
assert.strictEqual(result.default, 123)
},
async basicLoader({ esbuild, testDir }) {
const input = path.join(testDir, 'in.js')
const custom = path.join(testDir, 'example.custom')