Skip to content

Commit

Permalink
plugin - fix #113 and test for it
Browse files Browse the repository at this point in the history
  • Loading branch information
bensu committed Jul 4, 2016
1 parent 3dc642f commit 54c29e8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions plugin/src/leiningen/doo.clj
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@
(defn cli->js-envs
"Returns the js-envs where doo should be run from the cli arguments
and the project.clj options"
[{cli-alias :alias} {alias-map :alias}]
[{cli-alias :alias} {alias-map :alias :or {alias-map {}}}]
(assert (not (and (default? cli-alias) (not (contains? alias-map :default))))
"\n
"\n
To call lein doo without a js-env you need a :default :alias in
your project.clj and a default build. For example:
Expand Down
13 changes: 7 additions & 6 deletions plugin/test/clj/test/lein_doo/config.clj
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@
(testing "We can get the js-envs from the cli"
(let [opts {:build "test"
:alias {:default [:firefox]}}]
(are [args js-envs] (= js-envs (doo/cli->js-envs (doo/args->cli args) opts))
[] [:firefox]
["chrome"] [:chrome]
["chrome" "none-test"] [:chrome]
["chrome" "once"] [:chrome]
["chrome" "none-test" "once"] [:chrome]))))
(are [args js-envs doo-opts] (= js-envs (doo/cli->js-envs (doo/args->cli args) doo-opts))
[] [:firefox] opts
["chrome"] [:chrome] opts
["chrome" "none-test"] [:chrome] opts
["chrome" "once"] [:chrome] opts
["chrome" "none-test" "once"] [:chrome] opts
["chrome"] [:chrome] {:build "test"}))))

(deftest cli->build
(testing "We can get the right build from the cli, opts, and project"
Expand Down

0 comments on commit 54c29e8

Please sign in to comment.