zandaqo / structurae

Data structures for high-performance JavaScript applications.
MIT License
694 stars 21 forks source link

npm test - fails, tests not passing ( TextEncoder undefined ) #7

Closed autorTepatiki closed 4 years ago

autorTepatiki commented 4 years ago

Hi @zandaqo . After cloning and running the tests, they fail due to the undefined TextEncoder. Copy that :

FAIL test/string-array-view.spec.js ● Test suite failed to run

ReferenceError: TextEncoder is not defined

  362 |  * @type TextEncoder
  363 |  */
> 364 | StringView.encoder = new TextEncoder();
      |                          ^
  365 |
  366 | /**
  367 |  * @type TextDecoder

  at Object.TextEncoder (lib/string-view.js:364:26)
  at Object.require (lib/record-array.js:17:20)

Test Suites: 6 failed, 16 passed, 22 total Tests: 280 passed, 280 total Snapshots: 0 total Time: 23.737s Ran all test suites. npm ERR! Test failed. See above for more details.

autorTepatiki commented 4 years ago

It is just a dependency problem : I fixed it including:

require('fast-text-encoding');

in the file 'string-view.js' , and also installing from npm, 'npm i fast-text-encoding' .

Test Suites: 22 passed, 22 total Tests: 358 passed, 358 total Snapshots: 0 total Time: 13.991s Ran all test suites.

autorTepatiki commented 4 years ago

I would submit a fix/branch but have no write permission, sorry.

zandaqo commented 4 years ago

The problem is with older versions of Node or Jest that do not support TextEncoder used by StringView. According to this Node.js supports it since version 11.0.0 I guess I should specify it in package.json as the supported engine instead of 10.4. Thank you for reporting this.

dezren39 commented 4 years ago

It is just a dependency problem : I fixed it including:

require('fast-text-encoding');

in the file 'string-view.js' , and also installing from npm, 'npm i fast-text-encoding' .

Test Suites: 22 passed, 22 total Tests: 358 passed, 358 total Snapshots: 0 total Time: 13.991s Ran all test suites.

Thank you!!!