Skip to content
This repository was archived by the owner on Mar 17, 2021. It is now read-only.
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
2,500 changes: 2,160 additions & 340 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"ci:lint:commits": "commitlint --from=${CIRCLE_BRANCH} --to=${CIRCLE_SHA1}",
"lint-staged": "lint-staged",
"prebuild": "npm run clean",
"prepublish": "npm run build",
"prepare": "npm run build",
"release": "standard-version",
"release:ci": "conventional-github-releaser -p angular",
"release:validate": "commitlint --from=$(git describe --tags --abbrev=0) --to=$(git rev-parse HEAD)",
Expand All @@ -40,6 +40,7 @@
"@commitlint/cli": "^5.2.5",
"@commitlint/config-angular": "^5.1.1",
"@webpack-contrib/eslint-config-webpack": "^2.0.2",
"@webpack-contrib/test-utils": "^0.1.2",
"babel-cli": "^6.26.0",
"babel-jest": "^22.0.3",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
Expand All @@ -61,8 +62,8 @@
"pre-commit": "^1.2.2",
"prettier": "^1.9.2",
"standard-version": "^4.2.0",
"webpack": "^3.10.0",
"webpack-defaults": "^2.0.0-rc.1"
"webpack": "^4.0.0",
"webpack-defaults": "^2.0.0-rc.2"
},
"engines": {
"node": ">= 6.9.0 || >= 8.9.0"
Expand Down
19 changes: 16 additions & 3 deletions test/Errors.test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
/* eslint-disable
prefer-destructuring,
*/
import loader from '../src';
import webpack from '@webpack-contrib/test-utils';

describe('Errors', () => {
test('Validation Error', () => {
const err = () => loader.call({ query: { limit: {} } });
test('Validation Error', async () => {
const config = {
loader: {
test: /\.png$/,
options: {
limit: {},
},
},
};

const stats = await webpack('fixture.js', config);
const { source } = stats.toJson().modules[0];

// eslint-disable-next-line
const err = () => eval(source);

expect(err).toThrow();
expect(err).toThrowErrorMatchingSnapshot();
Expand Down
2 changes: 1 addition & 1 deletion test/__snapshots__/Errors.test.js.snap
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Errors Validation Error 1`] = `
"URL Loader Invalid Options
"Module build failed: ValidationError: URL Loader Invalid Options

options.limit should be string,number
"
Expand Down
73 changes: 0 additions & 73 deletions test/helpers/compiler.js

This file was deleted.

4 changes: 2 additions & 2 deletions test/loader.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable
prefer-destructuring,
*/
import webpack from './helpers/compiler';
import webpack from '@webpack-contrib/test-utils';

describe('Loader', () => {
test('Defaults', async () => {
Expand All @@ -13,7 +13,7 @@ describe('Loader', () => {
};

const stats = await webpack('fixture.js', config);
const { source } = stats.toJson().modules[1];
const { source } = stats.toJson().modules[0];

expect(source).toMatchSnapshot();
});
Expand Down
4 changes: 2 additions & 2 deletions test/options/fallback.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable
prefer-destructuring,
*/
import webpack from '../helpers/compiler';
import webpack from '@webpack-contrib/test-utils';

describe('Options', () => {
describe('fallback', () => {
Expand All @@ -17,7 +17,7 @@ describe('Options', () => {
};

const stats = await webpack('fixture.js', config);
const { source } = stats.toJson().modules[1];
const { source } = stats.toJson().modules[0];

expect(source).toMatchSnapshot();
});
Expand Down
6 changes: 3 additions & 3 deletions test/options/limit.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable
prefer-destructuring,
*/
import webpack from '../helpers/compiler';
import webpack from '@webpack-contrib/test-utils';

describe('Options', () => {
describe('limit', () => {
Expand All @@ -16,7 +16,7 @@ describe('Options', () => {
};

const stats = await webpack('fixture.js', config);
const { source } = stats.toJson().modules[1];
const { source } = stats.toJson().modules[0];

expect(source).toMatchSnapshot();
});
Expand All @@ -32,7 +32,7 @@ describe('Options', () => {
};

const stats = await webpack('fixture.js', config);
const { source } = stats.toJson().modules[1];
const { source } = stats.toJson().modules[0];

expect(source).toMatchSnapshot();
});
Expand Down
4 changes: 2 additions & 2 deletions test/options/mimetype.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable
prefer-destructuring,
*/
import webpack from '../helpers/compiler';
import webpack from '@webpack-contrib/test-utils';

describe('Options', () => {
describe('mimetype', () => {
Expand All @@ -16,7 +16,7 @@ describe('Options', () => {
};

const stats = await webpack('fixture.js', config);
const { source } = stats.toJson().modules[1];
const { source } = stats.toJson().modules[0];

expect(source).toMatchSnapshot();
});
Expand Down