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

Tests failing on a fresh install due to SyntaxErrors #707

Closed
pasimuno-ako opened this issue Apr 21, 2024 · 2 comments
Closed

Tests failing on a fresh install due to SyntaxErrors #707

pasimuno-ako opened this issue Apr 21, 2024 · 2 comments

Comments

@pasimuno-ako
Copy link

pasimuno-ako commented Apr 21, 2024

On Node v20.11.1, when running the tests on a freshly-cloned Epic stack, I immediately get failures.

✓ app/utils/misc.error-message.test.ts (3)
❯ app/utils/misc.use-double-check.test.tsx (3)
 × prevents default on the first click, and does not on the second
 × blurring the button starts things over
 × hitting "escape" on the input starts things over
❯ app/routes/users+/$username.test.tsx (2) 2073ms
 × The user profile when not logged in as self 1042ms
 × The user profile when logged in as self 1020ms
✓ app/routes/_auth+/auth.$provider.callback.test.ts (8)

 FAIL  app/utils/misc.use-double-check.test.tsx > prevents default on the first click, and does not on the second
 FAIL  app/utils/misc.use-double-check.test.tsx > blurring the button starts things over
 FAIL  app/utils/misc.use-double-check.test.tsx > hitting "escape" on the input starts things over
SyntaxError: 'h1' is not a valid selector
 ❯ emit node_modules/nwsapi/src/nwsapi.js:557:17
 ❯ Object._matches [as match] node_modules/nwsapi/src/nwsapi.js:1397:9
 ❯ HTMLOutputElementImpl.ElementImpl.matches node_modules/jsdom/lib/jsdom/living/nodes/Element-impl.js:592:18
 ❯ HTMLOutputElement.matches node_modules/jsdom/lib/jsdom/living/generated/Element.js:655:34
 ❯ node_modules/@testing-library/dom/dist/role-helpers.js:143:19
 ❯ getImplicitAriaRoles node_modules/@testing-library/dom/dist/role-helpers.js:86:9
 ❯ node_modules/@testing-library/dom/dist/queries/role.js:134:65
 ❯ queryAllByRole node_modules/@testing-library/dom/dist/queries/role.js:123:28
 ❯ node_modules/@testing-library/dom/dist/query-helpers.js:74:17

 FAIL  app/routes/users+/$username.test.tsx > The user profile when not logged in as self
SyntaxError: '*[role~="heading"],h1,h2,h3,h4,h5,h6' is not a valid selector
 ❯ emit node_modules/nwsapi/src/nwsapi.js:557:17
 ❯ Object._querySelectorAll [as select] node_modules/nwsapi/src/nwsapi.js:1501:9
 ❯ HTMLBodyElementImpl.querySelectorAll node_modules/jsdom/lib/jsdom/living/nodes/ParentNode-impl.js:78:26
 ❯ HTMLBodyElement.querySelectorAll node_modules/jsdom/lib/jsdom/living/generated/Element.js:1119:58
 ❯ queryAllByRole node_modules/@testing-library/dom/dist/queries/role.js:121:31
 ❯ node_modules/@testing-library/dom/dist/query-helpers.js:74:17
 ❯ node_modules/@testing-library/dom/dist/query-helpers.js:52:17
 ❯ node_modules/@testing-library/dom/dist/query-helpers.js:95:19
 ❯ container.container node_modules/@testing-library/dom/dist/query-helpers.js:87:14
 ❯ runWithExpensiveErrorDiagnosticsDisabled node_modules/@testing-library/dom/dist/config.js:47:12

FAIL  app/routes/users+/$username.test.tsx > The user profile when logged in as self
SyntaxError: '*[role~="heading"],h1,h2,h3,h4,h5,h6' is not a valid selector
 ❯ emit node_modules/nwsapi/src/nwsapi.js:557:17
 ❯ Object._querySelectorAll [as select] node_modules/nwsapi/src/nwsapi.js:1501:9
 ❯ HTMLBodyElementImpl.querySelectorAll node_modules/jsdom/lib/jsdom/living/nodes/ParentNode-impl.js:78:26
 ❯ HTMLBodyElement.querySelectorAll node_modules/jsdom/lib/jsdom/living/generated/Element.js:1119:58
 ❯ queryAllByRole node_modules/@testing-library/dom/dist/queries/role.js:121:31
 ❯ node_modules/@testing-library/dom/dist/query-helpers.js:74:17
 ❯ node_modules/@testing-library/dom/dist/query-helpers.js:52:17
 ❯ node_modules/@testing-library/dom/dist/query-helpers.js:95:19
 ❯ container.container node_modules/@testing-library/dom/dist/query-helpers.js:87:14
 ❯ runWithExpensiveErrorDiagnosticsDisabled node_modules/@testing-library/dom/dist/config.js:47:12

Some people were having issues with the nwsapi library where the error is coming from, and they were suggesting to downgrade to 2.2.2.

Upon checking, I am using nwsapi@2.2.8, a dependency of jsdom@24.0.0.

Here's another issue with the same cause: dperini/nwsapi#108

EDIT 1: The temporary fix is to add this to your package.json, delete node_modules (and probably package-lock.json too), and reinstall everything with npm i.

"overrides": {
  "nwsapi": "2.2.2"
}

Though @eps1lon says 2.2.7 works.

@eps1lon
Copy link

eps1lon commented Apr 21, 2024

Fixed in latest nwsapi@2.2.9

@kentcdodds
Copy link
Member

Thanks!

I'll be happy to accept a PR that upgrades our deps!

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

No branches or pull requests

3 participants