Skip to content
This repository has been archived by the owner on Dec 18, 2019. It is now read-only.

Pa11y reporters other than "html" fail to load #103

Open
ralf57 opened this issue Jun 12, 2017 · 2 comments
Open

Pa11y reporters other than "html" fail to load #103

ralf57 opened this issue Jun 12, 2017 · 2 comments

Comments

@ralf57
Copy link
Contributor

ralf57 commented Jun 12, 2017

Trying to have generate a report in a different format than "html", for example with

./node_modules/.bin/a11ym http://creakingshelf.net -r json

fails, with the following error

Error: Cannot find module '../node_modules/pa11y/reporter/json'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at tester (/vagrant/node_modules/the-a11y-machine/lib/tester.js:59:24)
    at Object.start (/vagrant/node_modules/the-a11y-machine/lib/a11ym.js:203:23)
    at Object.<anonymous> (/vagrant/node_modules/the-a11y-machine/a11ym:119:21)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)

Setting the path at
https://github.com/liip/TheA11yMachine/blob/master/lib/tester.js#L59
to

reporter = require('../../../node_modules/pa11y/reporter/' + options.report);

fixes it.

@Hywan
Copy link
Contributor

Hywan commented Jun 12, 2017

Hey,

It depends whether you are using a11ym directly, or as a dependency of a project. You should not use a fix path. My recommendation would be to: Find the node_modules directly by recurring the parent directories, and then, relatively to this path, look for the reporter file.

@ralf57
Copy link
Contributor Author

ralf57 commented Jun 12, 2017

@Hywan thanks for your input.
Submitted #104

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

No branches or pull requests

2 participants