Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 82dfd75

Browse files
JiaLiPassionIgorMinar
authored andcommitted
build: upgrade to pass jasmine 3.3 test
1 parent ac3851e commit 82dfd75

File tree

4 files changed

+64
-16
lines changed

4 files changed

+64
-16
lines changed

lib/jasmine/jasmine.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,32 @@
4242
// whether patch jasmine clock when in fakeAsync
4343
const enableClockPatch = _global[symbol('fakeAsyncPatchLock')] === true;
4444

45+
const ignoreUnhandledRejection = _global[symbol('ignoreUnhandledRejection')] === true;
46+
47+
if (!ignoreUnhandledRejection) {
48+
const globalErrors = (jasmine as any).GlobalErrors;
49+
if (globalErrors && !(jasmine as any)[symbol('GlobalErrors')]) {
50+
(jasmine as any)[symbol('GlobalErrors')] = globalErrors;
51+
(jasmine as any).GlobalErrors = function() {
52+
const instance = new globalErrors();
53+
const originalInstall = instance.install;
54+
if (originalInstall && !instance[symbol('install')]) {
55+
instance[symbol('install')] = originalInstall;
56+
instance.install = function() {
57+
const originalHandlers = process.listeners('unhandledRejection');
58+
const r = originalInstall.apply(this, arguments);
59+
process.removeAllListeners('unhandledRejection');
60+
if (originalHandlers) {
61+
originalHandlers.forEach(h => process.on('unhandledRejection', h));
62+
}
63+
return r;
64+
};
65+
}
66+
return instance;
67+
};
68+
}
69+
}
70+
4571
// Monkey patch all of the jasmine DSL so that each function runs in appropriate zone.
4672
const jasmineEnv: any = jasmine.getEnv();
4773
['describe', 'xdescribe', 'fdescribe'].forEach(methodName => {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"gulp-tslint": "^7.0.1",
8181
"gulp-uglify": "^1.2.0",
8282
"gulp-util": "^3.0.7",
83-
"jasmine": "^2.9.1",
83+
"jasmine": "^3.3.1",
8484
"jasmine-core": "^2.9.1",
8585
"karma": "^0.13.14",
8686
"karma-chrome-launcher": "^0.2.1",

test/node_bluebird_entry_point.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,28 @@ import '../lib/testing/promise-testing';
2828
// Setup test environment
2929
import './test-env-setup-jasmine';
3030

31+
const globalErrors = (jasmine as any).GlobalErrors;
32+
const symbol = Zone.__symbol__;
33+
if (globalErrors && !(jasmine as any)[symbol('GlobalErrors')]) {
34+
(jasmine as any)[symbol('GlobalErrors')] = globalErrors;
35+
(jasmine as any).GlobalErrors = function() {
36+
const instance = new globalErrors();
37+
const originalInstall = instance.install;
38+
if (originalInstall && !instance[symbol('install')]) {
39+
instance[symbol('install')] = originalInstall;
40+
instance.install = function() {
41+
const originalHandlers = process.listeners('unhandledRejection');
42+
const r = originalInstall.apply(this, arguments);
43+
process.removeAllListeners('unhandledRejection');
44+
if (originalHandlers) {
45+
originalHandlers.forEach(h => process.on('unhandledRejection', h));
46+
}
47+
return r;
48+
};
49+
}
50+
return instance;
51+
};
52+
}
53+
3154
// List all tests here:
32-
import './extra/bluebird.spec';
55+
import './extra/bluebird.spec';

yarn.lock

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1856,11 +1856,6 @@ execa@^0.7.0:
18561856
signal-exit "^3.0.0"
18571857
strip-eof "^1.0.0"
18581858

1859-
exit@^0.1.2:
1860-
version "0.1.2"
1861-
resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c"
1862-
integrity sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=
1863-
18641859
expand-braces@^0.1.1:
18651860
version "0.1.2"
18661861
resolved "https://registry.yarnpkg.com/expand-braces/-/expand-braces-0.1.2.tgz#488b1d1d2451cb3d3a6b192cfc030f44c5855fea"
@@ -2587,7 +2582,7 @@ graceful-fs@^3.0.0:
25872582
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-3.0.11.tgz#7613c778a1afea62f25c630a086d7f3acbbdd818"
25882583
integrity sha1-dhPHeKGv6mLyXGMKCG1/Osu92Bg=
25892584
dependencies:
2590-
natives "^1.1.3"
2585+
natives "^1.1.0"
25912586

25922587
graceful-fs@^4.1.0, graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9:
25932588
version "4.1.11"
@@ -3559,19 +3554,23 @@ jade@0.26.3:
35593554
commander "0.6.1"
35603555
mkdirp "0.3.0"
35613556

3562-
jasmine-core@^2.9.1, jasmine-core@~2.99.0:
3557+
jasmine-core@^2.9.1:
35633558
version "2.99.1"
35643559
resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-2.99.1.tgz#e6400df1e6b56e130b61c4bcd093daa7f6e8ca15"
35653560
integrity sha1-5kAN8ea1bhMLYcS80JPap/boyhU=
35663561

3567-
jasmine@^2.9.1:
3568-
version "2.99.0"
3569-
resolved "https://registry.yarnpkg.com/jasmine/-/jasmine-2.99.0.tgz#8ca72d102e639b867c6489856e0e18a9c7aa42b7"
3570-
integrity sha1-jKctEC5jm4Z8ZImFbg4YqceqQrc=
3562+
jasmine-core@~3.3.0:
3563+
version "3.3.0"
3564+
resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-3.3.0.tgz#dea1cdc634bc93c7e0d4ad27185df30fa971b10e"
3565+
integrity sha512-3/xSmG/d35hf80BEN66Y6g9Ca5l/Isdeg/j6zvbTYlTzeKinzmaTM4p9am5kYqOmE05D7s1t8FGjzdSnbUbceA==
3566+
3567+
jasmine@^3.3.1:
3568+
version "3.3.1"
3569+
resolved "https://registry.yarnpkg.com/jasmine/-/jasmine-3.3.1.tgz#d61bb1dd8888859bd11ea83074a78ee13d949905"
3570+
integrity sha512-/vU3/H7U56XsxIXHwgEuWpCgQ0bRi2iiZeUpx7Nqo8n1TpoDHfZhkPIc7CO8I4pnMzYsi3XaSZEiy8cnTfujng==
35713571
dependencies:
3572-
exit "^0.1.2"
35733572
glob "^7.0.6"
3574-
jasmine-core "~2.99.0"
3573+
jasmine-core "~3.3.0"
35753574

35763575
js-tokens@^3.0.2:
35773576
version "3.0.2"
@@ -4421,7 +4420,7 @@ nanomatch@^1.2.9:
44214420
snapdragon "^0.8.1"
44224421
to-regex "^3.0.1"
44234422

4424-
natives@^1.1.3:
4423+
natives@^1.1.0:
44254424
version "1.1.6"
44264425
resolved "https://registry.yarnpkg.com/natives/-/natives-1.1.6.tgz#a603b4a498ab77173612b9ea1acdec4d980f00bb"
44274426
integrity sha512-6+TDFewD4yxY14ptjKaS63GVdtKiES1pTPyxn9Jb0rBqPMZ7VcCiooEhPNsr+mqHtMGxa/5c/HhcC4uPEUw/nA==

0 commit comments

Comments
 (0)