-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Added Option to Automatically Add Vitest to New Projects using svelte-create #5708
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
2a35dd1
add vitest option to svelte-create
09d4ef3
added changeset
5fa5ec0
add c8 package for coverage
e4e9ccf
ran format
1bf7c59
add vitest option to fix typescript error
fdd3fcd
Remove svelte-testing-library
e75378f
update to just modify the vite.config.js
a168514
readd default vite-config for non vitest projects
e9e38a6
remove coverage testing
2f97dee
Merge branch 'master' into add-vitest-to-create
Rich-Harris 8c451fe
create typescript/checkjs/no-typechecking variants of .ts files in sh…
Rich-Harris e48c02f
simplify include
Rich-Harris f59f9c0
add testMatch to base playwright configs, remove vitest+playwright co…
Rich-Harris 0a8fc37
Update packages/create-svelte/scripts/build-templates.js
benmccann b512b49
Merge branch 'master' into add-vitest-to-create
benmccann 691e874
Update packages/create-svelte/shared/+playwright+typescript/playwrigh…
benmccann 78149b5
cleanup test patterns
benmccann c06a74f
newer version of vitest
benmccann db95545
sverdle test
benmccann e670e29
format
benmccann e71e21a
removed vitest globals
658dd56
Rename vite.config.ts to vite.config.js
8d3d11d
Fixed types on default vite config
01ab4ba
Merge remote-tracking branch 'upstream/HEAD' into add-vitest-to-create
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| 'create-svelte': patch | ||
| --- | ||
|
|
||
| Added the option to add Vitest to new projects |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
packages/create-svelte/shared/+vitest+checkjs/jsconfig.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "extends": "./.svelte-kit/tsconfig.json", | ||
| "compilerOptions": { | ||
| "types": ["vitest/globals"], | ||
| "allowJs": true, | ||
| "checkJs": true, | ||
| "esModuleInterop": true, | ||
| "forceConsistentCasingInFileNames": true, | ||
| "resolveJsonModule": true, | ||
| "skipLibCheck": true, | ||
| "sourceMap": true, | ||
| "strict": true | ||
| } | ||
| } |
11 changes: 11 additions & 0 deletions
11
packages/create-svelte/shared/+vitest+playwright+typescript/playwright.config.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import type { PlaywrightTestConfig } from '@playwright/test'; | ||
|
|
||
| const config: PlaywrightTestConfig = { | ||
| webServer: { | ||
| command: 'npm run build && npm run preview', | ||
| port: 4173 | ||
| }, | ||
| testMatch: 'tests/**/*.{js,ts}' | ||
| }; | ||
|
|
||
| export default config; | ||
10 changes: 10 additions & 0 deletions
10
packages/create-svelte/shared/+vitest+playwright-typescript/playwright.config.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| /** @type {import('@playwright/test').PlaywrightTestConfig} */ | ||
| const config = { | ||
| webServer: { | ||
| command: 'npm run build && npm run preview', | ||
| port: 4173 | ||
| }, | ||
| testMatch: 'tests/**/*.js' | ||
|
Rich-Harris marked this conversation as resolved.
Outdated
|
||
| }; | ||
|
|
||
| export default config; | ||
7 changes: 7 additions & 0 deletions
7
packages/create-svelte/shared/+vitest+typescript/src/lib/sum.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import { sum } from './sum'; | ||
|
|
||
| describe('sum test', () => { | ||
| it('adds 1 + 2 to equal 3', () => { | ||
| expect(sum(1, 2)).toBe(3); | ||
| }); | ||
| }); |
3 changes: 3 additions & 0 deletions
3
packages/create-svelte/shared/+vitest+typescript/src/lib/sum.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| export function sum(a: number, b: number): number { | ||
| return a + b; | ||
| } |
14 changes: 14 additions & 0 deletions
14
packages/create-svelte/shared/+vitest+typescript/tsconfig.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "extends": "./.svelte-kit/tsconfig.json", | ||
| "compilerOptions": { | ||
| "types": ["vitest/globals"], | ||
| "allowJs": true, | ||
| "checkJs": true, | ||
| "esModuleInterop": true, | ||
| "forceConsistentCasingInFileNames": true, | ||
| "resolveJsonModule": true, | ||
| "skipLibCheck": true, | ||
| "sourceMap": true, | ||
| "strict": true | ||
| } | ||
| } |
11 changes: 11 additions & 0 deletions
11
packages/create-svelte/shared/+vitest+typescript/vitest.config.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import { defineConfig } from 'vite'; | ||
| import viteConfig from './vite.config'; | ||
|
|
||
| export default defineConfig({ | ||
| ...viteConfig, | ||
| plugins: viteConfig?.plugins ?? [], | ||
| test: { | ||
| include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'], | ||
| globals: true | ||
| } | ||
| }); |
3 changes: 3 additions & 0 deletions
3
packages/create-svelte/shared/+vitest-typescript/src/lib/sum.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| export function sum(a, b) { | ||
| return a + b; | ||
| } |
7 changes: 7 additions & 0 deletions
7
packages/create-svelte/shared/+vitest-typescript/src/lib/sum.test.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import { sum } from './sum'; | ||
|
|
||
| describe('sum test', () => { | ||
| it('adds 1 + 2 to equal 3', () => { | ||
| expect(sum(1, 2)).toBe(3); | ||
| }); | ||
| }); |
11 changes: 11 additions & 0 deletions
11
packages/create-svelte/shared/+vitest-typescript/vitest.config.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import { defineConfig } from 'vite'; | ||
| import viteConfig from './vite.config'; | ||
|
|
||
| export default defineConfig({ | ||
|
Rich-Harris marked this conversation as resolved.
Outdated
|
||
| ...viteConfig, | ||
| plugins: viteConfig?.plugins ?? [], | ||
| test: { | ||
| include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'], | ||
| globals: true | ||
| } | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "devDependencies": { | ||
| "vitest": "^0.19.1", | ||
| "c8": "^7.12.0" | ||
| }, | ||
| "scripts": { | ||
| "test:unit": "vitest", | ||
| "coverage": "vitest run --coverage" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.