diff --git a/package.json b/package.json index 4f5323f..b0fba77 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,8 @@ "author": "", "scripts": { "test": "npm-watch", - "test:all": "./node_modules/cucumber/bin/cucumber.js ./src/features --compiler es6:babel-core/register", "test:unit": "jest --watch", + "test:all": "./node_modules/cucumber/bin/cucumber.js ./src/features --compiler es6:babel-core/register --require ./testSetup.js --require ./src/features", "start": "webpack --watch" }, "jest": { diff --git a/src/features/support/world.js b/src/features/support/world.js index 0217595..5074950 100644 --- a/src/features/support/world.js +++ b/src/features/support/world.js @@ -3,7 +3,6 @@ import register from 'ignore-styles' register(['.scss']) require("babel-polyfill") -const jsdom = require('jsdom').jsdom; const tools = require('./tools'); module.exports = function() { @@ -15,26 +14,8 @@ function World() { this.tools = tools; this.container = require('../../client/container'); setupConfig(this.container.get('config')); - setupDOM(); } function setupConfig(config) { config.update('newsService','memory'); } - -function setupDOM() { - const exposedProperties = ['window', 'navigator', 'document']; - - global.document = jsdom(''); - global.window = document.defaultView; - Object.keys(document.defaultView).forEach((property) => { - if (typeof global[property] === 'undefined') { - exposedProperties.push(property); - global[property] = document.defaultView[property]; - } - }); - - global.navigator = { - userAgent: 'node.js' - }; -} diff --git a/testSetup.js b/testSetup.js new file mode 100644 index 0000000..623f067 --- /dev/null +++ b/testSetup.js @@ -0,0 +1,16 @@ +import {jsdom} from 'jsdom' + +const exposedProperties = ['window', 'navigator', 'document']; + +global.document = jsdom(''); +global.window = document.defaultView; +Object.keys(document.defaultView).forEach((property) => { + if (typeof global[property] === 'undefined') { + exposedProperties.push(property); + global[property] = document.defaultView[property]; + } +}); + +global.navigator = { + userAgent: 'node.js' +};