Skip to content

Commit 49f20bb

Browse files
authored
chore: run typecheck in unit tests (#18858)
1 parent b39e696 commit 49f20bb

File tree

7 files changed

+14
-13
lines changed

7 files changed

+14
-13
lines changed

packages/vite/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"build": "premove dist && pnpm build-bundle && pnpm build-types",
7676
"build-bundle": "rollup --config rollup.config.ts --configPlugin esbuild",
7777
"build-types": "pnpm build-types-temp && pnpm build-types-roll && pnpm build-types-check",
78-
"build-types-temp": "tsc --emitDeclarationOnly --outDir temp -p src/node",
78+
"build-types-temp": "tsc --emitDeclarationOnly --outDir temp -p src/node/tsconfig.build.json",
7979
"build-types-roll": "rollup --config rollup.dts.config.ts --configPlugin esbuild && premove temp",
8080
"build-types-check": "tsc --project tsconfig.check.json",
8181
"typecheck": "tsc --noEmit && tsc --noEmit -p src/node",

packages/vite/src/node/__tests__/config.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import http from 'node:http'
22
import { describe, expect, test } from 'vitest'
3-
import type { InlineConfig } from '..'
4-
import type { PluginOption, UserConfig, UserConfigExport } from '../config'
3+
import type { InlineConfig, PluginOption } from '..'
4+
import type { UserConfig, UserConfigExport } from '../config'
55
import { defineConfig, resolveConfig } from '../config'
66
import { resolveEnvPrefix } from '../env'
77
import { createLogger, mergeConfig } from '../publicUtils'

packages/vite/src/node/__tests__/plugins/json.spec.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ test('can extract json error position', () => {
3030
})
3131

3232
describe('transform', () => {
33-
const transform = (input: string, opts: JsonOptions, isBuild: boolean) => {
33+
const transform = (
34+
input: string,
35+
opts: Required<JsonOptions>,
36+
isBuild: boolean,
37+
) => {
3438
const plugin = jsonPlugin(opts, isBuild)
3539
return (plugin.transform! as Function)(input, 'test.json').code
3640
}

packages/vite/src/node/__tests__/tsconfig.json

-8
This file was deleted.

packages/vite/src/node/ssr/runtime/__tests__/utils.ts

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export async function createModuleRunnerTester(
3232
}
3333

3434
beforeEach<TestClient>(async (t) => {
35+
// @ts-ignore
3536
globalThis.__HMR__ = {}
3637

3738
t.server = await createServer({
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"exclude": ["**/__tests__"]
4+
}

packages/vite/src/node/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"extends": "../../tsconfig.base.json",
33
"include": ["./", "../module-runner", "../types"],
4-
"exclude": ["../**/__tests__"],
4+
"exclude": ["**/fixtures"],
55
"compilerOptions": {
66
// https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping#node-18
77
"lib": ["ES2023", "DOM"], // DOM because we have client code that gets inlined via function.toString()

0 commit comments

Comments
 (0)