Skip to content

Commit 4de3b6f

Browse files
committed
Use vitest instead of bun:test in remix app
1 parent e1333a9 commit 4de3b6f

10 files changed

+26
-20
lines changed

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@ node_modules
33
/.cache
44
/build
55
.env
6-
.env.local
6+
.env.local
7+
8+
# tests results
9+
coverage

app/components/markdown/Markdown.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { render, screen } from '@testing-library/react';
2-
import { expect, test } from 'bun:test';
2+
import { expect, test } from 'vitest';
33
import { CustomMarkdown } from './Markdown';
44

55
test('Renders basic markdown', () => {

bun.lockb

-1.49 KB
Binary file not shown.

bunfig.toml

-2
This file was deleted.

happydom.ts

-3
This file was deleted.

matchers.d.ts

-8
This file was deleted.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint .",
1010
"start": "remix-serve ./build/server/index.js",
1111
"typecheck": "tsc",
12-
"test": "bun test"
12+
"test": "vitest",
13+
"test:ci": "vitest --coverage --run"
1314
},
1415
"dependencies": {
1516
"@headlessui/react": "^2.1.8",
@@ -39,7 +40,6 @@
3940
"turndown": "^7.2.0"
4041
},
4142
"devDependencies": {
42-
"@happy-dom/global-registrator": "^15.7.4",
4343
"@remix-run/dev": "^2.12.1",
4444
"@tailwindcss/typography": "^0.5.15",
4545
"@testing-library/dom": "^10.4.0",

testing-library.ts test/setup.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import * as matchers from '@testing-library/jest-dom/matchers';
22
import { cleanup } from '@testing-library/react';
3-
import { afterEach, expect } from 'bun:test';
3+
import { afterEach, expect } from 'vitest';
44

55
expect.extend(matchers);
66

7-
// Optional: cleans up `render` after each test
87
afterEach(() => {
98
cleanup();
109
});

tsconfig.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,14 @@
99
],
1010
"compilerOptions": {
1111
"lib": ["DOM", "DOM.Iterable", "ES2022"],
12-
"types": ["@remix-run/node", "vite/client", "@webgpu/types", "@types/bun"],
12+
"types": [
13+
"@remix-run/node",
14+
"vite/client",
15+
"@webgpu/types",
16+
"@types/bun",
17+
"vitest/globals",
18+
"@testing-library/jest-dom"
19+
],
1320
"isolatedModules": true,
1421
"esModuleInterop": true,
1522
"jsx": "react-jsx",

vitest.config.ts

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/// <reference types="vitest" />
2+
import { defineConfig } from 'vite';
3+
4+
export default defineConfig({
5+
test: {
6+
globals: true,
7+
environment: 'happy-dom',
8+
setupFiles: './test/setup.ts',
9+
},
10+
});

0 commit comments

Comments
 (0)