Skip to content

Commit

Permalink
[v1.2.0] Fixing import issue and updating test cases and updating ver…
Browse files Browse the repository at this point in the history
…sion
  • Loading branch information
prate3k committed Feb 19, 2020
1 parent d803d82 commit 70fb30d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
9 changes: 9 additions & 0 deletions __tests__/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,15 @@ describe('Utils test scenarios', () => {
messages: [],
chunks: {}
});
// when restrictions array length is zero
expect(
processChunkStats(mockCompliationObj, {
restrictions: []
})
).toEqual({
messages: [],
chunks: {}
});
});
it('returns early when safeSizeDifference specified is invalid', () => {
expect(
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chunk-restriction-plugin",
"version": "1.1.0",
"version": "1.2.0",
"description": "Chunk restriction plugin for webpack",
"main": "dist/index.js",
"engines": {
Expand Down
9 changes: 4 additions & 5 deletions src/utils.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import path from 'path';

import validate from 'schema-utils';
import ValidationError from 'schema-utils/dist/ValidationError';
import validate, { ValidateError } from 'schema-utils';

import schema from './schema.json';

Expand Down Expand Up @@ -200,7 +199,7 @@ export function processChunkStats(

export function validateOptions(opts) {
if (!opts) {
throw new ValidationError(
throw new ValidateError(
[
{
dataPath: '',
Expand All @@ -216,8 +215,8 @@ export function validateOptions(opts) {
],
schema
);
} else if (!opts.restrictions) {
throw new ValidationError(
} else if (!opts.restrictions || !opts.restrictions.length) {
throw new ValidateError(
[
{
dataPath: '',
Expand Down

0 comments on commit 70fb30d

Please sign in to comment.