I am playing around with sveltekit, and I have a "pure" js file that defines a quadTree and some functions for manipulating it.
All works fine, but it is growing to a size where it would really help to have some unit tests. So I installed jest, and it just fails.
if I write
import quadTree from './quadTree';
I get the error
cannot use import statement outside a module
all solutions I find when searching for this error seems to be react focused and unless I misunderstand something, they all suggest dragging in react dependencies which I of course do not want.
and if I change to
const quadTree = require('./quadTree');
I instead get the error
unexpected token 'export'
so question is: how do I get around this issue, and maybe jest is not the best fit here, in which case: what would be better?