2

I’m trying to integrate wakanda unit tests into our development workflow, but don’t really know where to start.

My favour would be if I could run unit tests somehow like “npm run test” (as i do for my frontend code) and start the unit tests with my npm script … this way, the tests could easily be executed.

Unfortunately, I have two problems with this:

  1. Can’t get wakanda to execute my file wakanda-unit-tests.js with relative file paths
  2. If a test fails, wakanda does not throw any exit code that my build would not fail -> how can I generate an exit code for example as described in this article http://doc.wakanda.org/home2.en.html#/Wakanda/0.v5/run.301-1019704.en.html -> run() returns the total number of failures, suitable for use as a process exit status code.

Any suggestions are very much appreciated :-)

Stefan
  • 425
  • 2
  • 8
  • Sorry Stefan, we are working to provide a better unit test feature for a v2 minor release. – Yann Apr 07 '17 at 14:35
  • Hi Yann, thank you for the feedback. For the moment I'm using mocha, chai & chai-http to test the wakanda unit test service through npm scripts as a workaround. – Stefan Apr 10 '17 at 06:39
  • Our solution will also work with mocha & chai. So there is a good hope that your migration could be easy. – Yann Apr 10 '17 at 07:14

1 Answers1

0

Wakanda v2.1 provides a way to test your solution SSJS code. You can write mocha/chai tests in the /backend/tests folder.

Here is the official documentation : https://wakanda.github.io/doc/#/guide?section=main-test

Yann
  • 478
  • 5
  • 10