ganlanyuan / tiny-slider

Vanilla javascript slider for all purposes.
MIT License
5.26k stars 785 forks source link

There is an SyntaxError in tiny-slider when I make unit test #350

Open PuzoLiang opened 5 years ago

PuzoLiang commented 5 years ago

Issue description:
I set all should setups that jest needs. but when I test files, it always occurs that tiny-slider SyntaxError Demo link/slider setting:
image There is my config file: image

There are some words from @Izhaki, he said: Sometimes it happens (especially in React Native or TypeScript projects) that 3rd party modules are published as untranspiled. Since all files inside node_modules are not transformed by default, Jest will not understand the code in these modules, resulting in syntax errors. To overcome this, you may use transformIgnorePatterns to whitelist such modules. You'll find a good example of this use case in React Native Guide.

But I do it as he said, it seems not to work as well. So, can you give me some advice on what happened? Tiny-slider version: 2.8.6 Browser name && version: ... OS name && version: ...

PuzoLiang commented 5 years ago

Oh, my god. I make this little unit test of some component for three days. But it also continues to annoy me to tackle these issues. I'm sorry to my PM. LOl

ganlanyuan commented 5 years ago

Is it because the import statements are not in the beginning of the file?

PuzoLiang commented 5 years ago

Is it because the import statements are not at the beginning of the file?

I don't know. I am new to take over the project.

forchel commented 3 years ago

I have the same problem with my Jest test using Vue 3 + TS and tiny-slider version 2.9.3