Skip to content
This repository has been archived by the owner on Jan 22, 2024. It is now read-only.

All js-tests examples fail except for jest example #88

Open
gnawinganimal opened this issue Aug 25, 2018 · 6 comments
Open

All js-tests examples fail except for jest example #88

gnawinganimal opened this issue Aug 25, 2018 · 6 comments

Comments

@gnawinganimal
Copy link

Hello, I am new to unit tests with kotlin-js and I am attempting to learn how to set it up using the karma example. However, it seems that there is something wrong with this example
because even if I clone the project itself and run 'gradle test' it always produces the same error:

> Task :fusion-js:karmaRun FAILED
C:\Users\Aidan\IdeaProjects\fusion\fusion-js\node_modules\karma\node_modules\log4js\lib\layouts.js:69
  ) + util.format(...loggingEvent.data);
                  ^^^
SyntaxError: Unexpected token ...
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:414:25)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (C:\Users\Aidan\IdeaProjects\fusion\fusion-js\node_modules\karma\node_modules\log4js\lib\log4js.js:27:17)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (C:\Users\Aidan\IdeaProjects\fusion\fusion-js\node_modules\karma\lib\logger.js:7:14)
    at Module._compile (module.js:435:26)

It seems that the js spread operator is not supported by the javascript version, but I don't know what to do about it 🤷. Does somebody here know?

@gnawinganimal gnawinganimal changed the title Syntax error when running 'gradle test' for gradle/js-tests/karma All test-js examples fail except for jest example Aug 27, 2018
@gnawinganimal
Copy link
Author

An update on this: it seems that running 'gradle test' in all the examples in the js-tests folder do not work, except for the jest example, which works as expected. I'm assuming they worked at one point but have become outdated somehow. Again, I am just trying to learn this myself so I am not sure what is wrong.

@gnawinganimal gnawinganimal changed the title All test-js examples fail except for jest example All js-tests examples fail except for jest example Aug 27, 2018
@czeidler
Copy link

Have the same issue any updates?

@kunalrdeshmukh
Copy link

Encountered the same issue.

@czeidler
Copy link

Maybe the node version is an issue:
karma-runner/karma#3111 (comment)

Any idea how to update the node version in com.craigburke.karma? From the craigburke sources I see that the used node version is the default in the plugin code...

@czeidler
Copy link

czeidler commented Jan 2, 2019

Here is a good article that helps to make the JS tests work again:
https://medium.com/@gz_k/effective-tool-chain-for-kotlin-js-testing-b243449e8a16

This solution has also a much faster build time than the karma gradle plugin.

If you use the amd format, here is an example how I got it running using requirejs:
https://gitlab.com/czeidler/fejoa/tree/master/jsbindings

@thigg
Copy link

thigg commented Jul 31, 2019

the node plugin version 1.2.0 does not seem to work anymore. And with version 1.3.1 I cannot use any dependencies in the tests.
Anyone actually using that? Experiences with a good project setup?

Also it would be useful, if the examples would use dependencies, so that case is handled as well.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants