The newly built opencv.js fails in certain tests

Hello,

I just built the whole opencv.js according to this page:
https://docs.opencv.org/3.4/d4/da1/tutorial_js_setup.html

When I run the battery of tests using the following commands:
npx http-server build_js/bin
firefox http://localhost:8080/tests.html

most of the tests succeeds, except the ones that use cv._malloc function and cv.Mat constructor, such as following ones:

1.13.
Died on test #13 test_mat.js:78:7
: cv._malloc is not a function@ 1 ms

6.1.
Died on test #1 test_mat.js:595:7
: cv.Mat is not a constructor@ 1 ms
Source:
cv/Module.matFromArray

and several similar ones.

I would greatly appreciate your help.