formkit / drag-and-drop

https://drag-and-drop.formkit.com
MIT License
1.42k stars 25 forks source link

Problems with drag-and-drop and vitest | parameter 3 dictionary has member signal #66

Closed Powershooter83 closed 4 months ago

Powershooter83 commented 4 months ago

Hello everyone, I use the drag-and-drop library. It works without problems, but when I try to run tests with Vitest / @vue/test-utils, I get errors.

The tests run when I use const parent = useDragAndDrop(). But as soon as I enter values, there is an error: const [parent, values] = useDragAndDrop(‘test’, ‘test’) For example, this also gives an error: const [parent] = useDragAndDrop()

But I must say, there are only errors in the tests, in the real frontend it works without any problems. The errors look like this:

TypeError: Failed to execute 'addEventListener' on 'EventTarget': parameter 3 dictionary has member 'signal' that is not of type 'AbortSignal'.
- node_modules/jsdom/lib/jsdom/living/generated/AbortSignal.js:23:9
- node_modules/jsdom/lib/jsdom/living/generated/AddEventListenerOptions.js:40:27
- node_modules/jsdom/lib/jsdom/living/generated/AddEventListenerOptions.js:53:11
- node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:139:46
- [node_modules/@formkit/drag-and-drop/index.mjs:137:8](mailto:node_modules/@formkit/drag-and-drop/index.mjs:137:8)
- [node_modules/@formkit/drag-and-drop/index.mjs:1000:44](mailto:node_modules/@formkit/drag-and-drop/index.mjs:1000:44)
- [node_modules/@formkit/drag-and-drop/index.mjs:979:3](mailto:node_modules/@formkit/drag-and-drop/index.mjs:979:3)
- [node_modules/@formkit/drag-and-drop/vue/index.mjs:74:5](mailto:node_modules/@formkit/drag-and-drop/vue/index.mjs:74:5)
- [node_modules/@formkit/drag-and-drop/vue/index.mjs:29:67](mailto:node_modules/@formkit/drag-and-drop/vue/index.mjs:29:67)
- [node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:157:22](mailto:node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:157:22)

There are also no errors when const parent = useDragAndDrop is used. Is the problem with me?

sashamilenkovic commented 4 months ago

@Powershooter83 I haven't run across this myself either; that being said we use Playwright for testing the package. Do you happen to have a vitest .spec file to share so I can reproduce this myself? Also, is it because you are invoking useDragAndDrop without passing correct arguments (or is that just pseudocode you wrote)?

Powershooter83 commented 4 months ago

I have now gone through all versions again and updated Vitest from 0.24.5 to 0.25.1 and the problem has not occurred. Therefore it was simply due to outdated dependencies and the problem is solved. Thanks for the help anyway :)