This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-10-24
Channels
- # aws (7)
- # aws-lambda (3)
- # beginners (65)
- # boot (43)
- # cider (7)
- # cljs-dev (12)
- # cljsrn (15)
- # clojure (284)
- # clojure-austin (32)
- # clojure-brasil (4)
- # clojure-dusseldorf (4)
- # clojure-germany (1)
- # clojure-italy (40)
- # clojure-spec (21)
- # clojure-uk (69)
- # clojurescript (97)
- # core-async (11)
- # cursive (19)
- # data-science (1)
- # datascript (6)
- # datomic (30)
- # dirac (2)
- # emacs (4)
- # events (2)
- # fulcro (76)
- # graphql (38)
- # juxt (1)
- # lein-figwheel (1)
- # leiningen (6)
- # luminus (4)
- # lumo (13)
- # mount (4)
- # off-topic (24)
- # om (28)
- # onyx (32)
- # other-languages (1)
- # parinfer (40)
- # pedestal (1)
- # portkey (47)
- # re-frame (21)
- # reagent (4)
- # ring (4)
- # ring-swagger (3)
- # rum (1)
- # shadow-cljs (115)
- # spacemacs (5)
- # sql (14)
- # unrepl (1)
- # yada (3)
going back to my gherkin scenario -- if I transpile my cljs
, it has deps on goog
, and cucumber
won't know how to read the files -- is there a way to have lumo
simply transpile the cljs
to es6
that could run in node?
@johnjelinek do you have a sharable project? Maybe I can have a look at it tomorrow, I am kind of worried that it is so hard to achieve that 😄
I can come up with a gist, but you can give it a shot by translating these little javascript files into cljs
: https://github.com/cucumber/cucumber-js/blob/master/docs/nodejs_example.md
if I build my step_definitions
from cljs
to js
, it ends up looking like this: https://clojurians.slack.com/archives/C03S1L9DN/p1508810459000036
and when I run cucumber
via the CLI or via node like this:
import Cli from 'cucumber/lib/cli';
const cli = new Cli.default({
argv: process.argv,
cwd: '',
stdout: process.stdout
})
cli.run();
it complains that it doesn't know what goog
isbecause the entrypoint is determined by cucumber
, so there's not going to be a main.js
kind of entrypoint
Uhm got it, sorry for keeping asking I will try to find some time to actually try this out
FYI when you get around to trying this out, I'm currently trying to run cucumber
like this:
./node_modules/.bin/cucumber-js ../features -r out/main.js
where ../features
includes my features
files and my cljs
step definitionsI'm not sure if this is right, but here's what an example step definitions looks like:
(ns step-definitions.steps)
(require 'chromedriver)
(def seleniumWebdriver (js/require "selenium-webdriver"))
(def defineSupportCode (.-defineSupportCode (js/require "cucumber")))
(defn custom-world []
(this-as this
(let [builder (new (.-Builder seleniumWebdriver))
forBrowser (.forBrowser builder "chrome")]
(set! (.-driver this) (.build forBrowser)))))
(defineSupportCode
(fn [context]
(let [set-world-constructor (.-setWorldConstructor context)
Given (.-Given context)
When (.-When context)
Then (.-Then context)
After (.-After context)]
(set-world-constructor custom-world)
(After (this-as this (.quit (.-driver this))))
(Given "I am on the Cucumber.js GitHub repository" #(println "test"))
(When "I click on {string}" #(% (println %)))
(Then "I should see {string}" #(% (println %))))))
that generates some js
that looks like this:
// Compiled by ClojureScript 1.9.946 {:target :nodejs}
goog.provide('step_definitions.steps');
goog.require('cljs.core');
step_definitions.steps.node$module$chromedriver = require('chromedriver');
step_definitions.steps.seleniumWebdriver = require("selenium-webdriver");
step_definitions.steps.defineSupportCode = require("cucumber").defineSupportCode;
step_definitions.steps.custom_world = (function step_definitions$steps$custom_world(){
var this$ = this;
var builder = (new step_definitions.steps.seleniumWebdriver.Builder());
var forBrowser = builder.forBrowser("chrome");
return this$.driver = forBrowser.build();
});
step_definitions.steps.defineSupportCode.call(null,(function (context){
var set_world_constructor = context.setWorldConstructor;
var Given = context.Given;
var When = context.When;
var Then = context.Then;
var After = context.After;
set_world_constructor.call(null,step_definitions.steps.custom_world);
After.call(null,(function (){var this$ = this;
return this$.driver.quit();
})());
Given.call(null,"I am on the Cucumber.js GitHub repository",((function (set_world_constructor,Given,When,Then,After){
return (function (){
return cljs.core.println.call(null,"test");
});})(set_world_constructor,Given,When,Then,After))
);
When.call(null,"I click on {string}",((function (set_world_constructor,Given,When,Then,After){
return (function (p1__1_SHARP_){
return p1__1_SHARP_.call(null,cljs.core.println.call(null,p1__1_SHARP_));
});})(set_world_constructor,Given,When,Then,After))
);
return Then.call(null,"I should see {string}",((function (set_world_constructor,Given,When,Then,After){
return (function (p1__2_SHARP_){
return p1__2_SHARP_.call(null,cljs.core.println.call(null,p1__2_SHARP_));
});})(set_world_constructor,Given,When,Then,After))
);
}));
Ok thanks did not have time today but it is queued
any luck with this?
sorry I have not had time for this yet...it still is in my queue though