kotest / kotest-examples-javascript

A sample javascript project with kotest
Apache License 2.0
3 stars 0 forks source link

Do Kotlin/JS tests run? #38

Closed CLOVIS-AI closed 6 months ago

CLOVIS-AI commented 8 months ago

Which version of Kotest are you using 5.7.2

Running the following script:

$ git clone git@github.com:kotest/kotest-examples-javascript.git
[...]
$ cd kotest-examples-javascript
$ ./gradlew check --rerun-tasks --info
[...]
> Task :jsBrowserTest
Caching disabled for task ':jsBrowserTest' because:
  Caching has not been enabled for the task
Task ':jsBrowserTest' is not up-to-date because:
  Executed with '--rerun-tasks'.
Starting process 'command '[...]''. Working directory: /tmp/kotest-examples-javascript/build/js/packages/kotest-examples-javascript-test Command: [...]/.gradle/nodejs/node-v18.12.1-linux-x64/bin/node --require /tmp/kotest-examples-javascript/build/js/node_modules/source-map-support/register.js /tmp/kotest-examples-javascript/build/js/node_modules/mocha/bin/mocha.js /tmp/kotest-examples-javascript/build/js/packages/kotest-examples-javascript-test/kotlin/kotest-examples-javascript-test.js --require /tmp/kotest-examples-javascript/build/js/packages_imported/kotlin-test-js-runner/0.0.1/kotlin-test-nodejs-empty-runner.js
Successfully started process 'command '/home/ivan/.gradle/nodejs/node-v18.12.1-linux-x64/bin/node''
Starting process 'command '/home/ivan/.gradle/nodejs/node-v18.12.1-linux-x64/bin/node''. Working directory: /tmp/kotest-examples-javascript/build/js/packages/kotest-examples-javascript-test Command: /[...]/.gradle/nodejs/node-v18.12.1-linux-x64/bin/node --require /tmp/kotest-examples-javascript/build/js/node_modules/source-map-support/register.js /tmp/kotest-examples-javascript/build/js/node_modules/mocha/bin/mocha.js /tmp/kotest-examples-javascript/build/js/packages/kotest-examples-javascript-test/kotlin/kotest-examples-javascript-test.js --reporter kotlin-test-js-runner/mocha-kotlin-reporter.js --require /tmp/kotest-examples-javascript/build/js/packages_imported/kotlin-test-js-runner/0.0.1/kotlin-test-nodejs-runner.js --timeout 2s
Successfully started process 'command '/[...]/.gradle/nodejs/node-v18.12.1-linux-x64/bin/node''
Finished generating test XML results (0.0 secs) into: /tmp/kotest-examples-javascript/build/test-results/jsBrowserTest
Generating HTML test report...
Finished generating test html results (0.0 secs) into: /tmp/kotest-examples-javascript/build/reports/tests/jsBrowserTest
Resolve mutations for :jsTest (Thread[Execution worker Thread 3,5,main]) started.
:jsTest (Thread[Execution worker Thread 3,5,main]) started.
[...]

The generated test report is empty.

By editing DogTest.kt and adding an error("failed") call in the test, and rerunning the Gradle command, the report is still empty, and there is no obvious sign that a test has failed (the Gradle command finishes successfully).

I would have expected that:

OliverO2 commented 6 months ago

The cause is a missing Kotest plugin declaration: alias(libs.plugins.kotest.multiplatform) needs to be added to the plugins block in build.gradle.kts.