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 CI on Node.js 12 and 14 #139

Merged
merged 2 commits into from
Jul 13, 2021

Conversation

midgleyc
Copy link
Contributor

Fix the failing CI tests on Node 12 and 14.

It looks like the error message for some invalid URLs has changed in 16. I've changed it to a regex that matches both.

xo has a (few levels deep) peer dependency on typescript. On npm < 7, this isn't installed automatically on npm install, and you get the error message seen in the CI:

Error: Failed to load parser '/home/runner/work/normalize-url/normalize-url/node_modules/@typescript-eslint/parser/dist/index.js' declared in 'BaseConfig': Cannot find module 'typescript'
Require stack:
- /home/runner/work/normalize-url/normalize-url/node_modules/@typescript-eslint/typescript-estree/dist/parser.js
- /home/runner/work/normalize-url/normalize-url/node_modules/@typescript-eslint/typescript-estree/dist/index.js
- /home/runner/work/normalize-url/normalize-url/node_modules/@typescript-eslint/parser/dist/parser.js
- /home/runner/work/normalize-url/normalize-url/node_modules/@typescript-eslint/parser/dist/index.js
- /home/runner/work/normalize-url/normalize-url/node_modules/@eslint/eslintrc/lib/config-array-factory.js
- /home/runner/work/normalize-url/normalize-url/node_modules/@eslint/eslintrc/lib/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at Function.Module._load (internal/modules/cjs/loader.js:667:27)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/runner/work/normalize-url/normalize-url/node_modules/@typescript-eslint/typescript-estree/dist/parser.js:31:25)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)

@sindresorhus
Copy link
Owner

Yeah, it's xojs/xo#555.

@sindresorhus sindresorhus changed the title Fix tests on node 12 and 14 Fix CI on Node.js 12 and 14 Jul 13, 2021
@sindresorhus
Copy link
Owner

CI seems to still be failing.

@midgleyc
Copy link
Contributor Author

Yes, now it's the code coverage, which only runs on 14. nyc ava is returning 0 for everything. Not sure whether nyc supports ESM. Could try c8 instead?

@midgleyc
Copy link
Contributor Author

Running c8 locally, it generates the lcov.info file, so I think that should work.

@sindresorhus sindresorhus merged commit 3fb24bb into sindresorhus:main Jul 13, 2021
@sindresorhus
Copy link
Owner

Thanks :)

@midgleyc midgleyc deleted the fix-tests-on-12-and-14 branch July 13, 2021 14:53
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