Skip to content

External runner fixes#24115

Merged
weswigham merged 3 commits into
microsoft:masterfrom
weswigham:external-runner-fixes
May 15, 2018
Merged

External runner fixes#24115
weswigham merged 3 commits into
microsoft:masterfrom
weswigham:external-runner-fixes

Conversation

@weswigham
Copy link
Copy Markdown
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.


describe(`${this.kind()} code samples`, () => {
const cwd = path.join(Harness.IO.getWorkspaceRoot(), this.testDir);
const placeholderName = ".node_modules";
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

/// <reference path="runnerbase.ts" />
const fs = require("fs");
const path = require("path");
const del = require("del");
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes. 👍

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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
Copy Markdown
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
Copy Markdown
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