Q&A
Vitestの自動終了の方法がわかりません。
どう設定すればいいでしょうか?
また、ターミナル上で自動終了できなくても、GithubActions上で終了させる方法を教えてください。
以下のスクリーンショットにて、"press h to show help, press q to quit" と表示され、メッセージどうりに、qを押さないと終了されません。
- テスト結果のスクリーンショット
設定ファイル等は、以下になります。
- package.json
json
1{ 2 "name": "markdown-site", 3 "private": true, 4 "version": "0.0.0", 5 "scripts": { 6 "dev": "vite", 7 "build": "tsc && vite build", 8 "preview": "vite preview", 9 "lint": "eslint . --ext .js,.jsx,.ts,.tsx", 10 "lintfix": "npm run lint -- --fix", 11 "test": "vitest", 12 "coverage": "vitest run --coverage" 13 }, 14 "dependencies": { 15 "@emotion/react": "^11.8.2", 16 "@emotion/styled": "^11.8.1", 17 "@mui/icons-material": "^5.5.1", 18 "@mui/material": "^5.5.3", 19 "@mui/system": "^5.6.0", 20 "eslint-config-airbnb-typescript": "^16.2.0", 21 "react": "^17.0.2", 22 "react-dom": "^17.0.2", 23 "react-markdown": "^8.0.2", 24 "react-router-dom": "^6.3.0", 25 "remark-gfm": "^3.0.1" 26 }, 27 "devDependencies": { 28 "@testing-library/jest-dom": "^5.16.4", 29 "@testing-library/react": "^12.1.2", 30 "@types/node": "^17.0.23", 31 "@types/react": "^17.0.33", 32 "@types/react-dom": "^17.0.10", 33 "@typescript-eslint/eslint-plugin": "^5.17.0", 34 "@typescript-eslint/parser": "^5.17.0", 35 "@vitejs/plugin-react": "^1.0.7", 36 "eslint": "^8.12.0", 37 "eslint-config-airbnb": "^19.0.4", 38 "eslint-plugin-import": "^2.25.4", 39 "eslint-plugin-jsx-a11y": "^6.5.1", 40 "eslint-plugin-react": "^7.29.4", 41 "eslint-plugin-react-hooks": "^4.4.0", 42 "happy-dom": "^2.55.0", 43 "jest-extended": "^2.0.0", 44 "typescript": "^4.5.4", 45 "vite": "^2.9.0", 46 "vitest": "^0.9.2" 47 } 48} 49
- vite.config.ts
ts
1/// <reference types="vitest" /> 2import { defineConfig } from 'vite'; 3import react from '@vitejs/plugin-react'; 4import * as path from "path"; 5 6// https://vitejs.dev/config/ 7export default defineConfig({ 8 plugins: [react()], 9 test: { 10 globals: true, 11 environment: 'happy-dom', 12 setupFiles: './src/vitestSetup.ts', 13 }, 14 resolve: { 15 alias: { 16 'components': path.resolve(__dirname, "src/components"), 17 'stores': path.resolve(__dirname, "src/stores"), 18 'types': path.resolve(__dirname, "src/types"), 19 'pages': path.resolve(__dirname, "src/pages"), 20 } 21 } 22}); 23
- vitestSetup.ts
ts
1/* eslint-disable import/no-extraneous-dependencies */ 2import '@testing-library/jest-dom/extend-expect'; 3import 'jest-extended';
回答1件
あなたの回答
tips
プレビュー
下記のような回答は推奨されていません。
このような回答には修正を依頼しましょう。
2022/04/12 12:35