Skip to content

Commit 9b835d8

Browse files
committed
wip: migrate tests to vitest
1 parent 9b66843 commit 9b835d8

File tree

159 files changed

+1796
-2210
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+1796
-2210
lines changed

.github/workflows/wac/utils/listPackagesWithJestTests.ts

Lines changed: 68 additions & 68 deletions
Large diffs are not rendered by default.

.prettierignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
.verdaccio/
44
**/build/
55
**/dist/
6-
**/*.d.ts
76
**/.out/
87
**/.pulumi/
98
.webiny/**

jest-es-config.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

jest.config.base.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// TO BE DELETED!
12
import { basename, join, dirname } from "path";
23
import fs from "fs";
34
import merge from "deepmerge";
@@ -7,7 +8,7 @@ import { createJsWithTsEsmPreset } from "ts-jest";
78
export default async ({ path }, presets = []) => {
89
const name = basename(path);
910

10-
const { PackageJson } = await import("@webiny/cli/utils/PackageJson.js");
11+
const { PackageJson } = await import("@webiny/project-utils/utils/PackageJson.js");
1112
const cliPackage = await PackageJson.fromPackage("@webiny/cli");
1213
const version = cliPackage.getJson().version;
1314

jest.config.base.setup.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// TO BE DELETED!
12
import { jest } from "@jest/globals";
23

34
// The `jest.config.base.setup.js` file is run by Jest before running the actual test suite.

package.json

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,8 @@
5454
"@commitlint/cli": "^11.0.0",
5555
"@commitlint/config-conventional": "^11.0.0",
5656
"@grpc/grpc-js": "^1.11.1",
57-
"@jest/globals": "^29.7.0",
5857
"@octokit/rest": "^20.0.2",
5958
"@types/fs-extra": "^11.0.4",
60-
"@types/jest": "^29.5.14",
6159
"@types/node": "^20.17.10",
6260
"@types/prettier": "^2.7.3",
6361
"@types/react": "18.2.79",
@@ -66,7 +64,6 @@
6664
"@typescript-eslint/parser": "^6.21.0",
6765
"adio": "^2.0.1",
6866
"axios": "^1.8.2",
69-
"babel-jest": "29.7.0",
7067
"babel-loader": "^9.2.1",
7168
"babel-plugin-dynamic-import-node": "2.3.3",
7269
"babel-plugin-macros": "3.1.0",
@@ -81,13 +78,13 @@
8178
"eslint-config-standard": "^16.0.3",
8279
"eslint-import-resolver-babel-module": "^5.3.2",
8380
"eslint-plugin-import": "^2.27.5",
84-
"eslint-plugin-jest": "^25.7.0",
8581
"eslint-plugin-lodash": "^7.4.0",
8682
"eslint-plugin-node": "^11.1.0",
8783
"eslint-plugin-promise": "^5.2.0",
8884
"eslint-plugin-react": "^7.32.2",
8985
"eslint-plugin-standard": "^5.0.0",
9086
"execa": "^5.1.1",
87+
"fast-glob": "^3.3.3",
9188
"folder-hash": "^4.0.4",
9289
"fs-extra": "^11.2.0",
9390
"get-stream": "^3.0.0",
@@ -101,9 +98,7 @@
10198
"inquirer-autocomplete-prompt": "^1.0.1",
10299
"inquirer-checkbox-plus-prompt": "^1.0.1",
103100
"inquirer-maxlength-input-prompt": "^1.0.0",
104-
"jest": "^30.0.0-rc.1",
105-
"jest-environment-jsdom": "^30.0.0-rc.1",
106-
"jest-extended": "^4.0.2",
101+
"jest-extended": "^6.0.0",
107102
"lerna": "8.1.2",
108103
"lint-staged": "^15.3.0",
109104
"listr": "^0.14.3",
@@ -118,13 +113,12 @@
118113
"prettier": "^2.8.8",
119114
"semver": "^7.6.3",
120115
"ts-expect": "^1.3.0",
121-
"ts-jest": "^29.2.5",
122-
"ts-jest-resolver": "^2.0.1",
123116
"tsx": "^4.16.2",
124117
"type-fest": "4.14.0",
125118
"typescript": "5.3.3",
126119
"typescript-transform-paths": "^3.5.3",
127120
"verdaccio": "^6.0.5",
121+
"vitest": "^3.2.4",
128122
"write-json-file": "^4.3.0",
129123
"yargs": "^17.7.2"
130124
},
@@ -172,7 +166,7 @@
172166
"setup-project": "node scripts/setupProject",
173167
"setup-env-files": "node scripts/setupEnvFiles",
174168
"setup-cypress": "node scripts/setupCypress",
175-
"test": "NODE_OPTIONS=\"--experimental-vm-modules --max_old_space_size=4096\" jest --runInBand --logHeapUsage --config jest.config.js",
169+
"test": "vitest --config testing/vitest.config.ts --run",
176170
"test:unit": "cross-env TEST_TYPE=unit yarn test",
177171
"test:integration": "cross-env TEST_TYPE=integration yarn test",
178172
"test:e2e": "cross-env TEST_TYPE=e2e yarn test",

packages/api-file-manager-s3/jest.config.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

packages/api-file-manager-s3/src/utils/FileKey.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, it, expect } from "vitest";
12
import { FileKey } from "./FileKey.js";
23

34
describe("FileKey", () => {
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { createTestConfig } from "../../testing";
2+
3+
export default async () => {
4+
return createTestConfig({
5+
path: import.meta.dirname,
6+
vitestConfig: {
7+
fileParallelism: true
8+
}
9+
});
10+
};

packages/api-i18n/__tests__/getI18NInformation.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, test, expect } from "vitest";
12
import useGqlHandler from "./useGqlHandler";
23

34
describe("getI18NInformation Test", () => {
@@ -47,7 +48,7 @@ describe("getI18NInformation Test", () => {
4748
}
4849
});
4950

50-
[response] = await getI18NInformation(null, {
51+
[response] = await getI18NInformation({}, {
5152
headers: {
5253
"accept-language": "en-GB,en;q=0.9,hr-HR;q=0.8,hr;q=0.7,en-US;q=0.6"
5354
}
@@ -73,7 +74,7 @@ describe("getI18NInformation Test", () => {
7374
});
7475

7576
// We are also testing "not-all-lower-case" scenario.
76-
[response] = await getI18NInformation(null, {
77+
[response] = await getI18NInformation({}, {
7778
headers: {
7879
"Accept-Language": "en-GB,en;q=0.9,hr-HR;q=0.8,hr;q=0.7,en-US;q=0.6",
7980
"X-I18N-LOCALE": "default:en-US;content:en-GB"
@@ -99,7 +100,7 @@ describe("getI18NInformation Test", () => {
99100
}
100101
});
101102

102-
[response] = await getI18NInformation(null, {
103+
[response] = await getI18NInformation({}, {
103104
headers: {
104105
"accept-language": "en-GB,en;q=0.9,hr-HR;q=0.8,hr;q=0.7,en-US;q=0.6",
105106
"x-i18n-locale": "default:it-IT;content:ru"

0 commit comments

Comments
 (0)