Skip to content

Commit d48ae89

Browse files
authored
Switch from bun test to vitest (#193)
1 parent d4941d8 commit d48ae89

6 files changed

+696
-167
lines changed

collector.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
export const testableUrls = new Map<string, string[]>();
44

55
export function addTests(test: string, urls: string[]): void {
6-
// eslint-disable-next-line n/prefer-global/process -- Better not import `process` to avoid bundling its polyfills by mistake
7-
if (process.env.NODE_ENV !== 'bundling') {
6+
if (import.meta.env.VITE_KEEP_URLS === '1') {
87
testableUrls.set(test, urls);
98
}
109
}

global.d.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
1+
/* eslint-disable @typescript-eslint/consistent-type-definitions -- Module augmentation */
2+
3+
/// <reference types="vite/client" />
4+
5+
interface ImportMetaEnv {
6+
readonly VITE_KEEP_URLS: string;
7+
}
8+
9+
interface ImportMeta {
10+
readonly env: ImportMetaEnv;
11+
}
12+
113
// Broaden types because testing against `"undefined"` is fine for our regexes
2-
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- Module augmentation
314
interface RegExp {
415
test(s: string | undefined): boolean;
516
}

index.test.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
/// <reference types="bun-types" />
21
/// <reference lib="dom" />
32
import assert from 'node:assert/strict';
4-
import {test} from 'bun:test';
3+
import {test} from 'vitest';
54
import stripIndent from 'strip-indent';
65
import {getAllUrls, getTests} from './collector.js';
76
import * as pageDetect from './index.js';

0 commit comments

Comments
 (0)