Skip to content

Add broccoli-typescript-compiler test #32564

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/testRunner/externalCompileRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,22 @@ ${stripAbsoluteImportPaths(result.stderr.toString().replace(/\r\n/g, "\n"))}`;
const cls = this;
describe(`${this.kind()} code samples`, function (this: Mocha.ISuiteCallbackContext) {
this.timeout(cls.timeout); // 20 minutes
let tsRev: string;
before(() => {
const cp: typeof import("child_process") = require("child_process");
const revOut = cp.spawnSync("git", ["rev-parse", "HEAD"], { cwd: Harness.IO.getWorkspaceRoot() });
if (revOut.status !== 0) {
throw new Error(`git rev-parse failed with output: ${revOut.stderr && revOut.stderr.toString()}`);
}
tsRev = revOut.stdout.toString().trim();
cls.exec("docker", ["build", ".", "-t", "typescript/typescript"], { cwd: IO.getWorkspaceRoot() }); // cached because workspace is hashed to determine cacheability
});
for (const test of testList) {
const directory = typeof test === "string" ? test : test.file;
const cwd = path.join(IO.getWorkspaceRoot(), cls.testDir, directory);
it(`should build ${directory} successfully`, () => {
const imageName = `tstest/${directory}`;
cls.exec("docker", ["build", "--no-cache", ".", "-t", imageName], { cwd }); // --no-cache so the latest version of the repos referenced is always fetched
cls.exec("docker", ["build", "--no-cache", ".", "-t", imageName, "--build-arg", `TS_SHA=${tsRev}`], { cwd }); // --no-cache so the latest version of the repos referenced is always fetched
const cp: typeof import("child_process") = require("child_process");
Baseline.runBaseline(`${cls.kind()}/${directory}.log`, cls.report(cp.spawnSync(`docker`, ["run", imageName], { cwd, timeout: cls.timeout, shell: true })));
});
Expand Down Expand Up @@ -337,4 +344,4 @@ ${stderr.replace(/\r\n/g, "\n")}`;
}
return result;
}
}
}
Loading