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 -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