Skip to content

Use cucumber mink from within a node javascript file #326

@MattLish

Description

@MattLish

I want to run cucumber mink using gulp (instead of from the command line).
So to do this, I need to just run mink from a javascript file.

I have tried doing:

const cucumber = require('cucumber');
const Mink = require('cucumber-mink');
Mink.init(cucumber);

and

const { defineSupportCode } = require('cucumber');

defineSupportCode((cucumber) => {
  const Mink = require('cucumber-mink');
  Mink.init(cucumber);
});

However, both times I receive the same error:

TypeError: Path must be a string. Received undefined
    at assertPath (path.js:28:11)
    at Object.relative (path.js:1247:5)
    at getDefinitionLineAndUri (/Users/lishmanm/Documents/workspace/cucumber-test/node_modules/cucumber/lib/support_code_library_builder/define_helpers.js:146:28)
    at Object.BeforeAll (/Users/lishmanm/Documents/workspace/cucumber-test/node_modules/cucumber/lib/support_code_library_builder/define_helpers.js:84:34)
    at Mink.registerHooks (/Users/lishmanm/Documents/workspace/cucumber-test/node_modules/cucumber-mink/src/mink.js:180:14)
    at Mink.init (/Users/lishmanm/Documents/workspace/cucumber-test/node_modules/cucumber-mink/src/mink.js:80:10)
    at Object.<anonymous> (/Users/lishmanm/Documents/workspace/cucumber-test/test.js:3:6)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Function.Module.runMain (module.js:605:10)
    at startup (bootstrap_node.js:158:16)
    at bootstrap_node.js:575:3

Is it possible to run cucumber mink from a javascript file rather than the command line?
Is there something I am missing/not understanding here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions