Skip to content

Add tests #1408

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

Closed
wants to merge 10 commits into from
Closed

Add tests #1408

wants to merge 10 commits into from

Conversation

willemneal
Copy link
Contributor

No description provided.

@willemneal willemneal mentioned this pull request Jul 23, 2020
1 task
@dcodeIO
Copy link
Member

dcodeIO commented Jul 24, 2020

Thanks, looks good! Just one question above.

@@ -303,7 +303,7 @@ exports.main = function main(argv, options, callback) {
// Append entries
if (asconfig.entries) {
for (let entry of asconfig.entries) {
argv.push(optionsUtil.resolvePath(entry, asconfigDir));
argv.push(path.relative(baseDir, optionsUtil.resolvePath(entry, asconfigDir)));
Copy link
Member

Choose a reason for hiding this comment

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

Why is this necessary when asconfigDir is already relative to baseDir?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolvePath returns an absolute path. This was mainly to output a relative path when --showConfig is passed.

Copy link
Member

Choose a reason for hiding this comment

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

It returns an absolute path only if entry is already absolute, where I guess keeping it that way makes sense for debugging purposes (so one knows about where the entry comes from by looking at the asconfigs), or node resolution is used, which is debatable. In the latter case, the place to change it would be inside of resolvePath where require.resolve is called, though.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, wait, for entries node resolution isn't used anyway, so the relative here seems redundant.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It can be used to get the asconfigDir, which returns an absolute path.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for clarifying. I'm not necessarily opposed to changing node resolution to relative, but if we do so I think we should do it in resolvePath where require.resolve is used (and the path returned as absolute), so we don't break explicitly specified absolute paths given as the value of extends. Like, if a user specifies something absolute explicitly, I'd prefer to not mangle it but keep it as-is.

Copy link
Member

Choose a reason for hiding this comment

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

Changed it in #1406 accordingly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

very true.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just looked at your changes to #1406, and I think you should roll it back and just keep everything as is. The issue was that I wanted the path relative to baseDir in asc.js, but in resolvePath, baseDir is passed in as asconfigDir. So we could adapt that to always pass in top level baseDir or just forget about it all together.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, let's remove the path.relative here then.

@dcodeIO
Copy link
Member

dcodeIO commented Jul 24, 2020

Hmm, merging #1411 into here looks like a mistake?

@willemneal
Copy link
Contributor Author

I had forgotten to add the node_modules in the test for node resolution.

dcodeIO added a commit that referenced this pull request Jul 24, 2020
@dcodeIO
Copy link
Member

dcodeIO commented Jul 24, 2020

As noted above, #1411, which is unrelated, somehow made it into this PR. With the original base branch now merged, I suggest to rebase this PR cleanly on master.

@willemneal
Copy link
Contributor Author

I think I'll just close this and reopen it to master.

@willemneal willemneal closed this Jul 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants