Skip to content

Commit

Permalink
Merge pull request #21 from expressots/feature/vitest
Browse files Browse the repository at this point in the history
feat: vite test env
  • Loading branch information
rsaz authored Sep 17, 2023
2 parents 5416b35 + 9a2c908 commit c87e7ac
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-env node */
module.exports = {
parser: "@typescript-eslint/parser",
parserOptions: {
Expand All @@ -15,6 +14,7 @@ module.exports = {
"node_modules/*",
"expressots.config.ts",
"commitlint.config.ts",
"vite.config.ts",
],
rules: {
"@typescript-eslint/interface-name-prefix": "off",
Expand Down
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@
"format": "prettier --write \"./src/**/*.ts\" --cache",
"lint": "eslint \"./src/**/*.ts\"",
"lint:fix": "eslint \"./src/**/*.ts\" --fix",
"release": "release-it"
"release": "release-it",
"test": "vitest run",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage"
},
"dependencies": {
"@expressots/boost-ts": "^1.1.1",
Expand Down Expand Up @@ -76,7 +79,9 @@
"release-it": "^16.1.5",
"rimraf": "^4.1.2",
"ts-node-dev": "^2.0.0",
"typescript": "^4.9.5"
"typescript": "^4.9.5",
"vite": "^4.4.9",
"vitest": "^0.34.4"
},
"release-it": {
"git": {
Expand Down
3 changes: 3 additions & 0 deletions test/test.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
it("pass", () => {
expect(true).toBe(true);
});
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"skipLibCheck": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"types": ["node"]
"types": ["node", "vitest/globals"]
},
"include": ["./src"],
"exclude": ["node_modules"]
"exclude": ["node_modules", "test/**/*.spec.ts"]
}
16 changes: 16 additions & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { defineConfig } from "vitest/config";

/**
* @see {@link https://vitejs.dev/config/}
* @see {@link https://vitest.dev/config/}
*/
export default defineConfig({
test: {
globals: true,
coverage: {
all: true,
},
// ref: https://vitest.dev/config/#testtimeout
testTimeout: 10000,
},
});

0 comments on commit c87e7ac

Please sign in to comment.