Hi
I'm trying to build a cucumber plugin for a
Velocity (the Meteor test runner) and I would like to run individual tests directly from node. My goals are to:
- Run any one feature or group of features at a time
- Collect the results into a custom report
Can anyone tell me how to do this please?
My attempts so far are below.
If I run this from the command line:
cd node_modules/cucumber/bin
./cucumber.js /Users/sam/WebstormProjects/meteor-testing/velocity-example/tests/cucumber/features
It works and I get:
1 scenario (1 undefined)
3 steps (3 undefined)
However when I try to do this programmatically like this:
var Cucumber = Npm.require('cucumber');
var featuresDir = '/Users/sam/WebstormProjects/meteor-testing/velocity-example/tests/cucumber/features';
var configuration = Cucumber.Cli.Configuration([featuresDir]);
var runtime = Cucumber.Runtime(configuration);
var formatter = configuration.getFormatter();
runtime.attachListener(formatter);
runtime.start(function() {
console.log('runtime.start callback');
});
Cucumber cannot find the suite and the get the following error:
Error: ENOENT, no such file or directory '/Users/sam/WebstormProjects/meteor-testing/velocity-example/.meteor/local/build/programs/server/features'
Which tells me the featuresDir above is being completely ignored.
also tried to take the content of
cucumber.js directly and pretend to pass in
process.argv like so:
var Cucumber = Npm.require('cucumber');
process.argv = ['/Users/sam/WebstormProjects/meteor-testing/velocity-example/tests/cucumber/features'];
var cli = Cucumber.Cli(process.argv);
cli.run(function (succeeded) {
var code = succeeded ? 0 : 1;
process.on('exit', function () {
process.exit(code);
});
var timeoutId = setTimeout(function () {
console.error('Cucumber process timed out after waiting 60 seconds for the node.js event loop to empty. There may be a resource leak. Have all resources like database connections and network connections been closed properly?');
process.exit(code);
}, 60 * 1000);
if (timeoutId.unref) {
timeoutId.unref();
}
else {
clearTimeout(timeoutId);
}
});
and got the same error again.
Any one got any ideas?