mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 03:23:08 -06:00
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.
This commit is contained in:
parent
41b117eda7
commit
fce7f9f87b
@ -25,7 +25,6 @@ async function main() {
|
||||
const percentTime = perf[k] / totalTime
|
||||
const percentHits = (1 + (edits[otherk] || 0)) / totalEdits
|
||||
const cost = 5 + Math.log(percentTime / percentHits)
|
||||
// TODO: Write counts instead of numbers to make JSON file smaller
|
||||
data.push({ name: otherk, time: perf[k], edits: 1 + (edits[otherk] || 0), cost})
|
||||
if (edits[otherk])
|
||||
i++
|
||||
@ -36,7 +35,7 @@ async function main() {
|
||||
data: data.sort((x,y) => y.cost - x.cost).map(x => ({ ...x, cost: x.cost.toFixed(2) }))
|
||||
}
|
||||
|
||||
fs.writeFileSync('.test-cost.json', JSON.stringify(output), 'utf8')
|
||||
fs.writeFileSync('tests/.test-cost.json', JSON.stringify(output), 'utf8')
|
||||
}
|
||||
|
||||
main().catch(e => {
|
||||
|
||||
@ -193,8 +193,8 @@ namespace Harness.Parallel.Host {
|
||||
}
|
||||
|
||||
function skipCostlyTests(tasks: Task[]) {
|
||||
if (statSync(".test-cost.json")) {
|
||||
const costs = JSON.parse(readFileSync(".test-cost.json", "utf8")) as {
|
||||
if (statSync("tests/.test-cost.json")) {
|
||||
const costs = JSON.parse(readFileSync("tests/.test-cost.json", "utf8")) as {
|
||||
totalTime: number,
|
||||
totalEdits: number,
|
||||
data: { name: string, time: number, edits: number, costs: number }[]
|
||||
@ -208,7 +208,7 @@ namespace Harness.Parallel.Host {
|
||||
skippedTime += costs.data[i].time;
|
||||
skippedTests.add(costs.data[i].name);
|
||||
}
|
||||
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.`);
|
||||
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.`);
|
||||
return tasks.filter(t => !skippedTests.has(t.file));
|
||||
}
|
||||
else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user