Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

Commit

Permalink
feat: use vitest
Browse files Browse the repository at this point in the history
  • Loading branch information
technote-space committed Jun 20, 2022
1 parent cedd5ed commit 65c47fb
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 1,204 deletions.
1 change: 1 addition & 0 deletions __tests__/process.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable no-magic-numbers */
import { describe, it } from 'vitest';
import path from 'path';
import {
testEnv,
Expand Down
1 change: 1 addition & 0 deletions __tests__/utils/command.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable no-magic-numbers */
import { describe, expect, it } from 'vitest';
import nock from 'nock';
import path, {resolve, join} from 'path';
import {
Expand Down
12 changes: 0 additions & 12 deletions jest.config.js

This file was deleted.

3 changes: 0 additions & 3 deletions jest.setup.ts

This file was deleted.

10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
],
"scripts": {
"build": "tsc && yarn ncc build lib/main.js && rm -rf lib",
"cover": "jest --coverage",
"cover": "vitest run --coverage",
"postinstall": "[ -n \"$CI\" ] || [ ! -f node_modules/.bin/husky ] || husky install",
"lint": "eslint 'src/**/*.ts' '__tests__/**/*.ts' --cache",
"lint:fix": "eslint --fix 'src/**/*.ts' '__tests__/**/*.ts'",
Expand All @@ -50,20 +50,18 @@
"@commitlint/config-conventional": "^17.0.2",
"@technote-space/github-action-test-helper": "^0.9.7",
"@technote-space/release-github-actions-cli": "^1.9.0",
"@types/jest": "^28.1.2",
"@types/node": "^18.0.0",
"@typescript-eslint/eslint-plugin": "^5.28.0",
"@typescript-eslint/parser": "^5.28.0",
"@vercel/ncc": "^0.34.0",
"c8": "^7.11.3",
"eslint": "^8.18.0",
"husky": "^8.0.1",
"jest": "^28.1.1",
"jest-circus": "^28.1.1",
"lint-staged": "^13.0.2",
"nock": "^13.2.7",
"pinst": "^3.0.0",
"ts-jest": "^28.0.5",
"typescript": "^4.7.4"
"typescript": "^4.7.4",
"vitest": "^0.15.1"
},
"publishConfig": {
"access": "public"
Expand Down
3 changes: 3 additions & 0 deletions src/setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { setupGlobal } from '@technote-space/github-action-test-helper';

setupGlobal();
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@
"exclude": [
"node_modules",
"__tests__",
"jest.setup.ts"
"vite.config.ts"
]
}
18 changes: 18 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/// <reference types="vitest" />
import { defineConfig } from 'vite';

// https://vitejs.dev/config/
export default defineConfig({
test: {
setupFiles: './src/setup.ts',
clearMocks: true,
mockReset: true,
restoreMocks: true,
coverage: {
reporter: ['html', 'lcov', 'text'],
},
deps: {
inline: [/github-action-test-helper/, /github-action-helper/]
},
},
});
Loading

0 comments on commit 65c47fb

Please sign in to comment.