Skip to content

Commit ca28051

Browse files
committed
Move to the Vitest testing framework
Just like esbuild, Vitest supports TypeScript out of the box, which means we can completely get rid of ts-node
1 parent bd8cfe4 commit ca28051

File tree

3 files changed

+678
-270
lines changed

3 files changed

+678
-270
lines changed

package.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"build": "esbuild src/index.ts --minify --bundle --platform=node --packages=external --outfile=build/index.js",
1212
"prestart": "npm run build",
1313
"start": "node build/index.js",
14-
"test": "mocha -r ts-node/register tests/**/*.test.ts"
14+
"test": "vitest"
1515
},
1616
"nodemonConfig": {
1717
"watch": [
@@ -37,20 +37,16 @@
3737
"homepage": "https://github.com/SerenityOS/discord-bot#readme",
3838
"devDependencies": {
3939
"@octokit/types": "^9.1.2",
40-
"@types/chai": "^4.3.4",
41-
"@types/mocha": "^10.0.1",
4240
"@typescript-eslint/eslint-plugin": "^5.59.9",
4341
"@typescript-eslint/parser": "^5.59.1",
44-
"chai": "^4.3.7",
4542
"esbuild": "^0.21.2",
4643
"eslint": "^8.39.0",
4744
"eslint-config-prettier": "^8.8.0",
4845
"eslint-plugin-prettier": "^4.2.1",
4946
"eslint-plugin-unused-imports": "^2.0.0",
50-
"mocha": "^10.2.0",
5147
"nodemon": "^2.0.22",
5248
"prettier": "^2.8.8",
53-
"ts-node": "^10.9.1"
49+
"vitest": "^1.6.0"
5450
},
5551
"dependencies": {
5652
"@octokit/plugin-throttling": "^5.1.1",

tests/githubAPI.test.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1-
import { assert, expect } from "chai";
1+
import { describe, expect, it, assert } from "vitest";
22
import githubAPI, { SERENITY_REPOSITORY } from "../src/apis/githubAPI";
33

44
import { GITHUB_TOKEN } from "../src/config/secrets";
55
import config from "../src/config/botConfig";
66

77
describe("githubApi", function () {
8-
// Disable the test timeout for our async tests.
9-
this.timeout(0);
10-
11-
it("Should be able to create quote PRs", async function () {
8+
it("Should be able to create quote PRs", async function (context) {
129
// This test only exists to ease debugging of the openFortunesPullRequest
1310
// github API when attempting to reproduce a bug. Skip it by default.
14-
this.skip();
11+
context.skip();
1512

1613
// The test if the environment is configured for serenity, or
1714
// if we don't have a github API token setup.

0 commit comments

Comments
 (0)