mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 21:53:42 -06:00
Merge pull request #19934 from Microsoft/add-starter-kit-to-user-tests
Add starter kit to user tests
This commit is contained in:
commit
7771d0c1fc
15
.gitmodules
vendored
Normal file
15
.gitmodules
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
[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
|
||||
[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
|
||||
[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
|
||||
[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
|
||||
[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
|
||||
@ -9,6 +9,10 @@ interface ExecResult {
|
||||
status: number;
|
||||
}
|
||||
|
||||
interface UserConfig {
|
||||
types: string[];
|
||||
}
|
||||
|
||||
abstract class ExternalCompileRunnerBase extends RunnerBase {
|
||||
abstract testDir: string;
|
||||
abstract report(result: ExecResult, cwd: string): string;
|
||||
@ -33,18 +37,34 @@ abstract class ExternalCompileRunnerBase extends RunnerBase {
|
||||
const cp = require("child_process");
|
||||
|
||||
it("should build successfully", () => {
|
||||
const cwd = path.join(__dirname, "../../", this.testDir, directoryName);
|
||||
let cwd = path.join(__dirname, "../../", this.testDir, directoryName);
|
||||
const timeout = 600000; // 600s = 10 minutes
|
||||
const stdio = isWorker ? "pipe" : "inherit";
|
||||
let types: string[];
|
||||
if (fs.existsSync(path.join(cwd, "test.json"))) {
|
||||
const update = cp.spawnSync("git", ["submodule", "update", "--remote"], { cwd, timeout, shell: true, stdio });
|
||||
if (update.status !== 0) throw new Error(`git submodule update for ${directoryName} failed!`);
|
||||
|
||||
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 = path.join(cwd, directoryName);
|
||||
}
|
||||
if (fs.existsSync(path.join(cwd, "package.json"))) {
|
||||
if (fs.existsSync(path.join(cwd, "package-lock.json"))) {
|
||||
fs.unlinkSync(path.join(cwd, "package-lock.json"));
|
||||
}
|
||||
const stdio = isWorker ? "pipe" : "inherit";
|
||||
const install = cp.spawnSync(`npm`, ["i"], { cwd, timeout, shell: true, stdio });
|
||||
if (install.status !== 0) throw new Error(`NPM Install for ${directoryName} failed!`);
|
||||
}
|
||||
const args = [path.join(__dirname, "tsc.js")];
|
||||
if (types) {
|
||||
args.push("--types", types.join(","));
|
||||
}
|
||||
args.push("--noEmit");
|
||||
Harness.Baseline.runBaseline(`${this.kind()}/${directoryName}.log`, () => {
|
||||
return this.report(cp.spawnSync(`node`, [path.join(__dirname, "tsc.js")], { cwd, timeout, shell: true }), cwd);
|
||||
return this.report(cp.spawnSync(`node`, args, { cwd, timeout, shell: true }), cwd);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
Exit Code: 2
|
||||
Exit Code: 1
|
||||
Standard output:
|
||||
node_modules/electron/electron.d.ts(5390,13): error TS2430: Interface 'WebviewTag' incorrectly extends interface 'HTMLElement'.
|
||||
Types of property 'addEventListener' are incompatible.
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
Exit Code: 2
|
||||
Exit Code: 1
|
||||
Standard output:
|
||||
node_modules/abstract-leveldown/index.d.ts(2,3): error TS7010: 'open', which lacks return-type annotation, implicitly has an 'any' return type.
|
||||
node_modules/abstract-leveldown/index.d.ts(3,3): error TS7010: 'open', which lacks return-type annotation, implicitly has an 'any' return type.
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
Exit Code: 2
|
||||
Exit Code: 1
|
||||
Standard output:
|
||||
node_modules/rxjs/scheduler/VirtualTimeScheduler.d.ts(22,22): error TS2415: Class 'VirtualAction<T>' incorrectly extends base class 'AsyncAction<T>'.
|
||||
Types of property 'work' are incompatible.
|
||||
|
||||
@ -0,0 +1 @@
|
||||
Subproject commit ed149eb0c787b1195a95b44105822c64bb6eb636
|
||||
3
tests/cases/user/TypeScript-Node-Starter/test.json
Normal file
3
tests/cases/user/TypeScript-Node-Starter/test.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"types": ["jquery"]
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
Subproject commit 2c62f5a4ea51978e3715b475e17962cdeca75e38
|
||||
@ -0,0 +1,3 @@
|
||||
{
|
||||
"types": ["jest"]
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
Subproject commit 96fb6237a9dda8d17059eea7fa7c22dd7db82c97
|
||||
3
tests/cases/user/TypeScript-React-Starter/test.json
Normal file
3
tests/cases/user/TypeScript-React-Starter/test.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"types": ["jest"]
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
Subproject commit 713c6986f043f2c31976b8bc2c03aa0a2b05590b
|
||||
3
tests/cases/user/TypeScript-Vue-Starter/test.json
Normal file
3
tests/cases/user/TypeScript-Vue-Starter/test.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"types": []
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
Subproject commit 5fca1032edaab5414ec1c167f42d3dc59220d9aa
|
||||
3
tests/cases/user/TypeScript-WeChat-Starter/test.json
Normal file
3
tests/cases/user/TypeScript-WeChat-Starter/test.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"types": []
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user