mirror of
https://github.com/goauthentik/authentik.git
synced 2026-08-30 18:51:39 -07:00
web: Allow the vite oxc transform to compile co-located unit tests. (#23991)
web: Allow oxc to transform co-located unit tests. Vite 8's vite:oxc plugin does per-file tsconfig discovery and refuses to transform src/**/*.unit.test.ts because the root tsconfig.json excludes src/**/*.test.ts. Disable tsconfig discovery for the Node "Unit Tests" project so oxc transforms those files, leaving tsconfig.json's excludes and tsgo -p . untouched.
This commit is contained in:
@@ -40,6 +40,17 @@ export default defineConfig({
|
||||
],
|
||||
projects: [
|
||||
{
|
||||
// The root `tsconfig.json` excludes `src/**/*.test.ts`, so `vite:oxc`'s
|
||||
// per-file tsconfig discovery bails with `[TSCONFIG_ERROR] Tsconfig not
|
||||
// found` on co-located `src/**/*.unit.test.ts`. Disabling tsconfig
|
||||
// discovery for this Node project lets oxc transform those files while
|
||||
// leaving `lint:types` (`tsgo -p .`) and the root excludes untouched.
|
||||
// `tsconfig` is forwarded to oxc's transform at runtime but is omitted
|
||||
// from vite's `OxcOptions` type, so the assertion adds it back to keep
|
||||
// `tsgo -p .` clean.
|
||||
oxc: /** @type {import("vite").OxcOptions & { tsconfig: false }} */ ({
|
||||
tsconfig: false,
|
||||
}),
|
||||
test: {
|
||||
include: ["./test/unit/**/*.{test,spec}.ts", "**/*.unit.{test,spec}.ts"],
|
||||
name: "Unit Tests",
|
||||
|
||||
Reference in New Issue
Block a user