Skip to content

User test runner improvements #35363

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
wants to merge 1 commit into from
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
12 changes: 7 additions & 5 deletions src/testRunner/externalCompileRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ namespace Harness {
ts.Debug.assert(!!config.cloneUrl, "Bad format from test.json: cloneUrl field must be present.");
const submoduleDir = path.join(cwd, directoryName);
if (!fs.existsSync(submoduleDir)) {
exec("git", ["clone", config.cloneUrl, directoryName], { cwd });
exec("git", ["--work-tree", submoduleDir, "clone", config.cloneUrl, path.join(submoduleDir, ".git")], { cwd });
}
else {
exec("git", ["reset", "HEAD", "--hard"], { cwd: submoduleDir });
exec("git", ["clean", "-f"], { cwd: submoduleDir });
exec("git", ["pull", "-f"], { cwd: submoduleDir });
exec("git", ["--git-dir", path.join(submoduleDir, ".git"), "--work-tree", submoduleDir, "checkout", ":/"], { cwd: submoduleDir });
exec("git", ["--git-dir", path.join(submoduleDir, ".git"), "--work-tree", submoduleDir, "clean", "--force"], { cwd: submoduleDir });
exec("git", ["--git-dir", path.join(submoduleDir, ".git"), "--work-tree", submoduleDir, "pull"], { cwd: submoduleDir });
}

types = config.types;
Expand All @@ -81,7 +81,9 @@ namespace Harness {
if (types) {
args.push("--types", types.join(","));
// Also actually install those types (for, eg, the js projects which need node)
exec("npm", ["i", ...types.map(t => `@types/${t}`), "--no-save", "--ignore-scripts"], { cwd: originalCwd, timeout: timeout / 2 }); // NPM shouldn't take the entire timeout - if it takes a long time, it should be terminated and we should log the failure
if (types.length) {
exec("npm", ["i", ...types.map(t => `@types/${t}`), "--no-save", "--ignore-scripts"], { cwd: originalCwd, timeout: timeout / 2 }); // NPM shouldn't take the entire timeout - if it takes a long time, it should be terminated and we should log the failure
}
}
args.push("--noEmit");
Baseline.runBaseline(`${cls.kind()}/${directoryName}.log`, cls.report(cp.spawnSync(`node`, args, { cwd, timeout, shell: true }), cwd));
Expand Down
9 changes: 0 additions & 9 deletions tests/baselines/reference/user/TypeScript-Vue-Starter.log

This file was deleted.

2 changes: 1 addition & 1 deletion tests/cases/user/TypeScript-React-Starter/test.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"cloneUrl": "https://github.com/Microsoft/TypeScript-React-Starter",
"cloneUrl": "https://github.com/Microsoft/TypeScript-React-Starter.git",
"types": ["jest", "node"]
}
2 changes: 1 addition & 1 deletion tests/cases/user/TypeScript-Vue-Starter/test.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"cloneUrl": "https://github.com/Microsoft/TypeScript-Vue-Starter.git",
"types": []
"types": ["jest"]
}
2 changes: 1 addition & 1 deletion tests/cases/user/TypeScript-WeChat-Starter/test.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"cloneUrl": "https://github.com/Microsoft/TypeScript-React-Starter",
"cloneUrl": "https://github.com/Microsoft/TypeScript-WeChat-Starter.git",
"types": []
}