Skip to content

Commit

Permalink
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
Browse files Browse the repository at this point in the history
… Add a brand new watcher
  • Loading branch information
novemberborn committed Jul 2, 2023
1 parent 5bada71 commit c8317d7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 4 additions & 2 deletions test/watch-mode/helpers/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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;
}
Expand Down
8 changes: 3 additions & 5 deletions test/watch-mode/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit c8317d7

Please sign in to comment.