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

Add support for Chrome headless #136

Merged
merged 2 commits into from
Sep 23, 2017
Merged

Conversation

ProjectFrank
Copy link
Contributor

@ProjectFrank ProjectFrank commented Jun 14, 2017

https://github.com/karma-runner/karma-chrome-launcher now has support for headless chrome.

This adds the option to run lein doo with karma in headless chrome by passing chrome-headless as a js-env (i.e. lein doo chrome-headless).

To test this, make sure you have:

  • karma-chrome-launcher >= 2.0.0
  • Chrome >= 59

@vemv
Copy link

vemv commented Aug 21, 2017

@bensu any chance of merging this one? Even if it wasn't perfect (which I hope isn't the case), something is better than nothing!

Cheers - Victor

@lverns
Copy link

lverns commented Sep 22, 2017

This doesn't seem to be working for me when I test it locally.

I'm running lein 2.7.1.

$ lein doo chrome-headless test once

;; ======================================================================
;; Testing with Chrome-headless:

Exception in thread "main" java.lang.AssertionError: Assert failed: (valid-js-env? js-env), compiling:(/tmp/form-init1487627120424023677.clj:1:73)
	at clojure.lang.Compiler.load(Compiler.java:7469)
	at clojure.lang.Compiler.loadFile(Compiler.java:7395)
	at clojure.main$load_script.invokeStatic(main.clj:277)
	at clojure.main$init_opt.invokeStatic(main.clj:279)
	at clojure.main$init_opt.invoke(main.clj:279)
	at clojure.main$initialize.invokeStatic(main.clj:310)
	at clojure.main$null_opt.invokeStatic(main.clj:344)
	at clojure.main$null_opt.invoke(main.clj:341)
	at clojure.main$main.invokeStatic(main.clj:423)
	at clojure.main$main.doInvoke(main.clj:386)
	at clojure.lang.RestFn.applyTo(RestFn.java:137)
	at clojure.lang.Var.applyTo(Var.java:702)
	at clojure.main.main(main.java:37)
Caused by: java.lang.AssertionError: Assert failed: (valid-js-env? js-env)
	at doo.core$run_script.invokeStatic(core.clj:236)
	at doo.core$run_script.invoke(core.clj:236)
	at user$eval29976$fn__29992.invoke(form-init1487627120424023677.clj:1)
	at clojure.core$map$fn__5406.invoke(core.clj:2733)
	at clojure.lang.LazySeq.sval(LazySeq.java:40)
	at clojure.lang.LazySeq.seq(LazySeq.java:49)
	at clojure.lang.RT.seq(RT.java:525)
	at clojure.core$seq__4944.invokeStatic(core.clj:137)
	at clojure.core$every_QMARK_.invokeStatic(core.clj:2659)
	at clojure.core$every_QMARK_.invoke(core.clj:2652)
	at user$eval29976.invokeStatic(form-init1487627120424023677.clj:1)
	at user$eval29976.invoke(form-init1487627120424023677.clj:1)
	at clojure.lang.Compiler.eval(Compiler.java:7005)
	at clojure.lang.Compiler.eval(Compiler.java:6995)
	at clojure.lang.Compiler.load(Compiler.java:7457)
	... 12 more
Subprocess failed

If I pass in a garbage name, you can see that the output lists chrome-headless as one of the valid options.

$ lein doo asdf test once
Exception in thread "main" java.lang.AssertionError: Assert failed: The given alias: :asdf didn't resolve to any runners. Try any of: karma-slimer, opera, safari, phantom, chrome-headless, node, firefox, slimer, electron, chrome, rhino, ie, karma-phantom, chrome-canary, nashorn, headless
(not (empty? resolved-js-envs))
	at doo.core$assert_alias.invokeStatic(core.clj:57)
	at doo.core$assert_alias.invoke(core.clj:53)
	at leiningen.doo$doo.invokeStatic(doo.clj:209)
	at leiningen.doo$doo.doInvoke(doo.clj:194)
	at clojure.lang.RestFn.invoke(RestFn.java:460)
	at clojure.lang.Var.invoke(Var.java:394)
	at clojure.lang.AFn.applyToHelper(AFn.java:165)
	at clojure.lang.Var.applyTo(Var.java:700)
	at clojure.core$apply.invokeStatic(core.clj:648)
	at clojure.core$apply.invoke(core.clj:641)
	at leiningen.core.main$partial_task$fn__5932.doInvoke(main.clj:272)
	at clojure.lang.RestFn.applyTo(RestFn.java:139)
	at clojure.lang.AFunction$1.doInvoke(AFunction.java:29)
	at clojure.lang.RestFn.applyTo(RestFn.java:137)
	at clojure.core$apply.invokeStatic(core.clj:648)
	at clojure.core$apply.invoke(core.clj:641)
	at leiningen.core.main$apply_task.invokeStatic(main.clj:322)
	at leiningen.core.main$apply_task.invoke(main.clj:308)
	at leiningen.core.main$resolve_and_apply.invokeStatic(main.clj:328)
	at leiningen.core.main$resolve_and_apply.invoke(main.clj:324)
	at leiningen.core.main$_main$fn__5998.invoke(main.clj:401)
	at leiningen.core.main$_main.invokeStatic(main.clj:394)
	at leiningen.core.main$_main.doInvoke(main.clj:391)
	at clojure.lang.RestFn.invoke(RestFn.java:457)
	at clojure.lang.Var.invoke(Var.java:394)
	at clojure.lang.AFn.applyToHelper(AFn.java:165)
	at clojure.lang.Var.applyTo(Var.java:700)
	at clojure.core$apply.invokeStatic(core.clj:646)
	at clojure.main$main_opt.invokeStatic(main.clj:314)
	at clojure.main$main_opt.invoke(main.clj:310)
	at clojure.main$main.invokeStatic(main.clj:421)
	at clojure.main$main.doInvoke(main.clj:384)
	at clojure.lang.RestFn.invoke(RestFn.java:512)
	at clojure.lang.Var.invoke(Var.java:409)
	at clojure.lang.AFn.applyToHelper(AFn.java:178)
	at clojure.lang.Var.applyTo(Var.java:700)
	at clojure.main.main(main.java:37)

@ProjectFrank
Copy link
Contributor Author

ProjectFrank commented Sep 23, 2017 via email

@lverns
Copy link

lverns commented Sep 23, 2017

Do you have karma-chrome-launcher >= 2.0.0 and chrome >=59?

Yes, it appears so:

$ grep _id node_modules/karma-chrome-launcher/package.json 
  "_id": "[email protected]",
$ google-chrome --version
Google Chrome 61.0.3163.91 

@miikka
Copy link
Collaborator

miikka commented Sep 23, 2017

I can reproduce it, and I think it's because of lein-doo plugin adds an old version of the doo library as a dependency. It's fixed by commit 494f42b, so if you merge master, or rebase this branch on master, and re-install the plugin, it should work.

Looks good and I'll merge this soon, I just want to figure out if there's anything missing.

@miikka
Copy link
Collaborator

miikka commented Sep 23, 2017

Okay, let's have it. I'll add it to the Circle build as well.

@miikka miikka merged commit 4019dfc into bensu:master Sep 23, 2017
@miikka miikka mentioned this pull request Sep 23, 2017
@lverns
Copy link

lverns commented Sep 23, 2017

The latest commit on master (f76f5e9) now works for me.

Thanks!

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

Successfully merging this pull request may close these issues.

4 participants