Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement the "fastly" condition (#660)
- Loading branch information
1 parent
3b97363
commit db7db46
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import test from 'brittle'; | ||
import { getBinPath } from 'get-bin-path' | ||
import { prepareEnvironment } from '@jakechampion/cli-testing-library'; | ||
|
||
const cli = await getBinPath() | ||
|
||
test('should build the fastly condition', async function (t) { | ||
const { execute, cleanup, writeFile, exists, path } = await prepareEnvironment(); | ||
t.teardown(async function () { | ||
await cleanup(); | ||
}); | ||
|
||
await writeFile('./index.js', `import '#test';`) | ||
await writeFile('./test.js', `addEventListener('fetch', function(){})`) | ||
await writeFile('./package.json', `{ "type": "module", "imports": { "#test": { "fastly": "./test.js" } } }`) | ||
|
||
t.is(await exists('./app.wasm'), false) | ||
|
||
const { code, stdout, stderr } = await execute(process.execPath, `${cli} ${path}/index.js ${path}/app.wasm`); | ||
|
||
t.is(await exists('./app.wasm'), true) | ||
t.alike(stdout, []); | ||
t.alike(stderr, []); | ||
t.is(code, 0); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters