( name: string, repoURL: string, subPaths: string[] )
| 475 | }; |
| 476 | |
| 477 | function bootstrapParserTests( |
| 478 | name: string, |
| 479 | repoURL: string, |
| 480 | subPaths: string[] |
| 481 | ) { |
| 482 | function getParserTestsCommit(id: string): string { |
| 483 | const content = readFileSync("./Makefile", "utf8"); |
| 484 | const commit = new RegExp(`${id}_COMMIT = (\\w{40})`).exec(content)![1]; |
| 485 | if (!commit) throw new Error(`Could not find ${id}_COMMIT in Makefile`); |
| 486 | return commit; |
| 487 | } |
| 488 | |
| 489 | const dir = "./build/" + name.toLowerCase(); |
| 490 | |
| 491 | shell.rm("-rf", dir); |
| 492 | console.log("mkdir -p build"); |
| 493 | mkdirSync("build", { recursive: true }); |
| 494 | |
| 495 | exec("git", [ |
| 496 | "clone", |
| 497 | "--filter=blob:none", |
| 498 | "--sparse", |
| 499 | "--depth", |
| 500 | "1", |
| 501 | "--revision=" + getParserTestsCommit(name), |
| 502 | repoURL, |
| 503 | dir, |
| 504 | ]); |
| 505 | |
| 506 | exec("git", ["sparse-checkout", "set", ...subPaths], dir); |
| 507 | } |
| 508 | |
| 509 | target["bootstrap-test262"] = function () { |
| 510 | bootstrapParserTests("TEST262", "https://github.com/tc39/test262.git", [ |
no test coverage detected