Pre loader

Writing tests for Scichart JS with Jest

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

1
0

Hi,

Im working with Scichart JS on a React project and trying to write some tests using Jest.
I managed to start a browser environment with webgl support to run the tests, but I’m having a hard time to provide the .data and .wasm files to this environment.

This is what i’m trying to run:

import {SciChartSurface} from 'scichart/Charting/Visuals/SciChartSurface';

const buildSurface = async () => {
    const {sciChartSurface} = await SciChartSurface.create('test-surface', {
        viewportBorder: {border: 1}
    });
    return {sciChartSurface};
};

it('should build a surface', async () => {
    document.body.innerHTML = `<div id="test-surface"></div>`;
    const response = await buildSurface();
    const {sciChartSurface} = response;
});

and I’m getting lots of warns an errors like:

console.warn    both async and sync fetching of the wasm failed
console.error    Could not load SciChart WebAssembly module.
                    Check your build process and ensure that your scichart2d.wasm, scichart2d.data and scichart2d.js files are from the same version
console.error   Error: Uncaught [Error: NetworkError for: scichart2d.data]
thrown: "Could not load SciChart WebAssembly module.
                    Check your build process and ensure that your scichart2d.wasm, scichart2d.data and scichart2d.js files are from the same version"

Does anyone know how to setup a sufficient environment on jest to successfully build a scichart surface?

Version
^2.2.2401
  • You must to post comments
1
0

Hi Lucas,
Unfortunately right now it is now possible to run tests for SciChart.js in Node. But we are looking at ways to make this easier in near future. The testing is possible in tools like Puppeteer which use browser. Another option would be to mock SciChart.js library.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies