From c8317d777d02fe382c377f9ebe9809e94a00df1f Mon Sep 17 00:00:00 2001 From: Mark Wubben Date: Sun, 2 Jul 2023 09:44:00 +0200 Subject: [PATCH] fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Add a brand new watcher --- test/watch-mode/helpers/watch.js | 6 ++++-- test/watch-mode/typescript.js | 8 +++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/watch-mode/helpers/watch.js b/test/watch-mode/helpers/watch.js index dd6002291..bd7cd21d6 100644 --- a/test/watch-mode/helpers/watch.js +++ b/test/watch-mode/helpers/watch.js @@ -80,12 +80,15 @@ export const withFixture = fixture => async (t, task) => { const assertIdle = async next => { assertingIdle = true; - t.timeout(10_000); + // TODO: When testing using AVA 6, enable for better managed timeouts. + // t.timeout(10_000); const promise = Promise.all([delay(5000, null, {ref: false}), next?.()]).finally(() => { if (idlePromise === promise) { idlePromise = new Promise(() => {}); assertingIdle = false; + // TODO: When testing using AVA 6, enable for better managed timeouts. + // t.timeout(0); if (failedIdleAssertion) { failedIdleAssertion = false; t.fail('Watcher performed a test run while it should have been idle'); @@ -142,7 +145,6 @@ export const withFixture = fixture => async (t, task) => { t.is(activeWatchCount, 0, 'Handlers for all watch() calls should have invoked `this.done()` to end their tests'); completedTask = true; }).catch(error => { - console.error({completedTask, error}); if (!completedTask) { throw error; } diff --git a/test/watch-mode/typescript.js b/test/watch-mode/typescript.js index baf0b6e21..1c19ed179 100644 --- a/test/watch-mode/typescript.js +++ b/test/watch-mode/typescript.js @@ -6,7 +6,7 @@ import {test, withFixture} from './helpers/watch.js'; test('waits for external compiler before re-running typescript test files', withFixture('typescript-precompiled'), async (t, fixture) => { await fixture.watch({ async 1({stats}) { - t.log(stats); + t.true(stats.passed.length > 0); await this.assertIdle(async () => { await this.touch('src/test.ts'); }); @@ -74,11 +74,9 @@ test('handles inline compilation', withFixture('typescript-inline'), async (t, f test('ignores changes to compiled files with inline compilation', withFixture('typescript-inline'), async (t, fixture) => { await fs.symlink(new URL('../../node_modules', import.meta.url), path.join(fixture.dir, 'node_modules'), 'junction'); await fixture.watch({ - async 1(result) { - t.log(result.stats); - t.log(result.stats.getError(result.stats.internalErrors[0])); + async 1({stats}) { + t.true(stats.passed.length > 0); await this.assertIdle(async () => { - t.log(await fs.readdir(path.join(fixture.dir))); await this.touch('build/test.js'); }); this.done();