Skip to content

Commit 68add1d

Browse files
committed
feat(profile-server): add Jest config, test infra, migrated tests, and CI wiring
1 parent efe7c13 commit 68add1d

12 files changed

Lines changed: 2379 additions & 7 deletions

File tree

.circleci/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -995,7 +995,7 @@ workflows:
995995
- integration-test:
996996
name: Integration Test Jest - Servers - Auth (PR)
997997
nx_run: affected --base=main --head=$CIRCLE_SHA1
998-
projects: --exclude '*,!tag:scope:server:auth'
998+
projects: --exclude '*,!tag:scope:server:auth,!fxa-profile-server'
999999
start_customs: true
10001000
target: -t test-integration-jest
10011001
test_suite: servers-auth-jest-integration
@@ -1216,7 +1216,7 @@ workflows:
12161216
- Build
12171217
- integration-test:
12181218
name: Integration Test Jest - Servers - Auth
1219-
projects: --exclude '*,!tag:scope:server:auth'
1219+
projects: --exclude '*,!tag:scope:server:auth,!fxa-profile-server'
12201220
start_customs: true
12211221
target: -t test-integration-jest
12221222
test_suite: servers-auth-jest-integration
@@ -1335,7 +1335,7 @@ workflows:
13351335
- Build (nightly)
13361336
- integration-test:
13371337
name: Integration Test Jest - Servers - Auth (nightly)
1338-
projects: --exclude '*,!tag:scope:server:auth'
1338+
projects: --exclude '*,!tag:scope:server:auth,!fxa-profile-server'
13391339
start_customs: true
13401340
target: -t test-integration-jest
13411341
test_suite: servers-auth-jest-integration
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
export default {
2+
testEnvironment: 'node',
3+
rootDir: '.',
4+
testMatch: [
5+
'<rootDir>/test/**/*.spec.ts',
6+
'<rootDir>/test/**/*.in.spec.ts',
7+
],
8+
moduleFileExtensions: ['ts', 'js', 'json'],
9+
transform: {
10+
'^.+\\.tsx?$': ['ts-jest', { tsconfig: { isolatedModules: true, allowJs: false } }],
11+
},
12+
testPathIgnorePatterns: ['/node_modules/'],
13+
testTimeout: 20000,
14+
clearMocks: true,
15+
};

packages/fxa-profile-server/package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414
"restart": "pm2 restart pm2.config.js",
1515
"delete": "pm2 delete pm2.config.js",
1616
"test": "scripts/test-local.sh",
17-
"test-unit": "MOCHA_FILE=../../artifacts/tests/$npm_package_name/fxa-profile-server-mocha-unit-results.xml node ./scripts/mocha-coverage.js --recursive test/*.js test/routes/*/*.js -g '#integration' --invert",
17+
"test-unit": "MOCHA_FILE=../../artifacts/tests/$npm_package_name/fxa-profile-server-mocha-unit-results.xml node ./scripts/mocha-coverage.js --recursive test/*.js test/routes/*/*.js -g '#integration' --invert && NODE_ENV=test npx jest --no-coverage --forceExit --testPathPattern='spec\\.ts$' --testPathIgnorePatterns='in\\.spec\\.ts$'",
1818
"test-integration": "MOCHA_FILE=../../artifacts/tests/$npm_package_name/fxa-profile-server-mocha-integration-results.xml node ./scripts/mocha-coverage.js --recursive test/*.js test/routes/*/*.js -g '#integration'",
19+
"test-jest-unit": "NODE_ENV=test npx jest --no-coverage --forceExit --testPathPattern='spec\\.ts$' --testPathIgnorePatterns='in\\.spec\\.ts$'",
20+
"test-integration-jest": "NODE_ENV=test npx jest --no-coverage --forceExit --testPathPattern='in\\.spec\\.ts$'",
1921
"format": "prettier --write --config ../../_dev/.prettierrc '**'"
2022
},
2123
"dependencies": {
@@ -42,6 +44,7 @@
4244
},
4345
"devDependencies": {
4446
"@types/sharp": "^0",
47+
"@types/sinon": "^17.0.0",
4548
"audit-filter": "^0.5.0",
4649
"commander": "9.3.0",
4750
"eslint": "^8.18.0",
@@ -55,7 +58,8 @@
5558
"prettier": "^3.5.3",
5659
"rimraf": "^6.0.1",
5760
"sinon": "^14.0.0",
58-
"through": "2.3.8"
61+
"through": "2.3.8",
62+
"ts-jest": "^29.1.1"
5963
},
6064
"repository": {
6165
"type": "git",

0 commit comments

Comments
 (0)