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

Figure out better (i.e. more testable) way to load axe.js in cli #793

Open
straker opened this issue Aug 21, 2023 · 0 comments
Open

Figure out better (i.e. more testable) way to load axe.js in cli #793

straker opened this issue Aug 21, 2023 · 0 comments

Comments

@straker
Copy link
Contributor

straker commented Aug 21, 2023

Currently the cli tries to load axe.js from 3 different locations (in oder):

  1. process.cwd()
  2. process.cwd() node_modules
  3. the cli's node_modules

The problem is that this makes it really hard to test. We were using fs-mock but then ran into a problem in node v20.5.0 that prevented fs-mock from working. So we converted our small use case from fs-mock to use tempy, but that required a small hack to allow passing in what the process.cwd was, and trying to mock out what the cli's node_modules was.

I think we should spend some time thinking about how to write the code to be more easily testable. Right now it requires the hack to define what the working directory and file directory is. It also is highly dependent on how the final code is built (/dist/src/lib), but changing our build process shouldn't break our code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants