node-wcag icon indicating copy to clipboard operation
node-wcag copied to clipboard

Module usage doesn't appear to work with localhost

Open anselmbradford opened this issue 10 years ago • 3 comments

Using a localhost address in https://github.com/cfpb/node-wcag#module-usage always passes and returns an empty array for errors and potentialProblems.

anselmbradford avatar Sep 16 '15 16:09 anselmbradford

AChecker will not check localhost. The workaround is using localtunnel. Localtunnel however is only triggered in cli.js. We'll need to move this into index.js.

zrrrzzt avatar Sep 16 '15 16:09 zrrrzzt

@zrrrzzt Do we want to bake localtunnel into this module? I kind of feel like it defeats the 'do one thing and only one thing' principle.

If you're testing localhost you can import localtunnel on your own:

var localtunnel = require('localtunnel');

localtunnel(port, function(err, tunnel) {
    wcag({uri: tunnel.url, id: 'xxxxxxxx'}, function(err, resp) {
      ...
    });
});

We should add better error handling, though, instead of returning no errors.

contolini avatar Sep 17 '15 18:09 contolini

I do agree @contolini. Moving localtunnel into index seemed like a good idea for a few seconds. We should consider having an example like the one you just gave in the README

zrrrzzt avatar Sep 17 '15 21:09 zrrrzzt