Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test runner fails when no java opts are specified #4

Closed
lread opened this issue Oct 28, 2023 · 3 comments
Closed

Test runner fails when no java opts are specified #4

lread opened this issue Oct 28, 2023 · 3 comments

Comments

@lread
Copy link

lread commented Oct 28, 2023

While helping out with editing poly docs, I decided to give the external test runner a whirl.

Working from the poly example tutorial project, if I configure the external test runner as described in the README and then run:

clojure -M:poly test

I get:

Projects to run tests from: command-line

Could not create valid test runner for the command-line project: java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.length()" because "this.text" is null
Cannot invoke "java.lang.CharSequence.length()" because "this.text" is null

The fact that poly is swallowing the stack trace doesn't help much, but I found if I provide some java opts:

POLY_TEST_JVM_OPTS=-Dfoo.bar=true clojure -M:poly test

All seems good:

Projects to run tests from: command-line

Running tests for the command-line project using test runner: Polylith org.corfield.external-test-runner...
Running tests from the command-line project, including 2 bricks: user, cli

Testing se.example.cli.core-test

Ran 1 tests containing 1 assertions.
0 failures, 0 errors.

Test results: 1 passes, 0 failures, 0 errors.

Testing se.example.user.interface-test

Ran 1 tests containing 1 assertions.
0 failures, 0 errors.

Test results: 1 passes, 0 failures, 0 errors.

Execution time: 1 seconds

Seems like the current code might be assuming java opts are always set?

@seancorfield
Copy link
Owner

Nice catch! I've never run it without at least some JVM options... oops!

@seancorfield
Copy link
Owner

Try:

io.github.seancorfield/polylith-external-test-runner
{:git/tag "v0.3.0" :git/sha "9f6391a"
 :deps/root "projects/runner"}

@lread
Copy link
Author

lread commented Oct 29, 2023

Thanks @seancorfield, 0.3.0 fixes the issue for me!

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

No branches or pull requests

2 participants