Skip to content

Commit 49b9d62

Browse files
Jake ChampionJakeChampion
authored andcommitted
add test for compiling a valid application
1 parent b7c8fcc commit 49b9d62

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

integration-tests/cli/valid.test.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import test from 'brittle';
2+
import { getBinPath } from 'get-bin-path'
3+
import { prepareEnvironment } from '@gmrchk/cli-testing-library';
4+
5+
const cli = await getBinPath()
6+
7+
test('should create wasm file and return zero exit code', async function (t) {
8+
const { execute, cleanup, writeFile, exists } = await prepareEnvironment();
9+
t.teardown(async function () {
10+
await cleanup();
11+
});
12+
13+
await writeFile('./bin/index.js', `addEventListener('fetch', function(){})`)
14+
15+
t.is(await exists('./bin/main.wasm'), false)
16+
17+
const { code, stdout, stderr } = await execute('node', cli);
18+
19+
t.is(await exists('./bin/main.wasm'), true)
20+
t.alike(stdout, []);
21+
t.alike(stderr, []);
22+
t.is(code, 0);
23+
});

0 commit comments

Comments
 (0)