Skip to content
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

fix(cli): find axe-core when installed globally #232

Merged
merged 10 commits into from
Apr 29, 2021

Conversation

michael-siek
Copy link
Member

@michael-siek michael-siek commented Apr 26, 2021

See: #229
This issue only happens when installing @axe-core/cli globally.

Reviewer checks

Required fields, to be filled out by PR reviewer(s)

  • Code is reviewed for security

@michael-siek michael-siek marked this pull request as draft April 26, 2021 15:44
@michael-siek michael-siek marked this pull request as ready for review April 26, 2021 17:14
@michael-siek michael-siek requested a review from a team April 26, 2021 17:14
Copy link
Member

@stephenmathieson stephenmathieson left a comment

Choose a reason for hiding this comment

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

I think we could better solve this using Node's module lookup algorithm.

axe_core_file_path = require.resolve('axe-core')

This will return the nearest installed axe-core. It works both when installed globally and as a project dependency.

Copy link
Contributor

@WilcoFiers WilcoFiers left a comment

Choose a reason for hiding this comment

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

Tests

@stephenmathieson
Copy link
Member

stephenmathieson commented Apr 27, 2021

Writing a proper test for this will be difficult. To actually reproduce the problem, we'd have to globally install the program and run it. Not really something that qualifies as a "unit test" IMO. Furthermore, we're using Node's algorithm now, which we already assume works (otherwise, nothing here would). Since the existing tests pass, and this is removing custom logic and replacing it with Node's require, do we really need to setup an E2E test for this?

packages/cli/src/lib/utils.test.ts Outdated Show resolved Hide resolved
@michael-siek michael-siek merged commit 75c273d into develop Apr 29, 2021
@michael-siek michael-siek deleted the fix/cli-installed-globally branch April 29, 2021 15:12
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.

None yet

3 participants