diff --git a/src/testRunner/externalCompileRunner.ts b/src/testRunner/externalCompileRunner.ts index 91f77faaf0d64..890ba6c43ca11 100644 --- a/src/testRunner/externalCompileRunner.ts +++ b/src/testRunner/externalCompileRunner.ts @@ -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; @@ -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)); diff --git a/tests/baselines/reference/user/TypeScript-Vue-Starter.log b/tests/baselines/reference/user/TypeScript-Vue-Starter.log deleted file mode 100644 index 99bf7df534e75..0000000000000 --- a/tests/baselines/reference/user/TypeScript-Vue-Starter.log +++ /dev/null @@ -1,9 +0,0 @@ -Exit Code: 1 -Standard output: -src/components/Hello.spec.ts(4,1): error TS2593: Cannot find name 'describe'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig. -src/components/Hello.spec.ts(5,3): error TS2593: Cannot find name 'it'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig. -src/components/Hello.spec.ts(14,5): error TS2304: Cannot find name 'expect'. - - - -Standard error: diff --git a/tests/cases/user/TypeScript-React-Starter/test.json b/tests/cases/user/TypeScript-React-Starter/test.json index caa97357cb741..98d38680468fb 100644 --- a/tests/cases/user/TypeScript-React-Starter/test.json +++ b/tests/cases/user/TypeScript-React-Starter/test.json @@ -1,4 +1,4 @@ { - "cloneUrl": "https://github.com/Microsoft/TypeScript-React-Starter", + "cloneUrl": "https://github.com/Microsoft/TypeScript-React-Starter.git", "types": ["jest", "node"] } diff --git a/tests/cases/user/TypeScript-Vue-Starter/test.json b/tests/cases/user/TypeScript-Vue-Starter/test.json index 4504c4c1cd515..ca7390f56390d 100644 --- a/tests/cases/user/TypeScript-Vue-Starter/test.json +++ b/tests/cases/user/TypeScript-Vue-Starter/test.json @@ -1,4 +1,4 @@ { "cloneUrl": "https://github.com/Microsoft/TypeScript-Vue-Starter.git", - "types": [] + "types": ["jest"] } diff --git a/tests/cases/user/TypeScript-WeChat-Starter/test.json b/tests/cases/user/TypeScript-WeChat-Starter/test.json index 92c47595d1a3b..fbcd73f2c12b5 100644 --- a/tests/cases/user/TypeScript-WeChat-Starter/test.json +++ b/tests/cases/user/TypeScript-WeChat-Starter/test.json @@ -1,4 +1,4 @@ { - "cloneUrl": "https://github.com/Microsoft/TypeScript-React-Starter", + "cloneUrl": "https://github.com/Microsoft/TypeScript-WeChat-Starter.git", "types": [] }