Skip to content

Commit 155e7a7

Browse files
authored
Merge pull request #20011 from mozilla/fxa-12561
feat(fxa-auth-server): Migrate more auth-server unit tests to jest
2 parents c8e88a4 + 2e464d1 commit 155e7a7

12 files changed

Lines changed: 2792 additions & 1 deletion

packages/fxa-auth-server/jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module.exports = {
2626
},
2727
testTimeout: 10000,
2828
clearMocks: true,
29-
setupFiles: ['<rootDir>/jest.setup.js'],
29+
setupFiles: ['<rootDir>/jest.setup.js', '<rootDir>/jest.setup-proxyquire.js'],
3030
testPathIgnorePatterns: ['/node_modules/'],
3131
// Coverage configuration (enabled via --coverage flag)
3232
collectCoverageFrom: [
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this
3+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4+
5+
/**
6+
* Fix for proxyquire not finding .ts files under Jest/ts-jest.
7+
* proxyquire uses resolve.sync() which defaults to only .js extensions.
8+
* This patches resolve.sync to also look for .ts files.
9+
*/
10+
11+
const resolve = require('resolve');
12+
const originalSync = resolve.sync;
13+
resolve.sync = function(id, opts) {
14+
opts = opts || {};
15+
if (!opts.extensions || opts.extensions.length === 0) {
16+
opts.extensions = ['.ts', '.tsx', '.js', '.json', '.node'];
17+
}
18+
return originalSync.call(this, id, opts);
19+
};

0 commit comments

Comments
 (0)