Skip to content

Commit

Permalink
Remove all submodules - just force clone and reset on run instead (#3…
Browse files Browse the repository at this point in the history
  • Loading branch information
weswigham authored Sep 13, 2019
1 parent 99229f8 commit 038d951
Show file tree
Hide file tree
Showing 23 changed files with 29 additions and 54 deletions.
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,14 @@ tests/cases/user/*/**/*.d.ts
tests/baselines/reference/dt
.failed-tests
TEST-results.xml
package-lock.json
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
40 changes: 0 additions & 40 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -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
11 changes: 8 additions & 3 deletions src/testRunner/externalCompileRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ interface ExecResult {

interface UserConfig {
types: string[];
cloneUrl: string;
path?: string;
}

Expand Down Expand Up @@ -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 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", ["submodule", "update", "--init", "--remote", "."], { cwd: originalCwd });
exec("git", ["pull", "-f"], { cwd: submoduleDir });

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.");
types = config.types;

cwd = config.path ? path.join(cwd, config.path) : submoduleDir;
Expand Down
Submodule TypeScript-Node-Starter deleted from ca14e7
1 change: 1 addition & 0 deletions tests/cases/user/TypeScript-Node-Starter/test.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"cloneUrl": "https://github.com/Microsoft/TypeScript-Node-Starter.git",
"types": ["jquery"]
}
Submodule TypeScript-React-Native-Starter deleted from 30acce
1 change: 1 addition & 0 deletions tests/cases/user/TypeScript-React-Native-Starter/test.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"cloneUrl": "https://github.com/Microsoft/TypeScript-React-Native-Starter.git",
"types": ["jest"],
"path": "TypeScript-React-Native-Starter/ExampleProject"
}
Submodule TypeScript-React-Starter deleted from 19c71f
1 change: 1 addition & 0 deletions tests/cases/user/TypeScript-React-Starter/test.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"cloneUrl": "https://github.com/Microsoft/TypeScript-React-Starter",
"types": ["jest", "node"]
}
Submodule TypeScript-Vue-Starter deleted from 56024c
1 change: 1 addition & 0 deletions tests/cases/user/TypeScript-Vue-Starter/test.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"cloneUrl": "https://github.com/Microsoft/TypeScript-Vue-Starter.git",
"types": []
}
Submodule TypeScript-WeChat-Starter deleted from 3fb8b4
1 change: 1 addition & 0 deletions tests/cases/user/TypeScript-WeChat-Starter/test.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"cloneUrl": "https://github.com/Microsoft/TypeScript-React-Starter",
"types": []
}
1 change: 0 additions & 1 deletion tests/cases/user/axios-src/axios-src
Submodule axios-src deleted from d74385
1 change: 1 addition & 0 deletions tests/cases/user/axios-src/test.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"cloneUrl": "https://github.com/axios/axios.git",
"types": ["node"]
}
1 change: 0 additions & 1 deletion tests/cases/user/create-react-app/create-react-app
Submodule create-react-app deleted from 74eb65
1 change: 1 addition & 0 deletions tests/cases/user/create-react-app/test.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"cloneUrl": "https://github.com/facebook/create-react-app.git",
"types": []
}
1 change: 0 additions & 1 deletion tests/cases/user/prettier/prettier
Submodule prettier deleted from e83b45
1 change: 1 addition & 0 deletions tests/cases/user/prettier/test.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"cloneUrl": "https://github.com/prettier/prettier.git",
"types": ["node"]
}
1 change: 0 additions & 1 deletion tests/cases/user/puppeteer/puppeteer
Submodule puppeteer deleted from a5f03c
1 change: 1 addition & 0 deletions tests/cases/user/puppeteer/test.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"cloneUrl": "https://github.com/GoogleChrome/puppeteer.git",
"types": []
}
1 change: 1 addition & 0 deletions tests/cases/user/webpack/test.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"cloneUrl": "https://github.com/webpack/webpack.git",
"types": []
}
1 change: 0 additions & 1 deletion tests/cases/user/webpack/webpack
Submodule webpack deleted from e4c7d8

0 comments on commit 038d951

Please sign in to comment.