Skip to content

Commit

Permalink
Split up vitest command
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlancollins committed Dec 27, 2023
1 parent 7d7e494 commit de6cdd1
Show file tree
Hide file tree
Showing 13 changed files with 50 additions and 15 deletions.
2 changes: 1 addition & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"build-js": {
"cache": true
},
"test:ci": {
"test:lib": {
"cache": true
},
"test:types": {
Expand Down
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"packageManager": "[email protected]",
"scripts": {
"clean": "npm exec --workspaces -c \"rm -rf build || true\"",
"test": "(is-ci && npm run test:ci) || npm run test:dev",
"test:ci": "nx test:ci root",
"test:dev": "vitest --watch",
"test": "(is-ci && npm run test:lib) || npm run test:dev",
"test:lib": "nx run-many -t test:lib",
"test:lib:dev": "nx run-many -t test:lib:dev",
"test:types": "nx run-many -t test:types",
"build": "nx build root",
"watch": "concurrently --kill-others \"rollup --config rollup.config.js -w\" \"tsc -b --watch\"",
Expand All @@ -16,11 +16,10 @@
"cipublish": "ts-node scripts/publish.ts",
"cipublishforce": "CI=true npm run cipublish",
"typecheck": "nx typecheck root",
"pr": "nx run-many --targets=test:ci,build,test:types --projects=root"
"pr": "nx run-many --targets=test:lib,build,test:types --projects=root"
},
"nx": {
"includedScripts": [
"test:ci",
"build"
]
},
Expand Down
4 changes: 3 additions & 1 deletion packages/match-sorter-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@
"src"
],
"scripts": {
"test:types": "tsc"
"test:types": "tsc",
"test:lib": "vitest",
"test:lib:dev": "pnpm test:lib --watch"
},
"dependencies": {
"remove-accents": "0.4.2"
Expand Down
File renamed without changes.
11 changes: 11 additions & 0 deletions packages/match-sorter-utils/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { defineConfig } from 'vitest/config'

export default defineConfig({
test: {
watch: false,
setupFiles: ['test-setup.ts'],
environment: 'jsdom',
globals: true,
dir: '__tests__',
},
})
4 changes: 3 additions & 1 deletion packages/react-table/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
"src"
],
"scripts": {
"test:types": "tsc"
"test:types": "tsc",
"test:lib": "vitest",
"test:lib:dev": "pnpm test:lib --watch"
},
"dependencies": {
"@tanstack/table-core": "workspace:*"
Expand Down
1 change: 1 addition & 0 deletions packages/react-table/test-setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '@testing-library/jest-dom'
11 changes: 11 additions & 0 deletions packages/react-table/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { defineConfig } from 'vitest/config'

export default defineConfig({
test: {
watch: false,
setupFiles: ['test-setup.ts'],
environment: 'jsdom',
globals: true,
dir: '__tests__',
},
})
4 changes: 3 additions & 1 deletion packages/table-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
"src"
],
"scripts": {
"test:types": "tsc"
"test:types": "tsc",
"test:lib": "vitest",
"test:lib:dev": "pnpm test:lib --watch"
}
}
1 change: 1 addition & 0 deletions packages/table-core/test-setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '@testing-library/jest-dom'
11 changes: 11 additions & 0 deletions packages/table-core/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { defineConfig } from 'vitest/config'

export default defineConfig({
test: {
watch: false,
setupFiles: ['test-setup.ts'],
environment: 'jsdom',
globals: true,
dir: '__tests__',
},
})
5 changes: 0 additions & 5 deletions project.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
"command": "echo \" @tanstack/table > All packages built! 📦\"",
"dependsOn": ["build-js", "typecheck"],
"inputs": ["packageSources"]
},
"test:ci": {
"command": "vitest",
"inputs": ["packageSources", "{workspaceRoot}/packages/*/__tests__/**/*"],
"dependsOn": ["build-js"]
}
}
}
2 changes: 1 addition & 1 deletion scripts/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ async function run() {
}

console.info('Testing packages...')
execSync(`npm run test:ci`, { encoding: 'utf8' })
execSync(`npm run test:lib`, { encoding: 'utf8' })
console.info('')

console.info(`Updating all changed packages to version ${version}...`)
Expand Down

0 comments on commit de6cdd1

Please sign in to comment.