Skip to content

Commit 0d48c54

Browse files
committed
Add tests runs to all packages
1 parent 8928cd1 commit 0d48c54

File tree

10 files changed

+90
-7
lines changed

10 files changed

+90
-7
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ jobs:
3232
run: npm run lint
3333

3434
- name: Run Jest tests
35-
run: npm run test:coverage
35+
env:
36+
NEXT_PUBLIC_FIREBASE_ENV: DEV
37+
run: yarn test
3638

3739
# - name: Build app
3840
# env:

backend/api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"verify:dir": "npx eslint . --max-warnings 0",
2222
"regen-types": "cd ../supabase && make ENV=prod regen-types",
2323
"regen-types-dev": "cd ../supabase && make ENV=dev regen-types-dev",
24-
"test": "jest"
24+
"test": "jest --config jest.config.js"
2525
},
2626
"engines": {
2727
"node": ">=20.0.0"

backend/email/jest.config.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
module.exports = {
2+
preset: 'ts-jest',
3+
testEnvironment: 'node',
4+
5+
rootDir: '.',
6+
testMatch: [
7+
"<rootDir>/tests/**/*.test.ts",
8+
"<rootDir>/tests/**/*.spec.ts"
9+
],
10+
11+
moduleNameMapper: {
12+
"^api/(.*)$": "<rootDir>/src/$1",
13+
"^shared/(.*)$": "<rootDir>/../shared/src/$1",
14+
"^common/(.*)$": "<rootDir>/../../common/src/$1",
15+
"^email/(.*)$": "<rootDir>/../email/emails/$1"
16+
},
17+
18+
moduleFileExtensions: ["ts", "js", "json"],
19+
clearMocks: true,
20+
21+
globals: {
22+
'ts-jest': {
23+
tsconfig: '<rootDir>/tsconfig.json'
24+
}
25+
}
26+
};

backend/email/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"private": true,
55
"scripts": {
66
"dev": "email dev --port 3001",
7-
"build": "tsc -b"
7+
"build": "tsc -b",
8+
"test": "jest --config jest.config.js --passWithNoTests"
89
},
910
"dependencies": {
1011
"@react-email/components": "0.0.33",

backend/shared/jest.config.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
module.exports = {
2+
preset: 'ts-jest',
3+
testEnvironment: 'node',
4+
5+
rootDir: '.',
6+
testMatch: [
7+
"<rootDir>/tests/**/*.test.ts",
8+
"<rootDir>/tests/**/*.spec.ts"
9+
],
10+
11+
moduleNameMapper: {
12+
"^api/(.*)$": "<rootDir>/src/$1",
13+
"^shared/(.*)$": "<rootDir>/../shared/src/$1",
14+
"^common/(.*)$": "<rootDir>/../../common/src/$1",
15+
"^email/(.*)$": "<rootDir>/../email/emails/$1"
16+
},
17+
18+
moduleFileExtensions: ["ts", "js", "json"],
19+
clearMocks: true,
20+
21+
globals: {
22+
'ts-jest': {
23+
tsconfig: '<rootDir>/tsconfig.json'
24+
}
25+
}
26+
};

backend/shared/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"build": "tsc -b && yarn --cwd=../../common tsc-alias && tsc-alias",
77
"compile": "tsc -b",
88
"verify": "yarn --cwd=../.. verify",
9-
"verify:dir": "npx eslint . --max-warnings 0"
9+
"verify:dir": "npx eslint . --max-warnings 0",
10+
"test": "jest --config jest.config.js --passWithNoTests"
1011
},
1112
"sideEffects": false,
1213
"dependencies": {

common/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"compile": "tsc -b",
88
"verify": "yarn --cwd=.. verify",
99
"verify:dir": "npx eslint . --max-warnings 0",
10-
"test": "jest"
10+
"test": "jest --config jest.config.js --passWithNoTests"
1111
},
1212
"sideEffects": false,
1313
"dependencies": {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"build-sync-android": "./scripts/build_sync_android.sh",
2222
"sync-android": "./scripts/sync_android.sh",
2323
"migrate": "./scripts/migrate.sh",
24-
"test": "jest",
24+
"test": "yarn workspaces run test",
2525
"test:coverage": "jest --coverage",
2626
"test:watch": "jest --watch",
2727
"test:update": "jest --updateSnapshot",

web/jest.config.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
module.exports = {
2+
preset: 'ts-jest',
3+
testEnvironment: 'node',
4+
5+
rootDir: '.',
6+
testMatch: [
7+
"<rootDir>/tests/**/*.test.ts",
8+
"<rootDir>/tests/**/*.spec.ts"
9+
],
10+
11+
moduleNameMapper: {
12+
"^api/(.*)$": "<rootDir>/src/$1",
13+
"^shared/(.*)$": "<rootDir>/../shared/src/$1",
14+
"^common/(.*)$": "<rootDir>/../../common/src/$1",
15+
"^email/(.*)$": "<rootDir>/../email/emails/$1"
16+
},
17+
18+
moduleFileExtensions: ["ts", "js", "json"],
19+
clearMocks: true,
20+
21+
globals: {
22+
'ts-jest': {
23+
tsconfig: '<rootDir>/tsconfig.json'
24+
}
25+
}
26+
};

web/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"format": "npx prettier --write .",
1818
"format-changed": "cd .. && git diff $(git merge-base --fork-point main) --name-only --diff-filter=d | xargs npx prettier -w",
1919
"verify": "(cd .. && yarn verify)",
20-
"verify:dir": "npx prettier --check .; yarn lint --max-warnings 0; tsc --pretty --project tsconfig.json --noEmit"
20+
"verify:dir": "npx prettier --check .; yarn lint --max-warnings 0; tsc --pretty --project tsconfig.json --noEmit",
21+
"test": "jest --config jest.config.js --passWithNoTests"
2122
},
2223
"dependencies": {
2324
"@floating-ui/react": "0.19.0",

0 commit comments

Comments
 (0)