Skip to content

Commit

Permalink
refactor(vitest): move public exports to public folder (#6218)
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va authored Jul 24, 2024
1 parent 56dbfa6 commit b76a927
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 41 deletions.
28 changes: 14 additions & 14 deletions packages/vitest/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ const entries = {
'index': 'src/public/index.ts',
'cli': 'src/node/cli.ts',
'node': 'src/public/node.ts',
'suite': 'src/suite.ts',
'browser': 'src/browser.ts',
'runners': 'src/runners.ts',
'suite': 'src/public/suite.ts',
'browser': 'src/public/browser.ts',
'runners': 'src/public/runners.ts',
'environments': 'src/public/environments.ts',
'spy': 'src/integrations/spy.ts',
'coverage': 'src/coverage.ts',
'coverage': 'src/public/coverage.ts',
'utils': 'src/public/utils.ts',
'execute': 'src/public/execute.ts',
'reporters': 'src/public/reporters.ts',
// TODO: advanced docs
'workers': 'src/workers.ts',
'workers': 'src/public/workers.ts',

// for performance reasons we bundle them separately so we don't import everything at once
'worker': 'src/runtime/worker.ts',
Expand All @@ -41,23 +41,23 @@ const entries = {

'workers/runVmTests': 'src/runtime/runVmTests.ts',

'snapshot': 'src/snapshot.ts',
'snapshot': 'src/public/snapshot.ts',
}

const dtsEntries = {
index: 'src/public/index.ts',
node: 'src/public/node.ts',
environments: 'src/public/environments.ts',
browser: 'src/browser.ts',
runners: 'src/runners.ts',
suite: 'src/suite.ts',
config: 'src/config.ts',
coverage: 'src/coverage.ts',
browser: 'src/public/browser.ts',
runners: 'src/public/runners.ts',
suite: 'src/public/suite.ts',
config: 'src/public/config.ts',
coverage: 'src/public/coverage.ts',
utils: 'src/public/utils.ts',
execute: 'src/public/execute.ts',
reporters: 'src/public/reporters.ts',
workers: 'src/workers.ts',
snapshot: 'src/snapshot.ts',
workers: 'src/public/workers.ts',
snapshot: 'src/public/snapshot.ts',
}

const external = [
Expand Down Expand Up @@ -114,7 +114,7 @@ export default ({ watch }) =>
onwarn,
},
{
input: 'src/config.ts',
input: 'src/public/config.ts',
output: [
{
file: 'dist/config.cjs',
Expand Down
1 change: 0 additions & 1 deletion packages/vitest/src/coverage.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/vitest/src/node/types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1065,4 +1065,4 @@ export type ProjectConfig = Omit<
}
}

export type { UserWorkspaceConfig } from '../../config'
export type { UserWorkspaceConfig } from '../../public/config'
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ export {
setupCommonEnv,
loadDiffConfig,
loadSnapshotSerializers,
} from './runtime/setup-common'
} from '../runtime/setup-common'
export {
takeCoverageInsideWorker,
stopCoverageInsideWorker,
getCoverageProvider,
startCoverageInsideWorker,
} from './integrations/coverage'
export * as SpyModule from './integrations/spy'
} from '../integrations/coverage'
export * as SpyModule from '../integrations/spy'
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import './node/types/vite'
import '../node/types/vite'

import type { ConfigEnv, UserConfig as ViteUserConfig } from 'vite'
import type { ProjectConfig } from './node/types/config'
import type { ProjectConfig } from '../node/types/config'

export interface UserWorkspaceConfig extends ViteUserConfig {
test?: ProjectConfig
Expand All @@ -14,9 +14,9 @@ export {
defaultInclude,
defaultExclude,
coverageConfigDefaults,
} from './defaults'
} from '../defaults'
export { mergeConfig } from 'vite'
export { extraInlineDeps } from './constants'
export { extraInlineDeps } from '../constants'
export type { Plugin } from 'vite'

export type { ConfigEnv, ViteUserConfig as UserConfig }
Expand Down
1 change: 1 addition & 0 deletions packages/vitest/src/public/coverage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { BaseCoverageProvider } from '../utils/coverage'
2 changes: 2 additions & 0 deletions packages/vitest/src/public/runners.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { VitestTestRunner } from '../runtime/runners/test'
export { NodeBenchmarkRunner } from '../runtime/runners/benchmark'
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export type { SnapshotEnvironment } from '@vitest/snapshot/environment'
export { VitestNodeSnapshotEnvironment as VitestSnapshotEnvironment } from './integrations/snapshot/environments/node'
export { VitestNodeSnapshotEnvironment as VitestSnapshotEnvironment } from '../integrations/snapshot/environments/node'
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export {
setHooks,
} from '@vitest/runner'
export { createChainable } from '@vitest/runner/utils'
export { getBenchFn, getBenchOptions } from './runtime/benchmark'
export { getBenchFn, getBenchOptions } from '../runtime/benchmark'
10 changes: 10 additions & 0 deletions packages/vitest/src/public/workers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export {
createForksRpcOptions,
createThreadsRpcOptions,
unwrapSerializableConfig,
} from '../runtime/workers/utils'
export { provideWorkerState } from '../runtime/utils'
export { run as runVitestWorker, collect as collectVitestWorkerTests } from '../runtime/worker'
export { runVmTests } from '../runtime/workers/vm'
export { runBaseTests } from '../runtime/workers/base'
export type { WorkerRpcOptions, VitestWorker } from '../runtime/workers/types'
2 changes: 0 additions & 2 deletions packages/vitest/src/runners.ts

This file was deleted.

10 changes: 0 additions & 10 deletions packages/vitest/src/workers.ts

This file was deleted.

8 changes: 4 additions & 4 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
"vitest/globals": ["./packages/vitest/globals.d.ts"],
"vitest/node": ["./packages/vitest/src/public/node.ts"],
"vitest/execute": ["./packages/vitest/src/public/execute.ts"],
"vitest/config": ["./packages/vitest/src/config.ts"],
"vitest/coverage": ["./packages/vitest/src/coverage.ts"],
"vitest/browser": ["./packages/vitest/src/browser.ts"],
"vitest/runners": ["./packages/vitest/src/runners.ts"],
"vitest/config": ["./packages/vitest/src/public/config.ts"],
"vitest/coverage": ["./packages/vitest/src/public/coverage.ts"],
"vitest/browser": ["./packages/vitest/src/public/browser.ts"],
"vitest/runners": ["./packages/vitest/src/public/runners.ts"],
"vite-node": ["./packages/vite-node/src/index.ts"],
"vite-node/client": ["./packages/vite-node/src/client.ts"],
"vite-node/server": ["./packages/vite-node/src/server.ts"],
Expand Down

0 comments on commit b76a927

Please sign in to comment.