Skip to content

Commit

Permalink
Output coverage per each test
Browse files Browse the repository at this point in the history
  • Loading branch information
exoego committed May 30, 2024
1 parent 3d0fbfb commit 771d324
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .vitest.config/jsx-runtime-default.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import config from '../vitest.config'

config.esbuild = {
jsx: 'automatic',
jsxImportSource: __dirname + '/../src/jsx',
Expand All @@ -8,5 +9,8 @@ if (config.test) {
'**/src/jsx/dom/**/(*.)+(spec|test).+(ts|tsx|js)',
'src/jsx/hooks/dom.test.tsx',
]
if (config.test.coverage) {
config.test.coverage.reportsDirectory = './coverage/raw/jsx-runtime'
}
}
export default config
3 changes: 3 additions & 0 deletions .vitest.config/jsx-runtime-dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@ if (config.test) {
'**/src/jsx/dom/**/(*.)+(spec|test).+(ts|tsx|js)',
'src/jsx/hooks/dom.test.tsx',
]
if (config.test.coverage) {
config.test.coverage.reportsDirectory = './coverage/raw/jsx-dom'
}
}
export default config
5 changes: 5 additions & 0 deletions runtime_tests/bun/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
/// <reference types="vitest" />
import { defineConfig } from 'vitest/config'
import config from '../../vitest.config'

export default defineConfig({
test: {
globals: true,
include: ['**/runtime_tests/bun/**/*.+(ts|tsx|js)'],
coverage: {
...config.test?.coverage,
reportsDirectory: './coverage/raw/runtime-bun',
},
},
})
5 changes: 5 additions & 0 deletions runtime_tests/fastly/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
/// <reference types="vitest" />
import fastlyCompute from 'vite-plugin-fastly-js-compute'
import { defineConfig } from 'vitest/config'
import config from '../../vitest.config'

export default defineConfig({
plugins: [fastlyCompute()],
test: {
globals: true,
include: ['**/runtime_tests/fastly/**/(*.)+(test).+(ts|tsx)'],
exclude: ['**/runtime_tests/fastly/vitest.config.ts'],
coverage: {
...config.test?.coverage,
reportsDirectory: './coverage/raw/runtime-fastly',
},
},
})
5 changes: 5 additions & 0 deletions runtime_tests/lambda-edge/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// <reference types="vitest" />
import { defineConfig } from 'vitest/config'
import config from '../../vitest.config'

export default defineConfig({
test: {
Expand All @@ -9,5 +10,9 @@ export default defineConfig({
globals: true,
include: ['**/runtime_tests/lambda-edge/**/*.+(ts|tsx|js)'],
exclude: ['**/runtime_tests/lambda-edge/vitest.config.ts'],
coverage: {
...config.test?.coverage,
reportsDirectory: './coverage/raw/runtime-lambda-edge',
},
},
})
5 changes: 5 additions & 0 deletions runtime_tests/lambda/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// <reference types="vitest" />
import { defineConfig } from 'vitest/config'
import config from '../../vitest.config'

export default defineConfig({
test: {
Expand All @@ -9,5 +10,9 @@ export default defineConfig({
globals: true,
include: ['**/runtime_tests/lambda/**/*.+(ts|tsx|js)'],
exclude: ['**/runtime_tests/lambda/vitest.config.ts', '**/runtime_tests/lambda/mock.ts'],
coverage: {
...config.test?.coverage,
reportsDirectory: './coverage/raw/runtime-lambda',
},
},
})
5 changes: 5 additions & 0 deletions runtime_tests/node/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// <reference types="vitest" />
import { defineConfig } from 'vitest/config'
import config from '../../vitest.config'

export default defineConfig({
test: {
Expand All @@ -9,5 +10,9 @@ export default defineConfig({
globals: true,
include: ['**/runtime_tests/node/**/*.+(ts|tsx|js)'],
exclude: ['**/runtime_tests/node/vitest.config.ts'],
coverage: {
...config.test?.coverage,
reportsDirectory: './coverage/raw/runtime-node',
},
},
})
5 changes: 5 additions & 0 deletions runtime_tests/wrangler/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
/// <reference types="vitest" />
import { defineConfig } from 'vitest/config'
import config from '../../vitest.config'

export default defineConfig({
test: {
globals: true,
include: ['**/runtime_tests/wrangler/**/(*.)+(test).+(ts|tsx)'],
exclude: ['**/runtime_tests/wrangler/vitest.config.ts'],
coverage: {
...config.test?.coverage,
reportsDirectory: './coverage/raw/runtime-wrangler',
},
},
})
9 changes: 7 additions & 2 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,20 @@ export default defineConfig({
esbuild: {
jsx: 'automatic',
jsxImportSource: __dirname + '/../src/jsx',
// sourcemap: true,
// treeShaking: false,
// minify: false,
},
test: {
globals: true,
include: ['**/src/**/(*.)+(spec|test).+(ts|tsx|js)'],
exclude: [...configDefaults.exclude, '**/sandbox/**', '**/*.case.test.+(ts|tsx|js)'],
setupFiles: ['./src/test-utils/setup-vitest.ts'],
coverage: {
provider: 'v8',
reporter: ['text'],
enabled: true,
provider: 'istanbul',
reportsDirectory: './coverage/raw/default',
reporter: ['json'],
},
pool: 'forks',
},
Expand Down

0 comments on commit 771d324

Please sign in to comment.