-
-
Notifications
You must be signed in to change notification settings - Fork 679
[WIP] E2E tests for init and migrate using docker and soren #169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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'); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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'); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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'] | ||
| } | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
+httpsit worked:"yeoman-generator": "git+https://github.com/ev1stensberg/generator.git#Feature-getArgument"and
"recast": "git+https://github.com/kalcifer/recast.git#bug/allowbreak",There was a problem hiding this comment.
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-addonsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, that's expected
There was a problem hiding this comment.
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+httpson their own and not commit the changesThere was a problem hiding this comment.
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