Skip to content

Commit 342f9fa

Browse files
Jake ChampionJakeChampion
authored andcommitted
refactor test to ensure cleanup always runs
1 parent 49b9d62 commit 342f9fa

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

integration-tests/cli/invalid.test.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@ import { prepareEnvironment } from '@gmrchk/cli-testing-library';
44

55
const cli = await getBinPath()
66

7-
test('should bail on syntax errors', async function (t) {
7+
test('should return non-zero exit code on syntax errors', async function (t) {
88
const { execute, cleanup, writeFile } = await prepareEnvironment();
9+
t.teardown(async function () {
10+
await cleanup();
11+
});
912
await writeFile('./bin/index.js', '@')
10-
const { code } = await execute(
11-
'node',
12-
cli
13-
);
14-
13+
const { code } = await execute('node', cli);
14+
1515
t.is(code, 1);
16-
17-
await cleanup();
1816
});

0 commit comments

Comments
 (0)