Skip to content

Commit 0bbeab6

Browse files
authored
Revert "Skip costly tests" (#35197)
* Revert "Skip costly tests" * fix package.json format
1 parent af0d5d3 commit 0bbeab6

File tree

8 files changed

+5
-147
lines changed

8 files changed

+5
-147
lines changed

Gulpfile.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,6 @@ task("runtests-parallel").flags = {
477477
" --workers=<number>": "The number of parallel workers to use.",
478478
" --timeout=<ms>": "Overrides the default test timeout.",
479479
" --built": "Compile using the built version of the compiler.",
480-
" --skipPercent=<number>": "Skip expensive tests with <percent> chance to miss an edit. Default 5%.",
481480
" --shards": "Total number of shards running tests (default: 1)",
482481
" --shardId": "1-based ID of this shard (default: 1)",
483482
};

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@
9292
"prex": "^0.4.3",
9393
"q": "latest",
9494
"remove-internal": "^2.9.2",
95-
"simple-git": "^1.113.0",
9695
"source-map-support": "latest",
9796
"through2": "latest",
9897
"travis-fold": "latest",
@@ -117,8 +116,7 @@
117116
"lint:ci": "gulp lint --ci",
118117
"lint:compiler": "gulp lint-compiler",
119118
"lint:scripts": "gulp lint-scripts",
120-
"setup-hooks": "node scripts/link-hooks.js",
121-
"update-costly-tests": "node scripts/costly-tests.js"
119+
"setup-hooks": "node scripts/link-hooks.js"
122120
},
123121
"browser": {
124122
"fs": false,

scripts/build/options.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ module.exports = minimist(process.argv.slice(2), {
1414
"ru": "runners", "runner": "runners",
1515
"r": "reporter",
1616
"c": "colors", "color": "colors",
17-
"skip-percent": "skipPercent",
1817
"skippercent": "skipPercent",
1918
"w": "workers",
2019
"f": "fix"

scripts/build/tests.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ async function runConsoleTests(runJs, defaultReporter, runInParallel, watchMode,
3131
const inspect = cmdLineOptions.inspect;
3232
const runners = cmdLineOptions.runners;
3333
const light = cmdLineOptions.light;
34-
const skipPercent = process.env.CI === "true" ? 0 : cmdLineOptions.skipPercent;
3534
const stackTraceLimit = cmdLineOptions.stackTraceLimit;
3635
const testConfigFile = "test.config";
3736
const failed = cmdLineOptions.failed;
@@ -65,8 +64,8 @@ async function runConsoleTests(runJs, defaultReporter, runInParallel, watchMode,
6564
testTimeout = 400000;
6665
}
6766

68-
if (tests || runners || light || testTimeout || taskConfigsFolder || keepFailed || skipPercent !== undefined || shards || shardId) {
69-
writeTestConfigFile(tests, runners, light, skipPercent, taskConfigsFolder, workerCount, stackTraceLimit, testTimeout, keepFailed, shards, shardId);
67+
if (tests || runners || light || testTimeout || taskConfigsFolder || keepFailed || shards || shardId) {
68+
writeTestConfigFile(tests, runners, light, taskConfigsFolder, workerCount, stackTraceLimit, testTimeout, keepFailed, shards, shardId);
7069
}
7170

7271
const colors = cmdLineOptions.colors;
@@ -161,7 +160,6 @@ exports.cleanTestDirs = cleanTestDirs;
161160
* @param {string} tests
162161
* @param {string} runners
163162
* @param {boolean} light
164-
* @param {string} skipPercent
165163
* @param {string} [taskConfigsFolder]
166164
* @param {string | number} [workerCount]
167165
* @param {string} [stackTraceLimit]
@@ -170,12 +168,11 @@ exports.cleanTestDirs = cleanTestDirs;
170168
* @param {number | undefined} [shards]
171169
* @param {number | undefined} [shardId]
172170
*/
173-
function writeTestConfigFile(tests, runners, light, skipPercent, taskConfigsFolder, workerCount, stackTraceLimit, timeout, keepFailed, shards, shardId) {
171+
function writeTestConfigFile(tests, runners, light, taskConfigsFolder, workerCount, stackTraceLimit, timeout, keepFailed, shards, shardId) {
174172
const testConfigContents = JSON.stringify({
175173
test: tests ? [tests] : undefined,
176174
runners: runners ? runners.split(",") : undefined,
177175
light,
178-
skipPercent,
179176
workerCount,
180177
stackTraceLimit,
181178
taskConfigsFolder,

scripts/costly-tests.js

Lines changed: 0 additions & 103 deletions
This file was deleted.

src/testRunner/parallel/host.ts

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace Harness.Parallel.Host {
1111
const isatty = tty.isatty(1) && tty.isatty(2);
1212
const path = require("path") as typeof import("path");
1313
const { fork } = require("child_process") as typeof import("child_process");
14-
const { statSync, readFileSync } = require("fs") as typeof import("fs");
14+
const { statSync } = require("fs") as typeof import("fs");
1515

1616
// NOTE: paths for module and types for FailedTestReporter _do not_ line up due to our use of --outFile for run.js
1717
const FailedTestReporter = require(path.resolve(__dirname, "../../scripts/failed-tests")) as typeof import("../../../scripts/failed-tests");
@@ -186,31 +186,6 @@ namespace Harness.Parallel.Host {
186186
return `tsrunner-${runner}://${test}`;
187187
}
188188

189-
function skipCostlyTests(tasks: Task[]) {
190-
if (statSync("tests/.test-cost.json")) {
191-
const costs = JSON.parse(readFileSync("tests/.test-cost.json", "utf8")) as {
192-
totalTime: number,
193-
totalEdits: number,
194-
data: { name: string, time: number, edits: number, costs: number }[]
195-
};
196-
let skippedEdits = 0;
197-
let skippedTime = 0;
198-
const skippedTests = new Set<string>();
199-
let i = 0;
200-
for (; i < costs.data.length && (skippedEdits / costs.totalEdits) < (skipPercent / 100); i++) {
201-
skippedEdits += costs.data[i].edits;
202-
skippedTime += costs.data[i].time;
203-
skippedTests.add(costs.data[i].name);
204-
}
205-
console.log(`Skipped ${i} expensive tests; estimated time savings of ${(skippedTime / costs.totalTime * 100).toFixed(2)}% with --skipPercent=${skipPercent.toFixed(2)} chance of missing a test.`);
206-
return tasks.filter(t => !skippedTests.has(t.file));
207-
}
208-
else {
209-
console.log("No cost analysis discovered.");
210-
return tasks;
211-
}
212-
}
213-
214189
function startDelayed(perfData: { [testHash: string]: number } | undefined, totalCost: number) {
215190
console.log(`Discovered ${tasks.length} unittest suites` + (newTasks.length ? ` and ${newTasks.length} new suites.` : "."));
216191
console.log("Discovering runner-based tests...");
@@ -250,7 +225,6 @@ namespace Harness.Parallel.Host {
250225
}
251226
tasks.sort((a, b) => a.size - b.size);
252227
tasks = tasks.concat(newTasks);
253-
tasks = skipCostlyTests(tasks);
254228
const batchCount = workerCount;
255229
const packfraction = 0.9;
256230
const chunkSize = 1000; // ~1KB or 1s for sending batches near the end of a test

src/testRunner/runner.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ let runUnitTests: boolean | undefined;
6767
let stackTraceLimit: number | "full" | undefined;
6868
let noColors = false;
6969
let keepFailed = false;
70-
let skipPercent = 5;
7170

7271
interface TestConfig {
7372
light?: boolean;
@@ -81,7 +80,6 @@ interface TestConfig {
8180
noColors?: boolean;
8281
timeout?: number;
8382
keepFailed?: boolean;
84-
skipPercent?: number;
8583
shardId?: number;
8684
shards?: number;
8785
}
@@ -115,9 +113,6 @@ function handleTestConfig() {
115113
if (testConfig.keepFailed) {
116114
keepFailed = true;
117115
}
118-
if (testConfig.skipPercent !== undefined) {
119-
skipPercent = testConfig.skipPercent;
120-
}
121116
if (testConfig.shardId) {
122117
shardId = testConfig.shardId;
123118
}

tests/.test-cost.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)