Skip to content

Commit f6354bc

Browse files
committed
chore: use vitest until fetch can be mocked with bun etc.
1 parent b5d477a commit f6354bc

File tree

8 files changed

+15
-6
lines changed

8 files changed

+15
-6
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ jobs:
4141
run: bun install --frozen-lockfile
4242

4343
- name: Test
44-
run: bun test --coverage
44+
run: bun run test:cov

bun.lockb

21.8 KB
Binary file not shown.

package.json

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
"format": "prettier . --check",
2020
"format:fix": "npm run format -- --write",
2121
"test": "vitest run",
22+
"test:watch": "vitest",
23+
"test:cov": "vitest run --coverage",
2224
"dev": "run-p -rl vite:watch serve:firefox",
2325
"vite:site": "vite",
2426
"vite:watch": "vite build --watch --mode development --minify false",
@@ -32,13 +34,15 @@
3234
"@types/leaflet": "^1.9.12",
3335
"@types/leaflet-fullscreen": "^1.0.9",
3436
"@types/webextension-polyfill": "^0.10.7",
37+
"@vitest/coverage-v8": "^1.6.0",
3538
"npm-run-all": "^4.1.5",
3639
"prettier": "^3.3.2",
3740
"release-it": "^17.4.0",
3841
"release-it-changelogen": "^0.1.0",
3942
"typescript": "^5.5.2",
4043
"vite": "^5.3.1",
4144
"vite-plugin-static-copy": "^1.0.5",
45+
"vitest": "^1.6.0",
4246
"web-ext": "^8.2.0",
4347
"webextension-polyfill": "^0.12.0"
4448
},

test/map/utils/parseDMS.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it, expect } from 'bun:test'
1+
import { describe, it, expect } from 'vitest'
22
import { parseDMS } from '../../../src/map/utils/parseDMS'
33

44
describe('Parse Degrees Minutes Seconds Direction', () => {

test/map/utils/parsePB.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it, expect } from 'bun:test'
1+
import { describe, it, expect } from 'vitest'
22
import { parsePB, tileTypes } from '../../../src/map/utils/parsePB'
33

44
describe('Parse PB', () => {

test/map/utils/read.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { describe, it, expect, jest } from 'bun:test'
1+
import { describe, it, expect, vitest } from 'vitest'
22
import { readPB, readQ, nominatimQ } from '../../../src/map/utils/read'
33

4-
globalThis.fetch = jest.fn()
4+
globalThis.fetch = vitest.fn()
55

66
const input = 'test position'
77
const result = [{ lat: '1.1', lon: '1.1' }]

test/map/utils/zoom.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it, expect } from 'bun:test'
1+
import { describe, it, expect } from 'vitest'
22
import { getMapZoom } from '../../../src/map/utils/zoom'
33

44
describe('Zoom levels', () => {

vite.config.ts

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/// <reference types="vitest" />
2+
13
import { defineConfig, normalizePath } from 'vite'
24
import { viteStaticCopy } from 'vite-plugin-static-copy'
35
import { resolve } from 'path'
@@ -51,4 +53,7 @@ export default defineConfig({
5153
drop: ['debugger'],
5254
pure: ['console.log', 'console.warn', 'console.error', 'console.debug', 'console.trace'],
5355
},
56+
test: {
57+
root: '.',
58+
},
5459
})

0 commit comments

Comments
 (0)