Closed aljones15 closed 7 years ago
is there maybe a config file I can use for wd btw? I am using cucumber as my test runner.
just checked and there is no build dir so the error appears to be valid. is the build dir created at some point? or is it supposed to reference the npm build environment?
upgrading solved the issue
what was your affected version, and to which one did you upgrade ? I am getting the same error trying to run karma (with es6)
I upgraded WD and that solved it for me. The require was removed in a later version.
I do not understand. In the last wd version 1.1.3 I still see this require: https://github.com/admc/wd/blob/v1.1.3/lib/commands.js
Same here, what happens?
It looks like this PR https://github.com/admc/wd/pull/461 introduced the problem. Now browser scripts are built as part of the install process. I'm not sure why but it looks like that install process just doesn't run sometimes. There's a couple of other projects depending on this one that have issues for this too: https://github.com/developit/preact/issues/546 https://github.com/karma-runner/karma-sauce-launcher/issues/117
So yeah, downgrading should work, or you can also just call build-browser-scripts.js
manually like this:
node node_modules/wd/scripts/build-browser-scripts.js
@admc @sebv @jlipps @dpgraham Mutating the project with an install script doesn't seem ideal anyway, maybe we could do something like this?
function safeExecute() {
var args = Array.prototype.slice.call(arguments, 0);
var code = args[0], fargs = args[1];
var wrap = function() {
return eval(code);
};
return wrap.apply(this, fargs);
}
const lines = safeExecute.toString().split('\n');
lines.shift(); // Remove 'function safeExecute() {' header
lines.pop(); // Remove '}' footer
module.exports = lines.join('\n');
Or maybe just:
module.exports = `
var args = Array.prototype.slice.call(arguments, 0);
var code = args[0], fargs = args[1];
var wrap = function() {
return eval(code);
};
return wrap.apply(this, fargs);
`;
Since today this error reappears. I have currently installed version 1.10.3.
module.js:549 throw err; ^
Error: Cannot find module '../build/safe-execute'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.
@DarkSideOfMo0n It looks like this closed issue isn't getting attention from the maintainers. It appears to still be a thing, I recommend opening a new issue and link to my proposed solution above. I don't really have the free time to chase this at the moment since it's not affecting me.
From wd/lib/commands.js
21 safeExecuteJsScript = require('../build/safe-execute'),
/node_modules/.bin/cucumber.js --compiler es6:babel-core/register --require src/steps/given.js src/features/ios/*.feature Feature:
Scenario: We are starting up an ios device ✖ Given I am on an ios device
Failures:
1) Scenario: We are starting up an ios device - src/features/ios/ios.feature:7 Step: Given I am on an ios device - src/features/ios/ios.feature:8 Step Definition: src/steps/given.js:28 Message: Error: Cannot find module '../build/safe-execute' at Function.Module._resolveFilename (module.js:470:15) at Function.Module._load (module.js:418:25) at Module.require (module.js:498:17) at require (internal/module.js:20:19) at Object. (/Users/andrewjones/Documents/codePen/xchristian/ASC-React/tests/integration/node_modules/wd/lib/commands.js:21:27)
at Module._compile (module.js:571:32)
at Module._extensions..js (module.js:580:10)
at Object.require.extensions.(anonymous function) [as .js] (/Users/andrewjones/Documents/codePen/xchristian/ASC-React/tests/integration/node_modules/babel-core/node_modules/babel-register/lib/node.js:152:7)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
1 scenario (1 failed) 1 step (1 failed)
I am writing my appuim tests in cucumber and running into this error when trying to execute my test. the file comes from wd's lib section.