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

Error when running with Jest & toMatchInlineSnapshot: Cannot read properties of undefined (reading 'filepath') #40

Closed
penspinner opened this issue Feb 4, 2022 · 2 comments · Fixed by #46

Comments

@penspinner
Copy link

penspinner commented Feb 4, 2022

I'm running into this issue while running Jest v27.4.7:

    TypeError: Cannot read properties of undefined (reading 'filepath')

      at Object.parse (node_modules/prettier-plugin-tailwindcss/dist/index.js:145:1735)
      at Object.parse$d [as parse] (node_modules/prettier/index.js:12975:19)
      at coreFormat (node_modules/prettier/index.js:14525:16)
      at formatWithCursor$1 (node_modules/prettier/index.js:14765:14)
      at node_modules/prettier/index.js:60959:12
      at Object.format (node_modules/prettier/index.js:60979:12)

This seems to happen when Jest tries to write out an inline snapshot:

test('a test', () => {
  // In this case, the inline snapshot has not been written yet. When running tests with
  // Jest, it fails with the error above and the inline snapshot is never written.
  expect('abc').toMatchInlineSnapshot()
})
@maierson
Copy link

maierson commented Feb 5, 2022

Same issue with jest v27.5.0
Uninstalling the plugin restores the toMatchInlineSnapshot() generation functionality

@bradlc
Copy link
Contributor

bradlc commented Feb 8, 2022

Thanks for reporting! This is fixed in v0.1.6 👍

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 a pull request may close this issue.

3 participants