Conversation
Assumes that ../DefinitelyTyped holds the DefinitelyTyped repo.
1. Only `npm install` packages with a package.json 2. Add `workingDirectory` to runnerBase to differentiate input directory from output directory (which should be different for definitelyRunner). 3. Don't output anything on success.
|
By the way, for @Andy-MS, 31 of the 78 errors that DefinitelyTyped has when compiling on master were from missing lib entries from dependencies. The others are a random mish-mash of errors that have been introduced since 2.0. |
weswigham
left a comment
There was a problem hiding this comment.
Also, maybe dt instead of definitely mostly because I think t=dt is shorter and I'm liable to misspell t=definitely a few times.
| 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 }); |
There was a problem hiding this comment.
Should we delete a package-lock.json before running npm 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.
Ugggg. Is there a way not to emit package-lock.json? I'd rather do that instead.
There was a problem hiding this comment.
Nope! Guess I'll have to remove it!
|
If we're not committing the baselines, I suppose we have no interest in adding it to the daily cron build? Would this be something we'd be more comfortable with as like a weekly build? Or is it because the DT repo already has similar associated tests? |
|
we already have another test run going against DT. this one is more of a local validation after a change. |
src/harness/dtRunner.ts
Outdated
| public workingDirectory = DefinitelyTypedRunner.testDir; | ||
|
|
||
| public enumerateTestFiles() { | ||
| return Harness.IO.getDirectories(DefinitelyTypedRunner.testDir); |
There was a problem hiding this comment.
do you want to add an assert here or something to let users know that DefinitllyTyped was not found in the expected place instead of silently not running any tests.
src/harness/dtRunner.ts
Outdated
| public workingDirectory = DefinitelyTypedRunner.testDir; | ||
|
|
||
| public enumerateTestFiles() { | ||
| return Harness.IO.getDirectories(DefinitelyTypedRunner.testDir); |
There was a problem hiding this comment.
It might be worth throwing an error if DefinitelyTypedRunner.testDir is empty/does not exist (rather than the usual behavior of getDirectories, which I believe just produces undefined or an empty list). After all, without that, an empty or missing folder is a passing DT suite, which could be misleading if you run this with DefinitelyTyped cloned in the wrong location.
There was a problem hiding this comment.
Turns out getDirectories throws already, which I think is good enough.
There was a problem hiding this comment.
Why does a function called enumerateTestFiles return a list of directories?
|
@Andy-MS can you take a look as well. |
| // Read in and evaluate the test list | ||
| const testList = this.tests && this.tests.length ? this.tests : this.enumerateTestFiles(); | ||
|
|
||
| describe(`${this.kind()} code samples`, () => { |
There was a problem hiding this comment.
This looks like code copied from elsewhere -- can you just inherit?
src/harness/dtRunner.ts
Outdated
| } | ||
| Harness.Baseline.runBaseline(`${this.kind()}/${directoryName}.log`, () => { | ||
| const result = cp.spawnSync(`node`, [path.join(__dirname, "tsc.js")], { cwd, timeout, shell: true }); | ||
| // tslint:disable:no-null-keyword |
There was a problem hiding this comment.
Nit: use // tslint:disable-next-line, and indent it with the other statements.
Also, can this code be shared with code elsewhere?
src/harness/tsconfig.json
Outdated
| "loggedIO.ts", | ||
| "rwcRunner.ts", | ||
| "userRunner.ts", | ||
| "definitelyRunner.ts", |
There was a problem hiding this comment.
The file you added is named dtRunner instead, which implies this isn't being used?
|
OK, I pulled everything up into a superclass except a couple of properties. I stuck all three classes in one file since the subclasses are now, essentially, just pieces of configuration (that still needs to be |
src/harness/externalCompileRunner.ts
Outdated
| } | ||
| } | ||
|
|
||
| class DefinitelyTypedRunner extends ExternalCompileRunnerBase { |
There was a problem hiding this comment.
This is starting to look like it should be just another instance of a class instead of its own class.
There was a problem hiding this comment.
True, except that Wesley is shortly going to want to put in more code into the UserCodeRunner, and I already need to put more code into the DefinitelyTypedRunner to skip ExpectErrors. I'll keep it the way it is for now and we can simplify later if neither of those efforts work out.
src/harness/externalCompileRunner.ts
Outdated
| Harness.Baseline.runBaseline(`${this.kind()}/${directoryName}.log`, () => { | ||
| const result = cp.spawnSync(`node`, [path.join(__dirname, "tsc.js")], { cwd, timeout, shell: true }); | ||
| // tslint:disable-next-line:no-null-keyword | ||
| return result.status === 0 ? null : `Exit Code: ${result.status} |
There was a problem hiding this comment.
As mentioned in person, check result.status and result.stdout and result.stderr instead of just result.status - we want to capture any output even when we report success.
I've got git problems and I'm not even on Windows!
| "loggedIO.ts", | ||
| "rwcRunner.ts", | ||
| "userRunner.ts", | ||
| "externalCompileRunner.ts", |
There was a problem hiding this comment.
Jakefile, but not gulp?
The official TS homepage refers to gulp. Does it mean both gulp/jake need to be used, depending on area of the project?
There was a problem hiding this comment.
If they don't behave the same it's a bug.
There was a problem hiding this comment.
Gulp uses the tsconfig edited below.
Adds a test runner that compiles DefinitelyTyped packages with the currently built compiler. You must have a DefinitelyTyped repo named
DefinitelyTypednext to your Typescript repo.The test only outputs a log file to
baselines/local/definitely/when there is a failure. Currently about 75 packages have compile failures. I expect this number to fluctuate up and down rapidly based on DefinitelyTyped's amount of traffic, so I have not included the baselines here, after discussion with @mhegazy. A run takes about 15 minutes on my machine, so it's simple, if slow, to baseline from master when needed.I just tested on #17765 and the experience is many times better and faster than the shell scripts I used before.