Running Cucumber within nw.js

38 views
Skip to first unread message

Murray Hopkins

unread,
Jul 31, 2018, 7:25:58 AM7/31/18
to nw.js
Hi. I am trying to write an app in nw.js for running Cucumber tests.

I am using the node version of cucumber and nw.js v28 on Win7 pro.

I can get Cucumber to work by using execFile.

var command = 'node_modules/.bin/cucumber-js';
if (NWK.OS == 'win') { command += '.cmd'; }
var cukeExe = path.join(command);


eg execFile
(cukeExe, [feature, '-f', 'json:' + toJsonFile, '-f', 'snippets:' + snippetFile, '--world-parameters', paramStr], function (error, stdout, stderr){ }

This works fine to run the standard Maths simple feature examples.

The problem is, of course, that since Cucumber is running in a child process I don't have access to the main process so cant set a World that has access to the main app. Well, at least as far as I understand it that is true.

I am probably missing something obvious here. Has anyone managed to get Cucumber running using node require() in nw.js?

Or even via a script tag in the browser context?

Cucumber syntax seems to change regularly so many of the blog posts are out of date / have wrong syntax which makes it really hard to work out.

Are there any other libraries that people have used that can use Gherkin?

Thanks,
Murray




Reply all
Reply to author
Forward
0 new messages