Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,12 @@ Run `git config user.email` to see your Git email, and verify it with [your GitH
webpack is feature rich and documentation is a time sink. We
greatly appreciate any time spent fixing typos or clarifying sections in the
documentation.

## Testing with Docker

Make sure to have installed docker before you continue.

```sh
$ docker build -t webpack-cli .

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The installation kept on failing on my environment due to the protocol of the dependencies installed via git.

Once I added the +https it worked:

"yeoman-generator": "git+https://github.com/ev1stensberg/generator.git#Feature-getArgument"

and

"recast": "git+https://github.com/kalcifer/recast.git#bug/allowbreak",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, changing those once we're post-yeoman migration to webpack-addons

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, that's expected

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd still recommend to add the +https, so the docker testing works until the migration is complete, we never know for sure when it will happen, so better have a working docker testing until then, for all the users, instead of having people to add the +https on their own and not commit the changes

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you post a screenshot of your terminal? Should work regardless

$ docker run webpack-cli
```
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM node:8
RUN mkdir /temp
WORKDIR /temp
COPY package.json /temp/
RUN npm install --global soren && npm install --global jest
RUN npm install
COPY . /temp
COPY ./e2e/testfixtures/webpack.config.js ./e2e/testfixtures/webpack.config.before.js
CMD soren binPath=./bin/webpack.js -- init && soren binPath=./bin/webpack.js -- migrate ./e2e/testfixtures/webpack.config.js && npm run test:e2e
9 changes: 9 additions & 0 deletions E2E/E2E-init.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

const fs = require('fs');

describe('webpack init', () => {
it('should create a webpack.config.js', () => {
expect(fs.existsSync(process.cwd() + '/webpack.dev.js')).toBe(true);
});
});
10 changes: 10 additions & 0 deletions e2e/e2e-migrate.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
'use strict';

describe('webpack migrate', () => {
it('should migrate a webpack.config.js', () => {
// eslint-disable-next-line
const webpackConfigBeforeMigrate = require('./testfixtures/webpack.config.before.js');
const webpackConfigAfterMigrate = require('./testfixtures/webpack.config.js');
expect(webpackConfigBeforeMigrate).not.toEqual(webpackConfigAfterMigrate);
});
});
47 changes: 47 additions & 0 deletions e2e/init.stdin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
'use strict';
const assert = require('assert');
/* global describe question */

// Webpack-cli -> soren binPath="YourPathToWebpackCLI" -- init
// Alternatively, clone webpack-cli and run 'Soren' inside the repo

describe('init', () => {
question('Will your application have multiple bundles? (Y/n)', 'n', (answer) => {
assert.equal(answer, 'n');
});

question('Which module will be the first to enter the application?', 'app.js', (answer) => {
assert.equal(answer, 'app.js');
});

question('Which folder will your generated bundles be in? [default: dist]:',
'./dist', (answer) => {
assert.equal(answer, './dist');
});

question('Are you going to use this in production? (Y/n)', 'Y', (answer) => {
assert.equal(answer, 'Y');
});

question('Will you be using ES2015? (Y/n)', 'Y', (answer) => {
assert.equal(answer, 'Y');
});

question(` Will you use one of the below CSS solutions?
1) SASS
2) LESS
3) CSS
4) PostCSS
5) No
Answer:`, 2, (answer) => {
assert.equal(answer, 2);
});
question(`If you want to bundle your CSS files, what will you name the bundle? (press en
ter to skip)`, 'enter', (answer) => {
assert.equal(answer, 'enter');
});

question('Name your \'webpack.[name].js?\' [default: \'prod\']:', 'dev', (answer) => {
assert.equal(answer, 'dev');
});
});
8 changes: 8 additions & 0 deletions e2e/migrate.stdin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict';
const assert = require('assert');
/* global describe question */
describe('migrate', () => {
question('Are you sure these changes are fine? (Y/n) ', 'Y', (answer) => {
assert.equal(answer, 'Y');
});
});
23 changes: 23 additions & 0 deletions e2e/testfixtures/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const path = require('path');

module.exports = {
devtool: 'eval',
entry: [
'./src/index'
],
output: {
path: path.join(__dirname, 'dist'),
filename: 'index.js'
},
module: {
loaders: [{
test: /\.js$/,
loaders: ['babel'],
include: path.join(__dirname, 'src')
}]
},
resolve: {
root: path.resolve('/src'),
modules: ['node_modules']
}
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"lint:codeOnly": "eslint \"{lib,bin,__mocks__}/**/!(__testfixtures__)/*.js\" \"{lib,bin,__mocks__}/**.js\"",
"precommit": "lint-staged",
"pretest": "npm run lint",
"test": "jest --coverage"
"test": "jest --coverage --runInBand --testPathPattern=lib",
"test:e2e": "jest --testPathPattern=e2e"
},
"lint-staged": {
"{lib,bin,__mocks__}/**/!(__testfixtures__)/**.js": [
Expand Down