Using datatables with jest
Using datatables with jest
mshah
Posts: 19Questions: 5Answers: 1
I have a vue file - Home.vue - that starts with:
<
script>
import datatable from "datatables-net.vue3"
.
.
.
I set up a jest spec and it gives this error when trying to run it:
Cannot find module 'datatables-net.vue3' from 'src/views/home/Home.vue'
How do i get around that?
Answers
datatables.net-vue3
is the package name, notdatatables-net.vue3
. see the documentation here.Allan
Thanks Allan. I changed it and it's still throwing the same error:
FAIL tests/unit/views/home/Home.spec.js
● Test suite failed to run
Test Suites: 1 failed, 7 passed, 8 total
If you could create an example on StackBlitz or create a demo repo showing the issue, that would be useful.
Thanks,
Allan
Here you go:
https://stackblitz.com/edit/vue-u3qibp
Thanks - I'll take a look at it in the morning.
Allan
Fix committed and a new package, 2.1.1, for
datatables.net-vue3
published.Note that your example still won't run since it is using a single file component which the browser doesn't understand, but that's not a DataTables error
Allan
Thanks Allan.
Ya, I think your right. I was just trying to convey the intention there. The example is difficult to create sometimes.
I'll give this a try and let you know.
This worked great. Thanks for the quick turnaround.
Awesome - thanks for letting me know!
Allan