Skip to content

Commit 0a43bc0

Browse files
fix(mobile): normalize compiler test source paths
1 parent 414b226 commit 0a43bc0

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎apps/mobile/vite.config.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as NodeModule from "node:module";
2-
import { defineConfig } from "vite-plus";
2+
import * as NodeURL from "node:url";
3+
import { defineConfig, normalizePath } from "vite-plus";
34
import "vite-plus/test/config";
45

56
const reactTests = [
@@ -19,6 +20,7 @@ const reactTests = [
1920
"src/state/use-selected-thread-git-actions.test.tsx",
2021
];
2122

23+
const sourceRoot = `${normalizePath(NodeURL.fileURLToPath(new URL("./src", import.meta.url)))}/`;
2224
const require = NodeModule.createRequire(import.meta.url);
2325
const babel: {
2426
transformAsync: (
@@ -53,7 +55,7 @@ export default defineConfig({
5355
enforce: "pre",
5456
async transform(code, id) {
5557
if (
56-
!id.startsWith(new URL("./src/", import.meta.url).pathname) ||
58+
!normalizePath(id).startsWith(sourceRoot) ||
5759
!/\.tsx?$/.test(id) ||
5860
/\.test\.tsx?$/.test(id)
5961
) {

0 commit comments

Comments
 (0)