hbz / oerworldmap-ui

The user interface for https://oerworldmap.org/
Apache License 2.0
4 stars 8 forks source link

Tests fail #640

Closed dr0i closed 4 years ago

dr0i commented 4 years ago

oer@www:~/oerworldmap-ui> node --version v8.11.4

oer@www:~/oerworldmap-ui> ../node/bin/npm test Test Suites: 9 failed, 9 total

The logs looks like this:

FAIL test/Block.js ● Test suite failed to run

Jest encountered an unexpected token

This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.

By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".

Here's what you can do:
 • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
 • If you need a custom transformation specify a "transform" option in your config.
 • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.

You'll find more details and examples of these config options in the docs:
https://jestjs.io/docs/en/configuration.html

Details:

/usr/local/oer/oerworldmap-ui/node_modules/jsdom/node_modules/webidl-conversions/lib/index.js:357
    } catch {
            ^

SyntaxError: Unexpected token {

  at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1258:14)
  at Object.<anonymous> (node_modules/jsdom/node_modules/whatwg-url/dist/URL.js:3:21)

These tests fail on production and on beta. Are they important resp. what have I/we to do to make them run - or should these just be ignored?

dr0i commented 4 years ago

Ah, I see: they do run successfully at travis - and this is all that is needed. I can imagine that it is failing because of the README saying that node 8 is fine, which I hence use, and travis uses node 12. I shall test this when I am back at work, maybe next week.

literarymachine commented 4 years ago

I can imagine that it is failing because of the README saying that node 8 is fine, which I hence use, and travis uses node 12.

Rights, this is a bug in the README, package.json also requires node >=12.16.0. If I recall correctly, there is a node v12 somewhere in the home. You can check out the service scripts where that version should be used.

dr0i commented 4 years ago

Also in the startup.sh there is no version of 'node' explicitly set. Fixed this in #645.

dr0i commented 4 years ago

Fixed with #645, tests run, closing.