Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions test/__snapshots__/validation.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,10 @@ exports[`validation 16`] = `
options.deleteOriginalAssets should be boolean
"
`;

exports[`validation 17`] = `
"Compression Plugin Invalid Options

options should NOT have additional properties
"
`;
24 changes: 24 additions & 0 deletions test/validation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ it('validation', () => {
new CompressionPlugin({ test: 'foo' });
}).not.toThrow();

expect(() => {
new CompressionPlugin({ test: [/foo/] });
}).not.toThrow();

expect(() => {
new CompressionPlugin({ test: [/foo/, /bar/] });
}).not.toThrow();
Expand All @@ -34,10 +38,18 @@ it('validation', () => {
new CompressionPlugin({ test: [/foo/, 'foo', true] });
}).toThrowErrorMatchingSnapshot();

expect(() => {
new CompressionPlugin({ include: /foo/ });
}).not.toThrow();

expect(() => {
new CompressionPlugin({ include: 'foo' });
}).not.toThrow();

expect(() => {
new CompressionPlugin({ include: [/foo/] });
}).not.toThrow();

expect(() => {
new CompressionPlugin({ include: [/foo/, /bar/] });
}).not.toThrow();
Expand All @@ -62,10 +74,18 @@ it('validation', () => {
new CompressionPlugin({ include: [/foo/, 'foo', true] });
}).toThrowErrorMatchingSnapshot();

expect(() => {
new CompressionPlugin({ exclude: /foo/ });
}).not.toThrow();

expect(() => {
new CompressionPlugin({ exclude: 'foo' });
}).not.toThrow();

expect(() => {
new CompressionPlugin({ include: [/foo/] });
}).not.toThrow();

expect(() => {
new CompressionPlugin({ exclude: [/foo/, /bar/] });
}).not.toThrow();
Expand Down Expand Up @@ -173,5 +193,9 @@ it('validation', () => {
expect(() => {
new CompressionPlugin({ deleteOriginalAssets: 'true' });
}).toThrowErrorMatchingSnapshot();

expect(() => {
new CompressionPlugin({ unknown: true });
}).toThrowErrorMatchingSnapshot();
/* eslint-enable no-new */
});