This repository was archived by the owner on Feb 11, 2025. It is now read-only.
forked from trpc/trpc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: use vitest workspaces (trpc#5461)
* use vitewt workspaces * sync lock * fix coverage? * maybe CI bust? * oh yeet * test v3 * change some scripts * rev settings.json
- Loading branch information
1 parent
0a3c261
commit 73447f7
Showing
16 changed files
with
181 additions
and
166 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 @@ | ||
export { default } from '../../vitest.config'; |
This file contains 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 @@ | ||
export { default } from '../../vitest.config'; |
This file contains 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 @@ | ||
export { default } from '../../vitest.config'; |
This file contains 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 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 @@ | ||
export { default } from '../../vitest.config'; |
This file contains 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 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 |
---|---|---|
@@ -1,63 +1 @@ | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
import { defineConfig } from 'vitest/config'; | ||
|
||
const aliases: Record<string, string> = {}; | ||
|
||
const dirs = fs | ||
.readdirSync(path.join(__dirname, '../')) | ||
.filter((it) => it !== 'tests' && !it.startsWith('.')) | ||
.filter((it) => fs.existsSync(path.join(__dirname, `../${it}/package.json`))); | ||
|
||
for (const pkg of dirs.sort()) { | ||
const pkgJson = path.join(__dirname, `/../${pkg}/package.json`); | ||
|
||
const json = JSON.parse(fs.readFileSync(pkgJson, 'utf-8').toString()); | ||
const exports = json.exports; | ||
for (const key of Object.keys(exports).sort()) { | ||
if (key.includes('.json')) { | ||
continue; | ||
} | ||
// trim first './' | ||
const trimmed = key.slice(1); | ||
aliases[`@trpc/${pkg}${trimmed}`] = path | ||
.join(__dirname, `../${pkg}/src${key.slice(1)}`) | ||
.replace(/\\/g, '/'); | ||
} | ||
} | ||
|
||
export default defineConfig({ | ||
root: '../', | ||
clearScreen: false, | ||
test: { | ||
environment: 'jsdom', | ||
globals: true, | ||
snapshotFormat: { | ||
printBasicPrototype: true, | ||
}, | ||
setupFiles: ['./tests/setupTests.ts'], | ||
coverage: { | ||
provider: 'istanbul', | ||
include: ['*/src/**/*.{ts,tsx,js,jsx}'], | ||
exclude: ['**/deprecated/**'], | ||
}, | ||
poolOptions: { | ||
threads: { | ||
useAtomics: !!process.env['CI'], | ||
}, | ||
}, | ||
}, | ||
resolve: { | ||
alias: { | ||
...aliases, | ||
'vitest-environment-miniflare': [ | ||
__dirname, | ||
'node_modules/vitest-environment-miniflare', | ||
].join('/'), | ||
'@vitest/coverage-istanbul': [ | ||
__dirname, | ||
'node_modules/@vitest/coverage-istanbul', | ||
].join('/'), | ||
}, | ||
}, | ||
}); | ||
export { default } from '../../vitest.config'; |
Oops, something went wrong.