Unit testing - Dialog component error and warnings

UI Components for Vue
Post Reply
galav
Posts: 2
Joined: 24 Jan 2022, 09:02

24 Jan 2022, 09:15

Hi everyone.
I recently started using PrimeVue 3.11.0.
I use the Dialog component. When running `npm run serve` everything works fine - the Dialog is displayed properly.
However, when I run unit test of my custom component and mount it, I get some warnings in console and the test fails:

Code: Select all

console.warn node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:40
    [Vue warn]: Property "$primevue" was accessed during render but is not defined on instance. 
      at <TransitionStub> 
      at <Dialog visible=true onUpdate:visible=fn style= { width: '450px' }  ... > 
      at <Anonymous ref="VTU_COMPONENT" > 
      at <VTUROOT>

  console.warn node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:40
    [Vue warn]: Unhandled error during execution of render function 
      at <TransitionStub> 
      at <Dialog visible=true onUpdate:visible=fn style= { width: '450px' }  ... > 
      at <Anonymous ref="VTU_COMPONENT" > 
      at <VTUROOT>

  console.warn node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:40
    [Vue warn]: Unhandled error during execution of scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core 
      at <TransitionStub> 
      at <Dialog visible=true onUpdate:visible=fn style= { width: '450px' }  ... > 
      at <Anonymous ref="VTU_COMPONENT" > 
      at <VTUROOT>


TypeError: Cannot read property 'config' of undefined

    at Proxy.dialogClass (C:\Users\user\Projects\project\node_modules\primevue\dialog\dialog.cjs.js:363
It happens when I use the Toast component as well.
What could be the issue?

BTW, are there any unit tests for PrimeVue? I couldn't find it on github.

Thank you.

galav
Posts: 2
Joined: 24 Jan 2022, 09:02

21 Feb 2022, 14:55

bump

micksp
Posts: 1
Joined: 10 May 2023, 11:51

10 May 2023, 11:55

Hi

Did you figure out a solution for this? I have the same on primevue 3.27.0

Code: Select all

  it("renders a title", async () => {
    const wrapper = mount(Component, {
      props: { title: "some title" },
    });
    expect(wrapper.find("*[title='some title']").exists()).toBe(true);
  });
  
[Vue warn]: Property "$primevue" was accessed during render but is not defined on instance.
at <Transition name="p-message" appear="" >
at <Message severity="info" closable=false >
at <CardActionsPicker style="hidden" title="some title" >
at <Dropdown class="ac-card__actions--dropdown" show-arrow=true show-underlay=true ... >
at <CardActions title="some title" ref="VTU_COMPONENT" >
at <VTUROOT>
works fine, but I can't find a way to test this

bahadirsofuoglu
Posts: 84
Joined: 06 Sep 2022, 08:59

16 May 2023, 09:44

Hi, Primevue components are already tested. You can use it as a Stub.

jatakeda
Posts: 1
Joined: 04 Oct 2022, 23:18

17 May 2023, 03:23

Still a problem here; in 2023-05-16 (with primevue 3.15.0). Is this fixed yet??? If not, what's the work-around?

bahadirsofuoglu
Posts: 84
Joined: 06 Sep 2022, 08:59

04 Sep 2023, 10:30

Hi, I've prepared an example for this scenario below. In this way, you can include the PrimeVue config globally.

https://codesandbox.io/p/sandbox/primev ... n%3A15%2C5

Post Reply

Return to “PrimeVue”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests