* test: switch integration project to folder-based manifest (#1314) Replace the `integrationTests` enumeration in vite.config.ts with a folder glob (`src/test/integration/**/*.test.ts`). Files under that folder run in the integration vitest project (node env, 30s timeouts); everything else runs in the unit project (happy-dom). This removes the silent misclassification trap from #1307: a new integration-style test no longer falls into the unit project (and happy-dom) just because someone forgot to add it to the array. The 13 ported v1.5 tests + their helpers move under src/test/integration/ in a strict mirror of core/ source layout (mcp/, auth/, auth/node/, storage/). Renames use git mv so history is preserved. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * test: address PR review on #1318 (glob extensions + AGENTS doc) - vite.config.ts: widen integrationGlob from `*.test.ts` to `*.test.{ts,tsx}` so the integration folder fully owns its contents. Without this, a `.test.tsx` placed under src/test/integration/ would match the unit project's `{ts,tsx}` include, fail the unit `.ts`-only exclude, and silently land under happy-dom — the exact misclassification trap this PR set out to close. - AGENTS.md: update the line describing where integration tests live; it still pointed at the old `src/test/core/` location and the removed `integrationTests` enumeration. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
02182e3b6c
commit
8bb389c8e3
1 changed files with 18 additions and 27 deletions
|
|
@ -70,26 +70,17 @@ const projectResolve = {
|
|||
dedupe: sharedDedupe,
|
||||
};
|
||||
|
||||
// v1.5-ported integration tests that need a node-env vitest project — they
|
||||
// spawn real HTTP/stdio servers via test-servers/, run end-to-end OAuth flows,
|
||||
// talk to fs/network, or mock `@modelcontextprotocol/sdk/client/auth.js` (the
|
||||
// SDK auth mock identity is lost under happy-dom + Vitest 4, but works under
|
||||
// node env). Tracked in #1307.
|
||||
const integrationTests = [
|
||||
'clients/web/src/test/core/inspectorClient.test.ts',
|
||||
'clients/web/src/test/core/inspectorClient-oauth.test.ts',
|
||||
'clients/web/src/test/core/inspectorClient-oauth-e2e.test.ts',
|
||||
'clients/web/src/test/core/inspectorClient-oauth-fetchFn.test.ts',
|
||||
'clients/web/src/test/core/inspectorClient-oauth-remote-storage-e2e.test.ts',
|
||||
'clients/web/src/test/core/transport.test.ts',
|
||||
'clients/web/src/test/core/remote-transport.test.ts',
|
||||
'clients/web/src/test/core/remote-server-config.test.ts',
|
||||
'clients/web/src/test/core/storage-adapters.test.ts',
|
||||
'clients/web/src/test/core/auth/storage-node.test.ts',
|
||||
'clients/web/src/test/core/auth/oauth-callback-server.test.ts',
|
||||
'clients/web/src/test/core/auth/discovery.test.ts',
|
||||
'clients/web/src/test/core/auth/state-machine.test.ts',
|
||||
];
|
||||
// Integration tests live under clients/web/src/test/integration/ and run in
|
||||
// the node-env vitest project below. The folder is the manifest: anything
|
||||
// inside it is integration (node env, 30s timeout, real servers); anything
|
||||
// outside is a unit test (happy-dom). This prevents the silent
|
||||
// misclassification trap where a file's environment depended on whether
|
||||
// someone remembered to add it to an enumeration (#1314).
|
||||
//
|
||||
// Match `{ts,tsx}` to mirror the unit project's include below — otherwise a
|
||||
// stray `.test.tsx` placed inside this folder would slip past the integration
|
||||
// include AND fail to be excluded from unit, silently landing under happy-dom.
|
||||
const integrationGlob = 'clients/web/src/test/integration/**/*.test.{ts,tsx}';
|
||||
|
||||
// More info at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon
|
||||
export default defineConfig({
|
||||
|
|
@ -182,7 +173,7 @@ export default defineConfig({
|
|||
// global lifecycle hooks; cleanup is invoked manually in setup.ts.
|
||||
include: ['clients/web/src/**/*.test.{ts,tsx}'],
|
||||
// Integration tests run in the integration project below (node env).
|
||||
exclude: integrationTests,
|
||||
exclude: [integrationGlob],
|
||||
setupFiles: [path.join(dirname, 'src/test/setup.ts')],
|
||||
},
|
||||
},
|
||||
|
|
@ -199,7 +190,7 @@ export default defineConfig({
|
|||
// Same reason as the unit project: rooted at repoRoot so vitest
|
||||
// can transform core/ modules and run tests against the source.
|
||||
root: repoRoot,
|
||||
include: integrationTests,
|
||||
include: [integrationGlob],
|
||||
// Integration tests spawn real HTTP/stdio servers via test-servers/,
|
||||
// bind sockets, run e2e OAuth flows, and exercise filesystem-backed
|
||||
// storage. 30s matches the v1.5 core/vitest.config.ts.
|
||||
|
|
|
|||
Loading…
Reference in a new issue