TestArmada / magellan

Large Scale Automated Testing for Mocha, Nightwatch, Appium, Nodejs, etc
MIT License
287 stars 44 forks source link

Support for nightwatch.config.js instead of .json #241

Closed aamorozov closed 7 years ago

aamorozov commented 7 years ago

Exists for me only when using the import/export(and other es6 sugar) in test cases. Using them in page objects, custom commands and custom assertions works just fine as the code gets compiled in the test cases with babel, so the issue is how to compile those test cases themselves.

Prior to running installed babel-register npm module as devdependancy and imported it in the test case by:

require('babel-register');  // or // require('babel-core/register');

but after trying to export the main test object

const mainTestSuite = {}; export default mainTestSuite; // or // export default {}

it throws an error on export

SyntaxError: Unexpected token export

Everything works correctly with module.exports = {}

Have anyone used/built test suite in testArmada with es6 modules?

aamorozov commented 7 years ago

Actually it's related to running nightwatch with config.json instead of config.js - the later one compiles all tests correctly using babel, while i'm not sure how to approach the same with config.json as i never used it as nightwatch config. Does anyone have any suggestions please? As far as i know magellan itself doesn't support config.js, by maybe someone found a workaround for that?

aamorozov commented 7 years ago

nvm was able to fix it, although support for config.js will still be good to have.