From df2923d3821faa888b88cf9bc857310028335361 Mon Sep 17 00:00:00 2001 From: Andrew Petersen Date: Tue, 7 Apr 2020 00:24:58 -0400 Subject: [PATCH] test: fix useful but super-annoying eslint error about try catch expects --- src/integration.test.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/integration.test.ts b/src/integration.test.ts index f8be1b6..aef1ef3 100644 --- a/src/integration.test.ts +++ b/src/integration.test.ts @@ -14,14 +14,17 @@ try { } test('display help via bin', async () => { + let caught; try { await execp('./cli --help'); } catch (e) { - expect(e.code).toBe(1); - expect(e.stdout).toMatch(/--age/); - expect(e.stdout).toMatch(/--root/); - expect(e.stdout).toMatch(/--archive/); - expect(e.stdout).toMatch(/--projects/); - expect(e.stdout).toMatch(/--yes/); + caught = e; } + + expect(caught.code).toBe(1); + expect(caught.stdout).toMatch(/--age/); + expect(caught.stdout).toMatch(/--root/); + expect(caught.stdout).toMatch(/--archive/); + expect(caught.stdout).toMatch(/--projects/); + expect(caught.stdout).toMatch(/--yes/); });