diff --git a/.gitignore b/.gitignore index a220522b5f..da24307954 100644 --- a/.gitignore +++ b/.gitignore @@ -81,4 +81,14 @@ tests/cases/user/*/**/*.d.ts tests/baselines/reference/dt .failed-tests TEST-results.xml -package-lock.json \ No newline at end of file +package-lock.json +tests/cases/user/TypeScript-React-Starter/TypeScript-React-Starter +tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter +tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter +tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter +tests/cases/user/TypeScript-WeChat-Starter/TypeScript-WeChat-Starter +tests/cases/user/create-react-app/create-react-app +tests/cases/user/webpack/webpack +tests/cases/user/puppeteer/puppeteer +tests/cases/user/axios-src/axios-src +tests/cases/user/prettier/prettier \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index 0e4e0b3ed7..e69de29bb2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,40 +0,0 @@ -[submodule "tests/cases/user/TypeScript-React-Starter/TypeScript-React-Starter"] - path = tests/cases/user/TypeScript-React-Starter/TypeScript-React-Starter - url = https://github.com/Microsoft/TypeScript-React-Starter - ignore = all -[submodule "tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter"] - path = tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter - url = https://github.com/Microsoft/TypeScript-Node-Starter.git - ignore = all -[submodule "tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter"] - path = tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter - url = https://github.com/Microsoft/TypeScript-React-Native-Starter.git - ignore = all -[submodule "tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter"] - path = tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter - url = https://github.com/Microsoft/TypeScript-Vue-Starter.git - ignore = all -[submodule "tests/cases/user/TypeScript-WeChat-Starter/TypeScript-WeChat-Starter"] - path = tests/cases/user/TypeScript-WeChat-Starter/TypeScript-WeChat-Starter - url = https://github.com/Microsoft/TypeScript-WeChat-Starter.git - ignore = all -[submodule "tests/cases/user/create-react-app/create-react-app"] - path = tests/cases/user/create-react-app/create-react-app - url = https://github.com/facebook/create-react-app.git - ignore = all -[submodule "tests/cases/user/webpack/webpack"] - path = tests/cases/user/webpack/webpack - url = https://github.com/webpack/webpack.git - ignore = all -[submodule "tests/cases/user/puppeteer/puppeteer"] - path = tests/cases/user/puppeteer/puppeteer - url = https://github.com/GoogleChrome/puppeteer.git - ignore = all -[submodule "tests/cases/user/axios-src/axios-src"] - path = tests/cases/user/axios-src/axios-src - url = https://github.com/axios/axios.git - ignore = all -[submodule "tests/cases/user/prettier/prettier"] - path = tests/cases/user/prettier/prettier - url = https://github.com/prettier/prettier.git - ignore = all diff --git a/src/testRunner/externalCompileRunner.ts b/src/testRunner/externalCompileRunner.ts index c9e800713c..7698fc3f08 100644 --- a/src/testRunner/externalCompileRunner.ts +++ b/src/testRunner/externalCompileRunner.ts @@ -10,6 +10,7 @@ interface ExecResult { interface UserConfig { types: string[]; + cloneUrl: string; path?: string; } @@ -49,13 +50,17 @@ abstract class ExternalCompileRunnerBase extends RunnerBase { const stdio = isWorker ? "pipe" : "inherit"; let types: string[] | undefined; if (fs.existsSync(path.join(cwd, "test.json"))) { - const submoduleDir = path.join(cwd, directoryName); - exec("git", ["reset", "HEAD", "--hard"], { cwd: submoduleDir }); - exec("git", ["clean", "-f"], { cwd: submoduleDir }); - exec("git", ["submodule", "update", "--init", "--remote", "."], { cwd: originalCwd }); - const config = JSON.parse(fs.readFileSync(path.join(cwd, "test.json"), { encoding: "utf8" })) as UserConfig; ts.Debug.assert(!!config.types, "Bad format from test.json: Types field must be present."); + 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", ["reset", "HEAD", "--hard"], { cwd: submoduleDir }); + exec("git", ["clean", "-f"], { cwd: submoduleDir }); + exec("git", ["pull", "-f"], { cwd: submoduleDir }); + types = config.types; cwd = config.path ? path.join(cwd, config.path) : submoduleDir; diff --git a/tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter b/tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter deleted file mode 160000 index ca14e7ccbc..0000000000 --- a/tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ca14e7ccbca8a821d3b860ebb6f3c81c68ccbd06 diff --git a/tests/cases/user/TypeScript-Node-Starter/test.json b/tests/cases/user/TypeScript-Node-Starter/test.json index 11d2aa87c5..c37bf34ad1 100644 --- a/tests/cases/user/TypeScript-Node-Starter/test.json +++ b/tests/cases/user/TypeScript-Node-Starter/test.json @@ -1,3 +1,4 @@ { + "cloneUrl": "https://github.com/Microsoft/TypeScript-Node-Starter.git", "types": ["jquery"] } diff --git a/tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter b/tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter deleted file mode 160000 index 30acce5e13..0000000000 --- a/tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 30acce5e136e86bcf4eff1df151742f78142aa1a diff --git a/tests/cases/user/TypeScript-React-Native-Starter/test.json b/tests/cases/user/TypeScript-React-Native-Starter/test.json index cbe38c569e..a87cd1ed89 100644 --- a/tests/cases/user/TypeScript-React-Native-Starter/test.json +++ b/tests/cases/user/TypeScript-React-Native-Starter/test.json @@ -1,4 +1,5 @@ { + "cloneUrl": "https://github.com/Microsoft/TypeScript-React-Native-Starter.git", "types": ["jest"], "path": "TypeScript-React-Native-Starter/ExampleProject" } diff --git a/tests/cases/user/TypeScript-React-Starter/TypeScript-React-Starter b/tests/cases/user/TypeScript-React-Starter/TypeScript-React-Starter deleted file mode 160000 index 19c71f2c6a..0000000000 --- a/tests/cases/user/TypeScript-React-Starter/TypeScript-React-Starter +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 19c71f2c6a2b874b1b2bb28a8526b19185b8eece diff --git a/tests/cases/user/TypeScript-React-Starter/test.json b/tests/cases/user/TypeScript-React-Starter/test.json index f3613bf3b0..caa97357cb 100644 --- a/tests/cases/user/TypeScript-React-Starter/test.json +++ b/tests/cases/user/TypeScript-React-Starter/test.json @@ -1,3 +1,4 @@ { + "cloneUrl": "https://github.com/Microsoft/TypeScript-React-Starter", "types": ["jest", "node"] } diff --git a/tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter b/tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter deleted file mode 160000 index 56024cfe41..0000000000 --- a/tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 56024cfe414491a9097e9dd33661a5ad5d51d975 diff --git a/tests/cases/user/TypeScript-Vue-Starter/test.json b/tests/cases/user/TypeScript-Vue-Starter/test.json index e0d4d26bdc..4504c4c1cd 100644 --- a/tests/cases/user/TypeScript-Vue-Starter/test.json +++ b/tests/cases/user/TypeScript-Vue-Starter/test.json @@ -1,3 +1,4 @@ { + "cloneUrl": "https://github.com/Microsoft/TypeScript-Vue-Starter.git", "types": [] } diff --git a/tests/cases/user/TypeScript-WeChat-Starter/TypeScript-WeChat-Starter b/tests/cases/user/TypeScript-WeChat-Starter/TypeScript-WeChat-Starter deleted file mode 160000 index 3fb8b46010..0000000000 --- a/tests/cases/user/TypeScript-WeChat-Starter/TypeScript-WeChat-Starter +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3fb8b4601022f7e2df899eb0ac0178f531e6f027 diff --git a/tests/cases/user/TypeScript-WeChat-Starter/test.json b/tests/cases/user/TypeScript-WeChat-Starter/test.json index e0d4d26bdc..92c47595d1 100644 --- a/tests/cases/user/TypeScript-WeChat-Starter/test.json +++ b/tests/cases/user/TypeScript-WeChat-Starter/test.json @@ -1,3 +1,4 @@ { + "cloneUrl": "https://github.com/Microsoft/TypeScript-React-Starter", "types": [] } diff --git a/tests/cases/user/axios-src/axios-src b/tests/cases/user/axios-src/axios-src deleted file mode 160000 index d74385f1c8..0000000000 --- a/tests/cases/user/axios-src/axios-src +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d74385f1c8f944a6d94ae0680d3841859a2fcb38 diff --git a/tests/cases/user/axios-src/test.json b/tests/cases/user/axios-src/test.json index b6495a1b80..36c01c495b 100644 --- a/tests/cases/user/axios-src/test.json +++ b/tests/cases/user/axios-src/test.json @@ -1,3 +1,4 @@ { + "cloneUrl": "https://github.com/axios/axios.git", "types": ["node"] } diff --git a/tests/cases/user/create-react-app/create-react-app b/tests/cases/user/create-react-app/create-react-app deleted file mode 160000 index 74eb65a462..0000000000 --- a/tests/cases/user/create-react-app/create-react-app +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 74eb65a46269d5c2cc5483841e271281477c650e diff --git a/tests/cases/user/create-react-app/test.json b/tests/cases/user/create-react-app/test.json index e0d4d26bdc..98888de7fd 100644 --- a/tests/cases/user/create-react-app/test.json +++ b/tests/cases/user/create-react-app/test.json @@ -1,3 +1,4 @@ { + "cloneUrl": "https://github.com/facebook/create-react-app.git", "types": [] } diff --git a/tests/cases/user/prettier/prettier b/tests/cases/user/prettier/prettier deleted file mode 160000 index e83b4537fe..0000000000 --- a/tests/cases/user/prettier/prettier +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e83b4537feaa6c063a1598b8d3972b6ad600f2a7 diff --git a/tests/cases/user/prettier/test.json b/tests/cases/user/prettier/test.json index b6495a1b80..7b04123842 100644 --- a/tests/cases/user/prettier/test.json +++ b/tests/cases/user/prettier/test.json @@ -1,3 +1,4 @@ { + "cloneUrl": "https://github.com/prettier/prettier.git", "types": ["node"] } diff --git a/tests/cases/user/puppeteer/puppeteer b/tests/cases/user/puppeteer/puppeteer deleted file mode 160000 index a5f03ce1c8..0000000000 --- a/tests/cases/user/puppeteer/puppeteer +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a5f03ce1c85c2630739f2a894a303c68632aa250 diff --git a/tests/cases/user/puppeteer/test.json b/tests/cases/user/puppeteer/test.json index e0d4d26bdc..f2e61aca5f 100644 --- a/tests/cases/user/puppeteer/test.json +++ b/tests/cases/user/puppeteer/test.json @@ -1,3 +1,4 @@ { + "cloneUrl": "https://github.com/GoogleChrome/puppeteer.git", "types": [] } diff --git a/tests/cases/user/webpack/test.json b/tests/cases/user/webpack/test.json index e0d4d26bdc..a3fcf317a7 100644 --- a/tests/cases/user/webpack/test.json +++ b/tests/cases/user/webpack/test.json @@ -1,3 +1,4 @@ { + "cloneUrl": "https://github.com/webpack/webpack.git", "types": [] } diff --git a/tests/cases/user/webpack/webpack b/tests/cases/user/webpack/webpack deleted file mode 160000 index e4c7d8c0ae..0000000000 --- a/tests/cases/user/webpack/webpack +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e4c7d8c0ae0c93306f07920bc28fe72119bc098a