Skip to content

Commit 7dfbc48

Browse files
committed
remove
1 parent f77a51e commit 7dfbc48

File tree

2 files changed

+0
-68
lines changed

2 files changed

+0
-68
lines changed

spec/helper.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ if (dns.setDefaultResultOrder) {
2525
jasmine.DEFAULT_TIMEOUT_INTERVAL = process.env.PARSE_SERVER_TEST_TIMEOUT || 10000;
2626
jasmine.getEnv().addReporter(new CurrentSpecReporter());
2727
jasmine.getEnv().addReporter(new SpecReporter());
28-
global.retryFlakyTests();
29-
3028
global.on_db = (db, callback, elseCallback) => {
3129
if (process.env.PARSE_SERVER_TEST_DB == db) {
3230
return callback();

spec/support/CurrentSpecReporter.js

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,10 @@ const { performance } = require('perf_hooks');
44

55
global.currentSpec = null;
66

7-
/**
8-
* Names of tests that fail randomly and are considered flaky. These tests will be retried
9-
* a number of times to reduce the chance of false negatives. The test name must be the same
10-
* as the one displayed in the CI log test output.
11-
*/
12-
const flakyTests = [];
13-
147
/** The minimum execution time in seconds for a test to be considered slow. */
158
const slowTestLimit = 2;
169

17-
/** The number of times to retry a flaky test. */
18-
const retries = 5;
19-
2010
const timerMap = {};
21-
const retryMap = {};
2211
const duplicates = [];
2312
class CurrentSpecReporter {
2413
specStarted(spec) {
@@ -52,61 +41,6 @@ global.displayTestStats = function() {
5241
console.warn('Duplicate spec: ' + spec);
5342
});
5443
console.log('\n');
55-
Object.keys(retryMap).forEach((spec) => {
56-
console.warn(`Flaky test: ${spec} failed ${retryMap[spec]} times`);
57-
});
58-
console.log('\n');
5944
};
6045

61-
global.retryFlakyTests = function() {
62-
const originalSpecConstructor = jasmine.Spec;
63-
64-
jasmine.Spec = function(attrs) {
65-
const spec = new originalSpecConstructor(attrs);
66-
const originalTestFn = spec.queueableFn.fn;
67-
const runOriginalTest = () => {
68-
if (originalTestFn.length == 0) {
69-
// handle async testing
70-
return originalTestFn();
71-
} else {
72-
// handle done() callback
73-
return new Promise((resolve) => {
74-
originalTestFn(resolve);
75-
});
76-
}
77-
};
78-
spec.queueableFn.fn = async function() {
79-
const isFlaky = flakyTests.includes(spec.result.fullName);
80-
const runs = isFlaky ? retries : 1;
81-
let exceptionCaught;
82-
let returnValue;
83-
84-
for (let i = 0; i < runs; ++i) {
85-
spec.result.failedExpectations = [];
86-
returnValue = undefined;
87-
exceptionCaught = undefined;
88-
try {
89-
returnValue = await runOriginalTest();
90-
} catch (exception) {
91-
exceptionCaught = exception;
92-
}
93-
const failed = !spec.markedPending &&
94-
(exceptionCaught || spec.result.failedExpectations.length != 0);
95-
if (!failed) {
96-
break;
97-
}
98-
if (isFlaky) {
99-
retryMap[spec.result.fullName] = (retryMap[spec.result.fullName] || 0) + 1;
100-
await global.afterEachFn();
101-
}
102-
}
103-
if (exceptionCaught) {
104-
throw exceptionCaught;
105-
}
106-
return returnValue;
107-
};
108-
return spec;
109-
};
110-
}
111-
11246
module.exports = CurrentSpecReporter;

0 commit comments

Comments
 (0)