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 on cljc test files #208

Closed
dpetran opened this issue Apr 7, 2022 · 1 comment
Closed

Test runner fails on cljc test files #208

dpetran opened this issue Apr 7, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@dpetran
Copy link
Contributor

dpetran commented Apr 7, 2022

Describe the bug
When running poly test :dev on a brick that has a cljc test file with a reader conditional, the following stacktrace is produced:

java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at polylith.clj.core.common.class_loader$invoke_in_STAR_.invokeStatic(class_loader.clj:31)
        at polylith.clj.core.common.class_loader$eval_in_STAR_$print_read_eval__233.invoke(class_loader.clj:46)
        at polylith.clj.core.common.class_loader$eval_in_STAR_.invokeStatic(class_loader.clj:51)
        at polylith.clj.core.common.class_loader$eval_in.invokeStatic(class_loader.clj:60)
        at polylith.clj.core.common.interface$eval_in.invokeStatic(interface.clj:21)
        at polylith.clj.core.test_runner.core$run_test_statements$fn__7491.invoke(core.clj:63)
        at polylith.clj.core.test_runner.core$run_test_statements.invokeStatic(core.clj:63)
        at polylith.clj.core.test_runner.core$run_tests_for_project.invokeStatic(core.clj:121)
        at polylith.clj.core.test_runner.core$run.invokeStatic(core.clj:171)
        at polylith.clj.core.test_runner.interface$run.invokeStatic(interface.clj:4)
        at polylith.clj.core.command.test$run.invokeStatic(test.clj:9)
        at polylith.clj.core.command.core$execute.invokeStatic(core.clj:75)
        at polylith.clj.core.command.interface$execute_command.invokeStatic(interface.clj:4)
        at polylith.clj.core.poly_cli.core$_main.invokeStatic(core.clj:31)
        at polylith.clj.core.poly_cli.core$_main.doInvoke(core.clj:7)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at polylith.clj.core.poly_cli.core.main(Unknown Source)
Caused by: Syntax error compiling quote at (0:0).
Wrong number of args (0) passed to quote
        at clojure.lang.Compiler.analyzeSeq(Compiler.java:7132)
        at clojure.lang.Compiler.analyze(Compiler.java:6806)
        at clojure.lang.Compiler.analyze(Compiler.java:6762)
        at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3900)
        at clojure.lang.Compiler.analyzeSeq(Compiler.java:7126)
        at clojure.lang.Compiler.analyze(Compiler.java:6806)
        at clojure.lang.Compiler.analyze(Compiler.java:6762)
        at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:6137)
        at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5479)
        at clojure.lang.Compiler$FnExpr.parse(Compiler.java:4041)
        at clojure.lang.Compiler.analyzeSeq(Compiler.java:7122)
        at clojure.lang.Compiler.analyze(Compiler.java:6806)
        at clojure.lang.Compiler.eval(Compiler.java:7191)
        at clojure.lang.Compiler.eval(Compiler.java:7183)
        at clojure.lang.Compiler.eval(Compiler.java:7149)
        at clojure.core$eval.invokeStatic(core.clj:3215)
        at clojure.core$eval.invoke(core.clj:3211)
        at clojure.core$eval138.invokeStatic(NO_SOURCE_FILE:0)
        at clojure.core$eval138.invoke(NO_SOURCE_FILE)
        at clojure.lang.Compiler.eval(Compiler.java:7194)
        at clojure.lang.Compiler.eval(Compiler.java:7149)
        ... 21 more
Caused by: clojure.lang.ExceptionInfo: Wrong number of args (0) passed to quote {:form (quote)}
        at clojure.lang.Compiler$ConstantExpr$Parser.parse(Compiler.java:2016)
        at clojure.lang.Compiler.analyzeSeq(Compiler.java:7124)
        ... 41 more
Couldn't run test statement for the development project: (do (clojure.core/use (quote clojure.test)) (clojure.core/require (quote )) (clojure.test/run-tests (quote ))) java.lang.reflect.InvocationTargetException

To Reproduce
Steps to reproduce the behavior:

  1. Run poly create component name:bar
  2. Change the components/bar/test/foo/bar/interface_test.clj to components/bar/test/foo/bar/interface_test.cljc
  3. Add the following conditionalized require to the interface_test.cljc file:
(ns foo.bar.interface-test
 (:require #?@(:clj  [[clojure.test :refer :all]]
               :cljs [[cljs.test :refer-macros [deftest is testing]]])
           [foo.bar.interface :as bar]))
  1. Run poly test :dev :verbose
  2. See the above stacktrace
  3. Note that the # test statements section of the output has this invalid test statement:
# test-statements:
[(do (clojure.core/use (quote clojure.test)) (clojure.core/require (quote )) (clojure.test/run-tests (quote )))] 
  1. Remove the reader conditional in the interface_test.cljc file
  2. Rerun poly test :dev
  3. The tests run just fine

Expected behavior
The poly test command should run the tests without crashing.

Operating System (please complete the following information):

  • OS: NixOS
  • Version: 21.11

Versions (please complete the following information):

  • Java: openjdk 17.0.1 2021-10-19
  • Poly: 0.2.14-alpha (2022-03-30)
@tengstrand
Copy link
Collaborator

Hi @dpetran,
I have fixed this issue, so please have a look, hash: b0632bea00842774d5859dfe528ac3e7758ea244
branch-208

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants