Skip to content

Commit 595b194

Browse files
committed
Add broccoli-typescript-compiler test
1 parent 772bee5 commit 595b194

File tree

3 files changed

+1391
-1
lines changed

3 files changed

+1391
-1
lines changed

src/testRunner/externalCompileRunner.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,22 @@ class DockerfileRunner extends ExternalCompileRunnerBase {
119119
const cls = this;
120120
describe(`${this.kind()} code samples`, function(this: Mocha.ISuiteCallbackContext) {
121121
this.timeout(cls.timeout); // 20 minutes
122+
let tsRev: string;
122123
before(() => {
124+
const cp: typeof import("child_process") = require("child_process");
125+
const revOut = cp.spawnSync("git", ["rev-parse", "HEAD"], { cwd: Harness.IO.getWorkspaceRoot() });
126+
if (revOut.status !== 0) {
127+
throw new Error(`git rev-parse failed with output: ${revOut.stderr && revOut.stderr.toString()}`);
128+
}
129+
tsRev = revOut.stdout.toString().trim();
123130
cls.exec("docker", ["build", ".", "-t", "typescript/typescript"], { cwd: Harness.IO.getWorkspaceRoot() }); // cached because workspace is hashed to determine cacheability
124131
});
125132
for (const test of testList) {
126133
const directory = typeof test === "string" ? test : test.file;
127134
const cwd = path.join(Harness.IO.getWorkspaceRoot(), cls.testDir, directory);
128135
it(`should build ${directory} successfully`, () => {
129136
const imageName = `tstest/${directory}`;
130-
cls.exec("docker", ["build", "--no-cache", ".", "-t", imageName], { cwd }); // --no-cache so the latest version of the repos referenced is always fetched
137+
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
131138
const cp: typeof import("child_process") = require("child_process");
132139
Harness.Baseline.runBaseline(`${cls.kind()}/${directory}.log`, cls.report(cp.spawnSync(`docker`, ["run", imageName], { cwd, timeout: cls.timeout, shell: true })));
133140
});

0 commit comments

Comments
 (0)