Migrate to Vitest (#483)

* Migrate to Vitest

* `skipLibCheck` for now
This commit is contained in:
Mateusz Burzyński
2025-05-11 20:59:28 +02:00
committed by GitHub
parent cf373e45c9
commit e82f42c2cc
9 changed files with 437 additions and 2401 deletions
-6
View File
@@ -1,6 +0,0 @@
{
"presets": [
["@babel/preset-env", { "targets": { "node": 10 } }],
"@babel/preset-typescript"
]
}
+5 -1
View File
@@ -1,6 +1,10 @@
name: Node CI
on: [pull_request]
on:
push:
branches:
- main
pull_request:
jobs:
build:
+3 -8
View File
@@ -4,27 +4,22 @@
"main": "dist/index.js",
"license": "MIT",
"devDependencies": {
"@babel/core": "^7.13.10",
"@babel/preset-env": "^7.13.10",
"@babel/preset-typescript": "^7.13.0",
"@changesets/changelog-github": "^0.4.2",
"@changesets/cli": "^2.20.0",
"@changesets/write": "^0.1.6",
"@types/fs-extra": "^8.0.0",
"@types/jest": "^29.5.1",
"@types/node": "^22.15.17",
"@types/semver": "^7.5.0",
"babel-jest": "^29.5.0",
"esbuild": "^0.25.4",
"fixturez": "^1.1.0",
"husky": "^3.0.3",
"jest": "^29.5.0",
"prettier": "^2.0.5",
"typescript": "^5.8.3"
"typescript": "^5.8.3",
"vitest": "^3.1.3"
},
"scripts": {
"build": "esbuild src/index.ts --bundle --platform=node --target=node20 --minify --outfile=dist/index.js",
"test": "jest",
"test": "vitest",
"test:watch": "yarn test --watch",
"typecheck": "tsc",
"changeset": "changeset",
+6 -6
View File
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`version creates simple PR 1`] = `
exports[`version > creates simple PR 1`] = `
[
{
"base": "some-branch",
@@ -33,7 +33,7 @@ exports[`version creates simple PR 1`] = `
]
`;
exports[`version does not include any release information if a message with simplified release info exceeds size limit 1`] = `
exports[`version > does not include any release information if a message with simplified release info exceeds size limit 1`] = `
[
{
"base": "some-branch",
@@ -51,7 +51,7 @@ exports[`version does not include any release information if a message with simp
]
`;
exports[`version does not include changelog entries if full message exceeds size limit 1`] = `
exports[`version > does not include changelog entries if full message exceeds size limit 1`] = `
[
{
"base": "some-branch",
@@ -73,7 +73,7 @@ exports[`version does not include changelog entries if full message exceeds size
]
`;
exports[`version doesn't include ignored package that got a dependency update in the PR body 1`] = `
exports[`version > doesn't include ignored package that got a dependency update in the PR body 1`] = `
[
{
"base": "some-branch",
@@ -95,7 +95,7 @@ exports[`version doesn't include ignored package that got a dependency update in
]
`;
exports[`version only includes bumped packages in the PR body 1`] = `
exports[`version > only includes bumped packages in the PR body 1`] = `
[
{
"base": "some-branch",
+1 -1
View File
@@ -1,4 +1,4 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`it sorts the things right 1`] = `
[
+8 -7
View File
@@ -3,11 +3,12 @@ import writeChangeset from "@changesets/write";
import fixturez from "fixturez";
import fs from "fs-extra";
import path from "path";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { Git } from "./git";
import { setupOctokit } from "./octokit";
import { runVersion } from "./run";
jest.mock("@actions/github", () => ({
vi.mock("@actions/github", () => ({
context: {
repo: {
owner: "changesets",
@@ -20,16 +21,16 @@ jest.mock("@actions/github", () => ({
rest: mockedGithubMethods,
}),
}));
jest.mock("./git");
jest.mock("@changesets/ghcommit/git");
vi.mock("./git");
vi.mock("@changesets/ghcommit/git");
let mockedGithubMethods = {
pulls: {
create: jest.fn(),
list: jest.fn(),
create: vi.fn(),
list: vi.fn(),
},
repos: {
createRelease: jest.fn(),
createRelease: vi.fn(),
},
};
@@ -46,7 +47,7 @@ const writeChangesets = (changesets: Changeset[], cwd: string) => {
};
beforeEach(() => {
jest.clearAllMocks();
vi.clearAllMocks();
});
describe("version", () => {
+2 -1
View File
@@ -1,4 +1,5 @@
import { getChangelogEntry, BumpLevels, sortTheThings } from "./utils";
import { expect, test } from "vitest";
import { BumpLevels, getChangelogEntry, sortTheThings } from "./utils";
let changelog = `# @keystone-alpha/email
+2 -1
View File
@@ -6,6 +6,7 @@
"isolatedModules": true,
"strict": true,
"moduleResolution": "node16",
"erasableSyntaxOnly": true
"erasableSyntaxOnly": true,
"skipLibCheck": true
}
}
+410 -2370
View File
File diff suppressed because it is too large Load Diff