Skip to content
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
13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
".": {
"types": "./types/index.d.ts",
"default": "./src/index.js"
},
"./vitest": {
"default": "./src/vitest.js"
}
},
"type": "module",
Expand Down Expand Up @@ -43,9 +46,9 @@
"toc": "doctoc README.md",
"lint": "(prettier . --check || true) && eslint .",
"format": "prettier . --write && eslint . --fix",
"test": "vitest run src",
"test:watch": "npm run test -- --watch",
"test:update": "npm run test -- --updateSnapshot --coverage",
"test": "vitest run --coverage",
"test:watch": "vitest",
"test:update": "vitest run --update",
"setup": "npm install && npm run validate",
"validate": "npm-run-all lint test",
"contributors:add": "all-contributors add",
Expand All @@ -61,10 +64,10 @@
"@commitlint/cli": "^17.6.6",
"@commitlint/config-conventional": "^17.6.6",
"@sveltejs/vite-plugin-svelte": "^2.4.2",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/jest-dom": "^6.3.0",
"@typescript-eslint/eslint-plugin": "^6.19.1",
"@typescript-eslint/parser": "^6.19.1",
"@vitest/coverage-c8": "^0.33.0",
"@vitest/coverage-v8": "^0.33.0",
"all-contributors-cli": "^6.26.0",
"doctoc": "^2.2.1",
"eslint": "^8.43.0",
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/_vitest-setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '@testing-library/jest-dom/vitest'
import '../vitest'
11 changes: 0 additions & 11 deletions src/test-setup.js
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed / moved this file to avoid confusion with the src/vitest.js entrypoint

This file was deleted.

8 changes: 8 additions & 0 deletions src/vitest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { afterEach } from 'vitest'

import { act, cleanup } from './pure.js'

afterEach(async () => {
await act()
cleanup()
})
12 changes: 8 additions & 4 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ import { defineConfig } from 'vite'

// https://vitejs.dev/config/
export default defineConfig({
plugins: [svelte()],
test: {
environment: 'jsdom',
setupFiles: ['./src/test-setup.js'],
plugins: [svelte()],
test: {
environment: 'jsdom',
setupFiles: ['./src/__tests__/_vitest-setup.js'],
coverage: {
provider: 'v8',
include: ['src'],
},
},
})