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

Testing components will throw a Cannot read properties of undefined (reading 'unstyled') error #4360

Closed
LanFeusT23 opened this issue Aug 30, 2023 · 0 comments
Assignees
Labels
Component: Test Issue or pull request is related to Component Testing Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@LanFeusT23
Copy link
Contributor

Describe the bug

Running tests with the PrimeVue 3.32.1 (likely happens with any PrimeVue version that has the new unstyled feature, even if you do not need to use it for it to break) will throw an error due to unstyled property being access on a possible undefined config object.

TypeError: Cannot read properties of undefined (reading 'unstyled')
 ❯ Proxy.isUnstyled node_modules/primevue/basecomponent/basecomponent.cjs.js:245:73
 ❯ ReactiveEffect.run node_modules/@vue/reactivity/dist/reactivity.cjs.js:182:19
 ❯ ComputedRefImpl.get value [as value] node_modules/@vue/reactivity/dist/reactivity.cjs.js:1143:33
 ❯ Object.get [as isUnstyled] node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:3399:22
 ❯ Object.get node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:2925:19
 ❯ getter node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:3508:90
 ❯ callWithErrorHandling node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:156:32
 ❯ ReactiveEffect.getter [as fn] node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:1689:22
 ❯ ReactiveEffect.run node_modules/@vue/reactivity/dist/reactivity.cjs.js:182:19
 ❯ job node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:1745:31

Reproducer

https://codesandbox.io/p/sandbox/primevue-test-bug-forked-6w4v6f?file=/src/__tests__/App.spec.js:1,1

PrimeVue version

3.32.1

Vue version

3.x

Language

TypeScript

Build / Runtime

Vue CLI App

Browser(s)

No response

Steps to reproduce the behavior

  1. Create a new vue app and install primevue
  2. Create a component that uses any component (primevue/button for example)
  3. Write a test with a snapshot for the component

The test will not run and throw the error TypeError: Cannot read properties of undefined (reading 'unstyled')

Expected behavior

The tests should pass and create a new snapshot.

@LanFeusT23 LanFeusT23 added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Aug 30, 2023
@bahadirsofuoglu bahadirsofuoglu self-assigned this Aug 31, 2023
@bahadirsofuoglu bahadirsofuoglu added Component: Test Issue or pull request is related to Component Testing Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Aug 31, 2023
@bahadirsofuoglu bahadirsofuoglu added this to the 3.32.3 milestone Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Test Issue or pull request is related to Component Testing Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

3 participants