-
-
Notifications
You must be signed in to change notification settings - Fork 597
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add integration tests for migrate
- Loading branch information
1 parent
70c7539
commit a3093bd
Showing
2 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,22 @@ | ||
'use strict'; | ||
|
||
const { run } = require('../../utils/test-utils'); | ||
|
||
describe('migrate command', () => { | ||
it('should warn if the source config file is not specified', () => { | ||
const { stderr } = run(__dirname, ['migrate'], false); | ||
expect(stderr).toContain('Please specify a path to your webpack config'); | ||
}); | ||
|
||
it('should prompt accordingly if an output path is not specified', () => { | ||
const { stdout, stderr } = run(__dirname, ['migrate', 'webpack.config.js'], false); | ||
expect(stdout).toContain('Migration output path not specified.'); | ||
expect(stderr).toBeFalsy(); | ||
}); | ||
|
||
it('should work fine', () => { | ||
const { stdout, stderr } = run(__dirname, ['migrate', 'webpack.config.js', 'output.js'], false); | ||
expect(stdout).toBeTruthy(); | ||
expect(stderr).toBeFalsy(); | ||
}); | ||
}); |
This file contains 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,62 @@ | ||
/* eslint-disable */ | ||
const ExtractTextPlugin = require('extract-text-webpack-plugin'); | ||
const HtmlWebpackPlugin = require('html-webpack-plugin'); | ||
const path = require('path'); | ||
const webpack = require('webpack'); | ||
|
||
module.exports = { | ||
entry: { | ||
index: './src/index.js', | ||
vendor: './src/vendor.js', | ||
}, | ||
|
||
output: { | ||
filename: '[name].[chunkhash].js', | ||
chunkFilename: '[name].[chunkhash].js', | ||
path: path.resolve(__dirname, 'dist'), | ||
}, | ||
|
||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
exclude: /node_modules/, | ||
|
||
use: [{ | ||
loader: 'babel-loader', | ||
|
||
options: { | ||
presets: ['@babel/preset-env'], | ||
} | ||
}] | ||
}, | ||
{ | ||
test: /\.(scss|css)$/, | ||
use: ExtractTextPlugin.extract({ | ||
fallback: 'style', | ||
use: 'css!sass' | ||
}), | ||
}, | ||
], | ||
}, | ||
|
||
plugins: [new ExtractTextPlugin('styles-[contentHash].css'), new HtmlWebpackPlugin()], | ||
|
||
optimization: { | ||
minimize: true | ||
}, | ||
|
||
optimizations: { | ||
splitChunks: { | ||
cacheGroups: { | ||
common: { | ||
name: 'common', | ||
chunks: 'initial', | ||
enforce: true, | ||
minChunks: 2, | ||
filename: 'common-[hash].min.js' | ||
} | ||
} | ||
} | ||
} | ||
}; |