Skip to content

Commit fce7f9f

Browse files
committed
Move .test-cost.json
Also include parameter name in test output so that people will know what to do to change the percent chance of failure.
1 parent 41b117e commit fce7f9f

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

scripts/costly-tests.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ async function main() {
2525
const percentTime = perf[k] / totalTime
2626
const percentHits = (1 + (edits[otherk] || 0)) / totalEdits
2727
const cost = 5 + Math.log(percentTime / percentHits)
28-
// TODO: Write counts instead of numbers to make JSON file smaller
2928
data.push({ name: otherk, time: perf[k], edits: 1 + (edits[otherk] || 0), cost})
3029
if (edits[otherk])
3130
i++
@@ -36,7 +35,7 @@ async function main() {
3635
data: data.sort((x,y) => y.cost - x.cost).map(x => ({ ...x, cost: x.cost.toFixed(2) }))
3736
}
3837

39-
fs.writeFileSync('.test-cost.json', JSON.stringify(output), 'utf8')
38+
fs.writeFileSync('tests/.test-cost.json', JSON.stringify(output), 'utf8')
4039
}
4140

4241
main().catch(e => {

src/testRunner/parallel/host.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@ namespace Harness.Parallel.Host {
193193
}
194194

195195
function skipCostlyTests(tasks: Task[]) {
196-
if (statSync(".test-cost.json")) {
197-
const costs = JSON.parse(readFileSync(".test-cost.json", "utf8")) as {
196+
if (statSync("tests/.test-cost.json")) {
197+
const costs = JSON.parse(readFileSync("tests/.test-cost.json", "utf8")) as {
198198
totalTime: number,
199199
totalEdits: number,
200200
data: { name: string, time: number, edits: number, costs: number }[]
@@ -208,7 +208,7 @@ namespace Harness.Parallel.Host {
208208
skippedTime += costs.data[i].time;
209209
skippedTests.add(costs.data[i].name);
210210
}
211-
console.log(`Skipped ${i} expensive tests; estimated time savings of ${(skippedTime / costs.totalTime * 100).toFixed(2)}% with ${skipPercent.toFixed(2)}% chance of missing a test.`);
211+
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.`);
212212
return tasks.filter(t => !skippedTests.has(t.file));
213213
}
214214
else {
File renamed without changes.

0 commit comments

Comments
 (0)