Skip to content

Commit dcee7ac

Browse files
committed
fix: jest.config file to properly run tests again. Follow up issue to fix these exceptions
1 parent 496cf05 commit dcee7ac

File tree

5 files changed

+43
-40
lines changed

5 files changed

+43
-40
lines changed

jest.config.js

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
module.exports = {
2-
coverageDirectory: './coverage/',
3-
collectCoverage: true,
4-
testURL: 'http://localhost/',
5-
setupTestFrameworkScriptFile: 'jest-extended',
6-
reporters: ['jest-tap-reporter'],
7-
testRegex: '(/__tests__/.*|/tests/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$',
8-
"transform": {
9-
"^.+\\.tsx?$": "ts-jest"
10-
},
11-
"moduleFileExtensions": [
12-
"ts",
13-
"tsx",
14-
"js",
15-
"jsx",
16-
"json"
17-
]
2+
preset: 'ts-jest',
3+
4+
testEnvironment: 'node',
5+
testRegex: '(/__tests__/.*|/tests/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$',
6+
testMatch: null,
7+
testURL: 'http://localhost/',
8+
9+
coverageDirectory: './coverage/',
10+
collectCoverage: true,
11+
12+
setupTestFrameworkScriptFile: 'jest-extended',
13+
14+
globals: {
15+
'ts-jest': {
16+
diagnostics: {
17+
ignoreCodes: [2445, 7006, 7031, 2339, 7016, 7023, 7017]
18+
},
19+
},
20+
},
1821
};

package-lock.json

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"test:bundles": "jest test/tests/bundles",
1818
"test:infrastructure": "jest test/tests/infrastructure",
1919
"test:services": "jest test/tests/services",
20-
"test": "jest && codecov",
20+
"test": "jest --debug && codecov",
2121
"prepublishOnly": "npm run build",
2222
"semantic-release": "semantic-release"
2323
},
@@ -52,22 +52,22 @@
5252
"@semantic-release/npm": "^5.0.4",
5353
"@types/humps": "^1.1.2",
5454
"@types/jest": "^23.3.5",
55-
"@types/qs": "^6.5.1",
5655
"@types/parse-link-header": "^1.0.0",
56+
"@types/qs": "^6.5.1",
5757
"@types/request-promise": "^4.1.42",
5858
"@types/url-join": "^0.8.2",
5959
"@types/util.promisify": "^1.0.0",
60-
"semantic-release": "^15.9.17",
6160
"codecov": "^3.1.0",
62-
"husky": "^1.1.1",
6361
"cz-conventional-changelog": "^2.1.0",
62+
"husky": "^1.1.1",
6463
"jest": "^23.6.0",
6564
"jest-extended": "^0.11.0",
6665
"jest-tap-reporter": "^1.9.0",
66+
"semantic-release": "^15.9.17",
6767
"ts-jest": "^23.10.4",
6868
"tslint": "^5.11.0",
6969
"tslint-config-airbnb": "^5.11.0",
70-
"typescript": "3.1.2"
70+
"typescript": "^3.1.2"
7171
},
7272
"dependencies": {
7373
"humps": "^2.0.1",

src/infrastructure/Bundler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ function Bundler(services = {}) {
22
const combined = { ...services };
33

44
return class Bundle {
5-
constructor(options) {
5+
constructor(options = {}) {
66
Object.keys(combined).forEach((serviceName) => {
77
this[serviceName] = new combined[serviceName](options);
88
});

test/tests/infrastructure/Bundle.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
import { Bundler } from '../../../src/infrastructure';
22

33
class Test1 {
4-
constructor(value) {
4+
constructor(value: number) {
55
this.value = value * 3;
66
}
77
}
88

99
class Test2 {
10-
constructor(value) {
10+
constructor(value: number) {
1111
this.value = value * 2;
1212
}
1313
}
1414

1515
test('No classes passed to Bundler returns an empty Bundle', async () => {
1616
const Bundle = Bundler();
1717
const services = new Bundle();
18-
18+
1919
expect(services).toEqual({});
2020
});
2121

0 commit comments

Comments
 (0)