Skip to content

Commit b747d11

Browse files
committed
🧪 Tests: Jest test
1 parent dd61641 commit b747d11

11 files changed

+2301
-1766
lines changed

.github/workflows/tests.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ on:
55
jobs:
66
unit_test-lint:
77
runs-on: ubuntu-latest
8+
env:
9+
CI: true
10+
VITE_OPEN_WEATHER_API_KEY: ${{ secrets.VITE_OPEN_WEATHER_API_KEY }}
811
steps:
912
- uses: actions/checkout@v2
10-
- run: |
11-
npm ci
12-
npm run build
13-
npm run test:unit
14-
npm run lint
13+
- run: npm ci
14+
- run: npm run build
15+
- run: npm run test:jest
16+
- run: npm run lint

babel.config.cjs

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// module.exports = {
2+
// presets: [
3+
// '@vue/cli-plugin-babel/preset'
4+
// ]
5+
// }
6+
7+
module.exports = {
8+
env: {
9+
test: {
10+
presets: [
11+
[
12+
"@babel/preset-env",
13+
{
14+
targets: {
15+
node: "current",
16+
},
17+
},
18+
],
19+
],
20+
},
21+
},
22+
};

babel.config.js

-5
This file was deleted.

jest.config.cjs

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// module.exports = {
2+
// preset: '@vue/cli-plugin-unit-jest/presets/typescript-and-babel'
3+
// }
4+
5+
module.exports = {
6+
transform: {
7+
"^.+\\.vue$": "@vue/vue3-jest",
8+
"^.+\\.js$": "babel-jest",
9+
"^.+\\.ts$": "ts-jest",
10+
},
11+
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.(js|ts)$",
12+
moduleFileExtensions: ["vue", "js", "ts"],
13+
moduleNameMapper: {
14+
"^@/(.*)$": "<rootDir>/src/$1",
15+
},
16+
coveragePathIgnorePatterns: ["/node_modules/", "/tests/"],
17+
coverageReporters: ["text", "json-summary"],
18+
// Fix in order for vue-test-utils to work with Jest 29
19+
// https://test-utils.vuejs.org/migration/#test-runners-upgrade-notes
20+
testEnvironmentOptions: {
21+
customExportConditions: ["node", "node-addons"],
22+
},
23+
}
24+
25+
26+
// module.exports = {
27+
// preset: '@vue/cli-plugin-unit-jest/presets/typescript-and-babel'
28+
// }

jest.config.js

-3
This file was deleted.

0 commit comments

Comments
 (0)