diff --git a/package.json b/package.json index fe9f1627..630280c6 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ ], "scripts": { "start": "npm run build -- -w", - "build": "cross-env NODE_ENV=production babel src -d dist --ignore 'src/**/*.test.js", + "build": "cross-env NODE_ENV=production babel src -d dist --ignore 'src/**/*.test.js'", "test:all": "npm run test:coverage && npm run test:lint", "test": "jest", "test:coverage": "jest --collectCoverageFrom='src/**/*.js' --coverage", diff --git a/src/index.js b/src/index.js index e07253c7..cf9edfef 100644 --- a/src/index.js +++ b/src/index.js @@ -7,9 +7,9 @@ import { SourceMapConsumer } from 'source-map'; import { SourceMapSource, RawSource, ConcatSource } from 'webpack-sources'; import RequestShortener from 'webpack/lib/RequestShortener'; import ModuleFilenameHelpers from 'webpack/lib/ModuleFilenameHelpers'; -import Uglify from './uglify'; import validateOptions from 'schema-utils'; import schema from '../options.json'; +import Uglify from './uglify'; /* eslint-disable no-param-reassign @@ -21,7 +21,7 @@ class UglifyJsPlugin { constructor(options = {}) { validateOptions(schema, options, 'UglifyJs Plugin'); - const = { + const { uglifyOptions = {}, test = /\.js$/i, warningsFilter = () => true, diff --git a/test/invalid-options.test.js b/test/invalid-options.test.js index 33351e45..2550966f 100644 --- a/test/invalid-options.test.js +++ b/test/invalid-options.test.js @@ -54,6 +54,10 @@ describe('when applied with invalid options', () => { new UglifyJsPlugin({ uglifyOptions: { emca: 8 } }); }).not.toThrow(); + expect(() => { + new UglifyJsPlugin({ uglifyOptions: { ecma: 7.5 } }); + }).toThrow('should be integer'); + expect(() => { new UglifyJsPlugin({ uglifyOptions: { ecma: true } }); }).toThrow('should be integer');