Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(vite): include vite mts config files #28691

Merged
merged 2 commits into from
Oct 30, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,9 @@ exports[`app --unit-test-runner vitest should add tsconfig.spec.json 1`] = `
},
"include": [
"vite.config.ts",
"vite.config.mts",
"vitest.config.ts",
"vitest.config.mts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.test.tsx",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ exports[`app generated files content - as-provided - my-app general application
"include": [
".nuxt/nuxt.d.ts",
"vite.config.ts",
"vite.config.mts",
"vitest.config.ts",
"vitest.config.mts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.test.tsx",
Expand Down Expand Up @@ -531,7 +533,9 @@ exports[`app generated files content - as-provided - myApp general application s
"include": [
".nuxt/nuxt.d.ts",
"vite.config.ts",
"vite.config.mts",
"vitest.config.ts",
"vitest.config.mts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.test.tsx",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ exports[`@nx/vite:configuration js library with --bundler=vite should add build
"include": ["src/**/*.ts"],
"exclude": [
"vite.config.ts",
"vite.config.mts",
"vitest.config.ts",
"vitest.config.mts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.test.tsx",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default defineConfig({
`;

exports[`vitest generator tsconfig should add vitest.workspace.ts at the root 1`] = `
"export default ['**/*/vite.config.ts', '**/*/vitest.config.ts'];
"export default ['**/*/vite.config.{ts,mts}', '**/*/vitest.config.{ts,mts}'];
"
`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
},
"include": [
"vite.config.ts",
"vite.config.mts",
"vitest.config.ts",
"vitest.config.mts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.test.tsx",
Expand Down
4 changes: 3 additions & 1 deletion packages/vite/src/generators/vitest/vitest-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export async function vitestGeneratorInternal(
) {
tree.write(
'vitest.workspace.ts',
`export default ['**/*/vite.config.ts', '**/*/vitest.config.ts'];`
`export default ['**/*/vite.config.{ts,mts}', '**/*/vitest.config.{ts,mts}'];`
);
}

Expand Down Expand Up @@ -236,7 +236,9 @@ function updateTsConfig(
const uniqueExclude = new Set([
...(json.exclude || []),
'vite.config.ts',
'vite.config.mts',
'vitest.config.ts',
'vitest.config.mts',
'src/**/*.test.ts',
'src/**/*.spec.ts',
'src/**/*.test.tsx',
Expand Down
2 changes: 2 additions & 0 deletions packages/vite/src/generators/vitest/vitest.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ describe('vitest generator', () => {
"extends": "./tsconfig.json",
"include": [
"vite.config.ts",
"vite.config.mts",
"vitest.config.ts",
"vitest.config.mts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.test.tsx",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,9 @@ exports[`library should add vue, vite and vitest to package.json 2`] = `
"src/**/*.spec.vue",
"src/**/*.test.vue",
"vite.config.ts",
"vite.config.mts",
"vitest.config.ts",
"vitest.config.mts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.test.tsx",
Expand Down Expand Up @@ -261,7 +263,9 @@ exports[`library should ignore test files in tsconfig.lib.json 1`] = `
"src/**/*.spec.vue",
"src/**/*.test.vue",
"vite.config.ts",
"vite.config.mts",
"vitest.config.ts",
"vitest.config.mts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.test.tsx",
Expand Down