From 8c2836f2b85677902a2ee608391f4086bf274133 Mon Sep 17 00:00:00 2001 From: Matt Mower Date: Wed, 31 Jul 2024 16:56:49 -0700 Subject: [PATCH] fix: strip ANSI from new test output - Before checking for substrings in stdout, strip ANSI escape codes --- tests/specs/watch.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/specs/watch.ts b/tests/specs/watch.ts index f00ec435a..ec17cbda0 100644 --- a/tests/specs/watch.ts +++ b/tests/specs/watch.ts @@ -348,9 +348,10 @@ export default testSuite(async ({ describe }, { tsx }: NodeApis) => { }); const tsxProcessResolved = await tsxProcess; - expect(tsxProcessResolved.stdout).toContain(`change in ./${fileA}`); - expect(tsxProcessResolved.stdout).toContain(`change in ./${fileB}`); - expect(tsxProcessResolved.stdout).toContain(`change in ./${entryFile}`); + const stdout = stripAnsi(tsxProcessResolved.stdout); + expect(stdout).toContain(`change in ./${fileA}`); + expect(stdout).toContain(`change in ./${fileB}`); + expect(stdout).toContain(`change in ./${entryFile}`); expect(tsxProcessResolved.stderr).toBe(''); }, 10_000); });