Skip to content

External runner fixes #24115

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 3 commits into from
May 15, 2018
Merged

Conversation

weswigham
Copy link
Member

Follow up to #24100, which I'll now close.

Fixes #24104
Fixes #24105

The tests didn't need typeRoots, unfortunately (that only affects implicit inclusion) - they needed all parent node_modules fully removed from the tree. (Which then showed how we were failing to include @types/node actually in a bunch of projects, which now do.) Also, the diagnostics are now sorted in case-sensitive path order (if they have a path - otherwise they should stay wherever they are - usually at the top), so the baseline file should match between platforms. I hope.

@@ -27,9 +28,32 @@ abstract class ExternalCompileRunnerBase extends RunnerBase {
const testList = this.tests && this.tests.length ? this.tests : this.enumerateTestFiles();

describe(`${this.kind()} code samples`, () => {
const cwd = path.join(Harness.IO.getWorkspaceRoot(), this.testDir);
const placeholderName = ".node_modules";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just add a types: [..] list?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They have one already. That only says which things get auto-included without even doing an import, but the issue here is when i say const x = require("chalk") and we walk up the tree and find ours when we can't find it locally. 🌞

Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few questions

try {
fs.renameSync(path.join(dir, moduleDirName), path.join(dir, placeholderName));
}
catch {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why catch here, at least with nothing in the body?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't care if the rename fails (since it means the folder didn't exist or we didn't have permissions to rename - in either case we're just going to continue)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, as long as the failure is obvious (and linkable back to this line of code) some other way. I think in this case it will be obvious in the baselines.

@@ -2,6 +2,7 @@
/// <reference path="runnerbase.ts" />
const fs = require("fs");
const path = require("path");
const del = require("del");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why change this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it's required before I renamed node_modules and make it unreachable.

@@ -0,0 +1,12 @@
Exit Code: 1
Standard output:
node_modules/log4js/types/log4js.d.ts(4,2): error TS7008: Member 'getLogger' implicitly has an 'any' type.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did these error before?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean why didn't they?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. 👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -91,7 +119,7 @@ class UserCodeRunner extends ExternalCompileRunnerBase {
// tslint:disable-next-line:no-null-keyword
return result.status === 0 && !result.stdout.length && !result.stderr.length ? null : `Exit Code: ${result.status}
Standard output:
${stripAbsoluteImportPaths(result.stdout.toString().replace(/\r\n/g, "\n"))}
${sortErrors(stripAbsoluteImportPaths(result.stdout.toString().replace(/\r\n/g, "\n")))}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this change address the path changes (eg from E:/... to /opt/...)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They were already fixed by the stripAbsoluteImportPaths function - the only one that remained was one from outside the test directly, which shouldn't have been in the test in the first place (and is now gone).

@weswigham weswigham merged commit 5756ae1 into microsoft:master May 15, 2018
@weswigham weswigham deleted the external-runner-fixes branch May 15, 2018 18:15
sandersn pushed a commit that referenced this pull request May 16, 2018
* Add missing @types/node dep to so many projects, rename parent node_modules dirs so they dont participate in tests, sort errors

* Accept new baselines

* Satisfy linter
@microsoft microsoft locked and limited conversation to collaborators Jul 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

User test baselines need to set typeRoots User test baselines need to be capturable independently of platform case
4 participants