diff --git a/.chronus/changes/fix-vitest-2024-4-17-21-35-16.md b/.chronus/changes/fix-vitest-2024-4-17-21-35-16.md new file mode 100644 index 0000000000..b762765d84 --- /dev/null +++ b/.chronus/changes/fix-vitest-2024-4-17-21-35-16.md @@ -0,0 +1,8 @@ +--- +# Change versionKind to one of: internal, fix, dependencies, feature, deprecation, breaking +changeKind: internal +packages: + - "@typespec/openapi3" +--- + +Fix vitest not reloading JS files diff --git a/packages/openapi3/vitest.config.ts b/packages/openapi3/vitest.config.ts index 113ec4ef24..dca50cce36 100644 --- a/packages/openapi3/vitest.config.ts +++ b/packages/openapi3/vitest.config.ts @@ -6,7 +6,6 @@ export default mergeConfig( defineConfig({ test: { testTimeout: 10000, - watchExclude: ["dist/**"], }, }) ); diff --git a/packages/samples/src/sample-snapshot-testing.ts b/packages/samples/src/sample-snapshot-testing.ts index d6fb232127..d2b3656e33 100644 --- a/packages/samples/src/sample-snapshot-testing.ts +++ b/packages/samples/src/sample-snapshot-testing.ts @@ -50,7 +50,7 @@ export function defineSampleSnaphotTests(config: SampleSnapshotTestOptions) { }); afterAll(async function (context: Readonly) { - if (context.tasks.length !== samples.length) { + if (context.tasks.some((x) => x.mode === "skip")) { return; // Not running the full test suite, so don't bother checking snapshots. } diff --git a/vitest.config.ts b/vitest.config.ts new file mode 100644 index 0000000000..d4d739b226 --- /dev/null +++ b/vitest.config.ts @@ -0,0 +1,4 @@ +import { defineConfig, mergeConfig } from "vitest/config"; +import { defaultTypeSpecVitestConfig } from "./vitest.workspace.js"; + +export default mergeConfig(defaultTypeSpecVitestConfig, defineConfig({}));