Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions ava.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
export default {
// GraphQL schema generation currently uses graphql-compose's process-global
// schemaComposer. Run AVA files serially so schema-building tests do not
// mutate that shared composer concurrently.
concurrency: 1,
// AVA isolates test files in worker processes. Test writers use unique
// mkdtemp directories (including the cwd-relative watcher fixtures), bind
// ephemeral ports, and close their servers; no test changes process.cwd().
// Four workers provide parallelism without over-subscribing real filesystem
// watchers during the suite's integration tests.
concurrency: 4,
files: [
'packages/**/*.test.(j|t)s',
// Codegen + utils use Vitest under src/__tests__. Keep those out of the
Expand Down
38 changes: 26 additions & 12 deletions packages/flatbread/src/graphql/liveServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,19 +167,33 @@ export async function startGraphqlServer(
: 'codegen refresh';
console.error(`Flatbread ${label} failed:`, result.error);
});
subscription = await subscribe(
cwd,
(error, events) => {
if (error) {
console.error('Flatbread watcher error:', error);
return;
}
coordinator!.push(
events.map((event) => ({ path: event.path, type: event.type }))
for (let attempt = 0; attempt < 3; attempt++) {
try {
subscription = await subscribe(
cwd,
(error, events) => {
if (error) {
console.error('Flatbread watcher error:', error);
return;
}
coordinator!.push(
events.map((event) => ({ path: event.path, type: event.type }))
);
},
{ ignore: ['**/node_modules/**', '**/.git/**', '**/dist/**'] }
);
},
{ ignore: ['**/node_modules/**', '**/.git/**', '**/dist/**'] }
);
break;
} catch (error: unknown) {
const isEnoent =
error instanceof Error &&
((error as NodeJS.ErrnoException).code === 'ENOENT' ||
error.message.includes('No such file or directory'));
if (!isEnoent || attempt === 2) throw error;
await new Promise<void>((resolve) =>
setTimeout(resolve, 100 * (attempt + 1))
);
}
}
}
return {
port,
Expand Down
Loading