-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Add DefinitelyTyped runner #19815
Merged
Merged
Add DefinitelyTyped runner #19815
Changes from 3 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e6c38bf
Add DefinitelyTyped test runner
sandersn f2d4b36
Update Jakefile with definitelyRunner.ts
sandersn 9a415a2
DefinitelyRunner cleanup and speedup
sandersn 2378ff3
Fix lint and allow null keyword
sandersn 88a31d6
Change runner name from 'definitely' to 'dt'
sandersn 5e5b565
Remove package-lock.json before `npm install`
sandersn d64a8f6
Refactor user+dt runners into externalCompilerRunner
sandersn 397b549
Remove positive baselines for user tests
sandersn bb79308
Use CRLF and emit test output for stdout/stderr
sandersn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/// <reference path="harness.ts"/> | ||
/// <reference path="runnerbase.ts" /> | ||
class DefinitelyTypedRunner extends RunnerBase { | ||
private static readonly testDir = "../DefinitelyTyped/types/"; | ||
|
||
public workingDirectory = DefinitelyTypedRunner.testDir; | ||
|
||
public enumerateTestFiles() { | ||
return Harness.IO.getDirectories(DefinitelyTypedRunner.testDir); | ||
} | ||
|
||
public kind(): TestRunnerKind { | ||
return "definitely"; | ||
} | ||
|
||
/** Setup the runner's tests so that they are ready to be executed by the harness | ||
* The first test should be a describe/it block that sets up the harness's compiler instance appropriately | ||
*/ | ||
public initializeTests(): void { | ||
// Read in and evaluate the test list | ||
const testList = this.tests && this.tests.length ? this.tests : this.enumerateTestFiles(); | ||
|
||
describe(`${this.kind()} code samples`, () => { | ||
for (const test of testList) { | ||
this.runTest(test); | ||
} | ||
}); | ||
} | ||
|
||
private runTest(directoryName: string) { | ||
describe(directoryName, () => { | ||
const cp = require("child_process"); | ||
const path = require("path"); | ||
const fs = require("fs"); | ||
|
||
it("should build successfully", () => { | ||
const cwd = path.join(__dirname, "../../", DefinitelyTypedRunner.testDir, directoryName); | ||
const timeout = 600000; // 600s = 10 minutes | ||
if (fs.existsSync(path.join(cwd, 'package.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!`); | ||
} | ||
Harness.Baseline.runBaseline(`${this.kind()}/${directoryName}.log`, () => { | ||
const result = cp.spawnSync(`node`, [path.join(__dirname, "tsc.js")], { cwd, timeout, shell: true }); | ||
return result.status === 0 ? null : `Exit Code: ${result.status} | ||
Standard output: | ||
${result.stdout.toString().replace(/\r\n/g, "\n")} | ||
|
||
|
||
Standard error: | ||
${result.stderr.toString().replace(/\r\n/g, "\n")}`; | ||
}); | ||
}); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,6 +93,7 @@ | |
"loggedIO.ts", | ||
"rwcRunner.ts", | ||
"userRunner.ts", | ||
"definitelyRunner.ts", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The file you added is named There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just by gulp. Fixed. |
||
"test262Runner.ts", | ||
"./parallel/shared.ts", | ||
"./parallel/host.ts", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we delete a
package-lock.json
before runningnpm i
? As is, if a DT package updates a dep, I don't think it'd get tested here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugggg. Is there a way not to emit
package-lock.json
? I'd rather do that instead.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope! Guess I'll have to remove it!