Skip to content

Commit a7ff760

Browse files
committed
Switch from mocha to vitest
1 parent c29c960 commit a7ff760

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

.github/workflows/schema-tests.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- uses: actions/checkout@v1 # checkout repo content
2424
- uses: actions/setup-node@v4 # setup Node.js
2525
with:
26-
node-version: '14.x'
26+
node-version: '20.x'
2727
- name: Install dependencies
2828
run: npm i
2929
- name: Run tests

package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
},
1414
"license": "Apache-2.0",
1515
"scripts": {
16-
"test": "npx mocha tests/**/test.mjs"
16+
"test": "vitest --watch=false"
1717
},
1818
"readmeFilename": "README.md",
1919
"files": [
@@ -28,9 +28,8 @@
2828
},
2929
"devDependencies": {
3030
"@hyperjump/json-schema": "^1.7.2",
31-
"chai": "^4.3.1",
3231
"mdv": "^1.3.4",
33-
"mocha": "^8.3.0",
32+
"vitest": "^1.2.1",
3433
"yaml": "^2.3.4"
3534
},
3635
"keywords": [

tests/v3.1/test.mjs renamed to tests/v3.1/schema.test.mjs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { readdirSync, readFileSync } from "node:fs";
22
import YAML from "yaml";
33
import { validate, setMetaSchemaOutputFormat } from "@hyperjump/json-schema/openapi-3-1";
44
import { BASIC } from "@hyperjump/json-schema/experimental";
5-
import { expect } from "chai";
5+
import { describe, test, expect } from "vitest";
66

77

88
const parseYamlFromFile = (filePath) => {
@@ -20,7 +20,7 @@ describe("v3.1", () => {
2020
readdirSync(`./tests/v3.1/pass`, { withFileTypes: true })
2121
.filter((entry) => entry.isFile() && /\.yaml$/.test(entry.name))
2222
.forEach((entry) => {
23-
it(entry.name, () => {
23+
test(entry.name, () => {
2424
const instance = parseYamlFromFile(`./tests/v3.1/pass/${entry.name}`);
2525
const output = validateOpenApi(instance, BASIC);
2626
expect(output.valid).to.equal(true);
@@ -32,7 +32,7 @@ describe("v3.1", () => {
3232
readdirSync(`./tests/v3.1/fail`, { withFileTypes: true })
3333
.filter((entry) => entry.isFile() && /\.yaml$/.test(entry.name))
3434
.forEach((entry) => {
35-
it(entry.name, () => {
35+
test(entry.name, () => {
3636
const instance = parseYamlFromFile(`./tests/v3.1/fail/${entry.name}`);
3737
const output = validateOpenApi(instance, BASIC);
3838
expect(output.valid).to.equal(false);

0 commit comments

Comments
 (0)