Skip to content
This repository was archived by the owner on Feb 4, 2025. It is now read-only.

Do Kotlin/JS tests run? #38

Closed
CLOVIS-AI opened this issue Mar 16, 2024 · 1 comment
Closed

Do Kotlin/JS tests run? #38

CLOVIS-AI opened this issue Mar 16, 2024 · 1 comment

Comments

@CLOVIS-AI
Copy link

Which version of Kotest are you using
5.7.2

Running the following script:

$ git clone [email protected]: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:

  • If a test fails, the Gradle execution ends with an error (like for the JVM platform)
  • Successful and failed tests to appear in the generated test report
@CLOVIS-AI CLOVIS-AI changed the title How to get the Gradle test report for Kotlin/JS? Do Kotlin/JS tests run? Apr 14, 2024
@OliverO2 OliverO2 transferred this issue from kotest/kotest Jun 2, 2024
@OliverO2
Copy link
Contributor

OliverO2 commented Jun 2, 2024

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.

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

2 participants