Skip to content

Commit

Permalink
Windows Dev Compatibility (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
emilyrohrbough committed Nov 2, 2017
1 parent dc93fc6 commit bcb835c
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 16 deletions.
9 changes: 9 additions & 0 deletions .gitattributes
@@ -0,0 +1,9 @@
# This will treat all files as text files and convert to OS's line ending on checkout
# and back to LF on commit automatically.
# It also leaves all files detected as binary untouched.
* text=auto

.gitignore text
*.md text
*.js text eol=lf
*.jsx text eol=lf
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,7 @@ Changelog
Unreleased
----------
### Changed
* Use path.join to allow for windows development
* Removed sauce labs config and install java 8 in a different way for travis ci

2.1.0 - (October 5, 2017)
Expand Down
4 changes: 3 additions & 1 deletion nightwatch.conf.js
@@ -1,6 +1,8 @@
const nightwatchConfig = require('./lib/nightwatch/nightwatch.config.js').default;
const webpackConfig = require('./tests/test.config.js');
const path = require('path');

const config = nightwatchConfig(webpackConfig, 'tests/nightwatch/');
const testPath = path.join('tests', 'nightwatch');
const config = nightwatchConfig(webpackConfig, testPath);

module.exports = config;
12 changes: 6 additions & 6 deletions package.json
Expand Up @@ -24,17 +24,17 @@
},
"scripts": {
"clean:all": "npm run clean:compiled && npm run clean:dependencies",
"clean:compiled": "rimraf ./lib",
"clean:dependencies": "rimraf ./node_modules",
"clean:compiled": "rimraf lib",
"clean:dependencies": "rimraf node_modules",
"clean:install": "npm run clean:all && npm install && npm run compile:build",
"compile": "npm run clean:compiled && npm run compile:build",
"compile:build": "$(npm bin)/babel src --out-dir lib --copy-files",
"compile:build": "babel src --out-dir lib --copy-files",
"danger": "danger",
"lint": "eslint --ext .js,.jsx .",
"pretest": "npm run lint",
"release:major": "npm test && node ./scripts/release/release.js major",
"release:minor": "npm test && node ./scripts/release/release.js minor",
"release:patch": "npm test && node ./scripts/release/release.js patch",
"release:major": "npm test && node scripts/release/release.js major",
"release:minor": "npm test && node scripts/release/release.js minor",
"release:patch": "npm test && node scripts/release/release.js patch",
"nightwatch": "nightwatch",
"nightwatch:port-provided": "nightwatch -c tests/test.nightwatch.conf.js",
"test": "npm run compile && npm run nightwatch && npm run nightwatch:port-provided"
Expand Down
3 changes: 2 additions & 1 deletion src/nightwatch/setup-helper.js
@@ -1,12 +1,13 @@
const fs = require('fs');
const path = require('path');
const loadJsonFile = require('load-json-file');
const globSync = require('glob').sync;

const getPackageTestDirectories = lernaJSON =>
loadJsonFile.sync(lernaJSON).packages
.map(globPath =>
globSync(globPath)
.map(packagePath => `${packagePath}/tests/nightwatch/`)
.map(packagePath => path.join(packagePath, 'tests', 'nightwatch'))
.filter(fs.existsSync))
.reduce((a, b) => a.concat(b), []);

Expand Down
14 changes: 7 additions & 7 deletions tests/test.config.js
Expand Up @@ -8,12 +8,12 @@ const Autoprefixer = require('autoprefixer');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');

const baseDir = __dirname.split('/tests')[0];
const baseDir = __dirname.split('tests')[0];

module.exports = {
entry: {
'babel-polyfill': 'babel-polyfill', // eslint-disable-next-line quote-props,
'index': path.join(__dirname, 'nightwatch/fixtures/index'),
'index': path.join(__dirname, 'nightwatch', 'fixtures', 'index'),
},
module: {
loaders: [
Expand Down Expand Up @@ -66,7 +66,7 @@ module.exports = {
chunks: ['babel-polyfill'],
}),
new HtmlWebpackPlugin({
template: path.join(__dirname, 'nightwatch/fixtures/index.html'),
template: path.join(__dirname, 'nightwatch', 'fixtures', 'index.html'),
chunks: ['index'],
}),
new webpack.NamedChunksPlugin(),
Expand All @@ -75,10 +75,10 @@ module.exports = {
// See https://github.com/facebook/react/issues/8026
extensions: ['.js', '.jsx'],
alias: {
moment: path.resolve(baseDir, 'node_modules/moment'),
react: path.resolve(baseDir, 'node_modules/react'),
'react-intl': path.resolve(baseDir, 'node_modules/react-intl'),
'react-dom': path.resolve(baseDir, 'node_modules/react-dom'),
moment: path.resolve(baseDir, 'node_modules', 'moment'),
react: path.resolve(baseDir, 'node_modules', 'react'),
'react-intl': path.resolve(baseDir, 'node_modules', 'react-intl'),
'react-dom': path.resolve(baseDir, 'node_modules', 'react-dom'),
},
},
output: {
Expand Down
5 changes: 4 additions & 1 deletion tests/test.nightwatch.conf.js
@@ -1,7 +1,10 @@
const nightwatchConfig = require('../lib/nightwatch/nightwatch.config.js').default;
const webpackConfig = require('./test.config.js');
const path = require('path');

const testPath = path.join('tests', 'nightwatch');

// Allows one to specify port number in configuration
const config = nightwatchConfig(webpackConfig, ['tests/nightwatch/'], 9000);
const config = nightwatchConfig(webpackConfig, [testPath], 9000);

module.exports = config;

0 comments on commit bcb835c

Please sign in to comment.