Skip to content

Remove all submodules - just force clone and reset on run instead #33425

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

Merged
merged 1 commit into from
Sep 13, 2019
Merged
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: 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