Skip to content

Commit 5a2b622

Browse files
JiaLiPassionalxhub
authored andcommitted
fix(zone.js): revert Mocha it.skip, describe.skip method patch (#49329)
In the previous commit #45047 The `it.skip` and `describe.skip` is wrongly deleted, should keep the patch for these methods. PR Close #49329
1 parent daaed89 commit 5a2b622

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

packages/zone.js/lib/mocha/mocha.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ Zone.__load_patch('mocha', (global: any, Zone: ZoneType) => {
115115
return mochaOriginal.describe.apply(this, wrapDescribeInZone(arguments));
116116
};
117117

118-
global.xdescribe = global.suite.skip = function() {
118+
global.xdescribe = global.suite.skip = global.describe.skip = function() {
119119
return mochaOriginal.describe.skip.apply(this, wrapDescribeInZone(arguments));
120120
};
121121

@@ -127,7 +127,7 @@ Zone.__load_patch('mocha', (global: any, Zone: ZoneType) => {
127127
return mochaOriginal.it.apply(this, wrapTestInZone(arguments));
128128
};
129129

130-
global.xit = global.xspecify = function() {
130+
global.xit = global.xspecify = global.it.skip = function() {
131131
return mochaOriginal.it.skip.apply(this, wrapTestInZone(arguments));
132132
};
133133

packages/zone.js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"jest": "^29.0",
1919
"jest-environment-jsdom": "^29.0.3",
2020
"jest-environment-node": "^29.0.3",
21-
"mocha": "^10.0.0",
21+
"mocha": "^10.2.0",
2222
"mock-require": "3.0.3",
2323
"promises-aplus-tests": "^2.1.2"
2424
},

packages/zone.js/test/mocha-patch.spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ ifEnvSupports('Mocha', function() {
6060
});
6161
});
6262

63+
(describe as any).skip('skip describe', () => {
64+
test('test', () => {
65+
fail('should not be here');
66+
});
67+
});
68+
6369
suite('Mocha TDD-style', () => {
6470
let testZone: Zone|null = null;
6571
let beforeEachZone: Zone|null = null;
@@ -94,6 +100,10 @@ ifEnvSupports('Mocha', function() {
94100
suiteTeardown(() => {
95101
expect(suiteSetupZone).toBe(Zone.current);
96102
});
103+
104+
(it as any).skip('test skip', () => {
105+
fail('should not be here');
106+
});
97107
});
98108

99109
describe('return promise', () => {

packages/zone.js/yarn.lock

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -812,11 +812,6 @@
812812
dependencies:
813813
"@types/yargs-parser" "*"
814814

815-
816-
version "1.1.2"
817-
resolved "https://registry.yarnpkg.com/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz#aa58042711d6e3275dd37dc597e5d31e8c290a44"
818-
integrity sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==
819-
820815
abab@^2.0.6:
821816
version "2.0.6"
822817
resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.6.tgz#41b80f2c871d19686216b82309231cfd3cb3d291"
@@ -2673,12 +2668,11 @@ [email protected]:
26732668
dependencies:
26742669
minimist "0.0.8"
26752670

2676-
mocha@^10.0.0:
2677-
version "10.0.0"
2678-
resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.0.0.tgz#205447d8993ec755335c4b13deba3d3a13c4def9"
2679-
integrity sha512-0Wl+elVUD43Y0BqPZBzZt8Tnkw9CMUdNYnUsTfOM1vuhJVZL+kiesFYsqwBkEEuEixaiPe5ZQdqDgX2jddhmoA==
2671+
mocha@^10.2.0:
2672+
version "10.2.0"
2673+
resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.2.0.tgz#1fd4a7c32ba5ac372e03a17eef435bd00e5c68b8"
2674+
integrity sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==
26802675
dependencies:
2681-
"@ungap/promise-all-settled" "1.1.2"
26822676
ansi-colors "4.1.1"
26832677
browser-stdout "1.3.1"
26842678
chokidar "3.5.3"

0 commit comments

Comments
 (0)