-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tests): set up unit tests ecosystem (#6)
- Loading branch information
1 parent
ee3e55f
commit e8dd711
Showing
12 changed files
with
710 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,6 @@ logs | |
.env | ||
.env.* | ||
!.env.example | ||
|
||
# Tests | ||
tests/unit/coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="true" type="JavaScriptTestRunnerVitest"> | ||
<config value="$PROJECT_DIR$/config/vitest/vitest.unit-config.ts" /> | ||
<node-interpreter value="project" /> | ||
<vitest-package value="$PROJECT_DIR$/node_modules/vitest" /> | ||
<working-dir value="$PROJECT_DIR$" /> | ||
<envs> | ||
<env name="NODE_ENV" value="test" /> | ||
</envs> | ||
<scope-kind value="ALL" /> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="Unit Tests Coverage" type="js.build_tools.npm"> | ||
<package-json value="$PROJECT_DIR$/package.json" /> | ||
<command value="run" /> | ||
<scripts> | ||
<script value="test:unit:cov" /> | ||
</scripts> | ||
<node-interpreter value="project" /> | ||
<package-manager value="pnpm" /> | ||
<envs /> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="Unit Tests Watch" type="js.build_tools.npm"> | ||
<package-json value="$PROJECT_DIR$/package.json" /> | ||
<command value="run" /> | ||
<scripts> | ||
<script value="test:unit:watch" /> | ||
</scripts> | ||
<node-interpreter value="project" /> | ||
<package-manager value="pnpm" /> | ||
<envs /> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="Unit Tests" type="JavaScriptTestRunnerVitest"> | ||
<config value="$PROJECT_DIR$/config/vitest/vitest.unit-config.ts" /> | ||
<node-interpreter value="project" /> | ||
<vitest-package value="$PROJECT_DIR$/node_modules/vitest" /> | ||
<working-dir value="$PROJECT_DIR$" /> | ||
<vitest-options value="--run --coverage" /> | ||
<envs> | ||
<env name="NODE_ENV" value="test" /> | ||
</envs> | ||
<scope-kind value="ALL" /> | ||
<method v="2" /> | ||
</configuration> | ||
<configuration default="false" name="Unit Tests" type="js.build_tools.npm"> | ||
<package-json value="$PROJECT_DIR$/package.json" /> | ||
<command value="run" /> | ||
<scripts> | ||
<script value="test:unit" /> | ||
</scripts> | ||
<node-interpreter value="project" /> | ||
<package-manager value="pnpm" /> | ||
<envs /> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { defineVitestConfig } from "@nuxt/test-utils/config" | ||
|
||
export default defineVitestConfig({ | ||
test: { | ||
watch: false, | ||
include: ["./tests/unit/**/*.spec.ts"], | ||
exclude: [ | ||
"nuxt.config.ts", | ||
"node_modules/**", | ||
"config/**/*.ts", | ||
], | ||
coverage: { | ||
exclude: [ | ||
"tests/**/*", | ||
"node_modules/**/*", | ||
"config/**/*", | ||
], | ||
include: [ | ||
"app.vue", | ||
"components/**/*.[vue|ts]", | ||
"composables/**/*.ts", | ||
], | ||
reportsDirectory: "./tests/unit/coverage", | ||
all: true, | ||
thresholds: { | ||
lines: 100, | ||
functions: 100, | ||
branches: 100, | ||
statements: 100, | ||
} | ||
}, | ||
globals: true, | ||
clearMocks: true, | ||
mockReset: true, | ||
restoreMocks: true, | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
// https://nuxt.com/docs/api/configuration/nuxt-config | ||
export default defineNuxtConfig({ | ||
modules: [ | ||
"@nuxt/test-utils/module" | ||
], | ||
devtools: { enabled: true } | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.