Does anyone have experience with Jest?
utils.ts
import { Vector3 } from '@babylonjs/core';
export const roundVector = (vec: Vector3): Vector3 => {
return new Vector3(Math.round(vec.x), Math.round(vec.y), Math.round(vec.z));
};
utils.spec.ts
import { Vector3 } from '@babylonjs/core';
import { roundVector } from './utils';
describe('utils', () => {
test('roundVector', () => {
expect(roundVector(new Vector3(0.4, 1.5, 2.6)).toString()).toBe(
'{ X: 0 Y: 2 Z: 3 }'
);
});
});
In this example I get the error:
\node_modules\@babylonjs\core\index.js:2
export * from "./abstractScene.js";
^^^^^^
SyntaxError: Unexpected token 'export'
The Jest config transformIgnorePatterns
does not work in this repo. I have another repo where transformIgnorePatterns
works, but then Jest RUN
hangs without errors. I’m going crazy. @babylonjs/core
is the only package which causes this problem. My original repo is a huge project with a lot of packages. Including ES modules. It’s weird why babaylon js is not working here. I feel like a noob. Ok, this repo may works a bit different like my original repo (Angular). I have no idea what’s wrong.
Please help! I appreciate any hint or pray for solution.
Again the info: In my Angular repo I was able to mute the Unexpected token ‘export’. But then, Jest runs infinitely. No error nothing. I never experiences such a weird behavior. Does anyone have a working repo with similar setup?