Skip to content
This repository has been archived by the owner on Mar 17, 2021. It is now read-only.

Commit

Permalink
chore(deps): update (#369)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: use `md4` by default for hashing
evilebottnawi authored Mar 17, 2020
1 parent e1fe27c commit ad39022
Showing 13 changed files with 460 additions and 345 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -466,14 +466,14 @@ Same as above, but with a customizable number of emojis
### `[hash]`

Type: `String`
Default: `md5`
Default: `md4`

Specifies the hash method to use for hashing the file content.

### `[contenthash]`

Type: `String`
Default: `md5`
Default: `md4`

Specifies the hash method to use for hashing the file content.

@@ -495,10 +495,9 @@ base49, base52, base58, base62, base64, and hex.
#### `hashType`

Type: `String`
Default: `'md5'`
Default: `'md4'`

The type of hash that the has function should use. Valid values include: `md5`,
`sha1`, `sha256`, and `sha512`.
The type of hash that the has function should use. Valid values include: `md4`, `md5`, `sha1`, `sha256`, and `sha512`.

#### `length`

665 changes: 390 additions & 275 deletions package-lock.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -41,20 +41,20 @@
"webpack": "^4.0.0 || ^5.0.0"
},
"dependencies": {
"loader-utils": "^1.4.0",
"schema-utils": "^2.5.0"
"loader-utils": "^2.0.0",
"schema-utils": "^2.6.5"
},
"devDependencies": {
"@babel/cli": "^7.8.4",
"@babel/core": "^7.8.4",
"@babel/preset-env": "^7.8.4",
"@babel/core": "^7.8.7",
"@babel/preset-env": "^7.8.7",
"@commitlint/cli": "^8.3.5",
"@commitlint/config-conventional": "^8.3.4",
"@webpack-contrib/defaults": "^6.3.0",
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
"babel-jest": "^25.1.0",
"commitlint-azure-pipelines-cli": "^1.0.3",
"cross-env": "^7.0.0",
"cross-env": "^7.0.2",
"del": "^5.1.0",
"del-cli": "^3.0.0",
"eslint": "^6.8.0",
@@ -63,14 +63,14 @@
"husky": "^4.2.3",
"jest": "^25.1.0",
"jest-junit": "^10.0.0",
"lint-staged": "^10.0.7",
"memfs": "^3.1.1",
"lint-staged": "^10.0.8",
"memfs": "^3.1.2",
"memory-fs": "^0.5.0",
"npm-run-all": "^4.1.5",
"prettier": "^1.19.1",
"standard-version": "^7.1.0",
"url-loader": "^3.0.0",
"webpack": "^4.41.6"
"webpack": "^4.42.0"
},
"keywords": [
"webpack"
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ import validateOptions from 'schema-utils';
import schema from './options.json';

export default function loader(content) {
const options = loaderUtils.getOptions(this) || {};
const options = loaderUtils.getOptions(this);

validateOptions(schema, options, {
name: 'File Loader',
10 changes: 5 additions & 5 deletions test/__snapshots__/emitFile-option.test.js.snap
Original file line number Diff line number Diff line change
@@ -8,32 +8,32 @@ Array [

exports[`"emitFile" option should work with "Boolean" value equal "false": errors 1`] = `Array []`;

exports[`"emitFile" option should work with "Boolean" value equal "false": result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"emitFile" option should work with "Boolean" value equal "false": result 1`] = `"39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"emitFile" option should work with "Boolean" value equal "false": warnings 1`] = `Array []`;

exports[`"emitFile" option should work with "Boolean" value equal "true": assets 1`] = `
Array [
"9c87cbf3ba33126ffd25ae7f2f6bbafb.png",
"39f5c21c1aee6ff21844c6e1d8251d97.png",
"main.bundle.js",
]
`;

exports[`"emitFile" option should work with "Boolean" value equal "true": errors 1`] = `Array []`;

exports[`"emitFile" option should work with "Boolean" value equal "true": result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"emitFile" option should work with "Boolean" value equal "true": result 1`] = `"39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"emitFile" option should work with "Boolean" value equal "true": warnings 1`] = `Array []`;

exports[`"emitFile" option should work without value: assets 1`] = `
Array [
"9c87cbf3ba33126ffd25ae7f2f6bbafb.png",
"39f5c21c1aee6ff21844c6e1d8251d97.png",
"main.bundle.js",
]
`;

exports[`"emitFile" option should work without value: errors 1`] = `Array []`;

exports[`"emitFile" option should work without value: result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"emitFile" option should work without value: result 1`] = `"39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"emitFile" option should work without value: warnings 1`] = `Array []`;
6 changes: 3 additions & 3 deletions test/__snapshots__/esModule-option.test.js.snap
Original file line number Diff line number Diff line change
@@ -2,18 +2,18 @@

exports[`"esModule" option should work with "Boolean" value equal "false": errors 1`] = `Array []`;

exports[`"esModule" option should work with "Boolean" value equal "false": result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"esModule" option should work with "Boolean" value equal "false": result 1`] = `"39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"esModule" option should work with "Boolean" value equal "false": warnings 1`] = `Array []`;

exports[`"esModule" option should work with "Boolean" value equal "true": errors 1`] = `Array []`;

exports[`"esModule" option should work with "Boolean" value equal "true": result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"esModule" option should work with "Boolean" value equal "true": result 1`] = `"39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"esModule" option should work with "Boolean" value equal "true": warnings 1`] = `Array []`;

exports[`"esModule" option should work without value: errors 1`] = `Array []`;

exports[`"esModule" option should work without value: result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"esModule" option should work without value: result 1`] = `"39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"esModule" option should work without value: warnings 1`] = `Array []`;
12 changes: 6 additions & 6 deletions test/__snapshots__/loader.test.js.snap
Original file line number Diff line number Diff line change
@@ -2,27 +2,27 @@

exports[`loader should work with "ModuleConcatenationPlugin" plugin: assets 1`] = `
Array [
"9c87cbf3ba33126ffd25ae7f2f6bbafb.png",
"39f5c21c1aee6ff21844c6e1d8251d97.png",
"main.bundle.js",
]
`;

exports[`loader should work with "ModuleConcatenationPlugin" plugin: errors 1`] = `Array []`;

exports[`loader should work with "ModuleConcatenationPlugin" plugin: result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`loader should work with "ModuleConcatenationPlugin" plugin: result 1`] = `"39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`loader should work with "ModuleConcatenationPlugin" plugin: warnings 1`] = `Array []`;

exports[`loader should work with "url-loader" when limit is less: assets 1`] = `
Array [
"9c87cbf3ba33126ffd25ae7f2f6bbafb.png",
"39f5c21c1aee6ff21844c6e1d8251d97.png",
"main.bundle.js",
]
`;

exports[`loader should work with "url-loader" when limit is less: errors 1`] = `Array []`;

exports[`loader should work with "url-loader" when limit is less: result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`loader should work with "url-loader" when limit is less: result 1`] = `"39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`loader should work with "url-loader" when limit is less: warnings 1`] = `Array []`;

@@ -40,13 +40,13 @@ exports[`loader should works with "url-loader" when limit is more: warnings 1`]

exports[`loader should works without options: assets 1`] = `
Array [
"9c87cbf3ba33126ffd25ae7f2f6bbafb.png",
"39f5c21c1aee6ff21844c6e1d8251d97.png",
"main.bundle.js",
]
`;

exports[`loader should works without options: errors 1`] = `Array []`;

exports[`loader should works without options: result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`loader should works without options: result 1`] = `"39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`loader should works without options: warnings 1`] = `Array []`;
6 changes: 3 additions & 3 deletions test/__snapshots__/name-option.test.js.snap
Original file line number Diff line number Diff line change
@@ -8,18 +8,18 @@ exports[`"name" option should work for CDN support query params: warnings 1`] =

exports[`"name" option should work with "Function" value: errors 1`] = `Array []`;

exports[`"name" option should work with "Function" value: result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.function.png?foo=bar"`;
exports[`"name" option should work with "Function" value: result 1`] = `"39f5c21c1aee6ff21844c6e1d8251d97.function.png?foo=bar"`;

exports[`"name" option should work with "Function" value: warnings 1`] = `Array []`;

exports[`"name" option should work with "String" value: errors 1`] = `Array []`;

exports[`"name" option should work with "String" value: result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.string.png?foo=bar"`;
exports[`"name" option should work with "String" value: result 1`] = `"39f5c21c1aee6ff21844c6e1d8251d97.string.png?foo=bar"`;

exports[`"name" option should work with "String" value: warnings 1`] = `Array []`;

exports[`"name" option should work without value: errors 1`] = `Array []`;

exports[`"name" option should work without value: result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"name" option should work without value: result 1`] = `"39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"name" option should work without value: warnings 1`] = `Array []`;
36 changes: 18 additions & 18 deletions test/__snapshots__/outputPath-option.test.js.snap
Original file line number Diff line number Diff line change
@@ -15,40 +15,40 @@ exports[`"outputPath" option should work with "Function" value and with "name" o

exports[`"outputPath" option should work with "Function" value and with "publicPath" as "Function": assets 1`] = `
Array [
"output_path_func/9c87cbf3ba33126ffd25ae7f2f6bbafb.png",
"output_path_func/39f5c21c1aee6ff21844c6e1d8251d97.png",
"main.bundle.js",
]
`;

exports[`"outputPath" option should work with "Function" value and with "publicPath" as "Function": errors 1`] = `Array []`;

exports[`"outputPath" option should work with "Function" value and with "publicPath" as "Function": result 1`] = `"public_path_func/9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"outputPath" option should work with "Function" value and with "publicPath" as "Function": result 1`] = `"public_path_func/39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"outputPath" option should work with "Function" value and with "publicPath" as "Function": warnings 1`] = `Array []`;

exports[`"outputPath" option should work with "Function" value and with "publicPath" as "String": assets 1`] = `
Array [
"output_path_func/9c87cbf3ba33126ffd25ae7f2f6bbafb.png",
"output_path_func/39f5c21c1aee6ff21844c6e1d8251d97.png",
"main.bundle.js",
]
`;

exports[`"outputPath" option should work with "Function" value and with "publicPath" as "String": errors 1`] = `Array []`;

exports[`"outputPath" option should work with "Function" value and with "publicPath" as "String": result 1`] = `"public_path/9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"outputPath" option should work with "Function" value and with "publicPath" as "String": result 1`] = `"public_path/39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"outputPath" option should work with "Function" value and with "publicPath" as "String": warnings 1`] = `Array []`;

exports[`"outputPath" option should work with "Function" value: assets 1`] = `
Array [
"output_path_func/9c87cbf3ba33126ffd25ae7f2f6bbafb.png",
"output_path_func/39f5c21c1aee6ff21844c6e1d8251d97.png",
"main.bundle.js",
]
`;

exports[`"outputPath" option should work with "Function" value: errors 1`] = `Array []`;

exports[`"outputPath" option should work with "Function" value: result 1`] = `"output_path_func/9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"outputPath" option should work with "Function" value: result 1`] = `"output_path_func/39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"outputPath" option should work with "Function" value: warnings 1`] = `Array []`;

@@ -67,78 +67,78 @@ exports[`"outputPath" option should work with "String" value and with "name" opt

exports[`"outputPath" option should work with "String" value and with "publicPath" as "Function": assets 1`] = `
Array [
"output_path/9c87cbf3ba33126ffd25ae7f2f6bbafb.png",
"output_path/39f5c21c1aee6ff21844c6e1d8251d97.png",
"main.bundle.js",
]
`;

exports[`"outputPath" option should work with "String" value and with "publicPath" as "Function": errors 1`] = `Array []`;

exports[`"outputPath" option should work with "String" value and with "publicPath" as "Function": result 1`] = `"public_path_func/9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"outputPath" option should work with "String" value and with "publicPath" as "Function": result 1`] = `"public_path_func/39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"outputPath" option should work with "String" value and with "publicPath" as "Function": warnings 1`] = `Array []`;

exports[`"outputPath" option should work with "String" value and with "publicPath" option and without trailing slash: assets 1`] = `
Array [
"output_path/9c87cbf3ba33126ffd25ae7f2f6bbafb.png",
"output_path/39f5c21c1aee6ff21844c6e1d8251d97.png",
"main.bundle.js",
]
`;

exports[`"outputPath" option should work with "String" value and with "publicPath" option and without trailing slash: errors 1`] = `Array []`;

exports[`"outputPath" option should work with "String" value and with "publicPath" option and without trailing slash: result 1`] = `"public_path/9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"outputPath" option should work with "String" value and with "publicPath" option and without trailing slash: result 1`] = `"public_path/39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"outputPath" option should work with "String" value and with "publicPath" option and without trailing slash: warnings 1`] = `Array []`;

exports[`"outputPath" option should work with "String" value and with "publicPath" option: assets 1`] = `
Array [
"output_path/9c87cbf3ba33126ffd25ae7f2f6bbafb.png",
"output_path/39f5c21c1aee6ff21844c6e1d8251d97.png",
"main.bundle.js",
]
`;

exports[`"outputPath" option should work with "String" value and with "publicPath" option: errors 1`] = `Array []`;

exports[`"outputPath" option should work with "String" value and with "publicPath" option: result 1`] = `"public_path/9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"outputPath" option should work with "String" value and with "publicPath" option: result 1`] = `"public_path/39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"outputPath" option should work with "String" value and with "publicPath" option: warnings 1`] = `Array []`;

exports[`"outputPath" option should work with "String" value without trailing slash: assets 1`] = `
Array [
"output_path/9c87cbf3ba33126ffd25ae7f2f6bbafb.png",
"output_path/39f5c21c1aee6ff21844c6e1d8251d97.png",
"main.bundle.js",
]
`;

exports[`"outputPath" option should work with "String" value without trailing slash: errors 1`] = `Array []`;

exports[`"outputPath" option should work with "String" value without trailing slash: result 1`] = `"output_path/9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"outputPath" option should work with "String" value without trailing slash: result 1`] = `"output_path/39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"outputPath" option should work with "String" value without trailing slash: warnings 1`] = `Array []`;

exports[`"outputPath" option should work with "String" value: assets 1`] = `
Array [
"output_path/9c87cbf3ba33126ffd25ae7f2f6bbafb.png",
"output_path/39f5c21c1aee6ff21844c6e1d8251d97.png",
"main.bundle.js",
]
`;

exports[`"outputPath" option should work with "String" value: errors 1`] = `Array []`;

exports[`"outputPath" option should work with "String" value: result 1`] = `"output_path/9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"outputPath" option should work with "String" value: result 1`] = `"output_path/39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"outputPath" option should work with "String" value: warnings 1`] = `Array []`;

exports[`"outputPath" option should work without value: assets 1`] = `
Array [
"9c87cbf3ba33126ffd25ae7f2f6bbafb.png",
"39f5c21c1aee6ff21844c6e1d8251d97.png",
"main.bundle.js",
]
`;

exports[`"outputPath" option should work without value: errors 1`] = `Array []`;

exports[`"outputPath" option should work without value: result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"outputPath" option should work without value: result 1`] = `"39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"outputPath" option should work without value: warnings 1`] = `Array []`;
18 changes: 9 additions & 9 deletions test/__snapshots__/postTransformPublicPath-option.test.js.snap
Original file line number Diff line number Diff line change
@@ -2,54 +2,54 @@

exports[`"postTransformPublicPath" option should work with "Function" and "publicPath" option as "Function": errors 1`] = `Array []`;

exports[`"postTransformPublicPath" option should work with "Function" and "publicPath" option as "Function": result 1`] = `"public_path/9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"postTransformPublicPath" option should work with "Function" and "publicPath" option as "Function": result 1`] = `"public_path/39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"postTransformPublicPath" option should work with "Function" and "publicPath" option as "Function": warnings 1`] = `Array []`;

exports[`"postTransformPublicPath" option should work with "Function" where append to input parameter value and "publicPath" option as "Function": errors 1`] = `Array []`;

exports[`"postTransformPublicPath" option should work with "Function" where append to input parameter value and "publicPath" option as "Function": result 1`] = `"public_path/9c87cbf3ba33126ffd25ae7f2f6bbafb.png?test=test"`;
exports[`"postTransformPublicPath" option should work with "Function" where append to input parameter value and "publicPath" option as "Function": result 1`] = `"public_path/39f5c21c1aee6ff21844c6e1d8251d97.png?test=test"`;

exports[`"postTransformPublicPath" option should work with "Function" where append to input parameter value and "publicPath" option as "Function": warnings 1`] = `Array []`;

exports[`"postTransformPublicPath" option should work with "Function" where append to input parameter value and use "publicPath" option: errors 1`] = `Array []`;

exports[`"postTransformPublicPath" option should work with "Function" where append to input parameter value and use "publicPath" option: result 1`] = `"public_path/9c87cbf3ba33126ffd25ae7f2f6bbafb.png?test=test"`;
exports[`"postTransformPublicPath" option should work with "Function" where append to input parameter value and use "publicPath" option: result 1`] = `"public_path/39f5c21c1aee6ff21844c6e1d8251d97.png?test=test"`;

exports[`"postTransformPublicPath" option should work with "Function" where append to input parameter value and use "publicPath" option: warnings 1`] = `Array []`;

exports[`"postTransformPublicPath" option should work with "Function" where append to input parameter value: errors 1`] = `Array []`;

exports[`"postTransformPublicPath" option should work with "Function" where append to input parameter value: result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.png/test"`;
exports[`"postTransformPublicPath" option should work with "Function" where append to input parameter value: result 1`] = `"39f5c21c1aee6ff21844c6e1d8251d97.png/test"`;

exports[`"postTransformPublicPath" option should work with "Function" where append to input parameter value: warnings 1`] = `Array []`;

exports[`"postTransformPublicPath" option should work with "Function" where prepend "__webpack_public_path__" and "publicPath" option as "String": errors 1`] = `Array []`;

exports[`"postTransformPublicPath" option should work with "Function" where prepend "__webpack_public_path__" and "publicPath" option as "String": result 1`] = `"http://code.com/public_path/9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"postTransformPublicPath" option should work with "Function" where prepend "__webpack_public_path__" and "publicPath" option as "String": result 1`] = `"http://code.com/public_path/39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"postTransformPublicPath" option should work with "Function" where prepend "__webpack_public_path__" and "publicPath" option as "String": warnings 1`] = `Array []`;

exports[`"postTransformPublicPath" option should work with "Function" where prepend path and "publicPath" option as "String": errors 1`] = `Array []`;

exports[`"postTransformPublicPath" option should work with "Function" where prepend path and "publicPath" option as "String": result 1`] = `"path_prefix/public_path/9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"postTransformPublicPath" option should work with "Function" where prepend path and "publicPath" option as "String": result 1`] = `"path_prefix/public_path/39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"postTransformPublicPath" option should work with "Function" where prepend path and "publicPath" option as "String": warnings 1`] = `Array []`;

exports[`"postTransformPublicPath" option should work with "Function" where return input parameter value without modification and use "publicPath" option: errors 1`] = `Array []`;

exports[`"postTransformPublicPath" option should work with "Function" where return input parameter value without modification and use "publicPath" option: result 1`] = `"public_path/9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"postTransformPublicPath" option should work with "Function" where return input parameter value without modification and use "publicPath" option: result 1`] = `"public_path/39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"postTransformPublicPath" option should work with "Function" where return input parameter value without modification and use "publicPath" option: warnings 1`] = `Array []`;

exports[`"postTransformPublicPath" option should work with "Function" where return input parameter value without modification: errors 1`] = `Array []`;

exports[`"postTransformPublicPath" option should work with "Function" where return input parameter value without modification: result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"postTransformPublicPath" option should work with "Function" where return input parameter value without modification: result 1`] = `"39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"postTransformPublicPath" option should work with "Function" where return input parameter value without modification: warnings 1`] = `Array []`;

exports[`"postTransformPublicPath" option should work without value: errors 1`] = `Array []`;

exports[`"postTransformPublicPath" option should work without value: result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"postTransformPublicPath" option should work without value: result 1`] = `"39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"postTransformPublicPath" option should work without value: warnings 1`] = `Array []`;
10 changes: 5 additions & 5 deletions test/__snapshots__/publicPath-option.test.js.snap
Original file line number Diff line number Diff line change
@@ -2,30 +2,30 @@

exports[`"publicPath" option should work with "Function" value and pass "url", "resourcePath" and "context" as arguments: errors 1`] = `Array []`;

exports[`"publicPath" option should work with "Function" value and pass "url", "resourcePath" and "context" as arguments: result 1`] = `"public_path/9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"publicPath" option should work with "Function" value and pass "url", "resourcePath" and "context" as arguments: result 1`] = `"public_path/39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"publicPath" option should work with "Function" value and pass "url", "resourcePath" and "context" as arguments: warnings 1`] = `Array []`;

exports[`"publicPath" option should work with "String" value equal an URL: errors 1`] = `Array []`;

exports[`"publicPath" option should work with "String" value equal an URL: result 1`] = `"https://cdn.com/9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"publicPath" option should work with "String" value equal an URL: result 1`] = `"https://cdn.com/39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"publicPath" option should work with "String" value equal an URL: warnings 1`] = `Array []`;

exports[`"publicPath" option should work with "String" value without trailing slash: errors 1`] = `Array []`;

exports[`"publicPath" option should work with "String" value without trailing slash: result 1`] = `"public_path/9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"publicPath" option should work with "String" value without trailing slash: result 1`] = `"public_path/39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"publicPath" option should work with "String" value without trailing slash: warnings 1`] = `Array []`;

exports[`"publicPath" option should work with "String" value: errors 1`] = `Array []`;

exports[`"publicPath" option should work with "String" value: result 1`] = `"public_path/9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"publicPath" option should work with "String" value: result 1`] = `"public_path/39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"publicPath" option should work with "String" value: warnings 1`] = `Array []`;

exports[`"publicPath" option should work without value: errors 1`] = `Array []`;

exports[`"publicPath" option should work without value: result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"publicPath" option should work without value: result 1`] = `"39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"publicPath" option should work without value: warnings 1`] = `Array []`;
9 changes: 5 additions & 4 deletions test/outputPath-option.test.js
Original file line number Diff line number Diff line change
@@ -71,12 +71,13 @@ describe('"outputPath" option', () => {
});

it('should work with "Function" value', async () => {
// TODO
expect.assertions(7);

const compiler = getCompiler('simple.js', {
outputPath(url, resourcePath, context) {
expect(url).toBe('9c87cbf3ba33126ffd25ae7f2f6bbafb.png');
expect(resourcePath).toMatch('file.png');
expect(context).toMatch('fixtures');
expect(typeof url).toBe('string');
expect(typeof resourcePath).toBe('string');
expect(typeof context).toBe('string');

return `output_path_func/${url}`;
},
6 changes: 3 additions & 3 deletions test/publicPath-option.test.js
Original file line number Diff line number Diff line change
@@ -70,9 +70,9 @@ describe('"publicPath" option', () => {

const compiler = getCompiler('simple.js', {
publicPath(url, resourcePath, context) {
expect(url).toMatch('9c87cbf3ba33126ffd25ae7f2f6bbafb.png');
expect(resourcePath).toMatch('file.png');
expect(context).toMatch('fixtures');
expect(typeof url).toBe('string');
expect(typeof resourcePath).toBe('string');
expect(typeof context).toBe('string');

return `public_path/${url}`;
},

0 comments on commit ad39022

Please sign in to comment.