Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: add cli unit tests #719

Merged
merged 10 commits into from Jul 18, 2022
16 changes: 16 additions & 0 deletions config/vitest.ts
@@ -0,0 +1,16 @@
// config/vitest.ts
// The vitest configuration file.

import { env } from 'node:process';
import { defineConfig } from 'vitest/config';

// Make sure the output of the CLI is in color, so that it matches the
// snapshots.
env.FORCE_COLOR = 2;

export default defineConfig({
test: {
// Collect coverage using C8.
coverage: { enabled: true },
},
});
12 changes: 9 additions & 3 deletions package.json
Expand Up @@ -25,7 +25,9 @@
"start": "node ./build/main.js",
"compile": "tsup ./source/main.ts",
"test:tsc": "tsc --project tsconfig.json",
"test": "pnpm test:tsc",
"test:unit": "vitest run --config config/vitest.ts",
"test:watch": "vitest watch --config config/vitest.ts",
"test": "pnpm test:tsc && pnpm test:unit",
"lint:code": "eslint --max-warnings 0 source/**/*.ts",
"lint:style": "prettier --check --ignore-path .gitignore .",
"lint": "pnpm lint:code && pnpm lint:style",
Expand All @@ -37,6 +39,7 @@
"ajv": "8.11.0",
"arg": "5.0.2",
"boxen": "7.0.0",
"c8": "7.11.3",
"chalk": "5.0.1",
"chalk-template": "0.4.0",
"clipboardy": "3.0.0",
Expand All @@ -50,12 +53,14 @@
"@types/serve-handler": "6.1.1",
"@vercel/style-guide": "3.0.0",
"eslint": "8.19.0",
"got": "12.1.0",
"husky": "8.0.1",
"lint-staged": "13.0.3",
"prettier": "2.7.1",
"tsup": "6.1.3",
"tsx": "3.7.1",
"typescript": "4.6.4"
"typescript": "4.6.4",
"vitest": "0.18.0"
},
"tsup": {
"target": "esnext",
Expand All @@ -79,7 +84,8 @@
"prettier --ignore-unknown --write"
],
"source/**/*.ts": [
"eslint --max-warnings 0 --fix"
"eslint --max-warnings 0 --fix",
"vitest related --run"
]
}
}