Skip to content

Commit 0bd968e

Browse files
authored
fix: Add Jest@28 to the peer dependencies (and fix a few other issues) (#211)
* fix: Improve robustness by importing types from the root of pact-js, introduced in pact@9.12.2 * build(deps): Reduce deprecation warnings by bumping several versions * fix: Add jest ^28.0.0 to peer dependencies * build(deps): Bump husky devDep version to address vulnerability warning * fix: Fixed a race condition where the extended timeout sometimes wasn't applied during pact setup
1 parent dce370c commit 0bd968e

File tree

4 files changed

+31
-34
lines changed

4 files changed

+31
-34
lines changed

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,29 +39,29 @@
3939
"devDependencies": {
4040
"@commitlint/cli": "^10.0.0",
4141
"@commitlint/config-conventional": "^10.0.0",
42-
"@pact-foundation/pact": "9.12.2",
42+
"@pact-foundation/pact": "9.17.3",
4343
"@pact-foundation/pact-js-prettier-config": "^1.0.0",
4444
"@types/jest": "^27.1.3",
4545
"@types/supertest": "2.0.8",
46-
"coveralls": "3.0.9",
46+
"coveralls": "3.1.1",
4747
"cross-env": "7.0.2",
48-
"husky": "4.2.3",
49-
"jest": "^27.1.3",
50-
"jest-junit": "10.0.0",
48+
"husky": "^4.3.8",
49+
"jest": "^28.1.0",
50+
"jest-junit": "13.2.0",
5151
"lint-staged": "10.2.2",
5252
"prettier": "2.0.5",
5353
"rimraf": "3.0.2",
5454
"standard-version": "^9.0.0",
55-
"supertest": "4.0.2",
56-
"ts-jest": "^27.1.3",
55+
"supertest": "6.2.3",
56+
"ts-jest": "^28.0.1",
5757
"ts-node": "8.6.2",
5858
"tslint": "5.20.1",
5959
"tslint-config-prettier": "1.18.0",
60-
"typescript": "3.8.3"
60+
"typescript": "4.6.4"
6161
},
6262
"peerDependencies": {
6363
"@pact-foundation/pact": "^9.12.2",
64-
"jest": "^24.0.0 || ^25.0.0 || ^26.0.0 || ^27.0.0"
64+
"jest": "^24.0.0 || ^25.0.0 || ^26.0.0 || ^27.0.0 || ^28.0.0"
6565
},
6666
"lint-staged": {
6767
"src/**/*.ts": [

src/internal/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { PactfileWriteMode } from '@pact-foundation/pact';
2-
import { LogLevel } from '@pact-foundation/pact/dsl/options';
2+
import { LogLevel } from '@pact-foundation/pact';
33
import * as path from 'path';
44
import { JestMessageConsumerOptions, JestPactOptions } from '../types';
55

src/internal/scaffold.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import {
2-
MessageConsumerOptions,
3-
PactOptions,
4-
} from '@pact-foundation/pact/dsl/options';
1+
import { MessageConsumerOptions, PactOptions } from '@pact-foundation/pact';
52
import { ConsumerOptions, WrapperFn, WrapperWithOnlyAndSkip } from './types';
63

74
const describeString = (options: PactOptions | MessageConsumerOptions) =>

src/internal/withTimeout.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,29 @@ export const withTimeout = (
88
): void => {
99
const pactTestTimeout = options.timeout || 30000;
1010

11-
describe(`with ${pactTestTimeout} ms timeout for Pact`, () => {
12-
let originalTimeout: number;
11+
let originalTimeout: number;
1312

14-
beforeAll(() => {
15-
// Jest's default timeout is 5000, and jest doesn't provide a way of
16-
// asking what the current timeout is. In Jest 24 and 25, Jasmine was probably
17-
// the test runner, so we can ask Jasmine if it is there. In later versions of
18-
// Jest (eg 26 and up), Jasmine may not be defined.
19-
// See https://github.com/pact-foundation/jest-pact/issues/197 for discussion
20-
//
21-
// For now, we just assume that 5000 was the original timeout.
22-
// The impact is likely to be small, as `jest.setTimeout()` only works for the
23-
// current test file
24-
originalTimeout = global.jasmine
25-
? global.jasmine.DEFAULT_TIMEOUT_INTERVAL
26-
: 5000;
27-
jest.setTimeout(pactTestTimeout);
28-
});
13+
beforeAll(() => {
14+
// Jest's default timeout is 5000, and jest doesn't provide a way of
15+
// asking what the current timeout is. In Jest 24 and 25, Jasmine was probably
16+
// the test runner, so we can ask Jasmine if it is there. In later versions of
17+
// Jest (eg 26 and up), Jasmine may not be defined.
18+
// See https://github.com/pact-foundation/jest-pact/issues/197 for discussion
19+
//
20+
// For now, we just assume that 5000 was the original timeout.
21+
// The impact is likely to be small, as `jest.setTimeout()` only works for the
22+
// current test file
23+
originalTimeout = global.jasmine
24+
? global.jasmine.DEFAULT_TIMEOUT_INTERVAL
25+
: 5000;
26+
jest.setTimeout(pactTestTimeout);
27+
});
2928

30-
afterAll(() => {
31-
jest.setTimeout(originalTimeout);
32-
});
29+
afterAll(() => {
30+
jest.setTimeout(originalTimeout);
31+
});
3332

33+
describe(`with ${pactTestTimeout} ms timeout for Pact`, () => {
3434
tests();
3535
});
3636
};

0 commit comments

Comments
 (0)