Skip to content

Commit

Permalink
Switch to vitest
Browse files Browse the repository at this point in the history
  • Loading branch information
fregante committed May 31, 2024
1 parent d4941d8 commit ffce1a5
Show file tree
Hide file tree
Showing 5 changed files with 680 additions and 160 deletions.
4 changes: 2 additions & 2 deletions collector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
export const testableUrls = new Map<string, string[]>();

export function addTests(test: string, urls: string[]): void {
// eslint-disable-next-line n/prefer-global/process -- Better not import `process` to avoid bundling its polyfills by mistake
if (process.env.NODE_ENV !== 'bundling') {
// @ts-expect-error Vitest-only ENV
if (!import.meta.vitest) {
testableUrls.set(test, urls);
}
}
Expand Down
3 changes: 1 addition & 2 deletions index.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/// <reference types="bun-types" />
/// <reference lib="dom" />
import assert from 'node:assert/strict';
import {test} from 'bun:test';
import {test} from 'vitest';
import stripIndent from 'strip-indent';
import {getAllUrls, getTests} from './collector.js';
import * as pageDetect from './index.js';
Expand Down
1 change: 1 addition & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {addTests} from './collector.js';
const $ = <E extends Element>(selector: string) => document.querySelector<E>(selector);
const exists = (selector: string) => Boolean($(selector));

console.log('Running tests for page-detect');
const combinedTestOnly = ['combinedTestOnly']; // To be used only to skip tests of combined functions, i.e. isPageA() || isPageB()

addTests('__urls_that_dont_match__', [
Expand Down
Loading

0 comments on commit ffce1a5

Please sign in to comment.