Skip to content

Commit 2e5df75

Browse files
authored
fix(vitest): remove broken "./src/*" export from package.json (#10918)
1 parent 3b5bbd8 commit 2e5df75

7 files changed

Lines changed: 27 additions & 12 deletions

File tree

knip.jsonc

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
"unresolved",
2424
"exports"
2525
],
26+
// The "./src/*" package export used to make every src file a public entry
27+
// point, hiding dead code from Knip. TODO(follow-up) Clean these up and drop the ignore.
28+
"packages/vitest/src/**": ["files", "exports", "types"],
2629
"packages/vitest/src/integrations/vi.ts": ["duplicates"],
2730
"packages/vitest/src/runtime/runner/suite.ts": ["duplicates"]
2831
},
@@ -92,7 +95,20 @@
9295
]
9396
},
9497
"packages/vitest": {
95-
"entry": ["*.{cjs,d.cts,d.ts,mjs}"],
98+
// Keep src entries in sync with rollup.config.js: Knip does not read
99+
// rollup configs here (the rollup plugin is not enabled per-workspace),
100+
// and package.json exports only point to dist.
101+
"entry": [
102+
"*.{cjs,d.cts,d.ts,mjs}",
103+
"src/paths.ts",
104+
"src/public/*.ts",
105+
"src/node/cli.ts",
106+
"src/integrations/spy.ts",
107+
"src/runtime/nodejsWorkerLoader.ts",
108+
"src/runtime/runVmTests.ts",
109+
"src/runtime/workers/*.ts",
110+
"src/utils/tasks.ts"
111+
],
96112
"ignoreDependencies": [
97113
// Dynamically imported providers remain optional for Vitest users.
98114
"@vitest/browser-playwright",

packages/vitest/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
"./optional-runtime-types.js": {
5353
"types": "./optional-runtime-types.d.ts"
5454
},
55-
"./src/*": "./src/*",
5655
"./globals": {
5756
"types": "./globals.d.ts"
5857
},

test/e2e/test/reporters/merge-reports.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { RunnerTestFile as File, RunnerTestCase as Test } from 'vitest'
22
import type { TestUserConfig, Vitest } from 'vitest/node'
3-
import type { MergeReport } from 'vitest/src/node/reporters/blob.js'
43
import type { RunVitestConfig } from '#test-utils'
4+
import type { MergeReport } from '../../../../packages/vitest/src/node/reporters/blob.js'
55
import { cpSync, existsSync, readdirSync, readFileSync, rmSync } from 'node:fs'
66
import { mkdir, writeFile } from 'node:fs/promises'
77
import path from 'node:path'
@@ -10,8 +10,8 @@ import { stringify } from 'flatted'
1010
import { dirname, resolve } from 'pathe'
1111
import { beforeEach, expect, test, TestRunner } from 'vitest'
1212
import { version } from 'vitest/package.json'
13-
import { getModuleGraph } from 'vitest/src/utils/graph.js'
1413
import { buildTestTree, runVitest, useFS, useTmpFS } from '#test-utils'
14+
import { getModuleGraph } from '../../../../packages/vitest/src/utils/graph.js'
1515

1616
// always relative to CWD because it's used only from the CLI,
1717
// so we need to correctly resolve it here

test/e2e/test/reporters/utils.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import type { ModuleGraph, ViteDevServer } from 'vite'
22
import type { RunnerTestCase, RunnerTestSuite, TestError } from 'vitest'
3-
import type { Vitest } from 'vitest/src/node/core.js'
4-
import type { Logger } from 'vitest/src/node/logger.js'
5-
import type { StateManager } from 'vitest/src/node/state.js'
6-
import type { ResolvedConfig } from 'vitest/src/node/types/config.js'
7-
import type { RunnerTestFile } from 'vitest/src/public/index.js'
3+
import type { Vitest } from '../../../../packages/vitest/src/node/core.js'
4+
import type { Logger } from '../../../../packages/vitest/src/node/logger.js'
5+
import type { StateManager } from '../../../../packages/vitest/src/node/state.js'
6+
import type { ResolvedConfig } from '../../../../packages/vitest/src/node/types/config.js'
7+
import type { RunnerTestFile } from '../../../../packages/vitest/src/public/index.js'
88
import { TestRunner } from 'vitest'
99

1010
export function trimReporterOutput(report: string) {

test/e2e/test/workers-option.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describe, expect, test, vi } from 'vitest'
2-
import { getWorkersCountByPercentage } from 'vitest/src/utils/workers.js'
32
import * as testUtils from '#test-utils'
3+
import { getWorkersCountByPercentage } from '../../../packages/vitest/src/utils/workers.js'
44

55
vi.mock(import('node:os'), async importOriginal => ({
66
...(await importOriginal()),

test/unit/test/memory-limit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it } from 'vitest'
2-
import { getWorkerMemoryLimit } from 'vitest/src/utils/memory-limit.js'
2+
import { getWorkerMemoryLimit } from '../../../packages/vitest/src/utils/memory-limit.js'
33

44
describe('getWorkerMemoryLimit', () => {
55
it('should prioritize vmMemoryLimit', () => {

test/unit/test/vm-code-cache.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect, test, vi } from 'vitest'
2-
import { CodeCache } from 'vitest/src/runtime/vm/code-cache.js'
2+
import { CodeCache } from '../../../packages/vitest/src/runtime/vm/code-cache.js'
33

44
test('returns the stored data only for the exact same source', () => {
55
const cache = new CodeCache()

0 commit comments

Comments
 (0)
Sponsor
SponsoredKunjungi sekarang
Promo