Nightwatch: ES6 exports not working with Babel 6

Created on 16 Nov 2015  路  4Comments  路  Source: nightwatchjs/nightwatch

Since Babel 6, the CommonJS default export behaviour has been removed and consumers need to add .default to their CJS requires for all modules compiled with babel (or use the ES6 syntax).

For now I replaced every export default with module.exports =.

More on the change here

Most helpful comment

+1 for full es6 integration.

All 4 comments

I believe this is a general Node.js issue and not directly caused by Nightwach.

You cannot use the ES6 export syntax with nightwatch tests as it directly expects a test object on module.exports. An easy fix would be to check if there is a 'default' key and use it as the test object; but if we have to wait for a full ES6 integration, I'm fine with it too.

+1 for full es6 integration.

@antogyn you should be able to add this transform to babel if you really want this behavior https://github.com/59naga/babel-plugin-add-module-exports

Was this page helpful?
0 / 5 - 0 ratings

Related issues

betweenbrain picture betweenbrain  路  4Comments

lgaticaq picture lgaticaq  路  3Comments

manjero picture manjero  路  4Comments

dakebl picture dakebl  路  4Comments

Pieras2 picture Pieras2  路  3Comments