Skip to content

Commit 58253bf

Browse files
authored
migrate from jest to vitest (#1324)
* setup vitest * fix ci * fixes * style * remove index.mjs * fix * should be good
1 parent 7badcf6 commit 58253bf

Some content is hidden

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

54 files changed

+441
-2704
lines changed

babel.config.js

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

jest.config.js

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

package.json

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,27 @@
55
"license": "MIT",
66
"private": true,
77
"scripts": {
8-
"build": "yarn transpile-ts && bob build",
8+
"build": "pnpm transpile-ts && bob build",
99
"ci:lint": "eslint --ignore-path .gitignore --ext ts,js . --output-file eslint_report.json --format json",
1010
"create-rule": "tsx scripts/create-rule.ts",
1111
"generate:configs": "tsx scripts/generate-configs.ts",
1212
"generate:docs": "tsx scripts/generate-docs.ts",
1313
"lint": "eslint --ignore-path .gitignore --ext ts,js .",
1414
"postbuild": "cp -r README.md docs ./packages/plugin/dist/",
15+
"postinstall": "node scripts/patch-graphql.js",
1516
"prebuild": "rimraf packages/*/dist ./tsconfig.tsbuildinfo",
16-
"prerelease": "yarn build",
17+
"prerelease": "pnpm build",
1718
"prettier": "prettier --cache --write --list-different .",
1819
"release": "changeset publish",
19-
"test": "jest --no-watchman --forceExit --noStackTrace --detectOpenHandles",
20+
"test": "vitest .",
2021
"transpile-ts": "tsc --project tsconfig.json"
2122
},
2223
"devDependencies": {
23-
"@babel/core": "7.20.5",
24-
"@babel/preset-env": "7.20.2",
25-
"@babel/preset-typescript": "7.18.6",
2624
"@changesets/changelog-github": "0.4.8",
2725
"@changesets/cli": "2.26.0",
2826
"@graphql-tools/utils": "^9.0.0",
29-
"@swc/core": "1.3.23",
30-
"@swc/jest": "0.2.24",
3127
"@theguild/prettier-config": "1.0.0",
3228
"@types/dedent": "0.7.0",
33-
"@types/jest": "29.2.4",
3429
"@types/node": "18.11.17",
3530
"@typescript-eslint/eslint-plugin": "5.47.0",
3631
"@typescript-eslint/parser": "5.47.0",
@@ -47,14 +42,14 @@
4742
"eslint-plugin-promise": "6.1.1",
4843
"eslint-plugin-unicorn": "45.0.2",
4944
"husky": "8.0.2",
50-
"jest": "29.3.1",
5145
"jest-snapshot-serializer-raw": "1.2.0",
5246
"json-schema-to-markdown": "1.1.1",
5347
"lint-staged": "13.1.0",
5448
"prettier": "2.8.1",
5549
"rimraf": "3.0.2",
5650
"tsx": "^3.12.1",
57-
"typescript": "4.9.4"
51+
"typescript": "4.9.4",
52+
"vitest": "0.26.1"
5853
},
5954
"resolutions": {
6055
"graphql": "16.6.0"
@@ -69,7 +64,8 @@
6964
"patchedDependencies": {
7065
7166
72-
67+
68+
7369
}
7470
}
7571
}

packages/plugin/src/testkit.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,9 @@ export class GraphQLRuleTester extends RuleTester {
167167
messageForSnapshot.push('#### 🔧 Autofix output', indentCode(printCode(output)));
168168
}
169169
}
170+
// @ts-expect-error -- we should import `vitest` but somebody could use globals from `jest`
170171
it(name || `Invalid #${idx + 1}`, () => {
172+
// @ts-expect-error -- ^ same
171173
expect(messageForSnapshot.join('\n\n')).toMatchSnapshot();
172174
});
173175
}

packages/plugin/tests/__snapshots__/alphabetize.spec.md

Lines changed: 1 addition & 1 deletion

packages/plugin/tests/__snapshots__/description-style.spec.md

Lines changed: 1 addition & 1 deletion

packages/plugin/tests/__snapshots__/eslint-directives.spec.md

Lines changed: 1 addition & 1 deletion

packages/plugin/tests/__snapshots__/examples.spec.md

Lines changed: 10 additions & 10 deletions

packages/plugin/tests/__snapshots__/executable-definitions.spec.md

Lines changed: 1 addition & 1 deletion

packages/plugin/tests/__snapshots__/fields-on-correct-type.spec.md

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)