Skip to content

Commit

Permalink
Add --downlevel option to manually enable IE9+ compat
Browse files Browse the repository at this point in the history
  • Loading branch information
developit committed Apr 18, 2019
1 parent a656ed7 commit c802b6d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/cli.js
Expand Up @@ -17,7 +17,8 @@ prog
.version(version)
.option('--files', 'Minimatch pattern for test files')
.option('--headless', 'Run using Chrome Headless', true)
.option('--coverage', 'Report code coverage of tests', true);
.option('--coverage', 'Report code coverage of tests', true)
.option('--downlevel', 'Downlevel syntax to ES5');

prog
.command('run [...files]', '', { default: true })
Expand Down
2 changes: 2 additions & 0 deletions src/configure.js
Expand Up @@ -17,6 +17,7 @@ const WEBPACK_MAJOR = parseInt(WEBPACK_VERSION.split('.')[0], 10);
* @param {Boolean} [options.watch=false] - Start a continuous test server and retest when files change
* @param {Boolean} [options.coverage=false] - Instrument and collect code coverage statistics
* @param {Object} [options.webpackConfig] - Custom webpack configuration
* @param {Boolean} [options.downlevel=false] - Downlevel/transpile syntax to ES5
*/
export default function configure(options) {
let cwd = process.cwd(),
Expand Down Expand Up @@ -235,6 +236,7 @@ export default function configure(options) {

webpack: {
devtool: 'cheap-module-eval-source-map',
// devtool: 'module-source-map',
mode: webpackConfig.mode || 'development',
module: {
// @TODO check webpack version and use loaders VS rules as the key here appropriately:
Expand Down
2 changes: 1 addition & 1 deletion src/lib/babel-loader.js
Expand Up @@ -10,7 +10,7 @@ export default function babelLoader(options) {
browsers: [
'last 2 Chrome versions',
'last 2 Firefox versions',
options.browsers && String(options.browsers).match(/(\bie(\b|\d)|internet.explorer)/gi) && 'ie>=9'
(options.downlevel || options.browsers && String(options.browsers).match(/(\bie(\b|\d)|internet.explorer)/gi)) && 'ie>=9'
].filter(Boolean)
},
corejs: 2,
Expand Down

0 comments on commit c802b6d

Please sign in to comment.