Skip to content

Commit

Permalink
test(tsconfig): switch from the Node.js test runner to Vitest (#817)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusrbrown authored Dec 29, 2024
1 parent bdd2c50 commit b423275
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .changeset/late-balloons-carry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@bfra.me/tsconfig": patch
---

Switch from the Node.js test runner to Vitest.

4 changes: 1 addition & 3 deletions packages/tsconfig/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@
"tsconfig.json"
],
"scripts": {
"compile-tests": "tsc --project ./test",
"run-tests": "node --test ./test/lib/*.test.js",
"test": "pnpm compile-tests && pnpm run-tests"
"test": "vitest"
},
"devDependencies": {
"@bfra.me/tsconfig": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/tsconfig/test/config.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import assert from 'node:assert'
import path from 'node:path'
import process from 'node:process'
import {describe, it} from 'node:test'
import ts from 'typescript'
import {describe, it} from 'vitest'

const {sys, findConfigFile, readConfigFile, parseJsonConfigFileContent} = ts

Expand Down
4 changes: 2 additions & 2 deletions packages/tsconfig/test/schema.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type {Jsonify, TsConfigJson} from 'type-fest'
import assert from 'node:assert'
import {promises as fs} from 'node:fs'
import {describe, it} from 'node:test'
import Ajv, {type JSONSchemaType} from 'ajv-draft-04'
import {describe, it} from 'vitest'

const SCHEMA_URL = 'https://json.schemastore.org/tsconfig'

Expand All @@ -14,7 +14,7 @@ describe('schema', () => {
const schemaUrl = tsconfig.$schema ?? SCHEMA_URL
const response = await fetch(schemaUrl)
if (!response.ok) {
return t.skip(`Could not fetch ${SCHEMA_URL}, skipping`)
return t.skip()
}
const schema = (await response.json()) as JSONSchemaType<TsConfigJson>
const ajv = new Ajv({
Expand Down

0 comments on commit b423275

Please sign in to comment.