Skip to content

Commit d80cfbd

Browse files
chore: update test targets
1 parent 9342179 commit d80cfbd

File tree

6 files changed

+67
-4
lines changed

6 files changed

+67
-4
lines changed

apps/analog-app/project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@
6666
},
6767
"test": {
6868
"executor": "@nx/vite:test",
69-
"outputs": ["{projectRoot}/coverage"]
69+
"outputs": ["{projectRoot}/coverage"],
70+
"dependsOn": ["^build"]
7071
}
7172
}
7273
}

apps/ng-app/project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@
5757
"outputs": ["{options.outputFile}"]
5858
},
5959
"test": {
60-
"executor": "@nx/vite:test"
60+
"executor": "@nx/vite:test",
61+
"dependsOn": ["^build"]
6162
}
6263
}
6364
}

apps/trpc-app/project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@
6767
},
6868
"test": {
6969
"executor": "@nx/vite:test",
70-
"outputs": ["{projectRoot}/coverage"]
70+
"outputs": ["{projectRoot}/coverage"],
71+
"dependsOn": ["^build"]
7172
}
7273
}
7374
}

packages/nx-plugin/src/generators/preset/__snapshots__/generator.spec.ts.snap

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,65 @@ exports[`preset generator > should match index.html 1`] = `
1818
"
1919
`;
2020

21+
exports[`preset generator > should match index.html 2`] = `
22+
"/// <reference types="vitest" />
23+
24+
import analog from '@analogjs/platform';
25+
import { defineConfig } from 'vite';
26+
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
27+
28+
// @ts-expect-error @tailwindcss/vite currently uses mts. TypeScript is complaining this, but it works as expected.
29+
import tailwindcss from '@tailwindcss/vite';
30+
31+
// https://vitejs.dev/config/
32+
export default defineConfig(({ mode }) => {
33+
return {
34+
root: __dirname,
35+
cacheDir: \`../node_modules/.vite\`,
36+
build: {
37+
outDir: '../dist/./my-app/client',
38+
reportCompressedSize: true,
39+
target: ['es2020'],
40+
},
41+
server: {
42+
fs: {
43+
allow: ['.'],
44+
},
45+
},
46+
plugins: [tailwindcss(), analog(), nxViteTsPaths()],
47+
test: {
48+
globals: true,
49+
environment: 'jsdom',
50+
setupFiles: ['src/test-setup.ts'],
51+
include: ['**/*.spec.ts'],
52+
reporters: ['default'],
53+
},
54+
define: {
55+
'import.meta.vitest': mode !== 'production',
56+
},
57+
};
58+
});
59+
"
60+
`;
61+
62+
exports[`preset generator > should match index.html 3`] = `
63+
"<!doctype html>
64+
<html lang="en">
65+
<head>
66+
<meta charset="utf-8" />
67+
<title>my-app</title>
68+
<base href="/" />
69+
<meta name="viewport" content="width=device-width, initial-scale=1" />
70+
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
71+
</head>
72+
<body>
73+
<app-root></app-root>
74+
<script type="module" src="/my-app/src/main.ts"></script>
75+
</body>
76+
</html>
77+
"
78+
`;
79+
2180
exports[`preset generator > should match project.json 1`] = `
2281
"{
2382
"name": "my-app",

packages/nx-plugin/vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export default defineConfig(({ mode }) => {
1212
include: ['**/*.spec.ts'],
1313
exclude: ['**/files/**/*.spec.ts'],
1414
cacheDir: '../../node_modules/.vitest',
15+
testTimeout: 10000,
1516
},
1617
define: {
1718
'import.meta.vitest': mode !== 'production',

packages/vite-plugin-nitro/src/lib/utils/get-page-handlers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export function getPageHandlers({
4343

4444
return {
4545
handler: endpointFile,
46-
route: `${hasAPIDir ? '/api' : ''}/_analog${route}`,
46+
route: `${hasAPIDir ? '/api' : ''}/_analog${route}.json`,
4747
lazy: true,
4848
};
4949
});

0 commit comments

Comments
 (0)