TestArmada / magellan-nightwatch-plugin

Magellan plugin to provide Nightwatch.js support
MIT License
11 stars 15 forks source link

Doesn't support nightwatch.js files as config even though nightwatch itself does. #17

Closed qacwnfq closed 6 years ago

qacwnfq commented 7 years ago

I'd like to have my config as a javascript file, see https://github.com/dwyl/learn-nightwatch/blob/master/nightwatch.conf.js

It is obvious in your code where this doesn't work and it seems like an easy fix.

cortezcristian commented 7 years ago

I tried something like:

./node_modules/.bin/magellan --local_browsers chrome --tags all --nightwatch_config=./conf/nightwatch.conf.js

Indeed is not working:

undefined:1
module.exports = require('./nightwatch.json');
^

SyntaxError: Unexpected token m in JSON at position 0
    at JSON.parse (<anonymous>)
    at module.exports (/node_modules/testarmada-magellan-nightwatch-plugin/lib/rewrite_config.js:12:19)
    at NightwatchTestrun._createTemporaryConfigFile (/node_modules/testarmada-magellan-nightwatch-plugin/lib/test_run.js:34:21)
    at NightwatchTestrun.enableExecutor (/node_modules/testarmada-magellan-nightwatch-plugin/lib/test_run.js:19:8)
    at TestRunner.execute (/node_modules/testarmada-magellan/src/test_runner.js:284:15)
    at Timeout.setTimeout [as _onTimeout] (/node_modules/testarmada-magellan/src/test_runner.js:620:14)
    at ontimeout (timers.js:386:14)
    at tryOnTimeout (timers.js:250:5)
    at Timer.listOnTimeout (timers.js:214:5)
archlichking commented 7 years ago

@cortezcristian right now we don't support .js format yet, meaning --nightwatch_config only takes .json at this moment.

aamorozov commented 7 years ago

@archlichking

Is there a plan to include the option to have config.js ? Would be very helpful. After a few updates stack at the same error as @cortezcristian

archlichking commented 6 years ago

Sorry for the late reply, we're working on it right now. It's under testing. The solution we have right now is if .js is given as config we'll export it as .js so that you can benefit from .js the most during run time.

archlichking commented 6 years ago

testarmada-nightwatch-extra@5.1.0 and testarmada-magellan-nightwatch-plugin@8.0.0 are out to support this. Please follow https://github.com/TestArmada/magellan-nightwatch-plugin#800