diff --git a/.editorconfig b/.editorconfig index f537e0e648f..45137161298 100644 --- a/.editorconfig +++ b/.editorconfig @@ -2,11 +2,11 @@ root = true [*] indent_style = tab -indent_size = 4 +indent_size = 2 charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true -max_line_length = 233 +max_line_length = 80 [.prettierrc] indent_style = space diff --git a/.eslintrc.js b/.eslintrc.js index 63413ea4821..a70d08eb0fb 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,6 +1,6 @@ module.exports = { root: true, - plugins: ["prettier", "node"], + plugins: ["prettier", "node", "jest"], extends: ["eslint:recommended", "plugin:node/recommended", "plugin:prettier/recommended"], env: { node: true, @@ -13,7 +13,6 @@ module.exports = { "prettier/prettier": "error", "no-undef": "error", "no-extra-semi": "error", - "semi": "error", "no-template-curly-in-string": "error", "no-caller": "error", "no-control-regex": "off", @@ -30,7 +29,20 @@ module.exports = { "no-loop-func": "warn", "indent": "off", "no-console": "off", - "valid-jsdoc": "error", + "valid-jsdoc": ["error", { + "prefer": { + "return": "returns", + "memberof": "DONTUSE", + "class": "DONTUSE", + "inheritdoc": "DONTUSE", + "description": "DONTUSE", + "readonly": "DONTUSE" + }, + "preferType": { + "*": "any" + }, + "requireReturnType": true + }], "node/no-unsupported-features": "error", "node/no-deprecated-api": "error", "node/no-missing-import": "error", @@ -56,7 +68,7 @@ module.exports = { { files: ["test/**/*.js"], env: { - mocha: true, + "jest/globals": true } } ] diff --git a/.github/ISSUE_TEMPLATE/Bug_report.md b/.github/ISSUE_TEMPLATE/Bug_report.md new file mode 100644 index 00000000000..657747d6289 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/Bug_report.md @@ -0,0 +1,39 @@ +--- +name: Bug report +about: Create a report to help us improve +--- + + + + +# Bug report + + + + + + +**What is the current behavior?** + + +**If the current behavior is a bug, please provide the steps to reproduce.** + + + + + + + + + +**What is the expected behavior?** + + + + + +**Other relevant information:** +webpack version: +Node.js version: +Operating System: +Additional tools: diff --git a/.github/ISSUE_TEMPLATE/Feature_request.md b/.github/ISSUE_TEMPLATE/Feature_request.md new file mode 100644 index 00000000000..e23f20d97cf --- /dev/null +++ b/.github/ISSUE_TEMPLATE/Feature_request.md @@ -0,0 +1,27 @@ +--- +name: Feature request +about: Suggest an idea for this project + +--- + + + +## Feature request + + + + + + + +**What is the expected behavior?** + + +**What is motivation or use case for adding/changing the behavior?** + + +**How should this be implemented in your opinion?** + + +**Are you willing to work on this yourself?** +yes diff --git a/.github/ISSUE_TEMPLATE/Other.md b/.github/ISSUE_TEMPLATE/Other.md new file mode 100644 index 00000000000..5e5b62bd605 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/Other.md @@ -0,0 +1,9 @@ +--- +name: Other +about: Something else + +--- + + + + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 7af602ab91a..8967c8f0169 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,4 +1,9 @@ + + + + + **What kind of change does this PR introduce?** @@ -8,17 +13,11 @@ -**If relevant, link to documentation update:** - - - -**Summary** - - - - **Does this PR introduce a breaking change?** -**Other information** +**What needs to be documented once your changes are merged?** + + + diff --git a/.gitignore b/.gitignore index f7a05a2b815..32814bb493a 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,5 @@ *.log .idea .vscode +.eslintcache package-lock.json diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000000..c99674c1822 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,15 @@ +# Ignore all paths. +**/*.* + +# Enable prettier for the following paths. +!setup/**/*.js +!lib/**/*.js +!bin/*.js +!hot/*.js +!buildin/*.js +!benchmark/**/*.js +!test/*.js +!test/**/webpack.config.js +!examples/**/webpack.config.js +!schemas/**/*.js +!declarations.d.ts diff --git a/.travis.yml b/.travis.yml index a1f10e144fc..184cf5ee220 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,39 +9,56 @@ branches: cache: yarn: true + directories: + - ".jest-cache" + - ".eslintcache" + +stages: + - basic + - advanced + - versions matrix: include: - os: linux - node_js: "8" - env: NO_WATCH_TESTS=1 JOB_PART=lint + node_js: "10" + env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=basic + stage: basic - os: linux - node_js: "8" - env: NO_WATCH_TESTS=1 JOB_PART=integration + node_js: "10" + env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=lint-unit + stage: advanced + - os: linux + node_js: "10" + env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=integration + stage: advanced + - os: osx + node_js: "10" + env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=integration + stage: versions - os: linux node_js: "8" - env: NO_WATCH_TESTS=1 JOB_PART=unit + env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=integration + stage: versions - os: linux node_js: "6" - env: NO_WATCH_TESTS=1 JOB_PART=integration - - os: osx - node_js: "8" - env: NO_WATCH_TESTS=1 JOB_PART=integration + env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=integration + stage: versions + fast_finish: true allow_failures: - os: osx - fast_finish: true install: - yarn --frozen-lockfile - yarn link --frozen-lockfile || true - yarn link webpack --frozen-lockfile -script: npm run travis:$JOB_PART +script: yarn travis:$JOB_PART after_success: - cat ./coverage/lcov.info | node_modules/.bin/coveralls --verbose - - bash <(curl -s https://codecov.io/bash) -F $JOB_PART - - rm -rf ./coverage + - bash <(curl -s https://codecov.io/bash) -F $JOB_PART -X gcov + - rm -f .jest-cache/haste-map* .jest-cache/perf-cache* notifications: slack: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 47b8a2ced62..3364e380801 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,17 +11,23 @@ Most of the time, if webpack is not working correctly for you it is a simple con If you are still having difficulty after looking over your configuration carefully, please post a question to [StackOverflow with the webpack tag](http://stackoverflow.com/tags/webpack). Questions -that include your webpack.config.js and relevant files are more likely to receive responses. +that include your webpack.config.js, relevant files, and the full error message are more likely to receive responses. **If you have discovered a bug or have a feature suggestion, please [create an issue on GitHub](https://github.com/webpack/webpack/issues/new).** +Do you want to fix an issue? Look at the issues with a tag of [X5: work required (PR / Help Wanted)](https://github.com/webpack/webpack/labels/X5%3A%20work%20required%20%28PR%20%2F%20Help%20Wanted%29). Each issue should be tagged with a difficulty tag - + +- D0: My First Commit (Contribution Difficulty) +- D1: Easy (Contribution Difficulty) +- D2: Medium (Contribution Difficulty) +- D3: Hard (Contribution Difficulty) + ## Contributing to the webpack ecosystem -If you have created your own loader/plugin please include it on the relevant -documentation pages: +If you have created your own loader/plugin please include it on the relevant documentation pages: -[List of loaders](https://webpack.js.org/loaders/) or [awesome-webpack](https://github.com/webpack-contrib/awesome-webpack#loaders) -[List of plugins](https://webpack.js.org/plugins) or [awesome-webpack](https://github.com/webpack-contrib/awesome-webpack#webpack-plugins) +- [List of loaders](https://webpack.js.org/loaders/) or [awesome-webpack](https://github.com/webpack-contrib/awesome-webpack#loaders) +- [List of plugins](https://webpack.js.org/plugins) or [awesome-webpack](https://github.com/webpack-contrib/awesome-webpack#webpack-plugins) ## Setup @@ -43,7 +49,7 @@ Some things that will increase the chance that your pull request is accepted: webpack is insanely feature rich and documentation is a huge time sink. We greatly appreciate any time spent fixing typos or clarifying sections in the -documentation. +documentation. [See a list of issues with the documentation tag.](https://github.com/webpack/webpack/labels/documentation) ## Discussions diff --git a/README.md b/README.md index 9a8c423f813..cb5e32d94ad 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,9 @@ + + install size + @@ -84,25 +87,30 @@ interface](https://webpack.js.org/plugins/). Most of the features within webpack itself use this plugin interface. This makes webpack very **flexible**. -|Name|Status|Description| -|:--:|:----:|:----------| -|[extract-text-webpack-plugin][extract]|![extract-npm]|Extracts Text (CSS) from your bundles into a separate file (app.bundle.css)| -|[compression-webpack-plugin][compression]|![compression-npm]|Prepares compressed versions of assets to serve them with Content-Encoding| -|[i18n-webpack-plugin][i18n]|![i18n-npm]|Adds i18n support to your bundles| -|[html-webpack-plugin][html-plugin]|![html-plugin-npm]| Simplifies creation of HTML files (`index.html`) to serve your bundles| +|Name|Status|Install Size|Description| +|:--:|:----:|:----------:|:----------| +|[extract-text-webpack-plugin][extract]|![extract-npm]|![extract-size]|Extracts Text (CSS) from your bundles into a separate file (app.bundle.css)| +|[compression-webpack-plugin][compression]|![compression-npm]|![compression-size]|Prepares compressed versions of assets to serve them with Content-Encoding| +|[i18n-webpack-plugin][i18n]|![i18n-npm]|![i18n-size]|Adds i18n support to your bundles| +|[html-webpack-plugin][html-plugin]|![html-plugin-npm]|![html-plugin-size]| Simplifies creation of HTML files (`index.html`) to serve your bundles| [common-npm]: https://img.shields.io/npm/v/webpack.svg [extract]: https://github.com/webpack/extract-text-webpack-plugin [extract-npm]: https://img.shields.io/npm/v/extract-text-webpack-plugin.svg +[extract-size]: https://packagephobia.now.sh/badge?p=extract-text-webpack-plugin [component]: https://github.com/webpack/component-webpack-plugin [component-npm]: https://img.shields.io/npm/v/component-webpack-plugin.svg +[component-size]: https://packagephobia.now.sh/badge?p=component-webpack-plugin [compression]: https://github.com/webpack/compression-webpack-plugin [compression-npm]: https://img.shields.io/npm/v/compression-webpack-plugin.svg +[compression-size]: https://packagephobia.now.sh/badge?p=compression-webpack-plugin [i18n]: https://github.com/webpack/i18n-webpack-plugin [i18n-npm]: https://img.shields.io/npm/v/i18n-webpack-plugin.svg +[i18n-size]: https://packagephobia.now.sh/badge?p=i18n-webpack-plugin [html-plugin]: https://github.com/ampedandwired/html-webpack-plugin [html-plugin-npm]: https://img.shields.io/npm/v/html-webpack-plugin.svg +[html-plugin-size]: https://packagephobia.now.sh/badge?p=html-webpack-plugin ### [Loaders](https://webpack.js.org/loaders/) @@ -115,121 +123,154 @@ or are automatically applied via regex from your webpack configuration. #### Files -|Name|Status|Description| -|:--:|:----:|:----------| -|[raw-loader][raw]|![raw-npm]|Loads raw content of a file (utf-8)| -|[val-loader][val]|![val-npm]|Executes code as module and considers exports as JS code| -|[url-loader][url]|![url-npm]|Works like the file loader, but can return a Data Url if the file is smaller than a limit| -|[file-loader][file]|![file-npm]|Emits the file into the output folder and returns the (relative) url| +|Name|Status|Install Size|Description| +|:--:|:----:|:----------:|:----------| +|[raw-loader][raw]|![raw-npm]|![raw-size]|Loads raw content of a file (utf-8)| +|[val-loader][val]|![val-npm]|![val-size]|Executes code as module and considers exports as JS code| +|[url-loader][url]|![url-npm]|![url-size]|Works like the file loader, but can return a Data Url if the file is smaller than a limit| +|[file-loader][file]|![file-npm]|![file-size]|Emits the file into the output folder and returns the (relative) url| [raw]: https://github.com/webpack/raw-loader [raw-npm]: https://img.shields.io/npm/v/raw-loader.svg +[raw-size]: https://packagephobia.now.sh/badge?p=raw-loader [val]: https://github.com/webpack/val-loader [val-npm]: https://img.shields.io/npm/v/val-loader.svg +[val-size]: https://packagephobia.now.sh/badge?p=val-loader [url]: https://github.com/webpack/url-loader [url-npm]: https://img.shields.io/npm/v/url-loader.svg +[url-size]: https://packagephobia.now.sh/badge?p=url-loader [file]: https://github.com/webpack/file-loader [file-npm]: https://img.shields.io/npm/v/file-loader.svg +[file-size]: https://packagephobia.now.sh/badge?p=file-loader #### JSON -|Name|Status|Description| -|:--:|:----:|:----------| -||![json-npm]|Loads a JSON file (included by default)| -||![json5-npm]|Loads and transpiles a JSON 5 file| -||![cson-npm]|Loads and transpiles a CSON file| +|Name|Status|Install Size|Description| +|:--:|:----:|:----------:|:----------| +||![json-npm]|![json-size]|Loads a JSON file (included by default)| +||![json5-npm]|![json5-size]|Loads and transpiles a JSON 5 file| +||![cson-npm]|![cson-size]|Loads and transpiles a CSON file| [json-npm]: https://img.shields.io/npm/v/json-loader.svg +[json-size]: https://packagephobia.now.sh/badge?p=json-loader [json5-npm]: https://img.shields.io/npm/v/json5-loader.svg +[json5-size]: https://packagephobia.now.sh/badge?p=json5-loader [cson-npm]: https://img.shields.io/npm/v/cson-loader.svg +[cson-size]: https://packagephobia.now.sh/badge?p=cson-loader #### Transpiling -|Name|Status|Description| -|:--:|:----:|:----------| -|` @@ -112,12 +112,19 @@ module.exports = { /******/ var installedModules = {}; /******/ /******/ // object to store loaded and loading chunks +/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched +/******/ // Promise = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ 3: 0 /******/ }; /******/ /******/ var deferredModules = []; /******/ +/******/ // script path function +/******/ function jsonpScriptSrc(chunkId) { +/******/ return __webpack_require__.p + "" + ({}[chunkId]||chunkId) + ".[chunkhash].js" +/******/ } +/******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ @@ -173,7 +180,7 @@ module.exports = { /******/ if (__webpack_require__.nc) { /******/ script.setAttribute("nonce", __webpack_require__.nc); /******/ } -/******/ script.src = __webpack_require__.p + "" + ({}[chunkId]||chunkId) + ".[chunkhash].js"; +/******/ script.src = jsonpScriptSrc(chunkId); /******/ var timeout = setTimeout(function(){ /******/ onScriptComplete({ type: 'timeout', target: script }); /******/ }, 120000); @@ -287,25 +294,25 @@ __webpack_require__.e(/*! import() */ 2).then(function() { var module = __webpac ``` Hash: 0a1b2c3d4e5f6a7b8c9d -Version: webpack 4.5.0 +Version: webpack 4.8.0 Asset Size Chunks Chunk Names main.[chunkhash].js 877 bytes 0 [emitted] main 1.[chunkhash].js 270 bytes 1 [emitted] 2.[chunkhash].js 264 bytes 2 [emitted] -runtime~main.[chunkhash].js 7.48 KiB 3 [emitted] runtime~main +runtime~main.[chunkhash].js 7.75 KiB 3 [emitted] runtime~main Entrypoint main = runtime~main.[chunkhash].js main.[chunkhash].js chunk {0} main.[chunkhash].js (main) 55 bytes ={3}= >{1}< >{2}< [initial] [rendered] > ./example main - [0] ./example.js 55 bytes {0} [built] - single entry ./example main + [0] ./example.js 55 bytes {0} [built] + single entry ./example main chunk {1} 1.[chunkhash].js 29 bytes <{0}> <{3}> [rendered] > ./async1 [0] ./example.js 2:0-18 - [1] ./async1.js 29 bytes {1} [built] - import() ./async1 [0] ./example.js 2:0-18 + [1] ./async1.js 29 bytes {1} [built] + import() ./async1 [0] ./example.js 2:0-18 chunk {2} 2.[chunkhash].js 29 bytes <{0}> <{3}> [rendered] > ./async2 [0] ./example.js 3:0-18 - [2] ./async2.js 29 bytes {2} [built] - import() ./async2 [0] ./example.js 3:0-18 + [2] ./async2.js 29 bytes {2} [built] + import() ./async2 [0] ./example.js 3:0-18 chunk {3} runtime~main.[chunkhash].js (runtime~main) 0 bytes ={0}= >{1}< >{2}< [entry] [rendered] > ./example main ``` @@ -314,25 +321,25 @@ chunk {3} runtime~main.[chunkhash].js (runtime~main) 0 bytes ={0}= >{1}< >{2} ``` Hash: 0a1b2c3d4e5f6a7b8c9d -Version: webpack 4.5.0 +Version: webpack 4.8.0 Asset Size Chunks Chunk Names 0.[chunkhash].js 77 bytes 0 [emitted] 1.[chunkhash].js 78 bytes 1 [emitted] -runtime~main.[chunkhash].js 1.76 KiB 2 [emitted] runtime~main +runtime~main.[chunkhash].js 1.79 KiB 2 [emitted] runtime~main main.[chunkhash].js 349 bytes 3 [emitted] main Entrypoint main = runtime~main.[chunkhash].js main.[chunkhash].js chunk {0} 0.[chunkhash].js 29 bytes <{2}> <{3}> [rendered] > ./async2 [0] ./example.js 3:0-18 - [1] ./async2.js 29 bytes {0} [built] - import() ./async2 [0] ./example.js 3:0-18 + [1] ./async2.js 29 bytes {0} [built] + import() ./async2 [0] ./example.js 3:0-18 chunk {1} 1.[chunkhash].js 29 bytes <{2}> <{3}> [rendered] > ./async1 [0] ./example.js 2:0-18 - [2] ./async1.js 29 bytes {1} [built] - import() ./async1 [0] ./example.js 2:0-18 + [2] ./async1.js 29 bytes {1} [built] + import() ./async1 [0] ./example.js 2:0-18 chunk {2} runtime~main.[chunkhash].js (runtime~main) 0 bytes ={3}= >{0}< >{1}< [entry] [rendered] > ./example main chunk {3} main.[chunkhash].js (main) 55 bytes ={2}= >{0}< >{1}< [initial] [rendered] > ./example main - [0] ./example.js 55 bytes {3} [built] - single entry ./example main + [0] ./example.js 55 bytes {3} [built] + single entry ./example main ``` diff --git a/examples/code-splitted-require.context-amd/README.md b/examples/code-splitted-require.context-amd/README.md index 062bba8bb0f..07a7855e2d8 100644 --- a/examples/code-splitted-require.context-amd/README.md +++ b/examples/code-splitted-require.context-amd/README.md @@ -52,12 +52,19 @@ getTemplate("b", function(b) { /******/ var installedModules = {}; /******/ /******/ // object to store loaded and loading chunks +/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched +/******/ // Promise = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ 1: 0 /******/ }; /******/ /******/ /******/ +/******/ // script path function +/******/ function jsonpScriptSrc(chunkId) { +/******/ return __webpack_require__.p + "" + chunkId + ".output.js" +/******/ } +/******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ @@ -113,7 +120,7 @@ getTemplate("b", function(b) { /******/ if (__webpack_require__.nc) { /******/ script.setAttribute("nonce", __webpack_require__.nc); /******/ } -/******/ script.src = __webpack_require__.p + "" + chunkId + ".output.js"; +/******/ script.src = jsonpScriptSrc(chunkId); /******/ var timeout = setTimeout(function(){ /******/ onScriptComplete({ type: 'timeout', target: script }); /******/ }, 120000); @@ -252,7 +259,7 @@ function webpackContext(req) { function webpackContextResolve(req) { var id = map[req]; if(!(id + 1)) { // check for number or string - var e = new Error('Cannot find module "' + req + '".'); + var e = new Error("Cannot find module '" + req + "'"); e.code = 'MODULE_NOT_FOUND'; throw e; } @@ -311,54 +318,54 @@ module.exports = function() { ``` Hash: 0a1b2c3d4e5f6a7b8c9d -Version: webpack 4.5.0 +Version: webpack 4.8.0 Asset Size Chunks Chunk Names 0.output.js 1.86 KiB 0 [emitted] - output.js 7.19 KiB 1 [emitted] main + output.js 7.46 KiB 1 [emitted] main Entrypoint main = output.js chunk {0} 0.output.js 463 bytes <{1}> [rendered] > [0] ./example.js 2:1-4:3 - [1] ../require.context/templates sync ^\.\/.*$ 217 bytes {0} [built] - amd require context ../require.context/templates [0] ./example.js 2:1-4:3 - [2] ../require.context/templates/c.js 82 bytes {0} [optional] [built] - context element ./c.js [1] ../require.context/templates sync ^\.\/.*$ ./c.js - context element ./c [1] ../require.context/templates sync ^\.\/.*$ ./c - [3] ../require.context/templates/b.js 82 bytes {0} [optional] [built] - context element ./b.js [1] ../require.context/templates sync ^\.\/.*$ ./b.js - context element ./b [1] ../require.context/templates sync ^\.\/.*$ ./b - [4] ../require.context/templates/a.js 82 bytes {0} [optional] [built] - context element ./a.js [1] ../require.context/templates sync ^\.\/.*$ ./a.js - context element ./a [1] ../require.context/templates sync ^\.\/.*$ ./a + [1] ../require.context/templates sync ^\.\/.*$ 217 bytes {0} [built] + amd require context ../require.context/templates [0] ./example.js 2:1-4:3 + [2] ../require.context/templates/c.js 82 bytes {0} [optional] [built] + context element ./c.js [1] ../require.context/templates sync ^\.\/.*$ ./c.js + context element ./c [1] ../require.context/templates sync ^\.\/.*$ ./c + [3] ../require.context/templates/b.js 82 bytes {0} [optional] [built] + context element ./b.js [1] ../require.context/templates sync ^\.\/.*$ ./b.js + context element ./b [1] ../require.context/templates sync ^\.\/.*$ ./b + [4] ../require.context/templates/a.js 82 bytes {0} [optional] [built] + context element ./a.js [1] ../require.context/templates sync ^\.\/.*$ ./a.js + context element ./a [1] ../require.context/templates sync ^\.\/.*$ ./a chunk {1} output.js (main) 261 bytes >{0}< [entry] [rendered] > .\example.js main - [0] ./example.js 261 bytes {1} [built] - single entry .\example.js main + [0] ./example.js 261 bytes {1} [built] + single entry .\example.js main ``` ## Production mode ``` Hash: 0a1b2c3d4e5f6a7b8c9d -Version: webpack 4.5.0 +Version: webpack 4.8.0 Asset Size Chunks Chunk Names 0.output.js 627 bytes 0 [emitted] - output.js 1.75 KiB 1 [emitted] main + output.js 1.78 KiB 1 [emitted] main Entrypoint main = output.js chunk {0} 0.output.js 463 bytes <{1}> [rendered] > [0] ./example.js 2:1-4:3 - [1] ../require.context/templates sync ^\.\/.*$ 217 bytes {0} [built] - amd require context ../require.context/templates [0] ./example.js 2:1-4:3 - [2] ../require.context/templates/c.js 82 bytes {0} [optional] [built] - context element ./c.js [1] ../require.context/templates sync ^\.\/.*$ ./c.js - context element ./c [1] ../require.context/templates sync ^\.\/.*$ ./c - [3] ../require.context/templates/b.js 82 bytes {0} [optional] [built] - context element ./b.js [1] ../require.context/templates sync ^\.\/.*$ ./b.js - context element ./b [1] ../require.context/templates sync ^\.\/.*$ ./b - [4] ../require.context/templates/a.js 82 bytes {0} [optional] [built] - context element ./a.js [1] ../require.context/templates sync ^\.\/.*$ ./a.js - context element ./a [1] ../require.context/templates sync ^\.\/.*$ ./a + [1] ../require.context/templates sync ^\.\/.*$ 217 bytes {0} [built] + amd require context ../require.context/templates [0] ./example.js 2:1-4:3 + [2] ../require.context/templates/c.js 82 bytes {0} [optional] [built] + context element ./c.js [1] ../require.context/templates sync ^\.\/.*$ ./c.js + context element ./c [1] ../require.context/templates sync ^\.\/.*$ ./c + [3] ../require.context/templates/b.js 82 bytes {0} [optional] [built] + context element ./b.js [1] ../require.context/templates sync ^\.\/.*$ ./b.js + context element ./b [1] ../require.context/templates sync ^\.\/.*$ ./b + [4] ../require.context/templates/a.js 82 bytes {0} [optional] [built] + context element ./a.js [1] ../require.context/templates sync ^\.\/.*$ ./a.js + context element ./a [1] ../require.context/templates sync ^\.\/.*$ ./a chunk {1} output.js (main) 261 bytes >{0}< [entry] [rendered] > .\example.js main - [0] ./example.js 261 bytes {1} [built] - single entry .\example.js main + [0] ./example.js 261 bytes {1} [built] + single entry .\example.js main ``` diff --git a/examples/code-splitted-require.context/README.md b/examples/code-splitted-require.context/README.md index 08db4e513a1..c1251d65308 100644 --- a/examples/code-splitted-require.context/README.md +++ b/examples/code-splitted-require.context/README.md @@ -52,12 +52,19 @@ getTemplate("b", function(b) { /******/ var installedModules = {}; /******/ /******/ // object to store loaded and loading chunks +/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched +/******/ // Promise = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ 1: 0 /******/ }; /******/ /******/ /******/ +/******/ // script path function +/******/ function jsonpScriptSrc(chunkId) { +/******/ return __webpack_require__.p + "" + chunkId + ".output.js" +/******/ } +/******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ @@ -113,7 +120,7 @@ getTemplate("b", function(b) { /******/ if (__webpack_require__.nc) { /******/ script.setAttribute("nonce", __webpack_require__.nc); /******/ } -/******/ script.src = __webpack_require__.p + "" + chunkId + ".output.js"; +/******/ script.src = jsonpScriptSrc(chunkId); /******/ var timeout = setTimeout(function(){ /******/ onScriptComplete({ type: 'timeout', target: script }); /******/ }, 120000); @@ -252,7 +259,7 @@ function webpackContext(req) { function webpackContextResolve(req) { var id = map[req]; if(!(id + 1)) { // check for number or string - var e = new Error('Cannot find module "' + req + '".'); + var e = new Error("Cannot find module '" + req + "'"); e.code = 'MODULE_NOT_FOUND'; throw e; } @@ -311,54 +318,54 @@ module.exports = function() { ``` Hash: 0a1b2c3d4e5f6a7b8c9d -Version: webpack 4.5.0 +Version: webpack 4.8.0 Asset Size Chunks Chunk Names 0.output.js 1.86 KiB 0 [emitted] - output.js 7.13 KiB 1 [emitted] main + output.js 7.4 KiB 1 [emitted] main Entrypoint main = output.js chunk {0} 0.output.js 463 bytes <{1}> [rendered] > [0] ./example.js 2:1-4:3 - [1] ../require.context/templates sync ^\.\/.*$ 217 bytes {0} [built] - cjs require context ../require.context/templates [0] ./example.js 3:11-64 - [2] ../require.context/templates/c.js 82 bytes {0} [optional] [built] - context element ./c.js [1] ../require.context/templates sync ^\.\/.*$ ./c.js - context element ./c [1] ../require.context/templates sync ^\.\/.*$ ./c - [3] ../require.context/templates/b.js 82 bytes {0} [optional] [built] - context element ./b.js [1] ../require.context/templates sync ^\.\/.*$ ./b.js - context element ./b [1] ../require.context/templates sync ^\.\/.*$ ./b - [4] ../require.context/templates/a.js 82 bytes {0} [optional] [built] - context element ./a.js [1] ../require.context/templates sync ^\.\/.*$ ./a.js - context element ./a [1] ../require.context/templates sync ^\.\/.*$ ./a + [1] ../require.context/templates sync ^\.\/.*$ 217 bytes {0} [built] + cjs require context ../require.context/templates [0] ./example.js 3:11-64 + [2] ../require.context/templates/c.js 82 bytes {0} [optional] [built] + context element ./c.js [1] ../require.context/templates sync ^\.\/.*$ ./c.js + context element ./c [1] ../require.context/templates sync ^\.\/.*$ ./c + [3] ../require.context/templates/b.js 82 bytes {0} [optional] [built] + context element ./b.js [1] ../require.context/templates sync ^\.\/.*$ ./b.js + context element ./b [1] ../require.context/templates sync ^\.\/.*$ ./b + [4] ../require.context/templates/a.js 82 bytes {0} [optional] [built] + context element ./a.js [1] ../require.context/templates sync ^\.\/.*$ ./a.js + context element ./a [1] ../require.context/templates sync ^\.\/.*$ ./a chunk {1} output.js (main) 276 bytes >{0}< [entry] [rendered] > .\example.js main - [0] ./example.js 276 bytes {1} [built] - single entry .\example.js main + [0] ./example.js 276 bytes {1} [built] + single entry .\example.js main ``` ## Production mode ``` Hash: 0a1b2c3d4e5f6a7b8c9d -Version: webpack 4.5.0 +Version: webpack 4.8.0 Asset Size Chunks Chunk Names 0.output.js 627 bytes 0 [emitted] - output.js 1.73 KiB 1 [emitted] main + output.js 1.75 KiB 1 [emitted] main Entrypoint main = output.js chunk {0} 0.output.js 463 bytes <{1}> [rendered] > [0] ./example.js 2:1-4:3 - [1] ../require.context/templates sync ^\.\/.*$ 217 bytes {0} [built] - cjs require context ../require.context/templates [0] ./example.js 3:11-64 - [2] ../require.context/templates/c.js 82 bytes {0} [optional] [built] - context element ./c.js [1] ../require.context/templates sync ^\.\/.*$ ./c.js - context element ./c [1] ../require.context/templates sync ^\.\/.*$ ./c - [3] ../require.context/templates/b.js 82 bytes {0} [optional] [built] - context element ./b.js [1] ../require.context/templates sync ^\.\/.*$ ./b.js - context element ./b [1] ../require.context/templates sync ^\.\/.*$ ./b - [4] ../require.context/templates/a.js 82 bytes {0} [optional] [built] - context element ./a.js [1] ../require.context/templates sync ^\.\/.*$ ./a.js - context element ./a [1] ../require.context/templates sync ^\.\/.*$ ./a + [1] ../require.context/templates sync ^\.\/.*$ 217 bytes {0} [built] + cjs require context ../require.context/templates [0] ./example.js 3:11-64 + [2] ../require.context/templates/c.js 82 bytes {0} [optional] [built] + context element ./c.js [1] ../require.context/templates sync ^\.\/.*$ ./c.js + context element ./c [1] ../require.context/templates sync ^\.\/.*$ ./c + [3] ../require.context/templates/b.js 82 bytes {0} [optional] [built] + context element ./b.js [1] ../require.context/templates sync ^\.\/.*$ ./b.js + context element ./b [1] ../require.context/templates sync ^\.\/.*$ ./b + [4] ../require.context/templates/a.js 82 bytes {0} [optional] [built] + context element ./a.js [1] ../require.context/templates sync ^\.\/.*$ ./a.js + context element ./a [1] ../require.context/templates sync ^\.\/.*$ ./a chunk {1} output.js (main) 276 bytes >{0}< [entry] [rendered] > .\example.js main - [0] ./example.js 276 bytes {1} [built] - single entry .\example.js main + [0] ./example.js 276 bytes {1} [built] + single entry .\example.js main ``` diff --git a/examples/code-splitting-bundle-loader/README.md b/examples/code-splitting-bundle-loader/README.md index 320f01a277a..a59a581ea7c 100644 --- a/examples/code-splitting-bundle-loader/README.md +++ b/examples/code-splitting-bundle-loader/README.md @@ -55,12 +55,19 @@ module.exports = "It works"; /******/ var installedModules = {}; /******/ /******/ // object to store loaded and loading chunks +/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched +/******/ // Promise = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ 1: 0 /******/ }; /******/ /******/ /******/ +/******/ // script path function +/******/ function jsonpScriptSrc(chunkId) { +/******/ return __webpack_require__.p + "" + chunkId + ".output.js" +/******/ } +/******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ @@ -116,7 +123,7 @@ module.exports = "It works"; /******/ if (__webpack_require__.nc) { /******/ script.setAttribute("nonce", __webpack_require__.nc); /******/ } -/******/ script.src = __webpack_require__.p + "" + chunkId + ".output.js"; +/******/ script.src = jsonpScriptSrc(chunkId); /******/ var timeout = setTimeout(function(){ /******/ onScriptComplete({ type: 'timeout', target: script }); /******/ }, 120000); @@ -266,40 +273,40 @@ module.exports = "It works"; ``` Hash: 0a1b2c3d4e5f6a7b8c9d -Version: webpack 4.5.0 +Version: webpack 4.8.0 Asset Size Chunks Chunk Names 0.output.js 257 bytes 0 [emitted] - output.js 7.56 KiB 1 [emitted] main + output.js 7.82 KiB 1 [emitted] main Entrypoint main = output.js chunk {0} 0.output.js 28 bytes <{1}> [rendered] > [0] (webpack)/node_modules/bundle-loader!./file.js 7:0-14:2 - [2] ./file.js 28 bytes {0} [built] - cjs require !!./file.js [0] (webpack)/node_modules/bundle-loader!./file.js 8:8-30 + [2] ./file.js 28 bytes {0} [built] + cjs require !!./file.js [0] (webpack)/node_modules/bundle-loader!./file.js 8:8-30 chunk {1} output.js (main) 378 bytes >{0}< [entry] [rendered] > .\example.js main - [0] (webpack)/node_modules/bundle-loader!./file.js 281 bytes {1} [built] - cjs require bundle-loader!./file.js [1] ./example.js 1:0-34 - [1] ./example.js 97 bytes {1} [built] - single entry .\example.js main + [0] (webpack)/node_modules/bundle-loader!./file.js 281 bytes {1} [built] + cjs require bundle-loader!./file.js [1] ./example.js 1:0-34 + [1] ./example.js 97 bytes {1} [built] + single entry .\example.js main ``` ## Production mode ``` Hash: 0a1b2c3d4e5f6a7b8c9d -Version: webpack 4.5.0 +Version: webpack 4.8.0 Asset Size Chunks Chunk Names 0.output.js 98 bytes 0 [emitted] - output.js 1.79 KiB 1 [emitted] main + output.js 1.81 KiB 1 [emitted] main Entrypoint main = output.js chunk {0} 0.output.js 28 bytes <{1}> [rendered] > [0] (webpack)/node_modules/bundle-loader!./file.js 7:0-14:2 - [2] ./file.js 28 bytes {0} [built] - cjs require !!./file.js [0] (webpack)/node_modules/bundle-loader!./file.js 8:8-30 + [2] ./file.js 28 bytes {0} [built] + cjs require !!./file.js [0] (webpack)/node_modules/bundle-loader!./file.js 8:8-30 chunk {1} output.js (main) 378 bytes >{0}< [entry] [rendered] > .\example.js main - [0] (webpack)/node_modules/bundle-loader!./file.js 281 bytes {1} [built] - cjs require bundle-loader!./file.js [1] ./example.js 1:0-34 - [1] ./example.js 97 bytes {1} [built] - single entry .\example.js main + [0] (webpack)/node_modules/bundle-loader!./file.js 281 bytes {1} [built] + cjs require bundle-loader!./file.js [1] ./example.js 1:0-34 + [1] ./example.js 97 bytes {1} [built] + single entry .\example.js main ``` diff --git a/examples/code-splitting-harmony/README.md b/examples/code-splitting-harmony/README.md index 2757222831f..c3e9e9d4c8d 100644 --- a/examples/code-splitting-harmony/README.md +++ b/examples/code-splitting-harmony/README.md @@ -63,12 +63,19 @@ Promise.all([loadC("1"), loadC("2")]).then(function(arr) { /******/ var installedModules = {}; /******/ /******/ // object to store loaded and loading chunks +/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched +/******/ // Promise = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ 3: 0 /******/ }; /******/ /******/ /******/ +/******/ // script path function +/******/ function jsonpScriptSrc(chunkId) { +/******/ return __webpack_require__.p + "" + chunkId + ".output.js" +/******/ } +/******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ @@ -124,7 +131,7 @@ Promise.all([loadC("1"), loadC("2")]).then(function(arr) { /******/ if (__webpack_require__.nc) { /******/ script.setAttribute("nonce", __webpack_require__.nc); /******/ } -/******/ script.src = __webpack_require__.p + "" + chunkId + ".output.js"; +/******/ script.src = jsonpScriptSrc(chunkId); /******/ var timeout = setTimeout(function(){ /******/ onScriptComplete({ type: 'timeout', target: script }); /******/ }, 120000); @@ -241,7 +248,7 @@ function webpackAsyncContext(req) { var ids = map[req]; if(!ids) { return Promise.resolve().then(function() { - var e = new Error('Cannot find module "' + req + '".'); + var e = new Error("Cannot find module '" + req + "'"); e.code = 'MODULE_NOT_FOUND'; throw e; }); @@ -305,12 +312,12 @@ Promise.all([loadC("1"), loadC("2")]).then(function(arr) { ``` Hash: 0a1b2c3d4e5f6a7b8c9d -Version: webpack 4.5.0 +Version: webpack 4.8.0 Asset Size Chunks Chunk Names 0.output.js 275 bytes 0 [emitted] 1.output.js 284 bytes 1 [emitted] 2.output.js 270 bytes 2 [emitted] - output.js 8.84 KiB 3 [emitted] main + output.js 9.11 KiB 3 [emitted] main Entrypoint main = output.js chunk {0} 0.output.js 13 bytes <{3}> [rendered] > ./2 [2] ./node_modules/c lazy ^\.\/.*$ namespace object ./2 @@ -325,11 +332,11 @@ chunk {2} 2.output.js 11 bytes <{3}> [rendered] 1 module chunk {3} output.js (main) 427 bytes >{0}< >{1}< >{2}< [entry] [rendered] > .\example.js main - [2] ./node_modules/c lazy ^\.\/.*$ namespace object 160 bytes {3} [built] - import() context lazy c [4] ./example.js 8:8-27 - [4] ./example.js 256 bytes {3} [built] - [no exports] - single entry .\example.js main + [2] ./node_modules/c lazy ^\.\/.*$ namespace object 160 bytes {3} [built] + import() context lazy c [4] ./example.js 8:8-27 + [4] ./example.js 256 bytes {3} [built] + [no exports] + single entry .\example.js main + 1 hidden module ``` @@ -337,12 +344,12 @@ chunk {3} output.js (main) 427 bytes >{0}< >{1}< >{2}< [entry] [rendered] ``` Hash: 0a1b2c3d4e5f6a7b8c9d -Version: webpack 4.5.0 +Version: webpack 4.8.0 Asset Size Chunks Chunk Names 0.output.js 76 bytes 0 [emitted] 1.output.js 77 bytes 1 [emitted] 2.output.js 78 bytes 2 [emitted] - output.js 2.33 KiB 3 [emitted] main + output.js 2.35 KiB 3 [emitted] main Entrypoint main = output.js chunk {0} 0.output.js 13 bytes <{3}> [rendered] > ./2 [2] ./node_modules/c lazy ^\.\/.*$ namespace object ./2 @@ -357,10 +364,10 @@ chunk {2} 2.output.js 11 bytes <{3}> [rendered] 1 module chunk {3} output.js (main) 427 bytes >{0}< >{1}< >{2}< [entry] [rendered] > .\example.js main - [2] ./node_modules/c lazy ^\.\/.*$ namespace object 160 bytes {3} [built] - import() context lazy c [4] ./example.js 8:8-27 - [4] ./example.js 256 bytes {3} [built] - [no exports] - single entry .\example.js main + [2] ./node_modules/c lazy ^\.\/.*$ namespace object 160 bytes {3} [built] + import() context lazy c [4] ./example.js 8:8-27 + [4] ./example.js 256 bytes {3} [built] + [no exports] + single entry .\example.js main + 1 hidden module ``` diff --git a/examples/code-splitting-native-import-context-filter/README.md b/examples/code-splitting-native-import-context-filter/README.md index cd137dac06f..86f2a9e9164 100644 --- a/examples/code-splitting-native-import-context-filter/README.md +++ b/examples/code-splitting-native-import-context-filter/README.md @@ -81,12 +81,19 @@ export default foo; /******/ var installedModules = {}; /******/ /******/ // object to store loaded and loading chunks +/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched +/******/ // Promise = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ 3: 0 /******/ }; /******/ /******/ /******/ +/******/ // script path function +/******/ function jsonpScriptSrc(chunkId) { +/******/ return __webpack_require__.p + "" + chunkId + ".output.js" +/******/ } +/******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ @@ -142,7 +149,7 @@ export default foo; /******/ if (__webpack_require__.nc) { /******/ script.setAttribute("nonce", __webpack_require__.nc); /******/ } -/******/ script.src = __webpack_require__.p + "" + chunkId + ".output.js"; +/******/ script.src = jsonpScriptSrc(chunkId); /******/ var timeout = setTimeout(function(){ /******/ onScriptComplete({ type: 'timeout', target: script }); /******/ }, 120000); @@ -268,7 +275,7 @@ function webpackAsyncContext(req) { var ids = map[req]; if(!ids) { return Promise.resolve().then(function() { - var e = new Error('Cannot find module "' + req + '".'); + var e = new Error("Cannot find module '" + req + "'"); e.code = 'MODULE_NOT_FOUND'; throw e; }); @@ -321,78 +328,78 @@ getTemplate("baz.noimport"); ``` Hash: 0a1b2c3d4e5f6a7b8c9d -Version: webpack 4.5.0 +Version: webpack 4.8.0 Asset Size Chunks Chunk Names 0.output.js 433 bytes 0 [emitted] 1.output.js 442 bytes 1 [emitted] 2.output.js 436 bytes 2 [emitted] - output.js 8.21 KiB 3 [emitted] main + output.js 8.47 KiB 3 [emitted] main Entrypoint main = output.js chunk {0} 0.output.js 38 bytes <{3}> [rendered] > ./foo [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo > ./foo.js [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo.js - [0] ./templates/foo.js 38 bytes {0} [optional] [built] - [exports: default] - context element ./foo.js [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo.js - context element ./foo [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo + [0] ./templates/foo.js 38 bytes {0} [optional] [built] + [exports: default] + context element ./foo.js [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo.js + context element ./foo [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo chunk {1} 1.output.js 38 bytes <{3}> [rendered] > ./baz [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz > ./baz.js [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz.js - [1] ./templates/baz.js 38 bytes {1} [optional] [built] - [exports: default] - context element ./baz.js [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz.js - context element ./baz [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz + [1] ./templates/baz.js 38 bytes {1} [optional] [built] + [exports: default] + context element ./baz.js [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz.js + context element ./baz [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz chunk {2} 2.output.js 38 bytes <{3}> [rendered] > ./bar [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./bar > ./bar.js [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./bar.js - [2] ./templates/bar.js 38 bytes {2} [optional] [built] - [exports: default] - context element ./bar.js [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./bar.js - context element ./bar [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./bar + [2] ./templates/bar.js 38 bytes {2} [optional] [built] + [exports: default] + context element ./bar.js [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./bar.js + context element ./bar [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./bar chunk {3} output.js (main) 597 bytes >{0}< >{1}< >{2}< [entry] [rendered] > .\example.js main - [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object 160 bytes {3} [optional] [built] - import() context lazy ./templates [4] ./example.js 3:23-7:3 - [4] ./example.js 437 bytes {3} [built] - single entry .\example.js main + [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object 160 bytes {3} [optional] [built] + import() context lazy ./templates [4] ./example.js 3:23-7:3 + [4] ./example.js 437 bytes {3} [built] + single entry .\example.js main ``` ## Production mode ``` Hash: 0a1b2c3d4e5f6a7b8c9d -Version: webpack 4.5.0 +Version: webpack 4.8.0 Asset Size Chunks Chunk Names 0.output.js 113 bytes 0 [emitted] 1.output.js 114 bytes 1 [emitted] 2.output.js 115 bytes 2 [emitted] - output.js 2.13 KiB 3 [emitted] main + output.js 2.16 KiB 3 [emitted] main Entrypoint main = output.js chunk {0} 0.output.js 38 bytes <{3}> [rendered] > ./foo [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo > ./foo.js [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo.js - [0] ./templates/foo.js 38 bytes {0} [optional] [built] - [exports: default] - context element ./foo.js [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo.js - context element ./foo [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo + [0] ./templates/foo.js 38 bytes {0} [optional] [built] + [exports: default] + context element ./foo.js [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo.js + context element ./foo [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo chunk {1} 1.output.js 38 bytes <{3}> [rendered] > ./baz [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz > ./baz.js [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz.js - [1] ./templates/baz.js 38 bytes {1} [optional] [built] - [exports: default] - context element ./baz.js [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz.js - context element ./baz [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz + [1] ./templates/baz.js 38 bytes {1} [optional] [built] + [exports: default] + context element ./baz.js [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz.js + context element ./baz [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz chunk {2} 2.output.js 38 bytes <{3}> [rendered] > ./bar [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./bar > ./bar.js [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./bar.js - [2] ./templates/bar.js 38 bytes {2} [optional] [built] - [exports: default] - context element ./bar.js [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./bar.js - context element ./bar [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./bar + [2] ./templates/bar.js 38 bytes {2} [optional] [built] + [exports: default] + context element ./bar.js [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./bar.js + context element ./bar [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./bar chunk {3} output.js (main) 597 bytes >{0}< >{1}< >{2}< [entry] [rendered] > .\example.js main - [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object 160 bytes {3} [optional] [built] - import() context lazy ./templates [4] ./example.js 3:23-7:3 - [4] ./example.js 437 bytes {3} [built] - single entry .\example.js main + [3] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object 160 bytes {3} [optional] [built] + import() context lazy ./templates [4] ./example.js 3:23-7:3 + [4] ./example.js 437 bytes {3} [built] + single entry .\example.js main ``` diff --git a/examples/code-splitting-native-import-context/README.md b/examples/code-splitting-native-import-context/README.md index 0bd87053271..f751eb9b227 100644 --- a/examples/code-splitting-native-import-context/README.md +++ b/examples/code-splitting-native-import-context/README.md @@ -70,12 +70,19 @@ export default foo; /******/ var installedModules = {}; /******/ /******/ // object to store loaded and loading chunks +/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched +/******/ // Promise = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ 3: 0 /******/ }; /******/ /******/ /******/ +/******/ // script path function +/******/ function jsonpScriptSrc(chunkId) { +/******/ return __webpack_require__.p + "" + chunkId + ".output.js" +/******/ } +/******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ @@ -131,7 +138,7 @@ export default foo; /******/ if (__webpack_require__.nc) { /******/ script.setAttribute("nonce", __webpack_require__.nc); /******/ } -/******/ script.src = __webpack_require__.p + "" + chunkId + ".output.js"; +/******/ script.src = jsonpScriptSrc(chunkId); /******/ var timeout = setTimeout(function(){ /******/ onScriptComplete({ type: 'timeout', target: script }); /******/ }, 120000); @@ -257,7 +264,7 @@ function webpackAsyncContext(req) { var ids = map[req]; if(!ids) { return Promise.resolve().then(function() { - var e = new Error('Cannot find module "' + req + '".'); + var e = new Error("Cannot find module '" + req + "'"); e.code = 'MODULE_NOT_FOUND'; throw e; }); @@ -308,78 +315,78 @@ getTemplate("baz"); ``` Hash: 0a1b2c3d4e5f6a7b8c9d -Version: webpack 4.5.0 +Version: webpack 4.8.0 Asset Size Chunks Chunk Names 0.output.js 436 bytes 0 [emitted] 1.output.js 445 bytes 1 [emitted] 2.output.js 439 bytes 2 [emitted] - output.js 8.03 KiB 3 [emitted] main + output.js 8.3 KiB 3 [emitted] main Entrypoint main = output.js chunk {0} 0.output.js 41 bytes <{3}> [rendered] > ./foo [3] ./templates lazy ^\.\/.*$ namespace object ./foo > ./foo.js [3] ./templates lazy ^\.\/.*$ namespace object ./foo.js - [0] ./templates/foo.js 41 bytes {0} [optional] [built] - [exports: default] - context element ./foo.js [3] ./templates lazy ^\.\/.*$ namespace object ./foo.js - context element ./foo [3] ./templates lazy ^\.\/.*$ namespace object ./foo + [0] ./templates/foo.js 41 bytes {0} [optional] [built] + [exports: default] + context element ./foo.js [3] ./templates lazy ^\.\/.*$ namespace object ./foo.js + context element ./foo [3] ./templates lazy ^\.\/.*$ namespace object ./foo chunk {1} 1.output.js 41 bytes <{3}> [rendered] > ./baz [3] ./templates lazy ^\.\/.*$ namespace object ./baz > ./baz.js [3] ./templates lazy ^\.\/.*$ namespace object ./baz.js - [1] ./templates/baz.js 41 bytes {1} [optional] [built] - [exports: default] - context element ./baz.js [3] ./templates lazy ^\.\/.*$ namespace object ./baz.js - context element ./baz [3] ./templates lazy ^\.\/.*$ namespace object ./baz + [1] ./templates/baz.js 41 bytes {1} [optional] [built] + [exports: default] + context element ./baz.js [3] ./templates lazy ^\.\/.*$ namespace object ./baz.js + context element ./baz [3] ./templates lazy ^\.\/.*$ namespace object ./baz chunk {2} 2.output.js 41 bytes <{3}> [rendered] > ./bar [3] ./templates lazy ^\.\/.*$ namespace object ./bar > ./bar.js [3] ./templates lazy ^\.\/.*$ namespace object ./bar.js - [2] ./templates/bar.js 41 bytes {2} [optional] [built] - [exports: default] - context element ./bar.js [3] ./templates lazy ^\.\/.*$ namespace object ./bar.js - context element ./bar [3] ./templates lazy ^\.\/.*$ namespace object ./bar + [2] ./templates/bar.js 41 bytes {2} [optional] [built] + [exports: default] + context element ./bar.js [3] ./templates lazy ^\.\/.*$ namespace object ./bar.js + context element ./bar [3] ./templates lazy ^\.\/.*$ namespace object ./bar chunk {3} output.js (main) 456 bytes >{0}< >{1}< >{2}< [entry] [rendered] > .\example.js main - [3] ./templates lazy ^\.\/.*$ namespace object 160 bytes {3} [optional] [built] - import() context lazy ./templates [4] ./example.js 3:23-60 - [4] ./example.js 296 bytes {3} [built] - single entry .\example.js main + [3] ./templates lazy ^\.\/.*$ namespace object 160 bytes {3} [optional] [built] + import() context lazy ./templates [4] ./example.js 3:23-60 + [4] ./example.js 296 bytes {3} [built] + single entry .\example.js main ``` ## Production mode ``` Hash: 0a1b2c3d4e5f6a7b8c9d -Version: webpack 4.5.0 +Version: webpack 4.8.0 Asset Size Chunks Chunk Names 0.output.js 113 bytes 0 [emitted] 1.output.js 114 bytes 1 [emitted] 2.output.js 115 bytes 2 [emitted] - output.js 2.09 KiB 3 [emitted] main + output.js 2.12 KiB 3 [emitted] main Entrypoint main = output.js chunk {0} 0.output.js 41 bytes <{3}> [rendered] > ./foo [3] ./templates lazy ^\.\/.*$ namespace object ./foo > ./foo.js [3] ./templates lazy ^\.\/.*$ namespace object ./foo.js - [0] ./templates/foo.js 41 bytes {0} [optional] [built] - [exports: default] - context element ./foo.js [3] ./templates lazy ^\.\/.*$ namespace object ./foo.js - context element ./foo [3] ./templates lazy ^\.\/.*$ namespace object ./foo + [0] ./templates/foo.js 41 bytes {0} [optional] [built] + [exports: default] + context element ./foo.js [3] ./templates lazy ^\.\/.*$ namespace object ./foo.js + context element ./foo [3] ./templates lazy ^\.\/.*$ namespace object ./foo chunk {1} 1.output.js 41 bytes <{3}> [rendered] > ./baz [3] ./templates lazy ^\.\/.*$ namespace object ./baz > ./baz.js [3] ./templates lazy ^\.\/.*$ namespace object ./baz.js - [1] ./templates/baz.js 41 bytes {1} [optional] [built] - [exports: default] - context element ./baz.js [3] ./templates lazy ^\.\/.*$ namespace object ./baz.js - context element ./baz [3] ./templates lazy ^\.\/.*$ namespace object ./baz + [1] ./templates/baz.js 41 bytes {1} [optional] [built] + [exports: default] + context element ./baz.js [3] ./templates lazy ^\.\/.*$ namespace object ./baz.js + context element ./baz [3] ./templates lazy ^\.\/.*$ namespace object ./baz chunk {2} 2.output.js 41 bytes <{3}> [rendered] > ./bar [3] ./templates lazy ^\.\/.*$ namespace object ./bar > ./bar.js [3] ./templates lazy ^\.\/.*$ namespace object ./bar.js - [2] ./templates/bar.js 41 bytes {2} [optional] [built] - [exports: default] - context element ./bar.js [3] ./templates lazy ^\.\/.*$ namespace object ./bar.js - context element ./bar [3] ./templates lazy ^\.\/.*$ namespace object ./bar + [2] ./templates/bar.js 41 bytes {2} [optional] [built] + [exports: default] + context element ./bar.js [3] ./templates lazy ^\.\/.*$ namespace object ./bar.js + context element ./bar [3] ./templates lazy ^\.\/.*$ namespace object ./bar chunk {3} output.js (main) 456 bytes >{0}< >{1}< >{2}< [entry] [rendered] > .\example.js main - [3] ./templates lazy ^\.\/.*$ namespace object 160 bytes {3} [optional] [built] - import() context lazy ./templates [4] ./example.js 3:23-60 - [4] ./example.js 296 bytes {3} [built] - single entry .\example.js main + [3] ./templates lazy ^\.\/.*$ namespace object 160 bytes {3} [optional] [built] + import() context lazy ./templates [4] ./example.js 3:23-60 + [4] ./example.js 296 bytes {3} [built] + single entry .\example.js main ``` diff --git a/examples/code-splitting-specify-chunk-name/README.md b/examples/code-splitting-specify-chunk-name/README.md index c97dced3558..16638fad95a 100644 --- a/examples/code-splitting-specify-chunk-name/README.md +++ b/examples/code-splitting-specify-chunk-name/README.md @@ -70,12 +70,19 @@ export default foo; /******/ var installedModules = {}; /******/ /******/ // object to store loaded and loading chunks +/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched +/******/ // Promise = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ 3: 0 /******/ }; /******/ /******/ /******/ +/******/ // script path function +/******/ function jsonpScriptSrc(chunkId) { +/******/ return __webpack_require__.p + "" + chunkId + ".output.js" +/******/ } +/******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ @@ -131,7 +138,7 @@ export default foo; /******/ if (__webpack_require__.nc) { /******/ script.setAttribute("nonce", __webpack_require__.nc); /******/ } -/******/ script.src = __webpack_require__.p + "" + chunkId + ".output.js"; +/******/ script.src = jsonpScriptSrc(chunkId); /******/ var timeout = setTimeout(function(){ /******/ onScriptComplete({ type: 'timeout', target: script }); /******/ }, 120000); @@ -249,7 +256,7 @@ function webpackAsyncContext(req) { var ids = map[req]; if(!ids) { return Promise.resolve().then(function() { - var e = new Error('Cannot find module "' + req + '".'); + var e = new Error("Cannot find module '" + req + "'"); e.code = 'MODULE_NOT_FOUND'; throw e; }); @@ -300,78 +307,78 @@ __webpack_require__(3)("./ba" + createContextVar).then(function(bar) { ``` Hash: 0a1b2c3d4e5f6a7b8c9d -Version: webpack 4.5.0 +Version: webpack 4.8.0 Asset Size Chunks Chunk Names 0.output.js 445 bytes 0 [emitted] chunk-bar-baz2 1.output.js 439 bytes 1 [emitted] chunk-bar-baz0 2.output.js 436 bytes 2 [emitted] chunk-foo - output.js 8.23 KiB 3 [emitted] main + output.js 8.5 KiB 3 [emitted] main Entrypoint main = output.js chunk {0} 0.output.js (chunk-bar-baz2) 41 bytes <{3}> [rendered] > ./baz [3] ./templates lazy ^\.\/ba.*$ namespace object ./baz > ./baz.js [3] ./templates lazy ^\.\/ba.*$ namespace object ./baz.js - [1] ./templates/baz.js 41 bytes {0} [optional] [built] - [exports: default] - context element ./baz.js [3] ./templates lazy ^\.\/ba.*$ namespace object ./baz.js - context element ./baz [3] ./templates lazy ^\.\/ba.*$ namespace object ./baz + [1] ./templates/baz.js 41 bytes {0} [optional] [built] + [exports: default] + context element ./baz.js [3] ./templates lazy ^\.\/ba.*$ namespace object ./baz.js + context element ./baz [3] ./templates lazy ^\.\/ba.*$ namespace object ./baz chunk {1} 1.output.js (chunk-bar-baz0) 41 bytes <{3}> [rendered] > ./bar [3] ./templates lazy ^\.\/ba.*$ namespace object ./bar > ./bar.js [3] ./templates lazy ^\.\/ba.*$ namespace object ./bar.js - [2] ./templates/bar.js 41 bytes {1} [optional] [built] - [exports: default] - context element ./bar.js [3] ./templates lazy ^\.\/ba.*$ namespace object ./bar.js - context element ./bar [3] ./templates lazy ^\.\/ba.*$ namespace object ./bar + [2] ./templates/bar.js 41 bytes {1} [optional] [built] + [exports: default] + context element ./bar.js [3] ./templates lazy ^\.\/ba.*$ namespace object ./bar.js + context element ./bar [3] ./templates lazy ^\.\/ba.*$ namespace object ./bar chunk {2} 2.output.js (chunk-foo) 41 bytes <{3}> [rendered] > ./templates/foo [4] ./example.js 1:0-62 > [4] ./example.js 5:0-8:16 - [0] ./templates/foo.js 41 bytes {2} [built] - [exports: default] - import() ./templates/foo [4] ./example.js 1:0-62 - cjs require ./templates/foo [4] ./example.js 6:11-37 + [0] ./templates/foo.js 41 bytes {2} [built] + [exports: default] + import() ./templates/foo [4] ./example.js 1:0-62 + cjs require ./templates/foo [4] ./example.js 6:11-37 chunk {3} output.js (main) 580 bytes >{0}< >{1}< >{2}< [entry] [rendered] > .\example.js main - [3] ./templates lazy ^\.\/ba.*$ namespace object 160 bytes {3} [built] - import() context lazy ./templates [4] ./example.js 11:0-84 - [4] ./example.js 420 bytes {3} [built] - single entry .\example.js main + [3] ./templates lazy ^\.\/ba.*$ namespace object 160 bytes {3} [built] + import() context lazy ./templates [4] ./example.js 11:0-84 + [4] ./example.js 420 bytes {3} [built] + single entry .\example.js main ``` ## Production mode ``` Hash: 0a1b2c3d4e5f6a7b8c9d -Version: webpack 4.5.0 +Version: webpack 4.8.0 Asset Size Chunks Chunk Names 0.output.js 114 bytes 0 [emitted] chunk-bar-baz2 1.output.js 115 bytes 1 [emitted] chunk-bar-baz0 2.output.js 113 bytes 2 [emitted] chunk-foo - output.js 2.12 KiB 3 [emitted] main + output.js 2.14 KiB 3 [emitted] main Entrypoint main = output.js chunk {0} 0.output.js (chunk-bar-baz2) 41 bytes <{3}> [rendered] > ./baz [3] ./templates lazy ^\.\/ba.*$ namespace object ./baz > ./baz.js [3] ./templates lazy ^\.\/ba.*$ namespace object ./baz.js - [1] ./templates/baz.js 41 bytes {0} [optional] [built] - [exports: default] - context element ./baz.js [3] ./templates lazy ^\.\/ba.*$ namespace object ./baz.js - context element ./baz [3] ./templates lazy ^\.\/ba.*$ namespace object ./baz + [1] ./templates/baz.js 41 bytes {0} [optional] [built] + [exports: default] + context element ./baz.js [3] ./templates lazy ^\.\/ba.*$ namespace object ./baz.js + context element ./baz [3] ./templates lazy ^\.\/ba.*$ namespace object ./baz chunk {1} 1.output.js (chunk-bar-baz0) 41 bytes <{3}> [rendered] > ./bar [3] ./templates lazy ^\.\/ba.*$ namespace object ./bar > ./bar.js [3] ./templates lazy ^\.\/ba.*$ namespace object ./bar.js - [2] ./templates/bar.js 41 bytes {1} [optional] [built] - [exports: default] - context element ./bar.js [3] ./templates lazy ^\.\/ba.*$ namespace object ./bar.js - context element ./bar [3] ./templates lazy ^\.\/ba.*$ namespace object ./bar + [2] ./templates/bar.js 41 bytes {1} [optional] [built] + [exports: default] + context element ./bar.js [3] ./templates lazy ^\.\/ba.*$ namespace object ./bar.js + context element ./bar [3] ./templates lazy ^\.\/ba.*$ namespace object ./bar chunk {2} 2.output.js (chunk-foo) 41 bytes <{3}> [rendered] > ./templates/foo [4] ./example.js 1:0-62 > [4] ./example.js 5:0-8:16 - [0] ./templates/foo.js 41 bytes {2} [built] - [exports: default] - import() ./templates/foo [4] ./example.js 1:0-62 - cjs require ./templates/foo [4] ./example.js 6:11-37 + [0] ./templates/foo.js 41 bytes {2} [built] + [exports: default] + import() ./templates/foo [4] ./example.js 1:0-62 + cjs require ./templates/foo [4] ./example.js 6:11-37 chunk {3} output.js (main) 580 bytes >{0}< >{1}< >{2}< [entry] [rendered] > .\example.js main - [3] ./templates lazy ^\.\/ba.*$ namespace object 160 bytes {3} [built] - import() context lazy ./templates [4] ./example.js 11:0-84 - [4] ./example.js 420 bytes {3} [built] - single entry .\example.js main + [3] ./templates lazy ^\.\/ba.*$ namespace object 160 bytes {3} [built] + import() context lazy ./templates [4] ./example.js 11:0-84 + [4] ./example.js 420 bytes {3} [built] + single entry .\example.js main ``` diff --git a/examples/code-splitting/README.md b/examples/code-splitting/README.md index 409dc05ba58..c6dd1964083 100644 --- a/examples/code-splitting/README.md +++ b/examples/code-splitting/README.md @@ -74,12 +74,19 @@ require.ensure(["c"], function(require) { /******/ var installedModules = {}; /******/ /******/ // object to store loaded and loading chunks +/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched +/******/ // Promise = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ 1: 0 /******/ }; /******/ /******/ /******/ +/******/ // script path function +/******/ function jsonpScriptSrc(chunkId) { +/******/ return __webpack_require__.p + "" + chunkId + ".output.js" +/******/ } +/******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ @@ -135,7 +142,7 @@ require.ensure(["c"], function(require) { /******/ if (__webpack_require__.nc) { /******/ script.setAttribute("nonce", __webpack_require__.nc); /******/ } -/******/ script.src = __webpack_require__.p + "" + chunkId + ".output.js"; +/******/ script.src = jsonpScriptSrc(chunkId); /******/ var timeout = setTimeout(function(){ /******/ onScriptComplete({ type: 'timeout', target: script }); /******/ }, 120000); @@ -301,18 +308,18 @@ Minimized ``` Hash: 0a1b2c3d4e5f6a7b8c9d -Version: webpack 4.5.0 +Version: webpack 4.8.0 Asset Size Chunks Chunk Names 0.output.js 490 bytes 0 [emitted] - output.js 7.47 KiB 1 [emitted] main + output.js 7.73 KiB 1 [emitted] main Entrypoint main = output.js chunk {0} 0.output.js 22 bytes <{1}> [rendered] > [2] ./example.js 3:0-6:2 2 modules chunk {1} output.js (main) 166 bytes >{0}< [entry] [rendered] > .\example.js main - [2] ./example.js 144 bytes {1} [built] - single entry .\example.js main + [2] ./example.js 144 bytes {1} [built] + single entry .\example.js main + 2 hidden modules ``` @@ -320,17 +327,17 @@ chunk {1} output.js (main) 166 bytes >{0}< [entry] [rendered] ``` Hash: 0a1b2c3d4e5f6a7b8c9d -Version: webpack 4.5.0 +Version: webpack 4.8.0 Asset Size Chunks Chunk Names 0.output.js 95 bytes 0 [emitted] - output.js 1.68 KiB 1 [emitted] main + output.js 1.71 KiB 1 [emitted] main Entrypoint main = output.js chunk {0} 0.output.js 22 bytes <{1}> [rendered] > [2] ./example.js 3:0-6:2 2 modules chunk {1} output.js (main) 166 bytes >{0}< [entry] [rendered] > .\example.js main - [2] ./example.js 144 bytes {1} [built] - single entry .\example.js main + [2] ./example.js 144 bytes {1} [built] + single entry .\example.js main + 2 hidden modules ``` diff --git a/examples/coffee-script/README.md b/examples/coffee-script/README.md index f857255c0d4..3f9c31fa5af 100644 --- a/examples/coffee-script/README.md +++ b/examples/coffee-script/README.md @@ -153,36 +153,36 @@ module.exports = 42; ``` Hash: 0a1b2c3d4e5f6a7b8c9d -Version: webpack 4.5.0 +Version: webpack 4.8.0 Asset Size Chunks Chunk Names output.js 3.35 KiB 0 [emitted] main Entrypoint main = output.js chunk {0} output.js (main) 206 bytes [entry] [rendered] > .\example.js main - [0] ./example.js 31 bytes {0} [built] - single entry .\example.js main - [1] ./cup1.coffee 118 bytes {0} [built] - cjs require ./cup1 [0] ./example.js 1:12-29 - [2] ./cup2.coffee 57 bytes {0} [built] - cjs require ./cup2.coffee [1] ./cup1.coffee 4:12-36 - cjs require ./cup2 [1] ./cup1.coffee 5:9-26 + [0] ./example.js 31 bytes {0} [built] + single entry .\example.js main + [1] ./cup1.coffee 118 bytes {0} [built] + cjs require ./cup1 [0] ./example.js 1:12-29 + [2] ./cup2.coffee 57 bytes {0} [built] + cjs require ./cup2.coffee [1] ./cup1.coffee 4:12-36 + cjs require ./cup2 [1] ./cup1.coffee 5:9-26 ``` ## Production mode ``` Hash: 0a1b2c3d4e5f6a7b8c9d -Version: webpack 4.5.0 +Version: webpack 4.8.0 Asset Size Chunks Chunk Names output.js 708 bytes 0 [emitted] main Entrypoint main = output.js chunk {0} output.js (main) 206 bytes [entry] [rendered] > .\example.js main - [0] ./cup2.coffee 57 bytes {0} [built] - cjs require ./cup2.coffee [1] ./cup1.coffee 4:12-36 - cjs require ./cup2 [1] ./cup1.coffee 5:9-26 - [1] ./cup1.coffee 118 bytes {0} [built] - cjs require ./cup1 [2] ./example.js 1:12-29 - [2] ./example.js 31 bytes {0} [built] - single entry .\example.js main + [0] ./cup2.coffee 57 bytes {0} [built] + cjs require ./cup2.coffee [1] ./cup1.coffee 4:12-36 + cjs require ./cup2 [1] ./cup1.coffee 5:9-26 + [1] ./cup1.coffee 118 bytes {0} [built] + cjs require ./cup1 [2] ./example.js 1:12-29 + [2] ./example.js 31 bytes {0} [built] + single entry .\example.js main ``` \ No newline at end of file diff --git a/examples/common-chunk-and-vendor-chunk/README.md b/examples/common-chunk-and-vendor-chunk/README.md index 89d27e640cc..f6d5e46aa9c 100644 --- a/examples/common-chunk-and-vendor-chunk/README.md +++ b/examples/common-chunk-and-vendor-chunk/README.md @@ -195,6 +195,8 @@ module.exports = "utility3"; /******/ var installedModules = {}; /******/ /******/ // object to store loaded and loading chunks +/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched +/******/ // Promise = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ 0: 0 /******/ }; @@ -368,6 +370,8 @@ module.exports = "utility1"; /******/ var installedModules = {}; /******/ /******/ // object to store loaded and loading chunks +/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched +/******/ // Promise = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ 1: 0 /******/ }; @@ -527,6 +531,8 @@ module.exports = "pageB"; /******/ var installedModules = {}; /******/ /******/ // object to store loaded and loading chunks +/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched +/******/ // Promise = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ 2: 0 /******/ }; @@ -634,11 +640,11 @@ module.exports = "pageC"; ``` Hash: 0a1b2c3d4e5f6a7b8c9d -Version: webpack 4.5.0 +Version: webpack 4.8.0 Asset Size Chunks Chunk Names - pageA.js 5.59 KiB 0 [emitted] pageA - pageB.js 5.39 KiB 1 [emitted] pageB - pageC.js 5.34 KiB 2 [emitted] pageC + pageA.js 5.72 KiB 0 [emitted] pageA + pageB.js 5.52 KiB 1 [emitted] pageB + pageC.js 5.47 KiB 2 [emitted] pageC vendor.js 536 bytes 3 [emitted] vendor commons~pageA~pageB~pageC.js 269 bytes 4 [emitted] commons~pageA~pageB~pageC commons~pageB~pageC.js 269 bytes 5 [emitted] commons~pageB~pageC @@ -647,18 +653,18 @@ Entrypoint pageB = vendor.js commons~pageA~pageB~pageC.js commons~pageB~pageC.js Entrypoint pageC = commons~pageA~pageB~pageC.js commons~pageB~pageC.js pageC.js chunk {0} pageA.js (pageA) 165 bytes ={3}= ={4}= [entry] [rendered] > ./pageA pageA - [0] ./pageA.js 137 bytes {0} [built] - single entry ./pageA pageA - [2] ./utility1.js 28 bytes {0} [built] - cjs require ./utility1 [0] ./pageA.js 2:15-36 + [0] ./pageA.js 137 bytes {0} [built] + single entry ./pageA pageA + [2] ./utility1.js 28 bytes {0} [built] + cjs require ./utility1 [0] ./pageA.js 2:15-36 chunk {1} pageB.js (pageB) 137 bytes ={3}= ={4}= ={5}= [entry] [rendered] > ./pageB pageB - [4] ./pageB.js 137 bytes {1} [built] - single entry ./pageB pageB + [4] ./pageB.js 137 bytes {1} [built] + single entry ./pageB pageB chunk {2} pageC.js (pageC) 105 bytes ={4}= ={5}= [entry] [rendered] > ./pageC pageC - [7] ./pageC.js 105 bytes {2} [built] - single entry ./pageC pageC + [7] ./pageC.js 105 bytes {2} [built] + single entry ./pageC pageC chunk {3} vendor.js (vendor) 54 bytes ={0}= ={1}= ={4}= ={5}= [initial] [rendered] split chunk (cache group: vendor) (name: vendor) > ./pageA pageA > ./pageB pageB @@ -667,23 +673,23 @@ chunk {4} commons~pageA~pageB~pageC.js (commons~pageA~pageB~pageC) 28 bytes = > ./pageA pageA > ./pageB pageB > ./pageC pageC - [3] ./utility2.js 28 bytes {4} [built] - cjs require ./utility2 [0] ./pageA.js 3:15-36 - cjs require ./utility2 [4] ./pageB.js 2:15-36 - cjs require ./utility2 [7] ./pageC.js 1:15-36 + [3] ./utility2.js 28 bytes {4} [built] + cjs require ./utility2 [0] ./pageA.js 3:15-36 + cjs require ./utility2 [4] ./pageB.js 2:15-36 + cjs require ./utility2 [7] ./pageC.js 1:15-36 chunk {5} commons~pageB~pageC.js (commons~pageB~pageC) 28 bytes ={1}= ={2}= ={3}= ={4}= [initial] [rendered] split chunk (cache group: commons) (name: commons~pageB~pageC) > ./pageB pageB > ./pageC pageC - [6] ./utility3.js 28 bytes {5} [built] - cjs require ./utility3 [4] ./pageB.js 3:15-36 - cjs require ./utility3 [7] ./pageC.js 2:15-36 + [6] ./utility3.js 28 bytes {5} [built] + cjs require ./utility3 [4] ./pageB.js 3:15-36 + cjs require ./utility3 [7] ./pageC.js 2:15-36 ``` ## Production mode ``` Hash: 0a1b2c3d4e5f6a7b8c9d -Version: webpack 4.5.0 +Version: webpack 4.8.0 Asset Size Chunks Chunk Names commons~pageA~pageB~pageC.js 96 bytes 0 [emitted] commons~pageA~pageB~pageC commons~pageB~pageC.js 97 bytes 1 [emitted] commons~pageB~pageC @@ -698,32 +704,32 @@ chunk {0} commons~pageA~pageB~pageC.js (commons~pageA~pageB~pageC) 28 bytes = > ./pageA pageA > ./pageB pageB > ./pageC pageC - [0] ./utility2.js 28 bytes {0} [built] - cjs require ./utility2 [2] ./pageC.js 1:15-36 - cjs require ./utility2 [4] ./pageB.js 2:15-36 - cjs require ./utility2 [7] ./pageA.js 3:15-36 + [0] ./utility2.js 28 bytes {0} [built] + cjs require ./utility2 [2] ./pageC.js 1:15-36 + cjs require ./utility2 [4] ./pageB.js 2:15-36 + cjs require ./utility2 [7] ./pageA.js 3:15-36 chunk {1} commons~pageB~pageC.js (commons~pageB~pageC) 28 bytes ={0}= ={2}= ={3}= ={4}= [initial] [rendered] split chunk (cache group: commons) (name: commons~pageB~pageC) > ./pageB pageB > ./pageC pageC - [1] ./utility3.js 28 bytes {1} [built] - cjs require ./utility3 [2] ./pageC.js 2:15-36 - cjs require ./utility3 [4] ./pageB.js 3:15-36 + [1] ./utility3.js 28 bytes {1} [built] + cjs require ./utility3 [2] ./pageC.js 2:15-36 + cjs require ./utility3 [4] ./pageB.js 3:15-36 chunk {2} vendor.js (vendor) 54 bytes ={0}= ={1}= ={4}= ={5}= [initial] [rendered] split chunk (cache group: vendor) (name: vendor) > ./pageA pageA > ./pageB pageB 2 modules chunk {3} pageC.js (pageC) 105 bytes ={0}= ={1}= [entry] [rendered] > ./pageC pageC - [2] ./pageC.js 105 bytes {3} [built] - single entry ./pageC pageC + [2] ./pageC.js 105 bytes {3} [built] + single entry ./pageC pageC chunk {4} pageB.js (pageB) 137 bytes ={0}= ={1}= ={2}= [entry] [rendered] > ./pageB pageB - [4] ./pageB.js 137 bytes {4} [built] - single entry ./pageB pageB + [4] ./pageB.js 137 bytes {4} [built] + single entry ./pageB pageB chunk {5} pageA.js (pageA) 165 bytes ={0}= ={2}= [entry] [rendered] > ./pageA pageA - [5] ./utility1.js 28 bytes {5} [built] - cjs require ./utility1 [7] ./pageA.js 2:15-36 - [7] ./pageA.js 137 bytes {5} [built] - single entry ./pageA pageA + [5] ./utility1.js 28 bytes {5} [built] + cjs require ./utility1 [7] ./pageA.js 2:15-36 + [7] ./pageA.js 137 bytes {5} [built] + single entry ./pageA pageA ``` diff --git a/examples/common-chunk-grandchildren/README.md b/examples/common-chunk-grandchildren/README.md index 3a833d7a1aa..9ce9e748da9 100644 --- a/examples/common-chunk-grandchildren/README.md +++ b/examples/common-chunk-grandchildren/README.md @@ -142,12 +142,19 @@ module.exports = { /******/ var installedModules = {}; /******/ /******/ // object to store loaded and loading chunks +/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched +/******/ // Promise = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ 4: 0 /******/ }; /******/ /******/ /******/ +/******/ // script path function +/******/ function jsonpScriptSrc(chunkId) { +/******/ return __webpack_require__.p + "" + chunkId + ".output.js" +/******/ } +/******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ @@ -203,7 +210,7 @@ module.exports = { /******/ if (__webpack_require__.nc) { /******/ script.setAttribute("nonce", __webpack_require__.nc); /******/ } -/******/ script.src = __webpack_require__.p + "" + chunkId + ".output.js"; +/******/ script.src = jsonpScriptSrc(chunkId); /******/ var timeout = setTimeout(function(){ /******/ onScriptComplete({ type: 'timeout', target: script }); /******/ }, 120000); @@ -430,74 +437,74 @@ module.exports = function() { ``` Hash: 0a1b2c3d4e5f6a7b8c9d -Version: webpack 4.5.0 +Version: webpack 4.8.0 Asset Size Chunks Chunk Names 0.output.js 340 bytes 0 [emitted] 1.output.js 549 bytes 1 [emitted] 2.output.js 414 bytes 2 [emitted] 3.output.js 414 bytes 3 [emitted] - output.js 7.53 KiB 4 [emitted] main + output.js 7.79 KiB 4 [emitted] main Entrypoint main = output.js chunk {0} 0.output.js 72 bytes <{1}> <{4}> ={2}= ={3}= [rendered] split chunk (cache group: default) > [0] ./example.js 3:1-6:3 > [2] ./pageB.js 3:1-6:3 - [4] ./reusableComponent.js 72 bytes {0} [built] - cjs require ./reusableComponent [3] ./pageA.js 1:24-54 - cjs require ./reusableComponent [5] ./pageC.js 1:24-54 + [4] ./reusableComponent.js 72 bytes {0} [built] + cjs require ./reusableComponent [3] ./pageA.js 1:24-54 + cjs require ./reusableComponent [5] ./pageC.js 1:24-54 chunk {1} 1.output.js 140 bytes <{4}> >{0}< >{3}< [rendered] > [0] ./example.js 7:1-10:3 - [2] ./pageB.js 140 bytes {1} [built] - cjs require ./pageB [0] ./example.js 8:15-33 + [2] ./pageB.js 140 bytes {1} [built] + cjs require ./pageB [0] ./example.js 8:15-33 chunk {2} 2.output.js 142 bytes <{4}> ={0}= [rendered] > [0] ./example.js 3:1-6:3 - [3] ./pageA.js 142 bytes {2} [built] - cjs require ./pageA [0] ./example.js 4:15-33 + [3] ./pageA.js 142 bytes {2} [built] + cjs require ./pageA [0] ./example.js 4:15-33 chunk {3} 3.output.js 142 bytes <{1}> ={0}= [rendered] > [2] ./pageB.js 3:1-6:3 - [5] ./pageC.js 142 bytes {3} [built] - cjs require ./pageC [2] ./pageB.js 4:15-33 + [5] ./pageC.js 142 bytes {3} [built] + cjs require ./pageC [2] ./pageB.js 4:15-33 chunk {4} output.js (main) 261 bytes >{0}< >{1}< >{2}< [entry] [rendered] > main - [0] ./example.js 233 bytes {4} [built] - single entry ./example.js [1] multi ./example.js main:100000 - [1] multi ./example.js 28 bytes {4} [built] - multi entry + [0] ./example.js 233 bytes {4} [built] + single entry ./example.js [1] multi ./example.js main:100000 + [1] multi ./example.js 28 bytes {4} [built] + multi entry ``` ## Production mode ``` Hash: 0a1b2c3d4e5f6a7b8c9d -Version: webpack 4.5.0 +Version: webpack 4.8.0 Asset Size Chunks Chunk Names 0.output.js 133 bytes 0 [emitted] 1.output.js 198 bytes 1 [emitted] 2.output.js 138 bytes 2 [emitted] 3.output.js 138 bytes 3 [emitted] - output.js 1.76 KiB 4 [emitted] main + output.js 1.78 KiB 4 [emitted] main Entrypoint main = output.js chunk {0} 0.output.js 72 bytes <{1}> <{4}> ={2}= ={3}= [rendered] split chunk (cache group: default) > [0] ./example.js 3:1-6:3 > [2] ./pageB.js 3:1-6:3 - [4] ./reusableComponent.js 72 bytes {0} [built] - cjs require ./reusableComponent [3] ./pageA.js 1:24-54 - cjs require ./reusableComponent [5] ./pageC.js 1:24-54 + [4] ./reusableComponent.js 72 bytes {0} [built] + cjs require ./reusableComponent [3] ./pageA.js 1:24-54 + cjs require ./reusableComponent [5] ./pageC.js 1:24-54 chunk {1} 1.output.js 140 bytes <{4}> >{0}< >{3}< [rendered] > [0] ./example.js 7:1-10:3 - [2] ./pageB.js 140 bytes {1} [built] - cjs require ./pageB [0] ./example.js 8:15-33 + [2] ./pageB.js 140 bytes {1} [built] + cjs require ./pageB [0] ./example.js 8:15-33 chunk {2} 2.output.js 142 bytes <{4}> ={0}= [rendered] > [0] ./example.js 3:1-6:3 - [3] ./pageA.js 142 bytes {2} [built] - cjs require ./pageA [0] ./example.js 4:15-33 + [3] ./pageA.js 142 bytes {2} [built] + cjs require ./pageA [0] ./example.js 4:15-33 chunk {3} 3.output.js 142 bytes <{1}> ={0}= [rendered] > [2] ./pageB.js 3:1-6:3 - [5] ./pageC.js 142 bytes {3} [built] - cjs require ./pageC [2] ./pageB.js 4:15-33 + [5] ./pageC.js 142 bytes {3} [built] + cjs require ./pageC [2] ./pageB.js 4:15-33 chunk {4} output.js (main) 261 bytes >{0}< >{1}< >{2}< [entry] [rendered] > main - [0] ./example.js 233 bytes {4} [built] - single entry ./example.js [1] multi ./example.js main:100000 - [1] multi ./example.js 28 bytes {4} [built] - multi entry + [0] ./example.js 233 bytes {4} [built] + single entry ./example.js [1] multi ./example.js main:100000 + [1] multi ./example.js 28 bytes {4} [built] + multi entry ``` diff --git a/examples/commonjs/README.md b/examples/commonjs/README.md index 92f30d4b76f..fb85a0b1c08 100644 --- a/examples/commonjs/README.md +++ b/examples/commonjs/README.md @@ -167,34 +167,34 @@ exports.add = function() { ``` Hash: 0a1b2c3d4e5f6a7b8c9d -Version: webpack 4.5.0 +Version: webpack 4.8.0 Asset Size Chunks Chunk Names output.js 3.44 KiB 0 [emitted] main Entrypoint main = output.js chunk {0} output.js (main) 329 bytes [entry] [rendered] > .\example.js main - [0] ./example.js 69 bytes {0} [built] - single entry .\example.js main - [1] ./increment.js 98 bytes {0} [built] - cjs require ./increment [0] ./example.js 1:10-32 - [2] ./math.js 162 bytes {0} [built] - cjs require ./math [1] ./increment.js 1:10-27 + [0] ./example.js 69 bytes {0} [built] + single entry .\example.js main + [1] ./increment.js 98 bytes {0} [built] + cjs require ./increment [0] ./example.js 1:10-32 + [2] ./math.js 162 bytes {0} [built] + cjs require ./math [1] ./increment.js 1:10-27 ``` ## Production mode ``` Hash: 0a1b2c3d4e5f6a7b8c9d -Version: webpack 4.5.0 +Version: webpack 4.8.0 Asset Size Chunks Chunk Names output.js 740 bytes 0 [emitted] main Entrypoint main = output.js chunk {0} output.js (main) 329 bytes [entry] [rendered] > .\example.js main - [0] ./math.js 162 bytes {0} [built] - cjs require ./math [1] ./increment.js 1:10-27 - [1] ./increment.js 98 bytes {0} [built] - cjs require ./increment [2] ./example.js 1:10-32 - [2] ./example.js 69 bytes {0} [built] - single entry .\example.js main + [0] ./math.js 162 bytes {0} [built] + cjs require ./math [1] ./increment.js 1:10-27 + [1] ./increment.js 98 bytes {0} [built] + cjs require ./increment [2] ./example.js 1:10-32 + [2] ./example.js 69 bytes {0} [built] + single entry .\example.js main ``` \ No newline at end of file diff --git a/examples/dll-app-and-vendor/0-vendor/README.md b/examples/dll-app-and-vendor/0-vendor/README.md index 61b4320f62d..0db675ca871 100644 --- a/examples/dll-app-and-vendor/0-vendor/README.md +++ b/examples/dll-app-and-vendor/0-vendor/README.md @@ -1,6 +1,6 @@ This is the vendor build part. -It's built separately from the app part. The vendors dll is only built when vendors has changed and not while the normal development cycle. +It's built separately from the app part. The vendors dll is only built when the array of vendors has changed and not during the normal development cycle. The DllPlugin in combination with the `output.library` option exposes the internal require function as global variable in the target environment. @@ -41,7 +41,7 @@ export function square(n) { # dist/vendor.js ``` javascript -var vendor_lib_bc3751dcff9f91451e0e = +var vendor_lib_f3fbcfb4ec389ba5bbf0 = ```
/******/ (function(modules) { /* webpackBootstrap */ }) @@ -157,7 +157,7 @@ function square(n) { # dist/vendor-manifest.json ``` javascript -{"name":"vendor_lib_bc3751dcff9f91451e0e","content":{"../node_modules/example-vendor.js":{"id":1,"buildMeta":{"exportsType":"namespace","providedExports":["square"]}}}} +{"name":"vendor_lib_f3fbcfb4ec389ba5bbf0","content":{"../node_modules/example-vendor.js":{"id":1,"buildMeta":{"exportsType":"namespace","providedExports":["square"]}}}} ``` # Info @@ -166,15 +166,15 @@ function square(n) { ``` Hash: 0a1b2c3d4e5f6a7b8c9d -Version: webpack 4.5.0 +Version: webpack 4.8.0 Asset Size Chunks Chunk Names vendor.js 3.32 KiB 0 [emitted] main Entrypoint main = vendor.js chunk {0} vendor.js (main) 60 bytes [entry] [rendered] > main - [0] dll main 12 bytes {0} [built] - dll entry - + [0] dll main 12 bytes {0} [built] + dll entry + + 1 hidden module ``` @@ -182,15 +182,15 @@ chunk {0} vendor.js (main) 60 bytes [entry] [rendered] ``` Hash: 0a1b2c3d4e5f6a7b8c9d -Version: webpack 4.5.0 +Version: webpack 4.8.0 Asset Size Chunks Chunk Names vendor.js 704 bytes 0 [emitted] main Entrypoint main = vendor.js chunk {0} vendor.js (main) 60 bytes [entry] [rendered] > main - [1] dll main 12 bytes {0} [built] - dll entry - + [1] dll main 12 bytes {0} [built] + dll entry + + 1 hidden module ``` diff --git a/examples/dll-app-and-vendor/0-vendor/template.md b/examples/dll-app-and-vendor/0-vendor/template.md index e66f844f1ce..662ea88e909 100644 --- a/examples/dll-app-and-vendor/0-vendor/template.md +++ b/examples/dll-app-and-vendor/0-vendor/template.md @@ -1,6 +1,6 @@ This is the vendor build part. -It's built separately from the app part. The vendors dll is only built when vendors has changed and not while the normal development cycle. +It's built separately from the app part. The vendors dll is only built when the array of vendors has changed and not during the normal development cycle. The DllPlugin in combination with the `output.library` option exposes the internal require function as global variable in the target environment. diff --git a/examples/dll-app-and-vendor/1-app/README.md b/examples/dll-app-and-vendor/1-app/README.md index 84f722ff6f7..d8b1e628fe2 100644 --- a/examples/dll-app-and-vendor/1-app/README.md +++ b/examples/dll-app-and-vendor/1-app/README.md @@ -147,22 +147,22 @@ console.log(new example_vendor__WEBPACK_IMPORTED_MODULE_0__["square"](7)); /***/ }), /* 1 */ /*!******************************************************************************************************!*\ - !*** delegated ../node_modules/example-vendor.js from dll-reference vendor_lib_bc3751dcff9f91451e0e ***! + !*** delegated ../node_modules/example-vendor.js from dll-reference vendor_lib_f3fbcfb4ec389ba5bbf0 ***! \******************************************************************************************************/ /*! exports provided: square */ /***/ (function(module, exports, __webpack_require__) { -module.exports = (__webpack_require__(/*! dll-reference vendor_lib_bc3751dcff9f91451e0e */ 2))(1); +module.exports = (__webpack_require__(/*! dll-reference vendor_lib_f3fbcfb4ec389ba5bbf0 */ 2))(1); /***/ }), /* 2 */ /*!**************************************************!*\ - !*** external "vendor_lib_bc3751dcff9f91451e0e" ***! + !*** external "vendor_lib_f3fbcfb4ec389ba5bbf0" ***! \**************************************************/ /*! no static exports found */ /***/ (function(module, exports) { -module.exports = vendor_lib_bc3751dcff9f91451e0e; +module.exports = vendor_lib_f3fbcfb4ec389ba5bbf0; /***/ }) /******/ ]); @@ -174,44 +174,44 @@ module.exports = vendor_lib_bc3751dcff9f91451e0e; ``` Hash: 0a1b2c3d4e5f6a7b8c9d -Version: webpack 4.5.0 +Version: webpack 4.8.0 Asset Size Chunks Chunk Names app.js 3.9 KiB 0 [emitted] main Entrypoint main = app.js chunk {0} app.js (main) 182 bytes [entry] [rendered] > ./example-app main - [0] ./example-app.js 98 bytes {0} [built] - [no exports] - single entry ./example-app main - [1] delegated ../node_modules/example-vendor.js from dll-reference vendor_lib_bc3751dcff9f91451e0e 42 bytes {0} [built] - [exports: square] - harmony side effect evaluation example-vendor [0] ./example-app.js 1:0-40 - harmony import specifier example-vendor [0] ./example-app.js 3:12-18 - harmony import specifier example-vendor [0] ./example-app.js 4:16-22 - [2] external "vendor_lib_bc3751dcff9f91451e0e" 42 bytes {0} [built] - delegated source dll-reference vendor_lib_bc3751dcff9f91451e0e [1] delegated ../node_modules/example-vendor.js from dll-reference vendor_lib_bc3751dcff9f91451e0e + [0] ./example-app.js 98 bytes {0} [built] + [no exports] + single entry ./example-app main + [1] delegated ../node_modules/example-vendor.js from dll-reference vendor_lib_f3fbcfb4ec389ba5bbf0 42 bytes {0} [built] + [exports: square] + harmony side effect evaluation example-vendor [0] ./example-app.js 1:0-40 + harmony import specifier example-vendor [0] ./example-app.js 3:12-18 + harmony import specifier example-vendor [0] ./example-app.js 4:16-22 + [2] external "vendor_lib_f3fbcfb4ec389ba5bbf0" 42 bytes {0} [built] + delegated source dll-reference vendor_lib_f3fbcfb4ec389ba5bbf0 [1] delegated ../node_modules/example-vendor.js from dll-reference vendor_lib_f3fbcfb4ec389ba5bbf0 ``` ## Production mode ``` Hash: 0a1b2c3d4e5f6a7b8c9d -Version: webpack 4.5.0 +Version: webpack 4.8.0 Asset Size Chunks Chunk Names app.js 736 bytes 0 [emitted] main Entrypoint main = app.js chunk {0} app.js (main) 182 bytes [entry] [rendered] > ./example-app main - [0] delegated ../node_modules/example-vendor.js from dll-reference vendor_lib_bc3751dcff9f91451e0e 42 bytes {0} [built] - [exports: square] - harmony side effect evaluation example-vendor [2] ./example-app.js 1:0-40 - harmony import specifier example-vendor [2] ./example-app.js 3:12-18 - harmony import specifier example-vendor [2] ./example-app.js 4:16-22 - [1] external "vendor_lib_bc3751dcff9f91451e0e" 42 bytes {0} [built] - delegated source dll-reference vendor_lib_bc3751dcff9f91451e0e [0] delegated ../node_modules/example-vendor.js from dll-reference vendor_lib_bc3751dcff9f91451e0e - [2] ./example-app.js 98 bytes {0} [built] - [no exports] - single entry ./example-app main + [0] delegated ../node_modules/example-vendor.js from dll-reference vendor_lib_f3fbcfb4ec389ba5bbf0 42 bytes {0} [built] + [exports: square] + harmony side effect evaluation example-vendor [2] ./example-app.js 1:0-40 + harmony import specifier example-vendor [2] ./example-app.js 3:12-18 + harmony import specifier example-vendor [2] ./example-app.js 4:16-22 + [1] external "vendor_lib_f3fbcfb4ec389ba5bbf0" 42 bytes {0} [built] + delegated source dll-reference vendor_lib_f3fbcfb4ec389ba5bbf0 [0] delegated ../node_modules/example-vendor.js from dll-reference vendor_lib_f3fbcfb4ec389ba5bbf0 + [2] ./example-app.js 98 bytes {0} [built] + [no exports] + single entry ./example-app main ``` " + )} -(circular)-> "${reexport.module.readableIdentifier( + requestShortener + )}".${reexport.exportName}` + ); + } + alreadyVisited.add(reexport); const refInfo = moduleToInfoMap.get(reexport.module); if (refInfo) { // module is in the concatenation @@ -141,7 +163,8 @@ const getFinalName = ( moduleToInfoMap, requestShortener, asCall, - strictHarmonyModule + strictHarmonyModule, + alreadyVisited ); } } @@ -308,7 +331,7 @@ class ConcatenatedModule extends Module { for (const d of m.dependencies.filter( dep => !(dep instanceof HarmonyImportDependency) || - !modulesSet.has(dep.module) + !modulesSet.has(dep._module) )) { this.dependencies.push(d); } @@ -325,13 +348,18 @@ class ConcatenatedModule extends Module { } } // populate warnings - for (const warning of m.warnings) this.warnings.push(warning); + for (const warning of m.warnings) { + this.warnings.push(warning); + } // populate errors - for (const error of m.errors) this.errors.push(error); + for (const error of m.errors) { + this.errors.push(error); + } if (m.buildInfo.assets) { - if (this.buildInfo.assets === undefined) + if (this.buildInfo.assets === undefined) { this.buildInfo.assets = Object.create(null); + } Object.assign(this.buildInfo.assets, m.buildInfo.assets); } } @@ -385,14 +413,26 @@ class ConcatenatedModule extends Module { const list = []; const set = new Set(); + /** + * @param {Module} module a module + * @returns {(function(): Module)[]} imported modules in order + */ const getConcatenatedImports = module => { - return module.dependencies + /** @type {WeakMap} */ + const map = new WeakMap(); + const references = module.dependencies .filter(dep => dep instanceof HarmonyImportDependency) - .sort((a, b) => a.sourceOrder - b.sourceOrder) - .map(dep => () => { + .map(dep => { const ref = dep.getReference(); - return ref && ref.module; - }); + if (ref) map.set(ref, dep); + return ref; + }) + .filter(ref => ref); + DependencyReference.sort(references); + return references.map(ref => { + const dep = map.get(ref); + return () => dep.getReference().module; + }); }; const enterModule = getModule => { @@ -450,16 +490,19 @@ class ConcatenatedModule extends Module { const reexportMap = new Map(); for (const dep of info.module.dependencies) { if (dep instanceof HarmonyExportSpecifierDependency) { - if (!exportMap.has(dep.name)) exportMap.set(dep.name, dep.id); + if (!exportMap.has(dep.name)) { + exportMap.set(dep.name, dep.id); + } } else if (dep instanceof HarmonyExportExpressionDependency) { - if (!exportMap.has("default")) + if (!exportMap.has("default")) { exportMap.set("default", "__WEBPACK_MODULE_DEFAULT_EXPORT__"); + } } else if ( dep instanceof HarmonyExportImportedSpecifierDependency ) { const exportName = dep.name; const importName = dep.id; - const importedModule = dep.module; + const importedModule = dep._module; if (exportName && importName) { if (!reexportMap.has(exportName)) { reexportMap.set(exportName, { @@ -478,8 +521,9 @@ class ConcatenatedModule extends Module { } } else if (importedModule) { for (const name of importedModule.buildMeta.providedExports) { - if (dep.activeExports.has(name) || name === "default") + if (dep.activeExports.has(name) || name === "default") { continue; + } if (!reexportMap.has(name)) { reexportMap.set(name, { module: importedModule, @@ -576,9 +620,12 @@ class ConcatenatedModule extends Module { moduleToInfoMap ) ); + + // Must use full identifier in our cache here to ensure that the source + // is updated should our dependencies list change. innerDependencyTemplates.set( "hash", - innerDependencyTemplates.get("hash") + this.rootModule.identifier() + innerDependencyTemplates.get("hash") + this.identifier() ); // Generate source code and analyse scopes @@ -1056,17 +1103,13 @@ class ConcatenatedModule extends Module { result.add( `var ${ info.interopNamespaceObjectName - } = /*#__PURE__*/Object.assign({ /* fake namespace object */ }, ${ - info.name - }, { "default": ${info.name} });\n` + } = /*#__PURE__*/__webpack_require__.t(${info.name}, 2);\n` ); } else if (!info.module.buildMeta.exportsType) { result.add( `var ${ info.interopNamespaceObjectName - } = /*#__PURE__*/{ /* fake namespace object */ "default": ${ - info.name - } };\n` + } = /*#__PURE__*/__webpack_require__.t(${info.name});\n` ); } } @@ -1142,7 +1185,7 @@ class HarmonyImportSpecifierDependencyConcatenatedTemplate { } getHarmonyInitOrder(dep) { - const module = dep.module; + const module = dep._module; const info = this.modulesMap.get(module); if (!info) { return this.originalTemplate.getHarmonyInitOrder(dep); @@ -1151,7 +1194,7 @@ class HarmonyImportSpecifierDependencyConcatenatedTemplate { } harmonyInit(dep, source, runtimeTemplate, dependencyTemplates) { - const module = dep.module; + const module = dep._module; const info = this.modulesMap.get(module); if (!info) { this.originalTemplate.harmonyInit( @@ -1165,7 +1208,7 @@ class HarmonyImportSpecifierDependencyConcatenatedTemplate { } apply(dep, source, runtime, dependencyTemplates) { - const module = dep.module; + const module = dep._module; const info = this.modulesMap.get(module); if (!info) { this.originalTemplate.apply(dep, source, runtime, dependencyTemplates); @@ -1176,14 +1219,14 @@ class HarmonyImportSpecifierDependencyConcatenatedTemplate { const strictFlag = dep.originModule.buildMeta.strictHarmonyModule ? "_strict" : ""; - if (dep.id === null) { + if (dep._id === null) { content = `__WEBPACK_MODULE_REFERENCE__${info.index}_ns${strictFlag}__`; } else if (dep.namespaceObjectAsContext) { content = `__WEBPACK_MODULE_REFERENCE__${ info.index - }_ns${strictFlag}__[${JSON.stringify(dep.id)}]`; + }_ns${strictFlag}__[${JSON.stringify(dep._id)}]`; } else { - const exportData = Buffer.from(dep.id, "utf-8").toString("hex"); + const exportData = Buffer.from(dep._id, "utf-8").toString("hex"); content = `__WEBPACK_MODULE_REFERENCE__${ info.index }_${exportData}${callFlag}${strictFlag}__`; @@ -1202,7 +1245,7 @@ class HarmonyImportSideEffectDependencyConcatenatedTemplate { } getHarmonyInitOrder(dep) { - const module = dep.module; + const module = dep._module; const info = this.modulesMap.get(module); if (!info) { return this.originalTemplate.getHarmonyInitOrder(dep); @@ -1211,7 +1254,7 @@ class HarmonyImportSideEffectDependencyConcatenatedTemplate { } harmonyInit(dep, source, runtime, dependencyTemplates) { - const module = dep.module; + const module = dep._module; const info = this.modulesMap.get(module); if (!info) { this.originalTemplate.harmonyInit( @@ -1225,7 +1268,7 @@ class HarmonyImportSideEffectDependencyConcatenatedTemplate { } apply(dep, source, runtime, dependencyTemplates) { - const module = dep.module; + const module = dep._module; const info = this.modulesMap.get(module); if (!info) { this.originalTemplate.apply(dep, source, runtime, dependencyTemplates); @@ -1299,7 +1342,7 @@ class HarmonyExportImportedSpecifierDependencyConcatenatedTemplate { } getExports(dep) { - const importModule = dep.module; + const importModule = dep._module; if (dep.id) { // export { named } from "module" return [ @@ -1333,7 +1376,7 @@ class HarmonyExportImportedSpecifierDependencyConcatenatedTemplate { } getHarmonyInitOrder(dep) { - const module = dep.module; + const module = dep._module; const info = this.modulesMap.get(module); if (!info) { return this.originalTemplate.getHarmonyInitOrder(dep); @@ -1342,7 +1385,7 @@ class HarmonyExportImportedSpecifierDependencyConcatenatedTemplate { } harmonyInit(dep, source, runtime, dependencyTemplates) { - const module = dep.module; + const module = dep._module; const info = this.modulesMap.get(module); if (!info) { this.originalTemplate.harmonyInit( @@ -1357,7 +1400,7 @@ class HarmonyExportImportedSpecifierDependencyConcatenatedTemplate { apply(dep, source, runtime, dependencyTemplates) { if (dep.originModule === this.rootModule) { - if (this.modulesMap.get(dep.module)) { + if (this.modulesMap.get(dep._module)) { const exportDefs = this.getExports(dep); for (const def of exportDefs) { const info = this.modulesMap.get(def.module); diff --git a/lib/optimize/FlagIncludedChunksPlugin.js b/lib/optimize/FlagIncludedChunksPlugin.js index a9a1e13dc2f..1890f0581eb 100644 --- a/lib/optimize/FlagIncludedChunksPlugin.js +++ b/lib/optimize/FlagIncludedChunksPlugin.js @@ -10,24 +10,85 @@ class FlagIncludedChunksPlugin { compilation.hooks.optimizeChunkIds.tap( "FlagIncludedChunksPlugin", chunks => { + // prepare two bit integers for each module + // 2^31 is the max number represented as SMI in v8 + // we want the bits distributed this way: + // the bit 2^31 is pretty rar and only one module should get it + // so it has a probability of 1 / modulesCount + // the first bit (2^0) is the easiest and every module could get it + // if it doesn't get a better bit + // from bit 2^n to 2^(n+1) there is a probability of p + // so 1 / modulesCount == p^31 + // <=> p = sqrt31(1 / modulesCount) + // so we use a modulo of 1 / sqrt31(1 / modulesCount) + const moduleBits = new WeakMap(); + const modulesCount = compilation.modules.length; + + // precalculate the modulo values for each bit + const modulo = 1 / Math.pow(1 / modulesCount, 1 / 31); + const modulos = Array.from( + { length: 31 }, + (x, i) => Math.pow(modulo, i) | 0 + ); + + // iterate all modules to generate bit values + let i = 0; + for (const module of compilation.modules) { + let bit = 30; + while (i % modulos[bit] !== 0) { + bit--; + } + moduleBits.set(module, 1 << bit); + i++; + } + + // interate all chunks to generate bitmaps + const chunkModulesHash = new WeakMap(); + for (const chunk of chunks) { + let hash = 0; + for (const module of chunk.modulesIterable) { + hash |= moduleBits.get(module); + } + chunkModulesHash.set(chunk, hash); + } + for (const chunkA of chunks) { - loopB: for (const chunkB of chunks) { + const chunkAHash = chunkModulesHash.get(chunkA); + const chunkAModulesCount = chunkA.getNumberOfModules(); + if (chunkAModulesCount === 0) continue; + let bestModule = undefined; + for (const module of chunkA.modulesIterable) { + if ( + bestModule === undefined || + bestModule.getNumberOfChunks() > module.getNumberOfChunks() + ) + bestModule = module; + } + loopB: for (const chunkB of bestModule.chunksIterable) { // as we iterate the same iterables twice // skip if we find ourselves - if (chunkA === chunkB) continue loopB; + if (chunkA === chunkB) continue; + + const chunkBModulesCount = chunkB.getNumberOfModules(); + + // ids for empty chunks are not included + if (chunkBModulesCount === 0) continue; // instead of swapping A and B just bail // as we loop twice the current A will be B and B then A - if (chunkA.getNumberOfModules() < chunkB.getNumberOfModules()) - continue loopB; + if (chunkAModulesCount > chunkBModulesCount) continue; + + // is chunkA in chunkB? - if (chunkB.getNumberOfModules() === 0) continue loopB; + // we do a cheap check for the hash value + const chunkBHash = chunkModulesHash.get(chunkB); + if ((chunkBHash & chunkAHash) !== chunkAHash) continue; - // is chunkB in chunkA? - for (const m of chunkB.modulesIterable) { - if (!chunkA.containsModule(m)) continue loopB; + // compare all modules + for (const m of chunkA.modulesIterable) { + if (!chunkB.containsModule(m)) continue loopB; } - chunkA.ids.push(chunkB.id); + chunkB.ids.push(chunkA.id); } } } diff --git a/lib/optimize/MergeDuplicateChunksPlugin.js b/lib/optimize/MergeDuplicateChunksPlugin.js index cc888923c4a..1c3e23aa3e9 100644 --- a/lib/optimize/MergeDuplicateChunksPlugin.js +++ b/lib/optimize/MergeDuplicateChunksPlugin.js @@ -31,8 +31,9 @@ class MergeDuplicateChunksPlugin { !notDuplicates.has(dup) ) { // delay allocating the new Set until here, reduce memory pressure - if (possibleDuplicates === undefined) + if (possibleDuplicates === undefined) { possibleDuplicates = new Set(); + } possibleDuplicates.add(dup); } } @@ -42,8 +43,9 @@ class MergeDuplicateChunksPlugin { // validate existing possible duplicates for (const dup of possibleDuplicates) { // remove possible duplicate when module is not contained - if (!dup.containsModule(module)) + if (!dup.containsModule(module)) { possibleDuplicates.delete(dup); + } } // when all chunks has been removed we can break here if (possibleDuplicates.size === 0) break; @@ -58,8 +60,9 @@ class MergeDuplicateChunksPlugin { for (const otherChunk of possibleDuplicates) { if (otherChunk.hasRuntime() !== chunk.hasRuntime()) continue; // merge them - if (chunk.integrate(otherChunk, "duplicate")) + if (chunk.integrate(otherChunk, "duplicate")) { chunks.splice(chunks.indexOf(otherChunk), 1); + } } } diff --git a/lib/optimize/ModuleConcatenationPlugin.js b/lib/optimize/ModuleConcatenationPlugin.js index 64459451eea..24710016f95 100644 --- a/lib/optimize/ModuleConcatenationPlugin.js +++ b/lib/optimize/ModuleConcatenationPlugin.js @@ -172,19 +172,21 @@ class ModuleConcatenationPlugin { ) .sort(); const explanations = Array.from(importingExplanations).sort(); - if (names.length > 0 && explanations.length === 0) + if (names.length > 0 && explanations.length === 0) { return `Module is referenced from these modules with unsupported syntax: ${names.join( ", " )}`; - else if (names.length === 0 && explanations.length > 0) + } else if (names.length === 0 && explanations.length > 0) { return `Module is referenced by: ${explanations.join( ", " )}`; - else if (names.length > 0 && explanations.length > 0) + } else if (names.length > 0 && explanations.length > 0) { return `Module is referenced from these modules with unsupported syntax: ${names.join( ", " )} and by: ${explanations.join(", ")}`; - else return "Module is referenced in a unsupported way"; + } else { + return "Module is referenced in a unsupported way"; + } }); continue; } @@ -226,8 +228,9 @@ class ModuleConcatenationPlugin { if (!currentConfiguration.isEmpty()) { concatConfigurations.push(currentConfiguration); for (const module of currentConfiguration.getModules()) { - if (module !== currentConfiguration.rootModule) + if (module !== currentConfiguration.rootModule) { usedAsInner.add(module); + } } } } @@ -250,13 +253,13 @@ class ModuleConcatenationPlugin { newModule.optimizationBailout.push(requestShortener => { const reason = getBailoutReason(warning[0], requestShortener); const reasonWithPrefix = reason ? ` (<- ${reason})` : ""; - if (warning[0] === warning[1]) + if (warning[0] === warning[1]) { return formatBailoutReason( `Cannot concat with ${warning[0].readableIdentifier( requestShortener )}${reasonWithPrefix}` ); - else + } else { return formatBailoutReason( `Cannot concat with ${warning[0].readableIdentifier( requestShortener @@ -264,6 +267,7 @@ class ModuleConcatenationPlugin { requestShortener )}${reasonWithPrefix}` ); + } }); } const chunks = concatConfiguration.rootModule.getChunks(); @@ -276,12 +280,19 @@ class ModuleConcatenationPlugin { for (const chunk of chunks) { chunk.addModule(newModule); newModule.addChunk(chunk); - if (chunk.entryModule === concatConfiguration.rootModule) + if (chunk.entryModule === concatConfiguration.rootModule) { chunk.entryModule = newModule; + } } compilation.modules.push(newModule); for (const reason of newModule.reasons) { - reason.dependency.module = newModule; + if (reason.dependency.module === concatConfiguration.rootModule) + reason.dependency.module = newModule; + if ( + reason.dependency.redirectedModule === + concatConfiguration.rootModule + ) + reason.dependency.redirectedModule = newModule; } // TODO: remove when LTS node version contains fixed v8 version // @see https://github.com/webpack/webpack/pull/6613 @@ -293,7 +304,9 @@ class ModuleConcatenationPlugin { let reasons = dep.module.reasons; for (let j = 0; j < reasons.length; j++) { let reason = reasons[j]; - if (reason.dependency === dep) reason.module = newModule; + if (reason.dependency === dep) { + reason.module = newModule; + } } } } @@ -308,29 +321,27 @@ class ModuleConcatenationPlugin { } getImports(module) { - return Array.from( - new Set( - module.dependencies - - // Only harmony Dependencies - .filter(dep => dep instanceof HarmonyImportDependency && dep.module) - - // Get reference info for this dependency - .map(dep => dep.getReference()) - - // Reference is valid and has a module - .filter(ref => ref && ref.module) - - // Dependencies are simple enough to concat them - .filter( - ref => - Array.isArray(ref.importedNames) || - Array.isArray(ref.module.buildMeta.providedExports) - ) - - // Take the imported module - .map(ref => ref.module) - ) + return new Set( + module.dependencies + + // Get reference info only for harmony Dependencies + .map( + dep => + dep instanceof HarmonyImportDependency ? dep.getReference() : null + ) + + // Reference is valid and has a module + // Dependencies are simple enough to concat them + .filter( + ref => + ref && + ref.module && + (Array.isArray(ref.importedNames) || + Array.isArray(ref.module.buildMeta.providedExports)) + ) + + // Take the imported module + .map(ref => ref.module) ); } diff --git a/lib/optimize/OccurrenceOrderPlugin.js b/lib/optimize/OccurrenceOrderPlugin.js index 613e403b6d7..8e23f951473 100644 --- a/lib/optimize/OccurrenceOrderPlugin.js +++ b/lib/optimize/OccurrenceOrderPlugin.js @@ -36,15 +36,22 @@ class OccurrenceOrderPlugin { } const countOccursInEntry = (sum, r) => { - if (!r.module) return sum; + if (!r.module) { + return sum; + } return sum + initialChunkChunkMap.get(r.module); }; const countOccurs = (sum, r) => { - if (!r.module) return sum; + if (!r.module) { + return sum; + } let factor = 1; - if (typeof r.dependency.getNumberOfIdOccurrences === "function") + if (typeof r.dependency.getNumberOfIdOccurrences === "function") { factor = r.dependency.getNumberOfIdOccurrences(); - if (factor === 0) return sum; + } + if (factor === 0) { + return sum; + } return sum + factor * r.module.getNumberOfChunks(); }; diff --git a/lib/optimize/RemoveEmptyChunksPlugin.js b/lib/optimize/RemoveEmptyChunksPlugin.js index 6a77e5278ca..42ba24a1574 100644 --- a/lib/optimize/RemoveEmptyChunksPlugin.js +++ b/lib/optimize/RemoveEmptyChunksPlugin.js @@ -8,24 +8,34 @@ class RemoveEmptyChunksPlugin { apply(compiler) { compiler.hooks.compilation.tap("RemoveEmptyChunksPlugin", compilation => { const handler = chunks => { - chunks - .filter( - chunk => - chunk.isEmpty() && !chunk.hasRuntime() && !chunk.hasEntryModule() - ) - .forEach(chunk => { + for (let i = chunks.length - 1; i >= 0; i--) { + const chunk = chunks[i]; + if ( + chunk.isEmpty() && + !chunk.hasRuntime() && + !chunk.hasEntryModule() + ) { chunk.remove("empty"); - chunks.splice(chunks.indexOf(chunk), 1); - }); + chunks.splice(i, 1); + } + } }; compilation.hooks.optimizeChunksBasic.tap( "RemoveEmptyChunksPlugin", handler ); + compilation.hooks.optimizeChunksAdvanced.tap( + "RemoveEmptyChunksPlugin", + handler + ); compilation.hooks.optimizeExtractedChunksBasic.tap( "RemoveEmptyChunksPlugin", handler ); + compilation.hooks.optimizeExtractedChunksAdvanced.tap( + "RemoveEmptyChunksPlugin", + handler + ); }); } } diff --git a/lib/optimize/RemoveParentModulesPlugin.js b/lib/optimize/RemoveParentModulesPlugin.js index 91cd43cffe7..7fff59207b8 100644 --- a/lib/optimize/RemoveParentModulesPlugin.js +++ b/lib/optimize/RemoveParentModulesPlugin.js @@ -29,12 +29,14 @@ class RemoveParentModulesPlugin { compiler.hooks.compilation.tap("RemoveParentModulesPlugin", compilation => { const handler = (chunks, chunkGroups) => { const queue = new Queue(); - const availableModulesMap = new Map(); + const availableModulesMap = new WeakMap(); for (const chunkGroup of compilation.entrypoints.values()) { // initialize available modules for chunks without parents availableModulesMap.set(chunkGroup, new Set()); - for (const child of chunkGroup.childrenIterable) queue.enqueue(child); + for (const child of chunkGroup.childrenIterable) { + queue.enqueue(child); + } } while (queue.length > 0) { @@ -49,8 +51,9 @@ class RemoveParentModulesPlugin { // if we have not own info yet: create new entry availableModules = new Set(availableModulesInParent); for (const chunk of parent.chunks) { - for (const m of chunk.modulesIterable) + for (const m of chunk.modulesIterable) { availableModules.add(m); + } } availableModulesMap.set(chunkGroup, availableModules); changed = true; @@ -69,8 +72,9 @@ class RemoveParentModulesPlugin { } if (changed) { // if something changed: enqueue our children - for (const child of chunkGroup.childrenIterable) + for (const child of chunkGroup.childrenIterable) { queue.enqueue(child); + } } } @@ -81,15 +85,24 @@ class RemoveParentModulesPlugin { chunkGroup => availableModulesMap.get(chunkGroup) ); if (availableModulesSets.some(s => s === undefined)) continue; // No info about this chunk group - const availableModules = intersect(availableModulesSets); + const availableModules = + availableModulesSets.length === 1 + ? availableModulesSets[0] + : intersect(availableModulesSets); const numberOfModules = chunk.getNumberOfModules(); const toRemove = new Set(); if (numberOfModules < availableModules.size) { - for (const m of chunk.modulesIterable) - if (availableModules.has(m)) toRemove.add(m); + for (const m of chunk.modulesIterable) { + if (availableModules.has(m)) { + toRemove.add(m); + } + } } else { - for (const m of availableModules) - if (chunk.containsModule(m)) toRemove.add(m); + for (const m of availableModules) { + if (chunk.containsModule(m)) { + toRemove.add(m); + } + } } for (const module of toRemove) { module.rewriteChunkInReasons( diff --git a/lib/optimize/RuntimeChunkPlugin.js b/lib/optimize/RuntimeChunkPlugin.js index 9d503a67e5e..1325dfc7868 100644 --- a/lib/optimize/RuntimeChunkPlugin.js +++ b/lib/optimize/RuntimeChunkPlugin.js @@ -19,12 +19,17 @@ module.exports = class RuntimeChunkPlugin { compilation.hooks.optimizeChunksAdvanced.tap("RuntimeChunkPlugin", () => { for (const entrypoint of compilation.entrypoints.values()) { const chunk = entrypoint.getRuntimeChunk(); - if (chunk.getNumberOfModules() > 0) { - let name = this.options.name; - if (typeof name === "function") { - name = name(entrypoint); - } + let name = this.options.name; + if (typeof name === "function") { + name = name(entrypoint); + } + if ( + chunk.getNumberOfModules() > 0 || + !chunk.preventIntegration || + chunk.name !== name + ) { const newChunk = compilation.addChunk(name); + newChunk.preventIntegration = true; entrypoint.unshiftChunk(newChunk); newChunk.addGroup(entrypoint); entrypoint.setRuntimeChunk(newChunk); diff --git a/lib/optimize/SideEffectsFlagPlugin.js b/lib/optimize/SideEffectsFlagPlugin.js index e503262a6ea..4b618c2990b 100644 --- a/lib/optimize/SideEffectsFlagPlugin.js +++ b/lib/optimize/SideEffectsFlagPlugin.js @@ -9,6 +9,15 @@ const HarmonyExportImportedSpecifierDependency = require("../dependencies/Harmon const HarmonyImportSideEffectDependency = require("../dependencies/HarmonyImportSideEffectDependency"); const HarmonyImportSpecifierDependency = require("../dependencies/HarmonyImportSpecifierDependency"); +/** @typedef {import("../Module")} Module */ +/** @typedef {import("../Dependency")} Dependency */ + +/** + * @typedef {Object} ExportInModule + * @property {Module} module the module + * @property {string} exportName the name of the export + */ + class SideEffectsFlagPlugin { apply(compiler) { compiler.hooks.normalModuleFactory.tap("SideEffectsFlagPlugin", nmf => { @@ -32,20 +41,23 @@ class SideEffectsFlagPlugin { return module; }); nmf.hooks.module.tap("SideEffectsFlagPlugin", (module, data) => { - if (data.settings.sideEffects === false) + if (data.settings.sideEffects === false) { module.factoryMeta.sideEffectFree = true; - else if (data.settings.sideEffects === true) + } else if (data.settings.sideEffects === true) { module.factoryMeta.sideEffectFree = false; + } }); }); compiler.hooks.compilation.tap("SideEffectsFlagPlugin", compilation => { compilation.hooks.optimizeDependencies.tap( "SideEffectsFlagPlugin", modules => { + /** @type {Map>} */ const reexportMaps = new Map(); // Capture reexports of sideEffectFree modules for (const module of modules) { + /** @type {Dependency[]} */ const removeDependencies = []; for (const dep of module.dependencies) { if (dep instanceof HarmonyImportSideEffectDependency) { @@ -72,12 +84,6 @@ class SideEffectsFlagPlugin { } } } - for (const dep of removeDependencies) { - module.removeDependency(dep); - dep.module.reasons = dep.module.reasons.filter( - r => r.dependency !== dep - ); - } } // Flatten reexports @@ -97,36 +103,42 @@ class SideEffectsFlagPlugin { } // Update imports along the reexports from sideEffectFree modules - const updates = []; for (const pair of reexportMaps) { const module = pair[0]; const map = pair[1]; - for (const reason of module.reasons) { + let newReasons = undefined; + for (let i = 0; i < module.reasons.length; i++) { + const reason = module.reasons[i]; const dep = reason.dependency; - if (dep instanceof HarmonyImportSpecifierDependency) { + if ( + dep instanceof HarmonyImportSpecifierDependency && + !dep.namespaceObjectAsContext + ) { const mapping = map.get(dep.id); if (mapping) { - updates.push({ + dep.redirectedModule = mapping.module; + dep.redirectedId = mapping.exportName; + mapping.module.addReason( + reason.module, dep, - mapping, - module, - reason - }); + reason.explanation + ? reason.explanation + + " (skipped side-effect-free modules)" + : "(skipped side-effect-free modules)" + ); + // removing the currect reason, by not adding it to the newReasons array + // lazily create the newReasons array + if (newReasons === undefined) { + newReasons = i === 0 ? [] : module.reasons.slice(0, i); + } + continue; } } + if (newReasons !== undefined) newReasons.push(reason); + } + if (newReasons !== undefined) { + module.reasons = newReasons; } - } - - // Execute updates - for (const update of updates) { - const dep = update.dep; - const mapping = update.mapping; - const module = update.module; - const reason = update.reason; - dep.module = mapping.module; - dep.id = mapping.exportName; - module.removeReason(reason.module, dep); - mapping.module.addReason(reason.module, dep); } } ); diff --git a/lib/optimize/SplitChunksPlugin.js b/lib/optimize/SplitChunksPlugin.js index 6caa3192721..c49c5b1761e 100644 --- a/lib/optimize/SplitChunksPlugin.js +++ b/lib/optimize/SplitChunksPlugin.js @@ -9,6 +9,9 @@ const SortableSet = require("../util/SortableSet"); const GraphHelpers = require("../GraphHelpers"); const { isSubset } = require("../util/SetHelpers"); +/** @typedef {import("../Chunk")} Chunk */ +/** @typedef {import("../Module")} Module */ + const hashFilename = name => { return crypto .createHash("md4") @@ -33,12 +36,20 @@ const getRequests = chunk => { const getModulesSize = modules => { let sum = 0; - for (const m of modules) sum += m.size(); + for (const m of modules) { + sum += m.size(); + } return sum; }; +/** + * @template T + * @param {Set} a set + * @param {Set} b other set + * @returns {boolean} true if at least one item of a is in b + */ const isOverlap = (a, b) => { - for (const item of a.keys()) { + for (const item of a) { if (b.has(item)) return true; } return false; @@ -78,6 +89,10 @@ const compareEntries = (a, b) => { } }; +const INITIAL_CHUNK_FILTER = chunk => chunk.canBeInitial(); +const ASYNC_CHUNK_FILTER = chunk => !chunk.canBeInitial(); +const ALL_CHUNK_FILTER = chunk => true; + module.exports = class SplitChunksPlugin { constructor(options) { this.options = SplitChunksPlugin.normalizeOptions(options); @@ -107,9 +122,20 @@ module.exports = class SplitChunksPlugin { static normalizeName({ name, automaticNameDelimiter }) { if (name === true) { + const cache = new Map(); const fn = (module, chunks, cacheGroup) => { + let cacheEntry = cache.get(chunks); + if (cacheEntry === undefined) { + cacheEntry = {}; + cache.set(chunks, cacheEntry); + } else if (cacheGroup in cacheEntry) { + return cacheEntry[cacheGroup]; + } const names = chunks.map(c => c.name); - if (!names.every(Boolean)) return; + if (!names.every(Boolean)) { + cacheEntry[cacheGroup] = undefined; + return; + } names.sort(); let name = (cacheGroup && cacheGroup !== "default" @@ -124,6 +150,7 @@ module.exports = class SplitChunksPlugin { name = name.slice(0, 100) + automaticNameDelimiter + hashFilename(name); } + cacheEntry[cacheGroup] = name; return name; }; return fn; @@ -139,23 +166,27 @@ module.exports = class SplitChunksPlugin { static normalizeChunksFilter(chunks) { if (chunks === "initial") { - return chunk => chunk.canBeInitial(); + return INITIAL_CHUNK_FILTER; } if (chunks === "async") { - return chunk => !chunk.canBeInitial(); + return ASYNC_CHUNK_FILTER; } if (chunks === "all") { - return () => true; + return ALL_CHUNK_FILTER; } if (typeof chunks === "function") return chunks; } static normalizeCacheGroups({ cacheGroups, automaticNameDelimiter }) { if (typeof cacheGroups === "function") { + // TODO webpack 5 remove this + if (cacheGroups.length !== 1) { + return module => cacheGroups(module, module.getChunks()); + } return cacheGroups; } if (cacheGroups && typeof cacheGroups === "object") { - const fn = (module, chunks) => { + const fn = module => { let results; for (const key of Object.keys(cacheGroups)) { let option = cacheGroups[key]; @@ -170,12 +201,7 @@ module.exports = class SplitChunksPlugin { if (result) { if (results === undefined) results = []; for (const r of Array.isArray(result) ? result : [result]) { - const result = Object.assign( - { - key - }, - r - ); + const result = Object.assign({ key }, r); if (result.name) result.getName = () => result.name; if (result.chunks) { result.chunksFilter = SplitChunksPlugin.normalizeChunksFilter( @@ -185,7 +211,7 @@ module.exports = class SplitChunksPlugin { results.push(result); } } - } else if (SplitChunksPlugin.checkTest(option.test, module, chunks)) { + } else if (SplitChunksPlugin.checkTest(option.test, module)) { if (results === undefined) results = []; results.push({ key: key, @@ -215,20 +241,38 @@ module.exports = class SplitChunksPlugin { return fn; } - static checkTest(test, module, chunks) { + static checkTest(test, module) { if (test === undefined) return true; - if (typeof test === "function") return test(module, chunks); + if (typeof test === "function") { + if (test.length !== 1) { + return test(module, module.getChunks()); + } + return test(module); + } if (typeof test === "boolean") return test; - const names = chunks - .map(c => c.name) - .concat(module.nameForCondition ? [module.nameForCondition()] : []) - .filter(Boolean); if (typeof test === "string") { - for (const name of names) if (name.startsWith(test)) return true; + if ( + module.nameForCondition && + module.nameForCondition().startsWith(test) + ) { + return true; + } + for (const chunk of module.chunksIterable) { + if (chunk.name && chunk.name.startsWith(test)) { + return true; + } + } return false; } if (test instanceof RegExp) { - for (const name of names) if (test.test(name)) return true; + if (module.nameForCondition && test.test(module.nameForCondition())) { + return true; + } + for (const chunk of module.chunksIterable) { + if (chunk.name && test.test(chunk.name)) { + return true; + } + } return false; } return false; @@ -256,32 +300,180 @@ module.exports = class SplitChunksPlugin { .sort() .join(); }; - // Create a list of possible combinations - const chunkSetsInGraph = new Map(); // Map> + /** @type {Map>} */ + const chunkSetsInGraph = new Map(); for (const module of compilation.modules) { - const chunkIndices = getKey(module.chunksIterable); - chunkSetsInGraph.set(chunkIndices, new Set(module.chunksIterable)); + const chunksKey = getKey(module.chunksIterable); + if (!chunkSetsInGraph.has(chunksKey)) { + chunkSetsInGraph.set(chunksKey, new Set(module.chunksIterable)); + } } - const combinations = new Map(); // Map[]> - for (const [key, chunksSet] of chunkSetsInGraph) { - var array = []; - for (const set of chunkSetsInGraph.values()) { - if (isSubset(chunksSet, set)) { - array.push(set); - } + + // group these set of chunks by count + // to allow to check less sets via isSubset + // (only smaller sets can be subset) + /** @type {Map>>} */ + const chunkSetsByCount = new Map(); + for (const chunksSet of chunkSetsInGraph.values()) { + const count = chunksSet.size; + let array = chunkSetsByCount.get(count); + if (array === undefined) { + array = []; + chunkSetsByCount.set(count, array); } - combinations.set(key, array); + array.push(chunksSet); } + + // Create a list of possible combinations + const combinationsCache = new Map(); // Map[]> + + const getCombinations = key => { + const chunksSet = chunkSetsInGraph.get(key); + var array = [chunksSet]; + if (chunksSet.size > 1) { + for (const [count, setArray] of chunkSetsByCount) { + // "equal" is not needed because they would have been merge in the first step + if (count < chunksSet.size) { + for (const set of setArray) { + if (isSubset(chunksSet, set)) { + array.push(set); + } + } + } + } + } + return array; + }; + + /** + * @typedef {Object} SelectedChunksResult + * @property {Chunk[]} chunks the list of chunks + * @property {string} key a key of the list + */ + + /** + * @typedef {function(Chunk): boolean} ChunkFilterFunction + */ + + /** @type {WeakMap, WeakMap>} */ + const selectedChunksCacheByChunksSet = new WeakMap(); + + /** + * get list and key by applying the filter function to the list + * It is cached for performance reasons + * @param {Set} chunks list of chunks + * @param {ChunkFilterFunction} chunkFilter filter function for chunks + * @returns {SelectedChunksResult} list and key + */ + const getSelectedChunks = (chunks, chunkFilter) => { + let entry = selectedChunksCacheByChunksSet.get(chunks); + if (entry === undefined) { + entry = new WeakMap(); + selectedChunksCacheByChunksSet.set(chunks, entry); + } + /** @type {SelectedChunksResult} */ + let entry2 = entry.get(chunkFilter); + if (entry2 === undefined) { + /** @type {Chunk[]} */ + const selectedChunks = []; + for (const chunk of chunks) { + if (chunkFilter(chunk)) selectedChunks.push(chunk); + } + entry2 = { + chunks: selectedChunks, + key: getKey(selectedChunks) + }; + entry.set(chunkFilter, entry2); + } + return entry2; + }; + + /** + * @typedef {Object} ChunksInfoItem + * @property {SortableSet} modules + * @property {TODO} cacheGroup + * @property {string} name + * @property {number} size + * @property {Set} chunks + * @property {Set} reuseableChunks + * @property {Set} chunksKeys + */ + // Map a list of chunks to a list of modules // For the key the chunk "index" is used, the value is a SortableSet of modules + /** @type {Map} */ const chunksInfoMap = new Map(); + + /** + * @param {TODO} cacheGroup the current cache group + * @param {Chunk[]} selectedChunks chunks selected for this module + * @param {string} selectedChunksKey a key of selectedChunks + * @param {Module} module the current module + * @returns {void} + */ + const addModuleToChunksInfoMap = ( + cacheGroup, + selectedChunks, + selectedChunksKey, + module + ) => { + // Break if minimum number of chunks is not reached + if (selectedChunks.length < cacheGroup.minChunks) return; + // Determine name for split chunk + const name = cacheGroup.getName( + module, + selectedChunks, + cacheGroup.key + ); + // Create key for maps + // When it has a name we use the name as key + // Elsewise we create the key from chunks and cache group key + // This automatically merges equal names + const key = + (name && `name:${name}`) || + `chunks:${selectedChunksKey} key:${cacheGroup.key}`; + // Add module to maps + let info = chunksInfoMap.get(key); + if (info === undefined) { + chunksInfoMap.set( + key, + (info = { + modules: new SortableSet(undefined, sortByIdentifier), + cacheGroup, + name, + size: 0, + chunks: new Set(), + reuseableChunks: new Set(), + chunksKeys: new Set() + }) + ); + } + info.modules.add(module); + info.size += module.size(); + if (!info.chunksKeys.has(selectedChunksKey)) { + info.chunksKeys.add(selectedChunksKey); + for (const chunk of selectedChunks) { + info.chunks.add(chunk); + } + } + }; + // Walk through all modules for (const module of compilation.modules) { - // Get array of chunks - const chunks = module.getChunks(); // Get cache group - let cacheGroups = this.options.getCacheGroups(module, chunks); - if (!Array.isArray(cacheGroups)) continue; + let cacheGroups = this.options.getCacheGroups(module); + if (!Array.isArray(cacheGroups) || cacheGroups.length === 0) { + continue; + } + + // Prepare some values + const chunksKey = getKey(module.chunksIterable); + let combs = combinationsCache.get(chunksKey); + if (combs === undefined) { + combs = getCombinations(chunksKey); + combinationsCache.set(chunksKey, combs); + } + for (const cacheGroupSource of cacheGroups) { const cacheGroup = { key: cacheGroupSource.key, @@ -291,11 +483,15 @@ module.exports = class SplitChunksPlugin { minSize: cacheGroupSource.minSize !== undefined ? cacheGroupSource.minSize - : cacheGroupSource.enforce ? 0 : this.options.minSize, + : cacheGroupSource.enforce + ? 0 + : this.options.minSize, minChunks: cacheGroupSource.minChunks !== undefined ? cacheGroupSource.minChunks - : cacheGroupSource.enforce ? 1 : this.options.minChunks, + : cacheGroupSource.enforce + ? 1 + : this.options.minChunks, maxAsyncRequests: cacheGroupSource.maxAsyncRequests !== undefined ? cacheGroupSource.maxAsyncRequests @@ -319,66 +515,28 @@ module.exports = class SplitChunksPlugin { reuseExistingChunk: cacheGroupSource.reuseExistingChunk }; // For all combination of chunk selection - for (const chunkCombination of combinations.get(getKey(chunks))) { - // Get indices of chunks in which this module occurs - const chunkIndices = Array.from(chunkCombination, chunk => - indexMap.get(chunk) - ); + for (const chunkCombination of combs) { // Break if minimum number of chunks is not reached - if (chunkIndices.length < cacheGroup.minChunks) continue; + if (chunkCombination.size < cacheGroup.minChunks) continue; // Select chunks by configuration - const selectedChunks = Array.from(chunkCombination).filter( + const { + chunks: selectedChunks, + key: selectedChunksKey + } = getSelectedChunks( + chunkCombination, cacheGroup.chunksFilter ); - // Break if minimum number of chunks is not reached - if (selectedChunks.length < cacheGroup.minChunks) continue; - // Determine name for split chunk - const name = cacheGroup.getName( - module, + + addModuleToChunksInfoMap( + cacheGroup, selectedChunks, - cacheGroup.key + selectedChunksKey, + module ); - // Create key for maps - // When it has a name we use the name as key - // Elsewise we create the key from chunks and cache group key - // This automatically merges equal names - const chunksKey = getKey(selectedChunks); - const key = - (name && `name:${name}`) || - `chunks:${chunksKey} key:${cacheGroup.key}`; - // Add module to maps - let info = chunksInfoMap.get(key); - if (info === undefined) { - chunksInfoMap.set( - key, - (info = { - modules: new SortableSet(undefined, sortByIdentifier), - cacheGroup, - name, - chunks: new Map(), - reusedableChunks: new Set(), - chunksKeys: new Set() - }) - ); - } - info.modules.add(module); - if (!info.chunksKeys.has(chunksKey)) { - info.chunksKeys.add(chunksKey); - for (const chunk of selectedChunks) { - info.chunks.set(chunk, chunk.getNumberOfModules()); - } - } } } } - for (const [key, info] of chunksInfoMap) { - // Get size of module lists - info.size = getModulesSize(info.modules); - if (info.size < info.cacheGroup.minSize) { - chunksInfoMap.delete(key); - } - } - let changed = false; + while (chunksInfoMap.size > 0) { // Find best matching entry let bestEntryKey; @@ -386,15 +544,20 @@ module.exports = class SplitChunksPlugin { for (const pair of chunksInfoMap) { const key = pair[0]; const info = pair[1]; - if (bestEntry === undefined) { - bestEntry = info; - bestEntryKey = key; - } else if (compareEntries(bestEntry, info) < 0) { - bestEntry = info; - bestEntryKey = key; + if (info.size >= info.cacheGroup.minSize) { + if (bestEntry === undefined) { + bestEntry = info; + bestEntryKey = key; + } else if (compareEntries(bestEntry, info) < 0) { + bestEntry = info; + bestEntryKey = key; + } } } + // No suitable item left + if (bestEntry === undefined) break; + const item = bestEntry; chunksInfoMap.delete(bestEntryKey); @@ -404,31 +567,43 @@ module.exports = class SplitChunksPlugin { // When no chunk name, check if we can reuse a chunk instead of creating a new one let isReused = false; if (item.cacheGroup.reuseExistingChunk) { - for (const pair of item.chunks) { - if (pair[1] === item.modules.size) { - const chunk = pair[0]; - if (chunk.hasEntryModule()) continue; - if (!newChunk || !newChunk.name) newChunk = chunk; - else if ( - chunk.name && - chunk.name.length < newChunk.name.length - ) - newChunk = chunk; - else if ( - chunk.name && - chunk.name.length === newChunk.name.length && - chunk.name < newChunk.name - ) - newChunk = chunk; - chunkName = undefined; - isReused = true; + outer: for (const chunk of item.chunks) { + if (chunk.getNumberOfModules() !== item.modules.size) continue; + if (chunk.hasEntryModule()) continue; + for (const module of item.modules) { + if (!chunk.containsModule(module)) continue outer; } + if (!newChunk || !newChunk.name) { + newChunk = chunk; + } else if ( + chunk.name && + chunk.name.length < newChunk.name.length + ) { + newChunk = chunk; + } else if ( + chunk.name && + chunk.name.length === newChunk.name.length && + chunk.name < newChunk.name + ) { + newChunk = chunk; + } + chunkName = undefined; + isReused = true; } } - // Walk through all chunks - for (const chunk of item.chunks.keys()) { + // Check if maxRequests condition can be fullfilled + + const usedChunks = Array.from(item.chunks).filter(chunk => { // skip if we address ourself - if (chunk.name === chunkName || chunk === newChunk) continue; + return ( + (!chunkName || chunk.name !== chunkName) && chunk !== newChunk + ); + }); + + // Skip when no chunk selected + if (usedChunks.length === 0) continue; + + const chunkInLimit = usedChunks.filter(chunk => { // respect max requests when not enforced const maxRequests = chunk.isOnlyInitial() ? item.cacheGroup.maxInitialRequests @@ -438,80 +613,102 @@ module.exports = class SplitChunksPlugin { item.cacheGroup.maxAsyncRequests ) : item.cacheGroup.maxAsyncRequests; - if (isFinite(maxRequests) && getRequests(chunk) >= maxRequests) - continue; - if (newChunk === undefined) { - // Create the new chunk - newChunk = compilation.addChunk(chunkName); + return !isFinite(maxRequests) || getRequests(chunk) < maxRequests; + }); + + if (chunkInLimit.length < usedChunks.length) { + for (const module of item.modules) { + addModuleToChunksInfoMap( + item.cacheGroup, + chunkInLimit, + getKey(chunkInLimit), + module + ); } + continue; + } + + // Create the new chunk if not reusing one + if (!isReused) { + newChunk = compilation.addChunk(chunkName); + } + // Walk through all chunks + for (const chunk of usedChunks) { // Add graph connections for splitted chunk chunk.split(newChunk); - // Remove all selected modules from the chunk - for (const module of item.modules) { - chunk.removeModule(module); - module.rewriteChunkInReasons(chunk, [newChunk]); + } + + // Add a note to the chunk + newChunk.chunkReason = isReused + ? "reused as split chunk" + : "split chunk"; + if (item.cacheGroup.key) { + newChunk.chunkReason += ` (cache group: ${item.cacheGroup.key})`; + } + if (chunkName) { + newChunk.chunkReason += ` (name: ${chunkName})`; + // If the chosen name is already an entry point we remove the entry point + const entrypoint = compilation.entrypoints.get(chunkName); + if (entrypoint) { + compilation.entrypoints.delete(chunkName); + entrypoint.remove(); + newChunk.entryModule = undefined; } } - // If we successfully created a new chunk or reused one - if (newChunk) { - // Add a note to the chunk - newChunk.chunkReason = isReused - ? "reused as split chunk" - : "split chunk"; - if (item.cacheGroup.key) { - newChunk.chunkReason += ` (cache group: ${ - item.cacheGroup.key - })`; + if (item.cacheGroup.filename) { + if (!newChunk.isOnlyInitial()) { + throw new Error( + "SplitChunksPlugin: You are trying to set a filename for a chunk which is (also) loaded on demand. " + + "The runtime can only handle loading of chunks which match the chunkFilename schema. " + + "Using a custom filename would fail at runtime. " + + `(cache group: ${item.cacheGroup.key})` + ); } - if (chunkName) { - newChunk.chunkReason += ` (name: ${chunkName})`; - // If the chosen name is already an entry point we remove the entry point - const entrypoint = compilation.entrypoints.get(chunkName); - if (entrypoint) { - compilation.entrypoints.delete(chunkName); - entrypoint.remove(); - newChunk.entryModule = undefined; + newChunk.filenameTemplate = item.cacheGroup.filename; + } + if (!isReused) { + // Add all modules to the new chunk + for (const module of item.modules) { + if (typeof module.chunkCondition === "function") { + if (!module.chunkCondition(newChunk)) continue; + } + // Add module to new chunk + GraphHelpers.connectChunkAndModule(newChunk, module); + // Remove module from used chunks + for (const chunk of usedChunks) { + chunk.removeModule(module); + module.rewriteChunkInReasons(chunk, [newChunk]); } } - if (item.cacheGroup.filename) { - if (!newChunk.isOnlyInitial()) { - throw new Error( - "SplitChunksPlugin: You are trying to set a filename for a chunk which is (also) loaded on demand. " + - "The runtime can only handle loading of chunks which match the chunkFilename schema. " + - "Using a custom filename would fail at runtime. " + - `(cache group: ${item.cacheGroup.key})` - ); + } else { + // Remove all modules from used chunks + for (const module of item.modules) { + for (const chunk of usedChunks) { + chunk.removeModule(module); + module.rewriteChunkInReasons(chunk, [newChunk]); } - newChunk.filenameTemplate = item.cacheGroup.filename; } - if (!isReused) { - // Add all modules to the new chunk + } + // remove all modules from other entries and update size + for (const [key, info] of chunksInfoMap) { + if (isOverlap(info.chunks, item.chunks)) { + const oldSize = info.modules.size; for (const module of item.modules) { - GraphHelpers.connectChunkAndModule(newChunk, module); + info.modules.delete(module); } - } - // remove all modules from other entries and update size - for (const [key, info] of chunksInfoMap) { - if (isOverlap(info.chunks, item.chunks)) { - const oldSize = info.modules.size; - for (const module of item.modules) { - info.modules.delete(module); - } - if (info.modules.size === 0) { + if (info.modules.size === 0) { + chunksInfoMap.delete(key); + continue; + } + if (info.modules.size !== oldSize) { + info.size = getModulesSize(info.modules); + if (info.size < info.cacheGroup.minSize) { chunksInfoMap.delete(key); - continue; - } - if (info.modules.size !== oldSize) { - info.size = getModulesSize(info.modules); - if (info.size < info.cacheGroup.minSize) - chunksInfoMap.delete(key); } } } - changed = true; } } - if (changed) return true; } ); }); diff --git a/lib/performance/AssetsOverSizeLimitWarning.js b/lib/performance/AssetsOverSizeLimitWarning.js index 55c0220cd1e..aac8b65a9ee 100644 --- a/lib/performance/AssetsOverSizeLimitWarning.js +++ b/lib/performance/AssetsOverSizeLimitWarning.js @@ -9,21 +9,21 @@ const SizeFormatHelpers = require("../SizeFormatHelpers"); module.exports = class AssetsOverSizeLimitWarning extends WebpackError { constructor(assetsOverSizeLimit, assetLimit) { - super(); - - this.name = "AssetsOverSizeLimitWarning"; - this.assets = assetsOverSizeLimit; - const assetLists = this.assets + const assetLists = assetsOverSizeLimit .map( asset => `\n ${asset.name} (${SizeFormatHelpers.formatSize(asset.size)})` ) .join(""); - this.message = `asset size limit: The following asset(s) exceed the recommended size limit (${SizeFormatHelpers.formatSize( + + super(`asset size limit: The following asset(s) exceed the recommended size limit (${SizeFormatHelpers.formatSize( assetLimit )}). This can impact web performance. -Assets: ${assetLists}`; +Assets: ${assetLists}`); + + this.name = "AssetsOverSizeLimitWarning"; + this.assets = assetsOverSizeLimit; Error.captureStackTrace(this, this.constructor); } diff --git a/lib/performance/EntrypointsOverSizeLimitWarning.js b/lib/performance/EntrypointsOverSizeLimitWarning.js index e81ea1e29f8..3c29553d207 100644 --- a/lib/performance/EntrypointsOverSizeLimitWarning.js +++ b/lib/performance/EntrypointsOverSizeLimitWarning.js @@ -9,11 +9,7 @@ const SizeFormatHelpers = require("../SizeFormatHelpers"); module.exports = class EntrypointsOverSizeLimitWarning extends WebpackError { constructor(entrypoints, entrypointLimit) { - super(); - - this.name = "EntrypointsOverSizeLimitWarning"; - this.entrypoints = entrypoints; - const entrypointList = this.entrypoints + const entrypointList = entrypoints .map( entrypoint => `\n ${entrypoint.name} (${SizeFormatHelpers.formatSize( @@ -21,10 +17,13 @@ module.exports = class EntrypointsOverSizeLimitWarning extends WebpackError { )})\n${entrypoint.files.map(asset => ` ${asset}`).join("\n")}` ) .join(""); - this.message = `entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (${SizeFormatHelpers.formatSize( + super(`entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (${SizeFormatHelpers.formatSize( entrypointLimit )}). This can impact web performance. -Entrypoints:${entrypointList}\n`; +Entrypoints:${entrypointList}\n`); + + this.name = "EntrypointsOverSizeLimitWarning"; + this.entrypoints = entrypoints; Error.captureStackTrace(this, this.constructor); } diff --git a/lib/performance/NoAsyncChunksWarning.js b/lib/performance/NoAsyncChunksWarning.js index 9687d5056c4..c64475f9712 100644 --- a/lib/performance/NoAsyncChunksWarning.js +++ b/lib/performance/NoAsyncChunksWarning.js @@ -8,13 +8,13 @@ const WebpackError = require("../WebpackError"); module.exports = class NoAsyncChunksWarning extends WebpackError { constructor() { - super(); + super( + "webpack performance recommendations: \n" + + "You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.\n" + + "For more info visit https://webpack.js.org/guides/code-splitting/" + ); this.name = "NoAsyncChunksWarning"; - this.message = - "webpack performance recommendations: \n" + - "You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.\n" + - "For more info visit https://webpack.js.org/guides/code-splitting/"; Error.captureStackTrace(this, this.constructor); } diff --git a/lib/util/Queue.js b/lib/util/Queue.js index 21e2925e800..385b3a9bf51 100644 --- a/lib/util/Queue.js +++ b/lib/util/Queue.js @@ -1,23 +1,46 @@ "use strict"; -module.exports = class Queue { +/** + * @template T + */ +class Queue { + /** + * @param {IterableIterator=} items The initial elements. + */ constructor(items) { + /** @private @type {Set} */ this.set = new Set(items); + /** @private @type {Iterator} */ this.iterator = this.set[Symbol.iterator](); } + /** + * Returns the number of elements in this queue. + * @returns {number} The number of elements in this queue. + */ get length() { return this.set.size; } + /** + * Appends the specified element to this queue. + * @param {T} item The element to add. + * @returns {void} + */ enqueue(item) { this.set.add(item); } + /** + * Retrieves and removes the head of this queue. + * @returns {T | undefined} The head of the queue of `undefined` if this queue is empty. + */ dequeue() { const result = this.iterator.next(); if (result.done) return undefined; this.set.delete(result.value); return result.value; } -}; +} + +module.exports = Queue; diff --git a/lib/util/SetHelpers.js b/lib/util/SetHelpers.js index e5395d870a8..8833415f8e0 100644 --- a/lib/util/SetHelpers.js +++ b/lib/util/SetHelpers.js @@ -1,6 +1,11 @@ "use strict"; -exports.intersect = sets => { +/** + * intersect creates Set containing the intersection of elements between all sets + * @param {Set[]} sets an array of sets being checked for shared elements + * @returns {Set} returns a new Set containing the intersecting items + */ +function intersect(sets) { if (sets.length === 0) return new Set(); if (sets.length === 1) return new Set(sets[0]); let minSize = Infinity; @@ -23,12 +28,21 @@ exports.intersect = sets => { } } return current; -}; +} -exports.isSubset = (bigSet, smallSet) => { +/** + * Checks if a set is the subset of another set + * @param {Set} bigSet a Set which contains the original elements to compare against + * @param {Set} smallSet the set whos elements might be contained inside of bigSet + * @returns {boolean} returns true if smallSet contains all elements inside of the bigSet + */ +function isSubset(bigSet, smallSet) { if (bigSet.size < smallSet.size) return false; for (const item of smallSet) { if (!bigSet.has(item)) return false; } return true; -}; +} + +exports.intersect = intersect; +exports.isSubset = isSubset; diff --git a/lib/util/SortableSet.js b/lib/util/SortableSet.js index a58cfc57354..6bc49a60db6 100644 --- a/lib/util/SortableSet.js +++ b/lib/util/SortableSet.js @@ -1,5 +1,7 @@ "use strict"; - +//TODO: Make this a generic type +//https://github.com/Microsoft/TypeScript/issues/23385 +//https://github.com/Microsoft/TypeScript/issues/23384 class SortableSet extends Set { constructor(initialIterable, defaultSort) { super(initialIterable); @@ -10,7 +12,7 @@ class SortableSet extends Set { } /** - * @param {any} value - value to add to set + * @param {TODO} value - value to add to set * @returns {this} - returns itself */ add(value) { @@ -33,8 +35,8 @@ class SortableSet extends Set { return super.clear(); } - sortWith(/** @type {(a: any, b: any) => number} */ sortFn) { - if (this.size === 0 || sortFn === this._lastActiveSortFn) { + sortWith(/** @type {(a: TODO, b: TODO) => number} */ sortFn) { + if (this.size <= 1 || sortFn === this._lastActiveSortFn) { // already sorted - nothing to do return; } @@ -57,7 +59,7 @@ class SortableSet extends Set { /** * @param {Function} fn - function to calculate value - * @returns {any} - returns result of fn(this), cached until set changes + * @returns {TODO} - returns result of fn(this), cached until set changes */ getFromCache(fn) { if (this._cache === undefined) { @@ -75,7 +77,7 @@ class SortableSet extends Set { /** * @param {Function} fn - function to calculate value - * @returns {any} - returns result of fn(this), cached until set changes + * @returns {TODO} - returns result of fn(this), cached until set changes */ getFromUnorderedCache(fn) { if (this._cacheOrderIndependent === undefined) { @@ -92,12 +94,15 @@ class SortableSet extends Set { } _invalidateCache() { - if (this._cache !== undefined) this._cache.clear(); + if (this._cache !== undefined) { + this._cache.clear(); + } } _invalidateOrderedCache() { - if (this._cacheOrderIndependent !== undefined) + if (this._cacheOrderIndependent !== undefined) { this._cacheOrderIndependent.clear(); + } } } diff --git a/lib/util/StackedSetMap.js b/lib/util/StackedSetMap.js index 6c65f868713..589b68d52b8 100644 --- a/lib/util/StackedSetMap.js +++ b/lib/util/StackedSetMap.js @@ -25,8 +25,11 @@ class StackedSetMap { } delete(item) { - if (this.stack.length > 1) this.map.set(item, TOMBSTONE); - else this.map.delete(item); + if (this.stack.length > 1) { + this.map.set(item, TOMBSTONE); + } else { + this.map.delete(item); + } } has(item) { @@ -47,10 +50,11 @@ class StackedSetMap { get(item) { const topValue = this.map.get(item); - if (topValue !== undefined) + if (topValue !== undefined) { return topValue === TOMBSTONE || topValue === UNDEFINED_MARKER ? undefined : topValue; + } if (this.stack.length > 1) { for (var i = this.stack.length - 2; i >= 0; i--) { const value = this.stack[i].get(item); @@ -71,8 +75,11 @@ class StackedSetMap { this.map = new Map(); for (const data of this.stack) { for (const pair of data) { - if (pair[1] === TOMBSTONE) this.map.delete(pair[0]); - else this.map.set(pair[0], pair[1]); + if (pair[1] === TOMBSTONE) { + this.map.delete(pair[0]); + } else { + this.map.set(pair[0], pair[1]); + } } } this.stack = [this.map]; @@ -92,7 +99,7 @@ class StackedSetMap { return Array.from( this.map.entries(), pair => - /** @type {[any, any]} */ (pair[1] === UNDEFINED_MARKER + /** @type {[TODO, TODO]} */ (pair[1] === UNDEFINED_MARKER ? [pair[0], undefined] : pair) ); diff --git a/lib/util/cachedMerge.js b/lib/util/cachedMerge.js index 863141e6b18..ff7b4426a62 100644 --- a/lib/util/cachedMerge.js +++ b/lib/util/cachedMerge.js @@ -6,6 +6,19 @@ const mergeCache = new WeakMap(); +/** + * Merges two given objects and caches the result to avoid computation if same objects passed as arguements again. + * @example + * // performs Object.assign(first, second), stores the result in WeakMap and returns result + * cachedMerge({a: 1}, {a: 2}) + * {a: 2} + * // when same arguments passed, gets the result from WeakMap and returns it. + * cachedMerge({a: 1}, {a: 2}) + * {a: 2} + * @param {object} first first object + * @param {object} second second object + * @returns {object} merged object of first and second object + */ const cachedMerge = (first, second) => { let innerCache = mergeCache.get(first); if (innerCache === undefined) { diff --git a/lib/util/identifier.js b/lib/util/identifier.js index 39f271d8b76..9176facd0fd 100644 --- a/lib/util/identifier.js +++ b/lib/util/identifier.js @@ -1,12 +1,38 @@ "use strict"; const path = require("path"); +/** + * @typedef {Object} MakeRelativePathsCache + * @property {Map>=} relativePaths + */ + +/** + * + * @param {string} maybeAbsolutePath path to check + * @returns {boolean} returns true if path is "Absolute Path"-like + */ const looksLikeAbsolutePath = maybeAbsolutePath => { + if (/^\/.*\/$/.test(maybeAbsolutePath)) { + // this 'path' is actually a regexp generated by dynamic requires. + // Don't treat it as an absolute path. + return false; + } return /^(?:[a-z]:\\|\/)/i.test(maybeAbsolutePath); }; +/** + * + * @param {string} p path to normalize + * @returns {string} normalized version of path + */ const normalizePathSeparator = p => p.replace(/\\/g, "/"); +/** + * + * @param {string} context context for relative path + * @param {string} identifier identifier for path + * @returns {string} a converted relative path + */ const _makePathsRelative = (context, identifier) => { return identifier .split(/([|! ])/) @@ -19,6 +45,13 @@ const _makePathsRelative = (context, identifier) => { .join(""); }; +/** + * + * @param {string} context context used to create relative path + * @param {string} identifier identifier used to create relative path + * @param {MakeRelativePathsCache=} cache the cache object being set + * @returns {string} the returned relative path + */ exports.makePathsRelative = (context, identifier, cache) => { if (!cache) return _makePathsRelative(context, identifier); diff --git a/lib/util/objectToMap.js b/lib/util/objectToMap.js index 49a1411c6e9..31713646f61 100644 --- a/lib/util/objectToMap.js +++ b/lib/util/objectToMap.js @@ -3,7 +3,7 @@ * into an ES6 map * * @param {object} obj - any object type that works with Object.keys() - * @returns {Map} an ES6 Map of KV pairs + * @returns {Map} an ES6 Map of KV pairs */ module.exports = function objectToMap(obj) { return new Map( diff --git a/lib/wasm/UnsupportedWebAssemblyFeatureError.js b/lib/wasm/UnsupportedWebAssemblyFeatureError.js new file mode 100644 index 00000000000..fede4eb21d4 --- /dev/null +++ b/lib/wasm/UnsupportedWebAssemblyFeatureError.js @@ -0,0 +1,17 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php +*/ +"use strict"; + +const WebpackError = require("../WebpackError"); + +module.exports = class UnsupportedWebAssemblyFeatureError extends WebpackError { + /** @param {string} message Error message */ + constructor(message) { + super(message); + this.name = "UnsupportedWebAssemblyFeatureError"; + this.hideStack = true; + + Error.captureStackTrace(this, this.constructor); + } +}; diff --git a/lib/wasm/WasmFinalizeExportsPlugin.js b/lib/wasm/WasmFinalizeExportsPlugin.js new file mode 100644 index 00000000000..5187dd9f124 --- /dev/null +++ b/lib/wasm/WasmFinalizeExportsPlugin.js @@ -0,0 +1,66 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra + */ +"use strict"; + +const UnsupportedWebAssemblyFeatureError = require("../wasm/UnsupportedWebAssemblyFeatureError"); + +class WasmFinalizeExportsPlugin { + apply(compiler) { + compiler.hooks.compilation.tap("WasmFinalizeExportsPlugin", compilation => { + compilation.hooks.finishModules.tap( + "WasmFinalizeExportsPlugin", + modules => { + for (const module of modules) { + // 1. if a WebAssembly module + if (module.type.startsWith("webassembly") === true) { + const jsIncompatibleExports = + module.buildMeta.jsIncompatibleExports; + + if (jsIncompatibleExports === undefined) { + continue; + } + + for (const reason of module.reasons) { + // 2. is referenced by a non-WebAssembly module + if (reason.module.type.startsWith("webassembly") === false) { + const ref = reason.dependency.getReference(); + + const importedNames = ref.importedNames; + + if (Array.isArray(importedNames)) { + importedNames.forEach(name => { + // 3. and uses a func with an incompatible JS signature + if ( + Object.prototype.hasOwnProperty.call( + jsIncompatibleExports, + name + ) + ) { + // 4. error + /** @type {any} */ + const error = new UnsupportedWebAssemblyFeatureError( + `Export "${name}" with ${ + jsIncompatibleExports[name] + } can only be used for direct wasm to wasm dependencies` + ); + error.module = module; + error.origin = reason.module; + error.originLoc = reason.dependency.loc; + error.dependencies = [reason.dependency]; + compilation.errors.push(error); + } + }); + } + } + } + } + } + } + ); + }); + } +} + +module.exports = WasmFinalizeExportsPlugin; diff --git a/lib/wasm/WasmMainTemplatePlugin.js b/lib/wasm/WasmMainTemplatePlugin.js new file mode 100644 index 00000000000..b946c4e00c8 --- /dev/null +++ b/lib/wasm/WasmMainTemplatePlugin.js @@ -0,0 +1,352 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +"use strict"; + +const Template = require("../Template"); +const WebAssemblyUtils = require("./WebAssemblyUtils"); + +/** @typedef {import("../Module")} Module */ + +// Get all wasm modules +function getAllWasmModules(chunk) { + const wasmModules = chunk.getAllAsyncChunks(); + const array = []; + for (const chunk of wasmModules) { + for (const m of chunk.modulesIterable) { + if (m.type.startsWith("webassembly")) { + array.push(m); + } + } + } + + return array; +} + +/** + * generates the import object function for a module + * @param {Module} module the module + * @param {boolean} mangle mangle imports + * @returns {string} source code + */ +function generateImportObject(module, mangle) { + const waitForInstances = new Map(); + const properties = []; + const usedWasmDependencies = WebAssemblyUtils.getUsedDependencies( + module, + mangle + ); + for (const usedDep of usedWasmDependencies) { + const dep = usedDep.dependency; + const importedModule = dep.module; + const exportName = dep.name; + const usedName = importedModule && importedModule.isUsed(exportName); + const description = dep.description; + const direct = dep.onlyDirectImport; + + const module = usedDep.module; + const name = usedDep.name; + + if (direct) { + const instanceVar = `m${waitForInstances.size}`; + waitForInstances.set(instanceVar, importedModule.id); + properties.push({ + module, + name, + value: `${instanceVar}[${JSON.stringify(usedName)}]` + }); + } else { + const params = description.signature.params.map( + (param, k) => "p" + k + param.valtype + ); + + const mod = `installedModules[${JSON.stringify(importedModule.id)}]`; + const func = `${mod}.exports[${JSON.stringify(usedName)}]`; + + properties.push({ + module, + name, + value: Template.asString([ + (importedModule.type.startsWith("webassembly") + ? `${mod} ? ${func} : ` + : "") + `function(${params}) {`, + Template.indent([`return ${func}(${params});`]), + "}" + ]) + }); + } + } + + let importObject; + if (mangle) { + importObject = [ + "return {", + Template.indent([ + properties.map(p => `${JSON.stringify(p.name)}: ${p.value}`).join(",\n") + ]), + "};" + ]; + } else { + const propertiesByModule = new Map(); + for (const p of properties) { + let list = propertiesByModule.get(p.module); + if (list === undefined) { + propertiesByModule.set(p.module, (list = [])); + } + list.push(p); + } + importObject = [ + "return {", + Template.indent([ + Array.from(propertiesByModule, ([module, list]) => { + return Template.asString([ + `${JSON.stringify(module)}: {`, + Template.indent([ + list.map(p => `${JSON.stringify(p.name)}: ${p.value}`).join(",\n") + ]), + "}" + ]); + }).join(",\n") + ]), + "};" + ]; + } + + if (waitForInstances.size === 1) { + const moduleId = Array.from(waitForInstances.values())[0]; + const promise = `installedWasmModules[${JSON.stringify(moduleId)}]`; + const variable = Array.from(waitForInstances.keys())[0]; + return Template.asString([ + `${JSON.stringify(module.id)}: function() {`, + Template.indent([ + `return promiseResolve().then(function() { return ${promise}; }).then(function(${variable}) {`, + Template.indent(importObject), + "});" + ]), + "}," + ]); + } else if (waitForInstances.size > 0) { + const promises = Array.from( + waitForInstances.values(), + id => `installedWasmModules[${JSON.stringify(id)}]` + ).join(", "); + const variables = Array.from( + waitForInstances.keys(), + (name, i) => `${name} = array[${i}]` + ).join(", "); + return Template.asString([ + `${JSON.stringify(module.id)}: function() {`, + Template.indent([ + `return promiseResolve().then(function() { return Promise.all([${promises}]); }).then(function(array) {`, + Template.indent([`var ${variables};`, ...importObject]), + "});" + ]), + "}," + ]); + } else { + return Template.asString([ + `${JSON.stringify(module.id)}: function() {`, + Template.indent(importObject), + "}," + ]); + } +} + +class WasmMainTemplatePlugin { + constructor({ generateLoadBinaryCode, supportsStreaming, mangleImports }) { + this.generateLoadBinaryCode = generateLoadBinaryCode; + this.supportsStreaming = supportsStreaming; + this.mangleImports = mangleImports; + } + apply(mainTemplate) { + mainTemplate.hooks.localVars.tap( + "WasmMainTemplatePlugin", + (source, chunk) => { + const wasmModules = getAllWasmModules(chunk); + if (wasmModules.length === 0) return source; + const importObjects = wasmModules.map(module => { + return generateImportObject(module, this.mangleImports); + }); + return Template.asString([ + source, + "", + "// object to store loaded and loading wasm modules", + "var installedWasmModules = {};", + "", + // This function is used to delay reading the installed wasm module promises + // by a microtask. Sorting them doesn't help because there are egdecases where + // sorting is not possible (modules splitted into different chunks). + // So we not even trying and solve this by a microtask delay. + "function promiseResolve() { return Promise.resolve(); }", + "", + "var wasmImportObjects = {", + Template.indent(importObjects), + "};" + ]); + } + ); + mainTemplate.hooks.requireEnsure.tap( + "WasmMainTemplatePlugin", + (source, chunk, hash) => { + const webassemblyModuleFilename = + mainTemplate.outputOptions.webassemblyModuleFilename; + + const chunkModuleMaps = chunk.getChunkModuleMaps(m => + m.type.startsWith("webassembly") + ); + if (Object.keys(chunkModuleMaps.id).length === 0) return source; + const wasmModuleSrcPath = mainTemplate.getAssetPath( + JSON.stringify(webassemblyModuleFilename), + { + hash: `" + ${mainTemplate.renderCurrentHashCode(hash)} + "`, + hashWithLength: length => + `" + ${mainTemplate.renderCurrentHashCode(hash, length)} + "`, + module: { + id: '" + wasmModuleId + "', + hash: `" + ${JSON.stringify( + chunkModuleMaps.hash + )}[wasmModuleId] + "`, + hashWithLength(length) { + const shortChunkHashMap = Object.create(null); + for (const wasmModuleId of Object.keys(chunkModuleMaps.hash)) { + if (typeof chunkModuleMaps.hash[wasmModuleId] === "string") { + shortChunkHashMap[wasmModuleId] = chunkModuleMaps.hash[ + wasmModuleId + ].substr(0, length); + } + } + return `" + ${JSON.stringify( + shortChunkHashMap + )}[wasmModuleId] + "`; + } + } + } + ); + const createImportObject = content => + this.mangleImports + ? `{ ${JSON.stringify( + WebAssemblyUtils.MANGLED_MODULE + )}: ${content} }` + : content; + return Template.asString([ + source, + "", + "// Fetch + compile chunk loading for webassembly", + "", + `var wasmModules = ${JSON.stringify( + chunkModuleMaps.id + )}[chunkId] || [];`, + "", + "wasmModules.forEach(function(wasmModuleId) {", + Template.indent([ + "var installedWasmModuleData = installedWasmModules[wasmModuleId];", + "", + '// a Promise means "currently loading" or "already loaded".', + "if(installedWasmModuleData)", + Template.indent(["promises.push(installedWasmModuleData);"]), + "else {", + Template.indent([ + `var importObject = wasmImportObjects[wasmModuleId]();`, + `var req = ${this.generateLoadBinaryCode(wasmModuleSrcPath)};`, + "var promise;", + this.supportsStreaming + ? Template.asString([ + "if(importObject instanceof Promise && typeof WebAssembly.compileStreaming === 'function') {", + Template.indent([ + "promise = Promise.all([WebAssembly.compileStreaming(req), importObject]).then(function(items) {", + Template.indent([ + `return WebAssembly.instantiate(items[0], ${createImportObject( + "items[1]" + )});` + ]), + "});" + ]), + "} else if(typeof WebAssembly.instantiateStreaming === 'function') {", + Template.indent([ + `promise = WebAssembly.instantiateStreaming(req, ${createImportObject( + "importObject" + )});` + ]) + ]) + : Template.asString([ + "if(importObject instanceof Promise) {", + Template.indent([ + "var bytesPromise = req.then(function(x) { return x.arrayBuffer(); });", + "promise = Promise.all([", + Template.indent([ + "bytesPromise.then(function(bytes) { return WebAssembly.compile(bytes); }),", + "importObject" + ]), + "]).then(function(items) {", + Template.indent([ + `return WebAssembly.instantiate(items[0], ${createImportObject( + "items[1]" + )});` + ]), + "});" + ]) + ]), + "} else {", + Template.indent([ + "var bytesPromise = req.then(function(x) { return x.arrayBuffer(); });", + "promise = bytesPromise.then(function(bytes) {", + Template.indent([ + `return WebAssembly.instantiate(bytes, ${createImportObject( + "importObject" + )});` + ]), + "});" + ]), + "}", + "promises.push(installedWasmModules[wasmModuleId] = promise.then(function(res) {", + Template.indent([ + `return ${ + mainTemplate.requireFn + }.w[wasmModuleId] = (res.instance || res).exports;` + ]), + "}));" + ]), + "}" + ]), + "});" + ]); + } + ); + mainTemplate.hooks.requireExtensions.tap( + "WasmMainTemplatePlugin", + (source, chunk) => { + if (!chunk.hasModuleInGraph(m => m.type.startsWith("webassembly"))) { + return source; + } + return Template.asString([ + source, + "", + "// object with all WebAssembly.instance exports", + `${mainTemplate.requireFn}.w = {};` + ]); + } + ); + mainTemplate.hooks.hash.tap("WasmMainTemplatePlugin", hash => { + hash.update("WasmMainTemplatePlugin"); + hash.update("1"); + hash.update(`${mainTemplate.outputOptions.webassemblyModuleFilename}`); + hash.update(`${this.mangleImports}`); + }); + mainTemplate.hooks.hashForChunk.tap( + "WasmMainTemplatePlugin", + (hash, chunk) => { + const chunkModuleMaps = chunk.getChunkModuleMaps(m => + m.type.startsWith("webassembly") + ); + hash.update(JSON.stringify(chunkModuleMaps.id)); + const wasmModules = getAllWasmModules(chunk); + for (const module of wasmModules) { + hash.update(module.hash); + } + } + ); + } +} + +module.exports = WasmMainTemplatePlugin; diff --git a/lib/wasm/WasmModuleTemplatePlugin.js b/lib/wasm/WasmModuleTemplatePlugin.js deleted file mode 100644 index 54dbdf3489f..00000000000 --- a/lib/wasm/WasmModuleTemplatePlugin.js +++ /dev/null @@ -1,106 +0,0 @@ -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ -"use strict"; - -const { RawSource } = require("webpack-sources"); -const WebAssemblyImportDependency = require("../dependencies/WebAssemblyImportDependency"); - -class WasmModuleTemplatePlugin { - apply(moduleTemplate) { - moduleTemplate.hooks.content.tap( - "WasmModuleTemplatePlugin", - (moduleSource, module, { chunk }) => { - if (module.type && module.type.startsWith("webassembly")) { - if (chunk.canBeInitial()) - throw new Error( - "Sync WebAssembly compilation is not yet implemented" - ); - const generateExports = () => { - if ( - Array.isArray(module.buildMeta.providedExports) && - Array.isArray(module.usedExports) - ) { - // generate mangled exports - return module.buildMeta.providedExports - .map(exp => { - const usedName = module.isUsed(exp); - if (usedName) { - return `${module.exportsArgument}[${JSON.stringify( - usedName - )}] = instance.exports[${JSON.stringify(exp)}];`; - } else { - return `// unused ${JSON.stringify(exp)} export`; - } - }) - .join("\n"); - } else { - // generate simple export - return `${module.moduleArgument}.exports = instance.exports;`; - } - }; - const generateImports = () => { - const depsByRequest = new Map(); - for (const dep of module.dependencies) { - if (dep instanceof WebAssemblyImportDependency) { - const request = dep.request; - let array = depsByRequest.get(request); - if (!array) { - depsByRequest.set(request, (array = [])); - } - const exportName = dep.name; - const usedName = dep.module && dep.module.isUsed(exportName); - array.push({ - exportName, - usedName, - module: dep.module - }); - } - } - const importsCode = []; - for (const pair of depsByRequest) { - const properties = []; - for (const data of pair[1]) { - properties.push( - `\n\t\t${JSON.stringify( - data.exportName - )}: __webpack_require__(${JSON.stringify( - data.module.id - )})[${JSON.stringify(data.usedName)}]` - ); - } - importsCode.push( - `\n\t${JSON.stringify(pair[0])}: {${properties.join(",")}\n\t}` - ); - } - return importsCode.join(","); - }; - const source = new RawSource( - [ - '"use strict";', - "", - "// Instantiate WebAssembly module", - "var instance = new WebAssembly.Instance(__webpack_require__.w[module.i], {" + - generateImports(), - "});", - "", - "// export exports from WebAssembly module", - // TODO rewrite this to getters depending on exports to support circular dependencies - generateExports() - ].join("\n") - ); - return source; - } else { - return moduleSource; - } - } - ); - - moduleTemplate.hooks.hash.tap("WasmModuleTemplatePlugin", hash => { - hash.update("WasmModuleTemplatePlugin"); - hash.update("1"); - }); - } -} -module.exports = WasmModuleTemplatePlugin; diff --git a/lib/wasm/WebAssemblyGenerator.js b/lib/wasm/WebAssemblyGenerator.js new file mode 100644 index 00000000000..d5fb13c4eb7 --- /dev/null +++ b/lib/wasm/WebAssemblyGenerator.js @@ -0,0 +1,440 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +"use strict"; + +const Generator = require("../Generator"); +const Template = require("../Template"); +const WebAssemblyUtils = require("./WebAssemblyUtils"); +const { RawSource } = require("webpack-sources"); + +const { shrinkPaddedLEB128 } = require("@webassemblyjs/wasm-opt"); +const { editWithAST, addWithAST } = require("@webassemblyjs/wasm-edit"); +const { decode } = require("@webassemblyjs/wasm-parser"); +const t = require("@webassemblyjs/ast"); +const { + moduleContextFromModuleAST +} = require("@webassemblyjs/helper-module-context"); + +const WebAssemblyExportImportedDependency = require("../dependencies/WebAssemblyExportImportedDependency"); + +/** @typedef {import("../Module")} Module */ +/** @typedef {import("./WebAssemblyUtils").UsedWasmDependency} UsedWasmDependency */ + +/** + * @typedef {(ArrayBuffer) => ArrayBuffer} ArrayBufferTransform + */ + +/** + * Run some preprocessing on the binary before wasm-edit + * + * @param {ArrayBuffer} ab - original binary + * @returns {ArrayBufferTransform} transform + */ +function preprocess(ab) { + const optBin = shrinkPaddedLEB128(new Uint8Array(ab)); + return optBin.buffer; +} + +/** + * @template T + * @param {Function[]} fns transforms + * @returns {Function} composed transform + */ +function compose(...fns) { + return fns.reduce((prevFn, nextFn) => { + return value => nextFn(prevFn(value)); + }, value => value); +} + +// TODO replace with @callback + +/** + * Removes the start instruction + * + * @param {Object} state - unused state + * @returns {ArrayBufferTransform} transform + */ +const removeStartFunc = state => bin => { + return editWithAST(state.ast, bin, { + Start(path) { + path.remove(); + } + }); +}; + +/** + * Get imported globals + * + * @param {Object} ast - Module's AST + * @returns {Array} - nodes + */ +function getImportedGlobals(ast) { + const importedGlobals = []; + + t.traverse(ast, { + ModuleImport({ node }) { + if (t.isGlobalType(node.descr) === true) { + importedGlobals.push(node); + } + } + }); + + return importedGlobals; +} + +function getCountImportedFunc(ast) { + let count = 0; + + t.traverse(ast, { + ModuleImport({ node }) { + if (t.isFuncImportDescr(node.descr) === true) { + count++; + } + } + }); + + return count; +} + +/** + * Get next type index + * + * @param {Object} ast - Module's AST + * @returns {t.Index} - index + */ +function getNextTypeIndex(ast) { + const typeSectionMetadata = t.getSectionMetadata(ast, "type"); + + if (typeof typeSectionMetadata === "undefined") { + return t.indexLiteral(0); + } + + return t.indexLiteral(typeSectionMetadata.vectorOfSize.value); +} + +/** + * Get next func index + * + * The Func section metadata provide informations for implemented funcs + * in order to have the correct index we shift the index by number of external + * functions. + * + * @param {Object} ast - Module's AST + * @param {Number} countImportedFunc - number of imported funcs + * @returns {t.Index} - index + */ +function getNextFuncIndex(ast, countImportedFunc) { + const funcSectionMetadata = t.getSectionMetadata(ast, "func"); + + if (typeof funcSectionMetadata === "undefined") { + return t.indexLiteral(0 + countImportedFunc); + } + + const vectorOfSize = funcSectionMetadata.vectorOfSize.value; + + return t.indexLiteral(vectorOfSize + countImportedFunc); +} + +/** + * Create a init instruction for a global + * @param {t.GlobalType} globalType the global type + * @returns {t.Instruction} init expression + */ +const createDefaultInitForGlobal = globalType => { + if (globalType.valtype[0] === "i") { + // create NumberLiteral global initializer + return t.objectInstruction("const", globalType.valtype, [ + t.numberLiteralFromRaw(66) + ]); + } else if (globalType.valtype[0] === "f") { + // create FloatLiteral global initializer + return t.objectInstruction("const", globalType.valtype, [ + t.floatLiteral(66, false, false, "66") + ]); + } else { + throw new Error("unknown type: " + globalType.valtype); + } +}; + +/** + * Rewrite the import globals: + * - removes the ModuleImport instruction + * - injects at the same offset a mutable global of the same time + * + * Since the imported globals are before the other global declarations, our + * indices will be preserved. + * + * Note that globals will become mutable. + * + * @param {Object} state - unused state + * @returns {ArrayBufferTransform} transform + */ +const rewriteImportedGlobals = state => bin => { + const additionalInitCode = state.additionalInitCode; + const newGlobals = []; + + bin = editWithAST(state.ast, bin, { + ModuleImport(path) { + if (t.isGlobalType(path.node.descr) === true) { + const globalType = path.node.descr; + + globalType.mutability = "var"; + + const init = createDefaultInitForGlobal(globalType); + + newGlobals.push(t.global(globalType, [init])); + + path.remove(); + } + }, + + // in order to preserve non-imported global's order we need to re-inject + // those as well + Global(path) { + const { node } = path; + const [init] = node.init; + + if (init.id === "get_global") { + node.globalType.mutability = "var"; + + const initialGlobalidx = init.args[0]; + + node.init = [createDefaultInitForGlobal(node.globalType)]; + + additionalInitCode.push( + /** + * get_global in global initilizer only work for imported globals. + * They have the same indices than the init params, so use the + * same index. + */ + t.instruction("get_local", [initialGlobalidx]), + t.instruction("set_global", [t.indexLiteral(newGlobals.length)]) + ); + } + + newGlobals.push(node); + + path.remove(); + } + }); + + // Add global declaration instructions + return addWithAST(state.ast, bin, newGlobals); +}; + +/** + * Rewrite the export names + * @param {Object} state state + * @param {Object} state.ast Module's ast + * @param {Module} state.module Module + * @param {Set} state.externalExports Module + * @returns {ArrayBufferTransform} transform + */ +const rewriteExportNames = ({ ast, module, externalExports }) => bin => { + return editWithAST(ast, bin, { + ModuleExport(path) { + const isExternal = externalExports.has(path.node.name); + if (isExternal) { + path.remove(); + return; + } + const usedName = module.isUsed(path.node.name); + if (!usedName) { + path.remove(); + return; + } + path.node.name = usedName; + } + }); +}; + +/** + * Mangle import names and modules + * @param {Object} state state + * @param {Object} state.ast Module's ast + * @param {Map} state.usedDependencyMap mappings to mangle names + * @returns {ArrayBufferTransform} transform + */ +const rewriteImports = ({ ast, usedDependencyMap }) => bin => { + return editWithAST(ast, bin, { + ModuleImport(path) { + const result = usedDependencyMap.get( + path.node.module + ":" + path.node.name + ); + + if (typeof result !== "undefined") { + path.node.module = result.module; + path.node.name = result.name; + } + } + }); +}; + +/** + * Add an init function. + * + * The init function fills the globals given input arguments. + * + * @param {Object} state transformation state + * @param {Object} state.ast - Module's ast + * @param {t.Identifier} state.initFuncId identifier of the init function + * @param {t.Index} state.startAtFuncOffset index of the start function + * @param {t.ModuleImport[]} state.importedGlobals list of imported globals + * @param {t.Instruction[]} state.additionalInitCode list of addition instructions for the init function + * @param {t.Index} state.nextFuncIndex index of the next function + * @param {t.Index} state.nextTypeIndex index of the next type + * @returns {ArrayBufferTransform} transform + */ +const addInitFunction = ({ + ast, + initFuncId, + startAtFuncOffset, + importedGlobals, + additionalInitCode, + nextFuncIndex, + nextTypeIndex +}) => bin => { + const funcParams = importedGlobals.map(importedGlobal => { + // used for debugging + const id = t.identifier(`${importedGlobal.module}.${importedGlobal.name}`); + + return t.funcParam(importedGlobal.descr.valtype, id); + }); + + const funcBody = importedGlobals.reduce((acc, importedGlobal, index) => { + const args = [t.indexLiteral(index)]; + const body = [ + t.instruction("get_local", args), + t.instruction("set_global", args) + ]; + + return [...acc, ...body]; + }, []); + + if (typeof startAtFuncOffset === "number") { + funcBody.push(t.callInstruction(t.numberLiteralFromRaw(startAtFuncOffset))); + } + + for (const instr of additionalInitCode) { + funcBody.push(instr); + } + + const funcResults = []; + + // Code section + const funcSignature = t.signature(funcParams, funcResults); + const func = t.func(initFuncId, funcSignature, funcBody); + + // Type section + const functype = t.typeInstruction(undefined, funcSignature); + + // Func section + const funcindex = t.indexInFuncSection(nextTypeIndex); + + // Export section + const moduleExport = t.moduleExport( + initFuncId.value, + t.moduleExportDescr("Func", nextFuncIndex) + ); + + return addWithAST(ast, bin, [func, moduleExport, funcindex, functype]); +}; + +/** + * Extract mangle mappings from module + * @param {Module} module current module + * @param {boolean} mangle mangle imports + * @returns {Map} mappings to mangled names + */ +const getUsedDependencyMap = (module, mangle) => { + /** @type {Map} */ + const map = new Map(); + for (const usedDep of WebAssemblyUtils.getUsedDependencies(module, mangle)) { + const dep = usedDep.dependency; + const request = dep.request; + const exportName = dep.name; + map.set(request + ":" + exportName, usedDep); + } + return map; +}; + +class WebAssemblyGenerator extends Generator { + constructor(options) { + super(); + this.options = options; + } + + generate(module) { + let bin = module.originalSource().source(); + bin = preprocess(bin); + + const initFuncId = t.identifier( + Array.isArray(module.usedExports) + ? Template.numberToIdentifer(module.usedExports.length) + : "__webpack_init__" + ); + + // parse it + const ast = decode(bin, { + ignoreDataSection: true, + ignoreCodeSection: true, + ignoreCustomNameSection: true + }); + + const moduleContext = moduleContextFromModuleAST(ast.body[0]); + + const importedGlobals = getImportedGlobals(ast); + const countImportedFunc = getCountImportedFunc(ast); + const startAtFuncOffset = moduleContext.getStart(); + const nextFuncIndex = getNextFuncIndex(ast, countImportedFunc); + const nextTypeIndex = getNextTypeIndex(ast); + + const usedDependencyMap = getUsedDependencyMap( + module, + this.options.mangleImports + ); + const externalExports = new Set( + module.dependencies + .filter(d => d instanceof WebAssemblyExportImportedDependency) + .map(d => d.exportName) + ); + + /** @type {t.Instruction[]} */ + const additionalInitCode = []; + + const transform = compose( + rewriteExportNames({ + ast, + module, + externalExports + }), + + removeStartFunc({ ast }), + + rewriteImportedGlobals({ ast, additionalInitCode }), + + rewriteImports({ + ast, + usedDependencyMap + }), + + addInitFunction({ + ast, + initFuncId, + importedGlobals, + additionalInitCode, + startAtFuncOffset, + nextFuncIndex, + nextTypeIndex + }) + ); + + const newBin = transform(bin); + + return new RawSource(newBin); + } +} + +module.exports = WebAssemblyGenerator; diff --git a/lib/wasm/WebAssemblyJavascriptGenerator.js b/lib/wasm/WebAssemblyJavascriptGenerator.js new file mode 100644 index 00000000000..994036d3680 --- /dev/null +++ b/lib/wasm/WebAssemblyJavascriptGenerator.js @@ -0,0 +1,133 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +"use strict"; + +const Generator = require("../Generator"); +const Template = require("../Template"); +const { RawSource } = require("webpack-sources"); +const WebAssemblyImportDependency = require("../dependencies/WebAssemblyImportDependency"); +const WebAssemblyExportImportedDependency = require("../dependencies/WebAssemblyExportImportedDependency"); + +class WebAssemblyJavascriptGenerator extends Generator { + generate(module, dependencyTemplates, runtimeTemplate) { + const initIdentifer = Array.isArray(module.usedExports) + ? Template.numberToIdentifer(module.usedExports.length) + : "__webpack_init__"; + + let needExportsCopy = false; + const importedModules = new Map(); + const initParams = []; + let index = 0; + for (const dep of module.dependencies) { + if (dep.module) { + let importData = importedModules.get(dep.module); + if (importData === undefined) { + importedModules.set( + dep.module, + (importData = { + importVar: `m${index}`, + index, + request: dep.userRequest, + names: new Set(), + reexports: [] + }) + ); + index++; + } + if (dep instanceof WebAssemblyImportDependency) { + importData.names.add(dep.name); + if (dep.description.type === "GlobalType") { + const exportName = dep.name; + const usedName = dep.module && dep.module.isUsed(exportName); + + if (dep.module) { + if (usedName) { + initParams.push( + runtimeTemplate.exportFromImport({ + module: dep.module, + request: dep.request, + importVar: importData.importVar, + originModule: module, + exportName: dep.name, + asiSafe: true, + isCall: false, + callContext: null + }) + ); + } + } + } + } + if (dep instanceof WebAssemblyExportImportedDependency) { + importData.names.add(dep.name); + const usedName = module.isUsed(dep.exportName); + if (usedName) { + const defineStatement = Template.asString([ + `${module.exportsArgument}[${JSON.stringify( + usedName + )}] = ${runtimeTemplate.exportFromImport({ + module: dep.module, + request: dep.request, + importVar: importData.importVar, + originModule: module, + exportName: dep.name, + asiSafe: true, + isCall: false, + callContext: null + })};` + ]); + importData.reexports.push(defineStatement); + needExportsCopy = true; + } + } + } + } + const importsCode = Template.asString( + Array.from( + importedModules, + ([module, { importVar, request, reexports }]) => { + const importStatement = runtimeTemplate.importStatement({ + module, + request, + importVar, + originModule: module + }); + return importStatement + reexports.join("\n"); + } + ) + ); + + // create source + const source = new RawSource( + [ + '"use strict";', + "// Instantiate WebAssembly module", + "var wasmExports = __webpack_require__.w[module.i];", + + !Array.isArray(module.usedExports) + ? `__webpack_require__.r(${module.exportsArgument});` + : "", + + // this must be before import for circular dependencies + "// export exports from WebAssembly module", + Array.isArray(module.usedExports) && !needExportsCopy + ? `${module.moduleArgument}.exports = wasmExports;` + : "for(var name in wasmExports) " + + `if(name != ${JSON.stringify(initIdentifer)}) ` + + `${module.exportsArgument}[name] = wasmExports[name];`, + "// exec imports from WebAssembly module (for esm order)", + importsCode, + "", + "// exec wasm module", + `wasmExports[${JSON.stringify(initIdentifer)}](${initParams.join( + ", " + )})` + ].join("\n") + ); + return source; + } +} + +module.exports = WebAssemblyJavascriptGenerator; diff --git a/lib/WebAssemblyModulesPlugin.js b/lib/wasm/WebAssemblyModulesPlugin.js similarity index 74% rename from lib/WebAssemblyModulesPlugin.js rename to lib/wasm/WebAssemblyModulesPlugin.js index 32ec3250b5b..e1ac050c531 100644 --- a/lib/WebAssemblyModulesPlugin.js +++ b/lib/wasm/WebAssemblyModulesPlugin.js @@ -4,11 +4,18 @@ */ "use strict"; +const Generator = require("../Generator"); const WebAssemblyParser = require("./WebAssemblyParser"); const WebAssemblyGenerator = require("./WebAssemblyGenerator"); -const WebAssemblyImportDependency = require("./dependencies/WebAssemblyImportDependency"); +const WebAssemblyJavascriptGenerator = require("./WebAssemblyJavascriptGenerator"); +const WebAssemblyImportDependency = require("../dependencies/WebAssemblyImportDependency"); +const WebAssemblyExportImportedDependency = require("../dependencies/WebAssemblyExportImportedDependency"); class WebAssemblyModulesPlugin { + constructor(options) { + this.options = options; + } + apply(compiler) { compiler.hooks.compilation.tap( "WebAssemblyModulesPlugin", @@ -18,6 +25,11 @@ class WebAssemblyModulesPlugin { normalModuleFactory ); + compilation.dependencyFactories.set( + WebAssemblyExportImportedDependency, + normalModuleFactory + ); + normalModuleFactory.hooks.createParser .for("webassembly/experimental") .tap("WebAssemblyModulesPlugin", () => { @@ -27,7 +39,10 @@ class WebAssemblyModulesPlugin { normalModuleFactory.hooks.createGenerator .for("webassembly/experimental") .tap("WebAssemblyModulesPlugin", () => { - return new WebAssemblyGenerator(); + return Generator.byType({ + javascript: new WebAssemblyJavascriptGenerator(), + webassembly: new WebAssemblyGenerator(this.options) + }); }); compilation.chunkTemplate.hooks.renderManifest.tap( diff --git a/lib/wasm/WebAssemblyParser.js b/lib/wasm/WebAssemblyParser.js new file mode 100644 index 00000000000..6c022af8589 --- /dev/null +++ b/lib/wasm/WebAssemblyParser.js @@ -0,0 +1,174 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +"use strict"; + +const t = require("@webassemblyjs/ast"); +const { decode } = require("@webassemblyjs/wasm-parser"); +const { + moduleContextFromModuleAST +} = require("@webassemblyjs/helper-module-context"); + +const { Tapable } = require("tapable"); +const WebAssemblyImportDependency = require("../dependencies/WebAssemblyImportDependency"); +const WebAssemblyExportImportedDependency = require("../dependencies/WebAssemblyExportImportedDependency"); + +/** @typedef {import("../Module")} Module */ + +const JS_COMPAT_TYPES = new Set(["i32", "f32", "f64"]); + +/** + * @param {t.Signature} signature the func signature + * @returns {null | string} the type incompatible with js types + */ +const getJsIncompatibleType = signature => { + for (const param of signature.params) { + if (!JS_COMPAT_TYPES.has(param.valtype)) { + return `${param.valtype} as parameter`; + } + } + for (const type of signature.results) { + if (!JS_COMPAT_TYPES.has(type)) return `${type} as result`; + } + return null; +}; + +/** + * TODO why are there two different Signature types? + * @param {t.FuncSignature} signature the func signature + * @returns {null | string} the type incompatible with js types + */ +const getJsIncompatibleTypeOfFuncSignature = signature => { + for (const param of signature.args) { + if (!JS_COMPAT_TYPES.has(param)) { + return `${param} as parameter`; + } + } + for (const type of signature.result) { + if (!JS_COMPAT_TYPES.has(type)) return `${type} as result`; + } + return null; +}; + +const decoderOpts = { + ignoreCodeSection: true, + ignoreDataSection: true, + + // this will avoid having to lookup with identifiers in the ModuleContext + ignoreCustomNameSection: true +}; + +class WebAssemblyParser extends Tapable { + constructor(options) { + super(); + this.hooks = {}; + this.options = options; + } + + parse(binary, state) { + // flag it as ESM + state.module.buildMeta.exportsType = "namespace"; + + // parse it + const program = decode(binary, decoderOpts); + const module = program.body[0]; + + const moduleContext = moduleContextFromModuleAST(module); + + // extract imports and exports + const exports = (state.module.buildMeta.providedExports = []); + const jsIncompatibleExports = (state.module.buildMeta.jsIncompatibleExports = []); + + const importedGlobals = []; + t.traverse(module, { + ModuleExport({ node }) { + const descriptor = node.descr; + + if (descriptor.exportType === "Func") { + const funcidx = descriptor.id.value; + + /** @type {t.FuncSignature} */ + const funcSignature = moduleContext.getFunction(funcidx); + + const incompatibleType = getJsIncompatibleTypeOfFuncSignature( + funcSignature + ); + + if (incompatibleType) { + jsIncompatibleExports[node.name] = incompatibleType; + } + } + + exports.push(node.name); + + if (node.descr && node.descr.exportType === "Global") { + const refNode = importedGlobals[node.descr.id.value]; + if (refNode) { + const dep = new WebAssemblyExportImportedDependency( + node.name, + refNode.module, + refNode.name + ); + + state.module.addDependency(dep); + } + } + }, + + Global({ node }) { + const init = node.init[0]; + + let importNode = null; + + if (init.id === "get_global") { + const globalIdx = init.args[0].value; + + if (globalIdx < importedGlobals.length) { + importNode = importedGlobals[globalIdx]; + } + } + + importedGlobals.push(importNode); + }, + + ModuleImport({ node }) { + /** @type {false | string} */ + let onlyDirectImport = false; + + if (t.isMemory(node.descr) === true) { + onlyDirectImport = "Memory"; + } else if (t.isTable(node.descr) === true) { + onlyDirectImport = "Table"; + } else if (t.isFuncImportDescr(node.descr) === true) { + const incompatibleType = getJsIncompatibleType(node.descr.signature); + if (incompatibleType) { + onlyDirectImport = `Non-JS-compatible Func Sigurature (${incompatibleType})`; + } + } else if (t.isGlobalType(node.descr) === true) { + const type = node.descr.valtype; + if (!JS_COMPAT_TYPES.has(type)) { + onlyDirectImport = `Non-JS-compatible Global Type (${type})`; + } + } + + const dep = new WebAssemblyImportDependency( + node.module, + node.name, + node.descr, + onlyDirectImport + ); + + state.module.addDependency(dep); + + if (t.isGlobalType(node.descr)) { + importedGlobals.push(node); + } + } + }); + + return state; + } +} + +module.exports = WebAssemblyParser; diff --git a/lib/wasm/WebAssemblyUtils.js b/lib/wasm/WebAssemblyUtils.js new file mode 100644 index 00000000000..75eb6d29577 --- /dev/null +++ b/lib/wasm/WebAssemblyUtils.js @@ -0,0 +1,59 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +"use strict"; + +const Template = require("../Template"); +const WebAssemblyImportDependency = require("../dependencies/WebAssemblyImportDependency"); + +/** @typedef {import("../Module")} Module */ + +/** @typedef {Object} UsedWasmDependency + * @property {WebAssemblyImportDependency} dependency the dependency + * @property {string} name the export name + * @property {string} module the module name + */ + +const MANGLED_MODULE = "a"; + +/** + * @param {Module} module the module + * @param {boolean} mangle mangle module and export names + * @returns {UsedWasmDependency[]} used dependencies and (mangled) name + */ +const getUsedDependencies = (module, mangle) => { + /** @type {UsedWasmDependency[]} */ + const array = []; + let importIndex = 0; + for (const dep of module.dependencies) { + if (dep instanceof WebAssemblyImportDependency) { + if (dep.description.type === "GlobalType" || dep.module === null) { + continue; + } + + const exportName = dep.name; + // TODO add the following 3 lines when removing of ModuleExport is possible + // const importedModule = dep.module; + // const usedName = importedModule && importedModule.isUsed(exportName); + // if (usedName !== false) { + if (mangle) { + array.push({ + dependency: dep, + name: Template.numberToIdentifer(importIndex++), + module: MANGLED_MODULE + }); + } else { + array.push({ + dependency: dep, + name: exportName, + module: dep.request + }); + } + } + } + return array; +}; + +exports.getUsedDependencies = getUsedDependencies; +exports.MANGLED_MODULE = MANGLED_MODULE; diff --git a/lib/web/FetchCompileWasmMainTemplatePlugin.js b/lib/web/FetchCompileWasmMainTemplatePlugin.js deleted file mode 100644 index e0e52c32cc1..00000000000 --- a/lib/web/FetchCompileWasmMainTemplatePlugin.js +++ /dev/null @@ -1,119 +0,0 @@ -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ -"use strict"; - -const Template = require("../Template"); - -class FetchCompileWasmMainTemplatePlugin { - apply(mainTemplate) { - mainTemplate.hooks.localVars.tap( - "FetchCompileWasmMainTemplatePlugin", - (source, chunk) => { - if (!chunk.hasModuleInGraph(m => m.type.startsWith("webassembly"))) - return source; - return Template.asString([ - source, - "", - "// object to store loaded and loading wasm modules", - "var installedWasmModules = {};" - ]); - } - ); - mainTemplate.hooks.requireEnsure.tap( - "FetchCompileWasmMainTemplatePlugin", - (source, chunk, hash) => { - const webassemblyModuleFilename = - mainTemplate.outputOptions.webassemblyModuleFilename; - const chunkModuleMaps = chunk.getChunkModuleMaps(m => - m.type.startsWith("webassembly") - ); - if (Object.keys(chunkModuleMaps.id).length === 0) return source; - const wasmModuleSrcPath = mainTemplate.getAssetPath( - JSON.stringify(webassemblyModuleFilename), - { - hash: `" + ${mainTemplate.renderCurrentHashCode(hash)} + "`, - hashWithLength: length => - `" + ${mainTemplate.renderCurrentHashCode(hash, length)} + "`, - module: { - id: '" + wasmModuleId + "', - hash: `" + ${JSON.stringify( - chunkModuleMaps.hash - )}[wasmModuleId] + "`, - hashWithLength(length) { - const shortChunkHashMap = Object.create(null); - for (const wasmModuleId of Object.keys(chunkModuleMaps.hash)) { - if (typeof chunkModuleMaps.hash[wasmModuleId] === "string") - shortChunkHashMap[wasmModuleId] = chunkModuleMaps.hash[ - wasmModuleId - ].substr(0, length); - } - return `" + ${JSON.stringify( - shortChunkHashMap - )}[wasmModuleId] + "`; - } - } - } - ); - return Template.asString([ - source, - "", - "// Fetch + compile chunk loading for webassembly", - "", - `var wasmModules = ${JSON.stringify( - chunkModuleMaps.id - )}[chunkId] || [];`, - "", - "wasmModules.forEach(function(wasmModuleId) {", - Template.indent([ - "var installedWasmModuleData = installedWasmModules[wasmModuleId];", - "", - '// a Promise means "currently loading" or "already loaded".', - "promises.push(installedWasmModuleData ||", - Template.indent([ - `(installedWasmModules[wasmModuleId] = fetch(${ - mainTemplate.requireFn - }.p + ${wasmModuleSrcPath}).then(function(response) {`, - Template.indent([ - "if(WebAssembly.compileStreaming) {", - Template.indent([ - "return WebAssembly.compileStreaming(response);" - ]), - "} else {", - Template.indent([ - "return response.arrayBuffer().then(function(bytes) { return WebAssembly.compile(bytes); });" - ]), - "}" - ]), - `}).then(function(module) { ${ - mainTemplate.requireFn - }.w[wasmModuleId] = module; }))` - ]), - ");" - ]), - "});" - ]); - } - ); - mainTemplate.hooks.requireExtensions.tap( - "FetchCompileWasmMainTemplatePlugin", - (source, chunk) => { - if (!chunk.hasModuleInGraph(m => m.type.startsWith("webassembly"))) - return source; - return Template.asString([ - source, - "", - "// object with all compiled WebAssembly.Modules", - `${mainTemplate.requireFn}.w = {};` - ]); - } - ); - mainTemplate.hooks.hash.tap("FetchCompileWasmMainTemplatePlugin", hash => { - hash.update("FetchCompileWasmMainTemplatePlugin"); - hash.update("1"); - hash.update(`${mainTemplate.outputOptions.webassemblyModuleFilename}`); - }); - } -} -module.exports = FetchCompileWasmMainTemplatePlugin; diff --git a/lib/web/FetchCompileWasmTemplatePlugin.js b/lib/web/FetchCompileWasmTemplatePlugin.js index 07263faa0c6..025921fcf85 100644 --- a/lib/web/FetchCompileWasmTemplatePlugin.js +++ b/lib/web/FetchCompileWasmTemplatePlugin.js @@ -4,20 +4,31 @@ */ "use strict"; -const FetchCompileWasmMainTemplatePlugin = require("./FetchCompileWasmMainTemplatePlugin"); -const WasmModuleTemplatePlugin = require("../wasm/WasmModuleTemplatePlugin"); +const WasmMainTemplatePlugin = require("../wasm/WasmMainTemplatePlugin"); class FetchCompileWasmTemplatePlugin { + constructor(options) { + this.options = options || {}; + } + apply(compiler) { compiler.hooks.thisCompilation.tap( "FetchCompileWasmTemplatePlugin", compilation => { - new FetchCompileWasmMainTemplatePlugin().apply( - compilation.mainTemplate - ); - new WasmModuleTemplatePlugin().apply( - compilation.moduleTemplates.javascript + const mainTemplate = compilation.mainTemplate; + const generateLoadBinaryCode = path => + `fetch(${mainTemplate.requireFn}.p + ${path})`; + + const plugin = new WasmMainTemplatePlugin( + Object.assign( + { + generateLoadBinaryCode, + supportsStreaming: true + }, + this.options + ) ); + plugin.apply(mainTemplate); } ); } diff --git a/lib/web/JsonpChunkTemplatePlugin.js b/lib/web/JsonpChunkTemplatePlugin.js index 212e60dd00c..bd2bdcb2684 100644 --- a/lib/web/JsonpChunkTemplatePlugin.js +++ b/lib/web/JsonpChunkTemplatePlugin.js @@ -14,6 +14,7 @@ class JsonpChunkTemplatePlugin { const jsonpFunction = chunkTemplate.outputOptions.jsonpFunction; const globalObject = chunkTemplate.outputOptions.globalObject; const source = new ConcatSource(); + const prefetchChunks = chunk.getChildIdsByOrders().prefetch; source.add( `(${globalObject}[${JSON.stringify( jsonpFunction @@ -31,6 +32,12 @@ class JsonpChunkTemplatePlugin { ); if (entries.length > 0) { source.add(`,${JSON.stringify(entries)}`); + } else if (prefetchChunks && prefetchChunks.length) { + source.add(`,0`); + } + + if (prefetchChunks && prefetchChunks.length) { + source.add(`,${JSON.stringify(prefetchChunks)}`); } source.add("])"); return source; diff --git a/lib/web/JsonpMainTemplate.runtime.js b/lib/web/JsonpMainTemplate.runtime.js index 359cfeadf34..d8b642b0861 100644 --- a/lib/web/JsonpMainTemplate.runtime.js +++ b/lib/web/JsonpMainTemplate.runtime.js @@ -24,8 +24,9 @@ module.exports = function() { function hotDownloadManifest(requestTimeout) { requestTimeout = requestTimeout || 10000; return new Promise(function(resolve, reject) { - if (typeof XMLHttpRequest === "undefined") + if (typeof XMLHttpRequest === "undefined") { return reject(new Error("No browser support")); + } try { var request = new XMLHttpRequest(); var requestPath = $require$.p + $hotMainFilename$; diff --git a/lib/web/JsonpMainTemplatePlugin.js b/lib/web/JsonpMainTemplatePlugin.js index c13216572be..e843a270a44 100644 --- a/lib/web/JsonpMainTemplatePlugin.js +++ b/lib/web/JsonpMainTemplatePlugin.js @@ -28,23 +28,87 @@ class JsonpMainTemplatePlugin { } return false; }; - // TODO refactor this - if (!mainTemplate.hooks.jsonpScript) { - mainTemplate.hooks.jsonpScript = new SyncWaterfallHook([ - "source", - "chunk", - "hash" - ]); - } + const needPrefetchingCode = chunk => { + const allPrefetchChunks = chunk.getChildIdsByOrdersMap(true).prefetch; + return allPrefetchChunks && Object.keys(allPrefetchChunks).length; + }; + + // TODO webpack 5, no adding to .hooks, use WeakMap and static methods + ["jsonpScript", "linkPreload", "linkPrefetch"].forEach(hook => { + if (!mainTemplate.hooks[hook]) { + mainTemplate.hooks[hook] = new SyncWaterfallHook([ + "source", + "chunk", + "hash" + ]); + } + }); + const getScriptSrcPath = (hash, chunk, chunkIdExpression) => { + const chunkFilename = mainTemplate.outputOptions.chunkFilename; + const chunkMaps = chunk.getChunkMaps(); + return mainTemplate.getAssetPath(JSON.stringify(chunkFilename), { + hash: `" + ${mainTemplate.renderCurrentHashCode(hash)} + "`, + hashWithLength: length => + `" + ${mainTemplate.renderCurrentHashCode(hash, length)} + "`, + chunk: { + id: `" + ${chunkIdExpression} + "`, + hash: `" + ${JSON.stringify( + chunkMaps.hash + )}[${chunkIdExpression}] + "`, + hashWithLength(length) { + const shortChunkHashMap = Object.create(null); + for (const chunkId of Object.keys(chunkMaps.hash)) { + if (typeof chunkMaps.hash[chunkId] === "string") { + shortChunkHashMap[chunkId] = chunkMaps.hash[chunkId].substr( + 0, + length + ); + } + } + return `" + ${JSON.stringify( + shortChunkHashMap + )}[${chunkIdExpression}] + "`; + }, + name: `" + (${JSON.stringify( + chunkMaps.name + )}[${chunkIdExpression}]||${chunkIdExpression}) + "`, + contentHash: { + javascript: `" + ${JSON.stringify( + chunkMaps.contentHash.javascript + )}[${chunkIdExpression}] + "` + }, + contentHashWithLength: { + javascript: length => { + const shortContentHashMap = {}; + const contentHash = chunkMaps.contentHash.javascript; + for (const chunkId of Object.keys(contentHash)) { + if (typeof contentHash[chunkId] === "string") { + shortContentHashMap[chunkId] = contentHash[chunkId].substr( + 0, + length + ); + } + } + return `" + ${JSON.stringify( + shortContentHashMap + )}[${chunkIdExpression}] + "`; + } + } + }, + contentHashType: "javascript" + }); + }; mainTemplate.hooks.localVars.tap( "JsonpMainTemplatePlugin", - (source, chunk) => { + (source, chunk, hash) => { + const extraCode = []; if (needChunkLoadingCode(chunk)) { - return Template.asString([ - source, + extraCode.push( "", "// object to store loaded and loading chunks", + "// undefined = chunk not loaded, null = chunk preloaded/prefetched", + "// Promise = chunk loading, 0 = chunk loaded", "var installedChunks = {", Template.indent( chunk.ids.map(id => `${JSON.stringify(id)}: 0`).join(",\n") @@ -52,70 +116,39 @@ class JsonpMainTemplatePlugin { "};", "", needEntryDeferringCode(chunk) ? "var deferredModules = [];" : "" - ]); + ); } - return source; + if (needChunkOnDemandLoadingCode(chunk)) { + extraCode.push( + "", + "// script path function", + "function jsonpScriptSrc(chunkId) {", + Template.indent([ + `return ${mainTemplate.requireFn}.p + ${getScriptSrcPath( + hash, + chunk, + "chunkId" + )}` + ]), + "}" + ); + } + if (extraCode.length === 0) return source; + return Template.asString([source, ...extraCode]); } ); + mainTemplate.hooks.jsonpScript.tap( "JsonpMainTemplatePlugin", (_, chunk, hash) => { - const chunkFilename = mainTemplate.outputOptions.chunkFilename; - const chunkMaps = chunk.getChunkMaps(); const crossOriginLoading = mainTemplate.outputOptions.crossOriginLoading; const chunkLoadTimeout = mainTemplate.outputOptions.chunkLoadTimeout; const jsonpScriptType = mainTemplate.outputOptions.jsonpScriptType; - const scriptSrcPath = mainTemplate.getAssetPath( - JSON.stringify(chunkFilename), - { - hash: `" + ${mainTemplate.renderCurrentHashCode(hash)} + "`, - hashWithLength: length => - `" + ${mainTemplate.renderCurrentHashCode(hash, length)} + "`, - chunk: { - id: '" + chunkId + "', - hash: `" + ${JSON.stringify(chunkMaps.hash)}[chunkId] + "`, - hashWithLength(length) { - const shortChunkHashMap = Object.create(null); - for (const chunkId of Object.keys(chunkMaps.hash)) { - if (typeof chunkMaps.hash[chunkId] === "string") - shortChunkHashMap[chunkId] = chunkMaps.hash[chunkId].substr( - 0, - length - ); - } - return `" + ${JSON.stringify(shortChunkHashMap)}[chunkId] + "`; - }, - name: `" + (${JSON.stringify( - chunkMaps.name - )}[chunkId]||chunkId) + "`, - contentHash: { - javascript: `" + ${JSON.stringify( - chunkMaps.contentHash.javascript - )}[chunkId] + "` - }, - contentHashWithLength: { - javascript: length => { - const shortContentHashMap = {}; - const contentHash = chunkMaps.contentHash.javascript; - for (const chunkId of Object.keys(contentHash)) { - if (typeof contentHash[chunkId] === "string") { - shortContentHashMap[chunkId] = contentHash[ - chunkId - ].substr(0, length); - } - } - return `" + ${JSON.stringify( - shortContentHashMap - )}[chunkId] + "`; - } - } - }, - contentHashType: "javascript" - } - ); + return Template.asString([ "var script = document.createElement('script');", + "var onScriptComplete;", jsonpScriptType ? `script.type = ${JSON.stringify(jsonpScriptType)};` : "", @@ -129,14 +162,8 @@ class JsonpMainTemplatePlugin { `script.setAttribute("nonce", ${mainTemplate.requireFn}.nc);` ), "}", - `script.src = ${mainTemplate.requireFn}.p + ${scriptSrcPath};`, - "var timeout = setTimeout(function(){", - Template.indent([ - "onScriptComplete({ type: 'timeout', target: script });" - ]), - `}, ${chunkLoadTimeout});`, - "script.onerror = script.onload = onScriptComplete;", - "function onScriptComplete(event) {", + "script.src = jsonpScriptSrc(chunkId);", + "onScriptComplete = function (event) {", Template.indent([ "// avoid mem leaks in IE.", "script.onerror = script.onload = null;", @@ -158,12 +185,67 @@ class JsonpMainTemplatePlugin { ]), "}" ]), - "};" + "};", + "var timeout = setTimeout(function(){", + Template.indent([ + "onScriptComplete({ type: 'timeout', target: script });" + ]), + `}, ${chunkLoadTimeout});`, + "script.onerror = script.onload = onScriptComplete;" ]); } ); - mainTemplate.hooks.requireEnsure.tap( + mainTemplate.hooks.linkPreload.tap( "JsonpMainTemplatePlugin", + (_, chunk, hash) => { + const crossOriginLoading = + mainTemplate.outputOptions.crossOriginLoading; + const jsonpScriptType = mainTemplate.outputOptions.jsonpScriptType; + + return Template.asString([ + "var link = document.createElement('link');", + jsonpScriptType + ? `link.type = ${JSON.stringify(jsonpScriptType)};` + : "", + "link.charset = 'utf-8';", + crossOriginLoading + ? `link.crossOrigin = ${JSON.stringify(crossOriginLoading)};` + : "", + `if (${mainTemplate.requireFn}.nc) {`, + Template.indent( + `link.setAttribute("nonce", ${mainTemplate.requireFn}.nc);` + ), + "}", + 'link.rel = "preload";', + 'link.as = "script";', + "link.href = jsonpScriptSrc(chunkId);" + ]); + } + ); + mainTemplate.hooks.linkPrefetch.tap( + "JsonpMainTemplatePlugin", + (_, chunk, hash) => { + const crossOriginLoading = + mainTemplate.outputOptions.crossOriginLoading; + + return Template.asString([ + "var link = document.createElement('link');", + crossOriginLoading + ? `link.crossOrigin = ${JSON.stringify(crossOriginLoading)};` + : "", + `if (${mainTemplate.requireFn}.nc) {`, + Template.indent( + `link.setAttribute("nonce", ${mainTemplate.requireFn}.nc);` + ), + "}", + 'link.rel = "prefetch";', + 'link.as = "script";', + "link.href = jsonpScriptSrc(chunkId);" + ]); + } + ); + mainTemplate.hooks.requireEnsure.tap( + "JsonpMainTemplatePlugin load", (source, chunk, hash) => { return Template.asString([ source, @@ -198,6 +280,41 @@ class JsonpMainTemplatePlugin { ]); } ); + mainTemplate.hooks.requireEnsure.tap( + { + name: "JsonpMainTemplatePlugin preload", + stage: 10 + }, + (source, chunk, hash) => { + const chunkMap = chunk.getChildIdsByOrdersMap().preload; + if (!chunkMap || Object.keys(chunkMap).length === 0) return source; + return Template.asString([ + source, + "", + "// chunk preloadng for javascript", + "", + `var chunkPreloadMap = ${JSON.stringify(chunkMap, null, "\t")};`, + "", + "var chunkPreloadData = chunkPreloadMap[chunkId];", + "if(chunkPreloadData) {", + Template.indent([ + "var head = document.getElementsByTagName('head')[0];", + "chunkPreloadData.forEach(function(chunkId) {", + Template.indent([ + "if(installedChunks[chunkId] === undefined) {", + Template.indent([ + "installedChunks[chunkId] = null;", + mainTemplate.hooks.linkPreload.call("", chunk, hash), + "head.appendChild(link);" + ]), + "}" + ]), + "});" + ]), + "}" + ]); + } + ); mainTemplate.hooks.requireExtensions.tap( "JsonpMainTemplatePlugin", (source, chunk) => { @@ -218,6 +335,7 @@ class JsonpMainTemplatePlugin { (source, chunk, hash) => { if (needChunkLoadingCode(chunk)) { const withDefer = needEntryDeferringCode(chunk); + const withPrefetch = needPrefetchingCode(chunk); return Template.asString([ source, "", @@ -227,6 +345,7 @@ class JsonpMainTemplatePlugin { "var chunkIds = data[0];", "var moreModules = data[1];", withDefer ? "var executeModules = data[2];" : "", + withPrefetch ? "var prefetchChunks = data[3] || [];" : "", '// add "moreModules" to the modules object,', '// then flag all "chunkIds" as loaded and fire callback', "var moduleId, chunkId, i = 0, resolves = [];", @@ -254,6 +373,23 @@ class JsonpMainTemplatePlugin { ]), "}", "if(parentJsonpFunction) parentJsonpFunction(data);", + withPrefetch + ? Template.asString([ + "// chunk prefetching for javascript", + "var head = document.getElementsByTagName('head')[0];", + "prefetchChunks.forEach(function(chunkId) {", + Template.indent([ + "if(installedChunks[chunkId] === undefined) {", + Template.indent([ + "installedChunks[chunkId] = null;", + mainTemplate.hooks.linkPrefetch.call("", chunk, hash), + "head.appendChild(link);" + ]), + "}" + ]), + "});" + ]) + : "", "while(resolves.length) {", Template.indent("resolves.shift()();"), "}", @@ -328,6 +464,25 @@ class JsonpMainTemplatePlugin { return source; } ); + mainTemplate.hooks.beforeStartup.tap( + "JsonpMainTemplatePlugin", + (source, chunk, hash) => { + const prefetchChunks = chunk.getChildIdsByOrders().prefetch; + if ( + needChunkLoadingCode(chunk) && + prefetchChunks && + prefetchChunks.length + ) { + return Template.asString([ + source, + `webpackJsonpCallback([[], {}, 0, ${JSON.stringify( + prefetchChunks + )}]);` + ]); + } + return source; + } + ); mainTemplate.hooks.startup.tap( "JsonpMainTemplatePlugin", (source, chunk, hash) => { diff --git a/lib/webpack.js b/lib/webpack.js index 65c0de44ed8..facfebf6c08 100644 --- a/lib/webpack.js +++ b/lib/webpack.js @@ -44,8 +44,9 @@ const webpack = (options, callback) => { throw new Error("Invalid argument: options"); } if (callback) { - if (typeof callback !== "function") + if (typeof callback !== "function") { throw new Error("Invalid argument: callback"); + } if ( options.watch === true || (Array.isArray(options) && options.some(o => o.watch)) diff --git a/lib/webworker/WebWorkerMainTemplate.runtime.js b/lib/webworker/WebWorkerMainTemplate.runtime.js index 9eab2f1bc00..8c63f7729e3 100644 --- a/lib/webworker/WebWorkerMainTemplate.runtime.js +++ b/lib/webworker/WebWorkerMainTemplate.runtime.js @@ -19,8 +19,9 @@ module.exports = function() { function hotDownloadManifest(requestTimeout) { requestTimeout = requestTimeout || 10000; return new Promise(function(resolve, reject) { - if (typeof XMLHttpRequest === "undefined") + if (typeof XMLHttpRequest === "undefined") { return reject(new Error("No browser support")); + } try { var request = new XMLHttpRequest(); var requestPath = $require$.p + $hotMainFilename$; diff --git a/open-bot.yaml b/open-bot.yaml index 46f693cba16..775f2aa98cc 100644 --- a/open-bot.yaml +++ b/open-bot.yaml @@ -59,7 +59,7 @@ rules: -# Report specific error message if mocha for integration tests fails +# Report specific error message if jest for basic tests fails - filters: ensure: value: "{{report_ci}}" @@ -71,33 +71,59 @@ rules: state: "failed" allow_failure: false config: - env: JOB_PART=integration + env: JOB_PART=basic fetch: travis_job.log string_cleanup: id: logResult value: "{{{fetch}}}" remove: - - "^[\\s\\S]+?\\d+\\s+pending\n+" - - "npm ERR!.*\n" - - "\n*=============================================================================\n[\\s\\S]*" + - ".\\[2K.\\[1G|.\\[999D.\\[K" + - "^[\\s\\S]+?\\$ yarn travis:\\$JOB_PART.*\n" + - "\\$ node --max-old-space-size=4096.*\n" + - ".+rimraf coverage" + - "yarn run.+\n" + - "\\(node:\\d+\\) (\\[DEP0005\\]|DeprecationWarning).+\n" + - "\\$ yarn (cover|test):.+\n" + - "Ran all test suites.\n[\\s\\S]*" + - "error Command failed with exit code \\d+.\n" + - "info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.\n" + - "Force exiting Jest\n\nHave you considered.+" + - "=============================== Coverage summary ===============================[\\s\\S]+?================================================================================" + - " *PASS *test/.*\n" + - "^\\s+\n|\\s+$" string_cleanup_1: id: firstError value: "{{{logResult}}}" remove: - - "\\s2\\)\\s[\\s\\S]*" + - "\n\n( ●| FAIL)[\\s\\S]*" + - "Test Suites:[\\s\\S]*" + - "\\s+$" string_cleanup_2: id: remainingErrors value: "{{{logResult}}}" remove: - - "^[\\s\\S]+?(?=\\s2\\)\\s)" + - "^[\\s\\S]+?(?=\n\n( ●| FAIL)|$)" + - "^\n+" + - "Test Suites:[\\s\\S]*" + - "\\s+$" + string_cleanup_3: + id: summary + value: "{{{logResult}}}" + remove: + - "^[\\s\\S]+?(?=Test Suites:)" + - "\\s+$" actions: comment: identifier: "ci-result" message: |- + The basic integration tests failed. + @{{commit.author.login}} Please review the following output log for errors: + ```text {{{firstError}}} ``` + {{#if remainingErrors}}
Show remaining errors @@ -105,6 +131,11 @@ rules: {{{remainingErrors}}} ```
+ {{/if}} + + ```text + {{{summary}}} + ``` See [complete report here]({{status.target_url}}). set: @@ -113,7 +144,7 @@ rules: -# Report specific error message if mocha for unit tests fails +# Report specific error message if jest for integration tests fails - filters: ensure: value: "{{report_ci}}" @@ -125,26 +156,72 @@ rules: state: "failed" allow_failure: false config: - env: JOB_PART=unit + env: JOB_PART=integration fetch: travis_job.log string_cleanup: id: logResult value: "{{{fetch}}}" remove: - - "^[\\s\\S]+?\\d+\\s+pending\n+" - - "npm ERR!.*\n" - - "\n*=============================================================================\n[\\s\\S]*" + - ".\\[2K.\\[1G|.\\[999D.\\[K" + - "^[\\s\\S]+?\\$ yarn travis:\\$JOB_PART.*\n" + - "\\$ node --max-old-space-size=4096.*\n" + - ".+rimraf coverage" + - "yarn run.+\n" + - "\\(node:\\d+\\) (\\[DEP0005\\]|DeprecationWarning).+\n" + - "\\$ yarn (cover|test):.+\n" + - "The command \"yarn travis:\\$JOB_PART\" exited[\\s\\S]*" + - "Ran all test suites.+\n" + - "error Command failed with exit code \\d+.\n" + - "info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.\n" + - "Force exiting Jest\n\nHave you considered.+" + - "=============================== Coverage summary ===============================[\\s\\S]+?================================================================================" + - " *PASS *test/.*\n" + - "^\\s+\n|\\s+$" + string_cleanup_1: + id: firstError + value: "{{{logResult}}}" + remove: + - "\n\n( ●| FAIL)[\\s\\S]*" + - "Test Suites:[\\s\\S]*" + - "\\s+$" + string_cleanup_2: + id: remainingErrors + value: "{{{logResult}}}" + remove: + - "^[\\s\\S]+?(?=\n\n( ●| FAIL)|$)" + - "^\n+" + - "Test Suites:[\\s\\S]*" + - "\\s+$" + string_cleanup_3: + id: summary + value: "{{{logResult}}}" + remove: + - "^[\\s\\S]+?(?=Test Suites:)" + - "\\s+$" actions: comment: identifier: "ci-result" message: |- + The basic integration tests succeeded, but the full suite failed. + @{{commit.author.login}} Please review the following output log for errors: - ``` text - {{{logResult}}} + ```text + {{{firstError}}} ``` + {{#if remainingErrors}} +
+ Show remaining errors - Instead of updating these (outdated?) unit tests, you can choose to delete them and add integration tests instead. That would be great. + ```text + {{{remainingErrors}}} + ``` +
+ {{/if}} + + ```text + {{{summary}}} + ``` See [complete report here]({{status.target_url}}). set: @@ -153,7 +230,7 @@ rules: -# Report specific error message if linting fails +# Report specific error message if jest for unit tests or liniting fails - filters: ensure: value: "{{report_ci}}" @@ -163,26 +240,43 @@ rules: context: "continuous-integration/travis-ci/pr" travis_job: state: "failed" + allow_failure: false config: - env: JOB_PART=lint + env: JOB_PART=lint-unit fetch: travis_job.log string_cleanup: id: logResult value: "{{{fetch}}}" remove: - - "^[\\s\\S]+?npm run travis:\\$JOB_PART\n*" - - "npm ERR!.*\n" - - "\n*The command \"npm run travis:\\$JOB_PART\" exited [\\s\\S]*" + - ".\\[2K.\\[1G|.\\[999D.\\[K" + - "^[\\s\\S]+?\\$ yarn travis:\\$JOB_PART.*\n" + - "\\$ node --max-old-space-size=4096.*\n" + - ".+rimraf coverage" + - "yarn run.+\n" + - "\\(node:\\d+\\) (\\[DEP0005\\]|DeprecationWarning).+\n" + - "\\$ yarn (unit|lint).+\n" + - "The command \"yarn travis:\\$JOB_PART\" exited[\\s\\S]*" + - "Ran all test suites.+\n" + - "error Command failed with exit code \\d+.\n" + - "info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.\n" + - "Force exiting Jest\n\nHave you considered.+" + - "=============================== Coverage summary ===============================[\\s\\S]+?================================================================================" + - " *PASS *test/.*\n" + - "^\\s+\n|\\s+$" actions: comment: identifier: "ci-result" message: |- - @{{commit.author.login}} The tests look fine, but there are code style issue in your Pull Request. Please review the following: + The integration tests look fine, but there are code style issues or unit test failures in the Pull Request. + + @{{commit.author.login}} Please review the following output log for errors: ``` text {{{logResult}}} ``` + If the unit tests are outdated, you can choose to delete them and add integration tests instead. That would be great. + See [complete report here]({{status.target_url}}). set: id: report_ci @@ -397,18 +491,6 @@ rules: -# add small label to small pull requests -- filters: - open: true - pull_request: - additions: "<= 10" - deletions: "<= 10" - changed_files: "<= 2" - actions: - label: "PR: small" - - - # add non-master label to pull request to other branch - filters: open: true @@ -517,10 +599,57 @@ rules: If you think this is still a valid issue, please file a new issue with additional information. +# Add action actions box to each pull request +- filters: + pull_request: true + open: true + not: + comment: + matching: admin-actions + author: webpack-bot + actions: + comment: + identifier: admin-actions + message: |- + *For maintainers only:* + + * [ ] This need to be documented (issue in webpack/webpack.js.org will be filed when merged) + + +# When a pull request need to be documented, create an issue in webpack/webpack.js.org when merged +- filters: + pull_request: + merged: true + comment: + author: webpack-bot + matching: "\\* \\[x\\] " + not: + comment_1: + author: webpack-bot + matching: admin-action-document-executed + actions: + new_issue: + target: webpack/webpack.js.org + title: "Document webpack change: {{{pull_request.title}}}" + body: |- + + + *A pull request by @{{pull_request.user.login}} was merged and maintainers requested a documentation change.* + + See pull request: {{{pull_request.html_url}}} + + --- + + {{{pull_request.body}}} + comment: + identifier: admin-action-document-executed + message: |- + I've created an issue to document this in webpack/webpack.js.org. + -# Check issues every week +# Check open issues and pull requests every day - filters: open: true actions: diff --git a/package.json b/package.json index 9c948466320..71ba1ff74a7 100644 --- a/package.json +++ b/package.json @@ -1,17 +1,23 @@ { "name": "webpack", - "version": "4.5.0", + "version": "4.12.0", "author": "Tobias Koppers @sokra", "description": "Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.", "license": "MIT", "dependencies": { - "acorn": "^5.0.0", + "@webassemblyjs/ast": "1.5.12", + "@webassemblyjs/helper-module-context": "1.5.12", + "@webassemblyjs/wasm-edit": "1.5.12", + "@webassemblyjs/wasm-opt": "1.5.12", + "@webassemblyjs/wasm-parser": "1.5.12", + "acorn": "^5.6.2", "acorn-dynamic-import": "^3.0.0", "ajv": "^6.1.0", "ajv-keywords": "^3.1.0", - "chrome-trace-event": "^0.1.1", + "chrome-trace-event": "^1.0.0", "enhanced-resolve": "^4.0.0", "eslint-scope": "^3.7.1", + "json-parse-better-errors": "^1.0.2", "loader-runner": "^2.3.0", "loader-utils": "^1.1.0", "memory-fs": "~0.4.1", @@ -19,7 +25,7 @@ "mkdirp": "~0.5.0", "neo-async": "^2.5.0", "node-libs-browser": "^2.0.0", - "schema-utils": "^0.4.2", + "schema-utils": "^0.4.4", "tapable": "^1.0.0", "uglifyjs-webpack-plugin": "^1.2.4", "watchpack": "^1.5.0", @@ -38,6 +44,7 @@ "es6-promise-polyfill": "^1.1.1", "eslint": "^4.19.1", "eslint-config-prettier": "^2.9.0", + "eslint-plugin-jest": "^21.17.0", "eslint-plugin-node": "^6.0.1", "eslint-plugin-prettier": "^2.6.0", "express": "~4.13.1", @@ -47,28 +54,29 @@ "istanbul": "^0.4.5", "jade": "^1.11.0", "jade-loader": "~0.8.0", + "jest": "^23.0.1", + "jest-silent-reporter": "^0.0.5", "json-loader": "^0.5.7", "less": "^2.5.1", "less-loader": "^4.0.3", "lodash": "^4.17.4", - "mocha": "^3.2.0", - "mocha-lcov-reporter": "^1.0.0", - "prettier": "^1.11.1", + "prettier": "^1.13.5", + "pug": "^2.0.3", + "pug-loader": "^2.4.0", "raw-loader": "~0.5.0", "react": "^15.2.1", "react-dom": "^15.2.1", "rimraf": "^2.6.2", "script-loader": "~0.7.0", - "should": "^11.1.1", "simple-git": "^1.65.0", - "sinon": "^2.3.2", "style-loader": "^0.19.1", - "typescript": "^2.9.0-dev.20180412", + "typescript": "^2.9.0-dev.20180518", "url-loader": "^0.6.2", "val-loader": "^1.0.2", "vm-browserify": "~0.0.0", + "wast-loader": "^1.5.5", "webpack-dev-middleware": "^1.9.0", - "worker-loader": "^1.1.0", + "worker-loader": "^1.1.1", "xxhashjs": "^0.2.1" }, "engines": { @@ -88,39 +96,82 @@ "buildin/", "hot/", "web_modules/", - "schemas/" + "schemas/", + "SECURITY.md" ], "scripts": { "setup": "node ./setup/setup.js", - "test": "npm run mocha", - "mocha": "mocha test/*.test.js test/*.unittest.js --max-old-space-size=4096 --harmony --trace-deprecation", - "test:integration": "mocha test/*.test.js --max-old-space-size=4096 --harmony --trace-deprecation", - "test:unit": "mocha test/*.unittest.js --max-old-space-size=4096 --harmony --trace-deprecation", - "travis:integration": "yarn cover:init && yarn cover:integration && yarn cover:report-min", - "travis:unit": "yarn cover:init && yarn cover:unit && yarn cover:report-min", - "travis:lint": "yarn lint", - "travis:benchmark": "yarn benchmark", - "appveyor:integration": "yarn cover:init && yarn cover:integration && yarn cover:report-min", - "appveyor:unit": "yarn cover:init && yarn cover:unit && yarn cover:report-min", - "appveyor:benchmark": "yarn benchmark", - "circleci:test": "node node_modules/mocha/bin/mocha --max-old-space-size=4096 --harmony --trace-deprecation test/*.test.js test/*.unittest.js", + "test": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest", + "test:integration": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"/test/*.test.js\"", + "test:basic": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"/test/{TestCasesNormal,StatsTestCases,ConfigTestCases}.test.js\"", + "test:unit": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"/test/*.unittest.js\"", + "travis:integration": "yarn cover:init && yarn cover:integration \"test/((?!TestCases)|TestCasesD)\" --ci $JEST && mv coverage/coverage-final.json coverage/coverage-final-1.json && yarn cover:integration \"test/TestCases(?!D)\" --ci $JEST && mv coverage/coverage-final.json coverage/coverage-final-2.json", + "travis:basic": "yarn test:basic --ci $JEST", + "travis:lint-unit": "yarn lint && yarn cover:init && yarn cover:unit --ci $JEST", + "travis:benchmark": "yarn benchmark --ci", + "appveyor:integration": "yarn cover:init && yarn cover:integration \"test/((?!TestCases)|TestCasesD)\" --ci %JEST% && move coverage\\coverage-final.json coverage\\coverage-final-1.json && yarn cover:integration \"test/TestCases(?!D)\" --ci %JEST% && move coverage\\coverage-final.json coverage\\coverage-final-2.json", + "appveyor:unit": "yarn cover:init && yarn cover:unit --ci %JEST%", + "appveyor:benchmark": "yarn benchmark --ci", + "circleci:test": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --ci", "circleci:lint": "yarn lint", "build:examples": "cd examples && node buildAll.js", "pretest": "yarn lint", "prelint": "yarn setup", "lint": "yarn code-lint && yarn schema-lint && yarn type-lint", - "code-lint": "eslint setup lib bin hot buildin \"test/*.js\" \"test/**/webpack.config.js\" \"examples/**/webpack.config.js\" \"schemas/**/*.js\"", + "code-lint": "eslint --cache setup lib bin hot buildin benchmark \"test/*.js\" \"test/**/webpack.config.js\" \"examples/**/webpack.config.js\" \"schemas/**/*.js\"", "type-lint": "tsc --pretty", "fix": "yarn code-lint --fix", - "pretty": "prettier \"setup/**/*.js\" \"lib/**/*.js\" \"bin/*.js\" \"hot/*.js\" \"buildin/*.js\" \"test/*.js\" \"test/**/webpack.config.js\" \"examples/**/webpack.config.js\" \"schemas/**/*.js\" \"declarations.d.ts\" --write", - "schema-lint": "mocha test/*.lint.js --opts test/lint-mocha.opts", - "benchmark": "mocha --max-old-space-size=4096 --harmony --trace-deprecation test/*.benchmark.js -R spec", + "pretty": "prettier --write \"setup/**/*.js\" \"lib/**/*.js\" \"bin/*.js\" \"hot/*.js\" \"buildin/*.js\" \"benchmark/**/*.js\" \"test/*.js\" \"test/**/webpack.config.js\" \"examples/**/webpack.config.js\" \"schemas/**/*.js\" \"declarations.d.ts\"", + "schema-lint": "node --max-old-space-size=4096 node_modules/jest-cli/bin/jest --testMatch \"/test/*.lint.js\" --no-verbose", + "benchmark": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"/test/*.benchmark.js\" --runInBand", "cover": "yarn cover:init && yarn cover:all && yarn cover:report", "cover:init": "rimraf coverage", - "cover:all": "node --max-old-space-size=4096 --harmony --trace-deprecation ./node_modules/istanbul/lib/cli.js cover --report none node_modules/mocha/bin/_mocha -- test/*.test.js test/*.unittest.js", - "cover:integration": "node --max-old-space-size=4096 --harmony --trace-deprecation ./node_modules/istanbul/lib/cli.js cover --report none node_modules/mocha/bin/_mocha -- test/*.test.js", - "cover:unit": "node --max-old-space-size=4096 --harmony --trace-deprecation ./node_modules/istanbul/lib/cli.js cover --report none node_modules/mocha/bin/_mocha -- test/*.unittest.js", - "cover:report": "istanbul report", - "cover:report-min": "istanbul report --report lcovonly" + "cover:all": "node --max-old-space-size=4096 node_modules/jest-cli/bin/jest --coverage", + "cover:integration": "node --max-old-space-size=4096 node_modules/jest-cli/bin/jest --testMatch \"/test/*.test.js\" --coverage", + "cover:unit": "node --max-old-space-size=4096 node_modules/jest-cli/bin/jest --testMatch \"/test/*.unittest.js\" --coverage", + "cover:report": "istanbul report" + }, + "jest": { + "forceExit": true, + "setupTestFrameworkScriptFile": "/test/setupTestFramework.js", + "testMatch": [ + "/test/*.test.js", + "/test/*.unittest.js" + ], + "watchPathIgnorePatterns": [ + "/node_modules/webpack/node_modules/", + "/test/js/", + "/test/browsertest/js/", + "/test/fixtures/temp-cache-fixture/", + "/test/fixtures/temp-", + "/benchmark/", + "/examples/*/dist", + "/coverage/", + "/.eslintcache/" + ], + "modulePathIgnorePatterns": [ + "/node_modules/webpack/node_modules/", + "/test/js/", + "/test/browsertest/js/", + "/test/fixtures/temp-cache-fixture/", + "/test/fixtures/temp-", + "/benchmark/", + "/examples/*/dist", + "/coverage/", + "/.eslintcache/" + ], + "transformIgnorePatterns": [ + "/" + ], + "coverageDirectory": "/coverage", + "coveragePathIgnorePatterns": [ + "\\.runtime\\.js$", + "/test/", + "/schemas/" + ], + "testEnvironment": "node", + "coverageReporters": [ + "json" + ] } } diff --git a/schemas/WebpackOptions.json b/schemas/WebpackOptions.json index 2634ed3eabb..ed3dfa894c9 100644 --- a/schemas/WebpackOptions.json +++ b/schemas/WebpackOptions.json @@ -492,7 +492,14 @@ "properties": { "root": { "description": "Name of the property exposed globally by a UMD library", - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/common.arrayOfStringValues" + } + ] }, "amd": { "description": "Name of the exposed AMD library in the UMD", @@ -1535,6 +1542,14 @@ "description": "Avoid emitting assets when errors occur", "type": "boolean" }, + "checkWasmTypes": { + "description": "Check for incompatible wasm types when importing/exporting from/to ESM", + "type": "boolean" + }, + "mangleWasmImports": { + "description": "Reduce size of WASM by changing imports to shorter strings.", + "type": "boolean" + }, "namedModules": { "description": "Use readable module identifiers for better debugging", "type": "boolean" @@ -1672,6 +1687,10 @@ } ] }, + "serve": { + "description": "Options for webpack-serve", + "type": "object" + }, "stats": { "description": "Used by the webpack CLI program to pass stats options.", "anyOf": [ @@ -1853,6 +1872,10 @@ "type": "boolean", "description": "Display the entry points with the corresponding bundles" }, + "chunkGroups": { + "type": "boolean", + "description": "Display all chunk groups with the corresponding bundles" + }, "errorDetails": { "type": "boolean", "description": "add details to errors (like resolving log)" diff --git a/schemas/plugins/BannerPlugin.json b/schemas/plugins/BannerPlugin.json index f2e50213217..87e47903611 100644 --- a/schemas/plugins/BannerPlugin.json +++ b/schemas/plugins/BannerPlugin.json @@ -39,8 +39,15 @@ ], "properties": { "banner": { - "description": "The banner as string, it will be wrapped in a comment", - "type": "string" + "description": "Specifies the banner", + "anyOf": [ + { + "instanceof": "Function" + }, + { + "type": "string" + } + ] }, "raw": { "description": "If true, banner will not be wrapped in a comment", @@ -76,6 +83,10 @@ } } }, + { + "description": "The banner as function, it will be wrapped in a comment", + "instanceof": "Function" + }, { "description": "The banner as string, it will be wrapped in a comment", "minLength": 1, diff --git a/schemas/plugins/DllPlugin.json b/schemas/plugins/DllPlugin.json index 20c47588d30..940da62f155 100644 --- a/schemas/plugins/DllPlugin.json +++ b/schemas/plugins/DllPlugin.json @@ -23,6 +23,10 @@ "description": "Absolute path to the manifest json file (output)", "minLength": 1, "type": "string" + }, + "entryOnly": { + "description": "If true, only entry points will be exposed", + "type": "boolean" } } } diff --git a/test/BenchmarkTestCases.benchmark.js b/test/BenchmarkTestCases.benchmark.js index f81f996da37..5ed59054865 100644 --- a/test/BenchmarkTestCases.benchmark.js +++ b/test/BenchmarkTestCases.benchmark.js @@ -1,12 +1,10 @@ "use strict"; -require("should"); const path = require("path"); const fs = require("fs"); const asyncLib = require("neo-async"); -var Test = require("mocha/lib/test"); - const Benchmark = require("benchmark"); +const { remove } = require("./helpers/remove"); describe("BenchmarkTestCases", function() { const casesPath = path.join(__dirname, "benchmarkCases"); @@ -27,8 +25,7 @@ describe("BenchmarkTestCases", function() { fs.mkdirSync(baselinesPath); } catch (e) {} // eslint-disable-line no-empty - before(function(done) { - this.timeout(270000); + beforeAll(function(done) { const git = require("simple-git"); const rootPath = path.join(__dirname, ".."); getBaselineRevs(rootPath, (err, baselineRevisions) => { @@ -65,7 +62,11 @@ describe("BenchmarkTestCases", function() { err => { if (err) return callback(err); fs.writeFileSync(gitIndex, index); - doLoadWebpack(); + try { + doLoadWebpack(); + } catch (err) { + callback(err); + } } ); } @@ -75,10 +76,9 @@ describe("BenchmarkTestCases", function() { } function doLoadWebpack() { - const baselineWebpack = require(path.resolve( - baselinePath, - "lib/webpack.js" - )); + const baselineWebpack = require.requireActual( + path.resolve(baselinePath, "lib/webpack.js") + ); baselines.push({ name: baselineInfo.name, rev: baselineRevision, @@ -87,9 +87,20 @@ describe("BenchmarkTestCases", function() { callback(); } }, - done + err => { + if (err) { + done(err); + return; + } + createTests(); + done(); + } ); }); + }, 270000); + + afterAll(() => { + remove(baselinesPath); }); function getBaselineRevs(rootPath, callback) { @@ -243,8 +254,8 @@ describe("BenchmarkTestCases", function() { const n = stats.sample.length; const nSqrt = Math.sqrt(n); const z = tDistribution(n - 1); - stats.minConfidence = stats.mean - z * stats.deviation / nSqrt; - stats.maxConfidence = stats.mean + z * stats.deviation / nSqrt; + stats.minConfidence = stats.mean - (z * stats.deviation) / nSqrt; + stats.maxConfidence = stats.mean + (z * stats.deviation) / nSqrt; stats.text = `${Math.round(stats.mean * 1000)}ms ± ${Math.round( stats.deviation * 1000 )}ms [${Math.round(stats.minConfidence * 1000)}ms; ${Math.round( @@ -261,64 +272,94 @@ describe("BenchmarkTestCases", function() { }); } - tests.forEach(testName => { - const testDirectory = path.join(casesPath, testName); - let headStats = null; - const suite = describe(testName, function() {}); - it(`${testName} create benchmarks`, function() { - baselines.forEach(baseline => { - let baselineStats = null; - - function it(title, fn) { - const test = new Test(title, fn); - suite.addTest(test); - } - it(`should benchmark ${baseline.name} (${ - baseline.rev - })`, function(done) { - this.timeout(180000); - const outputDirectory = path.join( - __dirname, - "js", - "benchmark", - `baseline-${baseline.name}`, - testName - ); - const config = Object.create( - require(path.join(testDirectory, "webpack.config.js")) + function createTests() { + tests.forEach(testName => { + const testDirectory = path.join(casesPath, testName); + let headStats = null; + describe(`${testName} create benchmarks`, function() { + baselines.forEach(baseline => { + let baselineStats = null; + it( + `should benchmark ${baseline.name} (${baseline.rev})`, + function(done) { + const outputDirectory = path.join( + __dirname, + "js", + "benchmark", + `baseline-${baseline.name}`, + testName + ); + const config = + Object.create( + require.requireActual( + path.join(testDirectory, "webpack.config.js") + ) + ) || {}; + config.output = Object.create(config.output || {}); + if (!config.context) config.context = testDirectory; + if (!config.output.path) config.output.path = outputDirectory; + runBenchmark(baseline.webpack, config, (err, stats) => { + if (err) return done(err); + process.stderr.write(` ${baseline.name} ${stats.text}`); + if (baseline.name === "HEAD") headStats = stats; + else baselineStats = stats; + done(); + }); + }, + 180000 ); - config.output = Object.create(config.output || {}); - if (!config.context) config.context = testDirectory; - if (!config.output.path) config.output.path = outputDirectory; - runBenchmark(baseline.webpack, config, (err, stats) => { - if (err) return done(err); - console.log(` ${baseline.name} ${stats.text}`); - if (baseline.name === "HEAD") headStats = stats; - else baselineStats = stats; - done(); - }); - }); - if (baseline.name !== "HEAD") { - it(`HEAD should not be slower than ${baseline.name} (${ - baseline.rev - })`, function() { - if (baselineStats.maxConfidence < headStats.minConfidence) { - throw new Error( - `HEAD (${headStats.text}) is slower than ${baseline.name} (${ - baselineStats.text - }) (90% confidence)` - ); - } else if (baselineStats.minConfidence > headStats.maxConfidence) { - console.log( - `======> HEAD is ${Math.round( - baselineStats.mean / headStats.mean * 100 - 100 - )}% faster than ${baseline.name} (90% confidence)!` + it( + `should benchmark ${baseline.name} (${baseline.rev})`, + done => { + const outputDirectory = path.join( + __dirname, + "js", + "benchmark", + `baseline-${baseline.name}`, + testName ); - } - }); - } + const config = + require.requireActual( + path.join(testDirectory, "webpack.config.js") + ) || {}; + config.output = config.output || {}; + if (!config.context) config.context = testDirectory; + if (!config.output.path) config.output.path = outputDirectory; + runBenchmark(baseline.webpack, config, (err, stats) => { + if (err) return done(err); + process.stderr.write(` ${baseline.name} ${stats.text}`); + if (baseline.name === "HEAD") headStats = stats; + else baselineStats = stats; + done(); + }); + }, + 180000 + ); + + if (baseline.name !== "HEAD") { + it(`HEAD should not be slower than ${baseline.name} (${ + baseline.rev + })`, function() { + if (baselineStats.maxConfidence < headStats.minConfidence) { + throw new Error( + `HEAD (${headStats.text}) is slower than ${baseline.name} (${ + baselineStats.text + }) (90% confidence)` + ); + } else if ( + baselineStats.minConfidence > headStats.maxConfidence + ) { + console.log( + `======> HEAD is ${Math.round( + (baselineStats.mean / headStats.mean) * 100 - 100 + )}% faster than ${baseline.name} (90% confidence)!` + ); + } + }); + } + }); }); }); - }); + } }); diff --git a/test/CachePlugin.unittest.js b/test/CachePlugin.unittest.js index 7ce741c01f9..c3985b8c454 100644 --- a/test/CachePlugin.unittest.js +++ b/test/CachePlugin.unittest.js @@ -1,6 +1,5 @@ "use strict"; -require("should"); const CachePlugin = require("../lib/CachePlugin"); describe("CachePlugin", () => { @@ -20,22 +19,22 @@ describe("CachePlugin", () => { it("sets file system accuracy to 1 for granular modification timestamp", () => { env.plugin.applyMtime(1483819067001); - env.plugin.FS_ACCURACY.should.be.exactly(1); + expect(env.plugin.FS_ACCURACY).toBe(1); }); it("sets file system accuracy to 10 for moderately granular modification timestamp", () => { env.plugin.applyMtime(1483819067004); - env.plugin.FS_ACCURACY.should.be.exactly(10); + expect(env.plugin.FS_ACCURACY).toBe(10); }); it("sets file system accuracy to 100 for moderately coarse modification timestamp", () => { env.plugin.applyMtime(1483819067040); - env.plugin.FS_ACCURACY.should.be.exactly(100); + expect(env.plugin.FS_ACCURACY).toBe(100); }); it("sets file system accuracy to 1000 for coarse modification timestamp", () => { env.plugin.applyMtime(1483819067400); - env.plugin.FS_ACCURACY.should.be.exactly(1000); + expect(env.plugin.FS_ACCURACY).toBe(1000); }); }); }); diff --git a/test/CaseSensitiveModulesWarning.unittest.js b/test/CaseSensitiveModulesWarning.unittest.js index 6023c02ec13..98abfb85e0d 100644 --- a/test/CaseSensitiveModulesWarning.unittest.js +++ b/test/CaseSensitiveModulesWarning.unittest.js @@ -1,6 +1,5 @@ "use strict"; -require("should"); const CaseSensitiveModulesWarning = require("../lib/CaseSensitiveModulesWarning"); const createModule = function(identifier, numberOfReasons) { @@ -31,13 +30,14 @@ describe("CaseSensitiveModulesWarning", () => { myCaseSensitiveModulesWarning = new CaseSensitiveModulesWarning(modules); }); - it("has the a name", () => - myCaseSensitiveModulesWarning.name.should.be.exactly( + it("has the a name", () => { + expect(myCaseSensitiveModulesWarning.name).toBe( "CaseSensitiveModulesWarning" - )); + ); + }); it("has the a message", () => { - myCaseSensitiveModulesWarning.message.should.be.exactly( + expect(myCaseSensitiveModulesWarning.message).toBe( ` There are multiple modules with names that only differ in casing. This can lead to unexpected behavior when compiling on a filesystem with other case-semantic. @@ -53,9 +53,11 @@ Use equal casing. Compare these module identifiers: ); }); - it("has the an origin", () => - myCaseSensitiveModulesWarning.origin.should.be.exactly(modules[0])); + it("has the an origin", () => { + expect(myCaseSensitiveModulesWarning.origin).toBe(modules[0]); + }); - it("has the a module", () => - myCaseSensitiveModulesWarning.module.should.be.exactly(modules[0])); + it("has the a module", () => { + expect(myCaseSensitiveModulesWarning.module).toBe(modules[0]); + }); }); diff --git a/test/Chunk.unittest.js b/test/Chunk.unittest.js index 42c5c26fc82..dab229ee6a9 100644 --- a/test/Chunk.unittest.js +++ b/test/Chunk.unittest.js @@ -1,107 +1,115 @@ /* globals describe, it, beforeEach */ "use strict"; -const should = require("should"); -const sinon = require("sinon"); const Chunk = require("../lib/Chunk"); describe("Chunk", () => { let ChunkInstance; - beforeEach( - () => (ChunkInstance = new Chunk("chunk-test", "module-test", "loc-test")) - ); + beforeEach(() => { + ChunkInstance = new Chunk("chunk-test", "module-test", "loc-test"); + }); - it("should have debugId more than 999", () => - should(ChunkInstance.debugId).be.above(999)); + it("should have debugId more than 999", () => { + expect(ChunkInstance.debugId).toBeGreaterThan(999); + }); - it("returns a string with modules information", () => - should(ChunkInstance.toString()).be.exactly("Chunk[]")); + it("returns a string with modules information", () => { + expect(ChunkInstance.toString()).toBe("Chunk[]"); + }); - it("should not be the initial instance", () => - should(ChunkInstance.canBeInitial()).be.false()); + it("should not be the initial instance", () => { + expect(ChunkInstance.canBeInitial()).toBe(false); + }); describe("entry", () => { - it("returns an error if get entry", () => - should(() => { + it("returns an error if get entry", () => { + expect(() => { ChunkInstance.entry; - }).throw("Chunk.entry was removed. Use hasRuntime()")); + }).toThrow("Chunk.entry was removed. Use hasRuntime()"); + }); - it("returns an error if set an entry", () => - should(() => { + it("returns an error if set an entry", () => { + expect(() => { ChunkInstance.entry = 10; - }).throw("Chunk.entry was removed. Use hasRuntime()")); + }).toThrow("Chunk.entry was removed. Use hasRuntime()"); + }); }); describe("initial", () => { - it("returns an error if get initial", () => - should(() => { + it("returns an error if get initial", () => { + expect(() => { ChunkInstance.initial; - }).throw("Chunk.initial was removed. Use canBeInitial/isOnlyInitial()")); + }).toThrow("Chunk.initial was removed. Use canBeInitial/isOnlyInitial()"); + }); - it("returns an error if set an initial", () => - should(() => { + it("returns an error if set an initial", () => { + expect(() => { ChunkInstance.initial = 10; - }).throw("Chunk.initial was removed. Use canBeInitial/isOnlyInitial()")); + }).toThrow("Chunk.initial was removed. Use canBeInitial/isOnlyInitial()"); + }); }); describe("hasRuntime", () => { - it("returns false", () => should(ChunkInstance.hasRuntime()).be.false()); + it("returns false", () => { + expect(ChunkInstance.hasRuntime()).toBe(false); + }); }); describe("isEmpty", () => { - it("should NOT have any module by default", () => - should(ChunkInstance.isEmpty()).be.true()); + it("should NOT have any module by default", () => { + expect(ChunkInstance.isEmpty()).toBe(true); + }); }); describe("size", () => { - it("should NOT have any module by default", () => - should( + it("should NOT have any module by default", () => { + expect( ChunkInstance.size({ chunkOverhead: 10, entryChunkMultiplicator: 2 }) - ).be.exactly(10)); + ).toBe(10); + }); }); - describe("removeModule", function() { + describe("removeModule", () => { let module; let removeChunkSpy; - beforeEach(function() { - removeChunkSpy = sinon.spy(); - + beforeEach(() => { + removeChunkSpy = jest.fn(); module = { removeChunk: removeChunkSpy }; }); - describe("and the chunk does not contain this module", function() { - it("returns false", function() { - ChunkInstance.removeModule(module).should.eql(false); + describe("and the chunk does not contain this module", () => { + it("returns false", () => { + expect(ChunkInstance.removeModule(module)).toBe(false); }); }); - describe("and the chunk does contain this module", function() { - beforeEach(function() { + describe("and the chunk does contain this module", () => { + beforeEach(() => { ChunkInstance._modules = new Set([module]); }); - it("calls module.removeChunk with itself and returns true", function() { - ChunkInstance.removeModule(module).should.eql(true); + it("calls module.removeChunk with itself and returns true", () => { + expect(ChunkInstance.removeModule(module)).toBe(true); - removeChunkSpy.callCount.should.eql(1); - removeChunkSpy.args[0][0].should.eql(ChunkInstance); + expect(removeChunkSpy.mock.calls.length).toBe(1); + expect(removeChunkSpy.mock.calls[0][0]).toBe(ChunkInstance); }); }); - describe("getNumberOfGroups", function() { - beforeEach(function() { + describe("getNumberOfGroups", () => { + beforeEach(() => { ChunkInstance._groups = new Set(); }); - it("should return the number of chunk groups contained by the chunk", function() { - ChunkInstance.getNumberOfGroups().should.eql(0); + it("should return the number of chunk groups contained by the chunk", () => { + expect(ChunkInstance.getNumberOfGroups()).toBe(0); }); }); }); diff --git a/test/Compiler-caching.test.js b/test/Compiler-caching.test.js index 9e612c848fc..5c7ba0e8eb1 100644 --- a/test/Compiler-caching.test.js +++ b/test/Compiler-caching.test.js @@ -1,15 +1,16 @@ -/* globals describe, it, before, after */ +/* globals describe, it */ "use strict"; -const should = require("should"); const path = require("path"); const fs = require("fs"); +const rimraf = require("rimraf"); const webpack = require("../"); const WebpackOptionsDefaulter = require("../lib/WebpackOptionsDefaulter"); +let fixtureCount = 0; -describe("Compiler (caching)", function() { - this.timeout(15000); +describe("Compiler (caching)", () => { + jest.setTimeout(15000); function compile(entry, options, callback) { options.mode = "none"; @@ -29,14 +30,14 @@ describe("Compiler (caching)", function() { const c = webpack(options); const files = {}; c.outputFileSystem = { - join: function() { + join() { return [].join.call(arguments, "/").replace(/\/+/g, "/"); }, - mkdirp: function(path, callback) { + mkdirp(path, callback) { logs.mkdirp.push(path); callback(); }, - writeFile: function(name, content, callback) { + writeFile(name, content, callback) { logs.writeFile.push(name, content); files[name] = content.toString("utf-8"); callback(); @@ -56,19 +57,19 @@ describe("Compiler (caching)", function() { } c.run((err, stats) => { if (err) throw err; - should.strictEqual(typeof stats, "object"); + expect(typeof stats).toBe("object"); stats = stats.toJson({ modules: true, reasons: true }); - should.strictEqual(typeof stats, "object"); - stats.should.have.property("errors"); - Array.isArray(stats.errors).should.be.ok(); + expect(typeof stats).toBe("object"); + expect(stats).toHaveProperty("errors"); + expect(Array.isArray(stats.errors)).toBe(true); if (options.expectErrors) { - stats.errors.length.should.be.eql(options.expectErrors); + expect(stats.errors).toHaveLength(options.expectErrors); } else { if (stats.errors.length > 0) { - stats.errors[0].should.be.type("string"); + expect(typeof stats.errors[0]).toBe("string"); throw new Error(stats.errors[0]); } } @@ -90,51 +91,34 @@ describe("Compiler (caching)", function() { "fixtures", "temp-cache-fixture" ); - const aFilepath = path.join(tempFixturePath, "a.js"); - const cFilepath = path.join(tempFixturePath, "c.js"); function cleanup() { - function ignoreENOENT(fn) { - try { - return fn(); - } catch (e) { - if (e.code !== "ENOENT") { - throw e; - } - } - } - ignoreENOENT(() => fs.unlinkSync(aFilepath)); - ignoreENOENT(() => fs.unlinkSync(cFilepath)); - ignoreENOENT(() => fs.rmdirSync(tempFixturePath)); + rimraf.sync(`${tempFixturePath}-*`); } - before(cleanup); - after(cleanup); + + beforeAll(cleanup); + afterAll(cleanup); function createTempFixture() { + const fixturePath = `${tempFixturePath}-${fixtureCount}`; + const aFilepath = path.join(fixturePath, "a.js"); + const cFilepath = path.join(fixturePath, "c.js"); + // Remove previous copy if present - try { - if (fs.statSync(tempFixturePath)) { - fs.unlinkSync(aFilepath); - fs.unlinkSync(cFilepath); - fs.rmdirSync(tempFixturePath); - } - } catch (e) { - if (e.code !== "ENOENT") { - throw e; - } - } + rimraf.sync(fixturePath); // Copy over file since we"ll be modifying some of them - fs.mkdirSync(tempFixturePath); - fs - .createReadStream(path.join(__dirname, "fixtures", "a.js")) - .pipe(fs.createWriteStream(aFilepath)); - fs - .createReadStream(path.join(__dirname, "fixtures", "c.js")) - .pipe(fs.createWriteStream(cFilepath)); + fs.mkdirSync(fixturePath); + fs.createReadStream(path.join(__dirname, "fixtures", "a.js")).pipe( + fs.createWriteStream(aFilepath) + ); + fs.createReadStream(path.join(__dirname, "fixtures", "c.js")).pipe( + fs.createWriteStream(cFilepath) + ); + fixtureCount++; return { - rootPath: tempFixturePath, + rootPath: fixturePath, aFilepath: aFilepath, cFilepath: cFilepath }; @@ -144,192 +128,155 @@ describe("Compiler (caching)", function() { const options = {}; const tempFixture = createTempFixture(); - const helper = compile( - "./temp-cache-fixture/c", - options, - (stats, files) => { - // Not cached the first time - stats.assets[0].name.should.be.exactly("bundle.js"); - stats.assets[0].emitted.should.be.exactly(true); + const helper = compile(tempFixture.cFilepath, options, (stats, files) => { + // Not cached the first time + expect(stats.assets[0].name).toBe("bundle.js"); + expect(stats.assets[0].emitted).toBe(true); - helper.runAgain((stats, files, iteration) => { - // Cached the second run - stats.assets[0].name.should.be.exactly("bundle.js"); - stats.assets[0].emitted.should.be.exactly(false); + helper.runAgain((stats, files, iteration) => { + // Cached the second run + expect(stats.assets[0].name).toBe("bundle.js"); + expect(stats.assets[0].emitted).toBe(false); - const aContent = fs - .readFileSync(tempFixture.aFilepath) - .toString() - .replace("This is a", "This is a MODIFIED"); + const aContent = fs + .readFileSync(tempFixture.aFilepath) + .toString() + .replace("This is a", "This is a MODIFIED"); - setTimeout(() => { - fs.writeFileSync(tempFixture.aFilepath, aContent); + setTimeout(() => { + fs.writeFileSync(tempFixture.aFilepath, aContent); - helper.runAgain((stats, files, iteration) => { - // Cached the third run - stats.assets[0].name.should.be.exactly("bundle.js"); - stats.assets[0].emitted.should.be.exactly(true); + helper.runAgain((stats, files, iteration) => { + // Cached the third run + expect(stats.assets[0].name).toBe("bundle.js"); + expect(stats.assets[0].emitted).toBe(true); - done(); - }); - }, 1100); - }); - } - ); + done(); + }); + }, 1100); + }); + }); }); it("should cache single file (even with no timeout) ", done => { const options = {}; const tempFixture = createTempFixture(); - const helper = compile( - "./temp-cache-fixture/c", - options, - (stats, files) => { - // Not cached the first time - stats.assets[0].name.should.be.exactly("bundle.js"); - stats.assets[0].emitted.should.be.exactly(true); + const helper = compile(tempFixture.cFilepath, options, (stats, files) => { + // Not cached the first time + expect(stats.assets[0].name).toBe("bundle.js"); + expect(stats.assets[0].emitted).toBe(true); - helper.runAgain((stats, files, iteration) => { - // Cached the second run - stats.assets[0].name.should.be.exactly("bundle.js"); - stats.assets[0].emitted.should.be.exactly(false); + helper.runAgain((stats, files, iteration) => { + // Cached the second run + expect(stats.assets[0].name).toBe("bundle.js"); + expect(stats.assets[0].emitted).toBe(false); - files["/bundle.js"].should.containEql("This is a"); + expect(files["/bundle.js"]).toMatch("This is a"); - const aContent = fs - .readFileSync(tempFixture.aFilepath) - .toString() - .replace("This is a", "This is a MODIFIED"); + const aContent = fs + .readFileSync(tempFixture.aFilepath) + .toString() + .replace("This is a", "This is a MODIFIED"); - fs.writeFileSync(tempFixture.aFilepath, aContent); + fs.writeFileSync(tempFixture.aFilepath, aContent); - helper.runAgain((stats, files, iteration) => { - // Cached the third run - stats.assets[0].name.should.be.exactly("bundle.js"); - stats.assets[0].emitted.should.be.exactly(true); + helper.runAgain((stats, files, iteration) => { + // Cached the third run + expect(stats.assets[0].name).toBe("bundle.js"); + expect(stats.assets[0].emitted).toBe(true); - files["/bundle.js"].should.containEql("This is a MODIFIED"); + expect(files["/bundle.js"]).toMatch("This is a MODIFIED"); - done(); - }); + done(); }); - } - ); + }); + }); }); it("should only build when modified (with manual 2s wait)", done => { const options = {}; const tempFixture = createTempFixture(); - const helper = compile( - "./temp-cache-fixture/c", - options, - (stats, files) => { - // Built the first time - stats.modules[0].name.should.containEql("c.js"); - stats.modules[0].built.should.be.exactly( - true, - "c.js should have been built" - ); - - stats.modules[1].name.should.containEql("a.js"); - stats.modules[1].built.should.be.exactly( - true, - "a.js should have been built" - ); + const helper = compile(tempFixture.cFilepath, options, (stats, files) => { + // Built the first time + expect(stats.modules[0].name).toMatch("c.js"); + expect(stats.modules[0].built).toBe(true); - setTimeout(() => { - helper.runAgain((stats, files, iteration) => { - // Not built when cached the second run - stats.modules[0].name.should.containEql("c.js"); - //stats.modules[0].built.should.be.exactly(false, "c.js should not have built"); - - stats.modules[1].name.should.containEql("a.js"); - //stats.modules[1].built.should.be.exactly(false, "a.js should not have built"); - - const aContent = fs - .readFileSync(tempFixture.aFilepath) - .toString() - .replace("This is a", "This is a MODIFIED"); - - setTimeout(() => { - fs.writeFileSync(tempFixture.aFilepath, aContent); - - helper.runAgain((stats, files, iteration) => { - // And only a.js built after it was modified - stats.modules[0].name.should.containEql("c.js"); - stats.modules[0].built.should.be.exactly( - false, - "c.js should not have built" - ); - - stats.modules[1].name.should.containEql("a.js"); - stats.modules[1].built.should.be.exactly( - true, - "a.js should have been built" - ); - - done(); - }); - }, 2100); - }); - }, 4100); - } - ); - }); - - it("should build when modified (even with no timeout)", done => { - const options = {}; - const tempFixture = createTempFixture(); - - const helper = compile( - "./temp-cache-fixture/c", - options, - (stats, files) => { - // Built the first time - stats.modules[0].name.should.containEql("c.js"); - stats.modules[0].built.should.be.exactly( - true, - "c.js should have been built" - ); - - stats.modules[1].name.should.containEql("a.js"); - stats.modules[1].built.should.be.exactly( - true, - "a.js should have been built" - ); + expect(stats.modules[1].name).toMatch("a.js"); + expect(stats.modules[1].built).toBe(true); + setTimeout(() => { helper.runAgain((stats, files, iteration) => { // Not built when cached the second run - stats.modules[0].name.should.containEql("c.js"); - //stats.modules[0].built.should.be.exactly(false, "c.js should not have built"); + expect(stats.modules[0].name).toMatch("c.js"); + // expect(stats.modules[0].built).toBe(false); - stats.modules[1].name.should.containEql("a.js"); - //stats.modules[1].built.should.be.exactly(false, "a.js should not have built"); + expect(stats.modules[1].name).toMatch("a.js"); + // expect(stats.modules[1].built).toBe(false); const aContent = fs .readFileSync(tempFixture.aFilepath) .toString() .replace("This is a", "This is a MODIFIED"); - fs.writeFileSync(tempFixture.aFilepath, aContent); + setTimeout(() => { + fs.writeFileSync(tempFixture.aFilepath, aContent); - helper.runAgain((stats, files, iteration) => { - // And only a.js built after it was modified - stats.modules[0].name.should.containEql("c.js"); - //stats.modules[0].built.should.be.exactly(false, "c.js should not have built"); + helper.runAgain((stats, files, iteration) => { + // And only a.js built after it was modified + expect(stats.modules[0].name).toMatch("c.js"); + expect(stats.modules[0].built).toBe(false); - stats.modules[1].name.should.containEql("a.js"); - stats.modules[1].built.should.be.exactly( - true, - "a.js should have been built" - ); + expect(stats.modules[1].name).toMatch("a.js"); + expect(stats.modules[1].built).toBe(true); - done(); - }); + done(); + }); + }, 2100); }); - } - ); + }, 4100); + }); + }); + + it("should build when modified (even with no timeout)", done => { + const options = {}; + const tempFixture = createTempFixture(); + + const helper = compile(tempFixture.cFilepath, options, (stats, files) => { + // Built the first time + expect(stats.modules[0].name).toMatch("c.js"); + expect(stats.modules[0].built).toBe(true); + + expect(stats.modules[1].name).toMatch("a.js"); + expect(stats.modules[1].built).toBe(true); + + helper.runAgain((stats, files, iteration) => { + // Not built when cached the second run + expect(stats.modules[0].name).toMatch("c.js"); + // expect(stats.modules[0].built).toBe(false); + + expect(stats.modules[1].name).toMatch("a.js"); + // expect(stats.modules[1].built).toBe(false); + + const aContent = fs + .readFileSync(tempFixture.aFilepath) + .toString() + .replace("This is a", "This is a MODIFIED"); + + fs.writeFileSync(tempFixture.aFilepath, aContent); + + helper.runAgain((stats, files, iteration) => { + // And only a.js built after it was modified + expect(stats.modules[0].name).toMatch("c.js"); + // expect(stats.modules[0].built).toBe(false); + + expect(stats.modules[1].name).toMatch("a.js"); + expect(stats.modules[1].built).toBe(true); + + done(); + }); + }); + }); }); }); diff --git a/test/Compiler.test.js b/test/Compiler.test.js index f977ed5622b..063343f38c2 100644 --- a/test/Compiler.test.js +++ b/test/Compiler.test.js @@ -1,9 +1,7 @@ /* globals describe, it */ "use strict"; -const should = require("should"); const path = require("path"); -const sinon = require("sinon"); const webpack = require("../"); const WebpackOptionsDefaulter = require("../lib/WebpackOptionsDefaulter"); @@ -29,14 +27,14 @@ describe("Compiler", () => { const c = webpack(options); const files = {}; c.outputFileSystem = { - join: function() { + join() { return [].join.call(arguments, "/").replace(/\/+/g, "/"); }, - mkdirp: function(path, callback) { + mkdirp(path, callback) { logs.mkdirp.push(path); callback(); }, - writeFile: function(name, content, callback) { + writeFile(name, content, callback) { logs.writeFile.push(name, content); files[name] = content.toString("utf-8"); callback(); @@ -48,17 +46,17 @@ describe("Compiler", () => { ); c.run((err, stats) => { if (err) throw err; - should.strictEqual(typeof stats, "object"); + expect(typeof stats).toBe("object"); const compilation = stats.compilation; stats = stats.toJson({ modules: true, reasons: true }); - should.strictEqual(typeof stats, "object"); - stats.should.have.property("errors"); - Array.isArray(stats.errors).should.be.ok(); + expect(typeof stats).toBe("object"); + expect(stats).toHaveProperty("errors"); + expect(Array.isArray(stats.errors)).toBe(true); if (stats.errors.length > 0) { - stats.errors[0].should.be.instanceOf(Error); + expect(stats.errors[0]).toBeInstanceOf(Error); throw stats.errors[0]; } stats.logs = logs; @@ -76,7 +74,7 @@ describe("Compiler", () => { } }, (stats, files) => { - stats.logs.mkdirp.should.eql(["/what", "/what/the"]); + expect(stats.logs.mkdirp).toEqual(["/what", "/what/the"]); done(); } ); @@ -84,92 +82,87 @@ describe("Compiler", () => { it("should compile a single file", done => { compile("./c", {}, (stats, files) => { - files.should.have.property("/main.js").have.type("string"); - Object.keys(files).should.be.eql(["/main.js"]); + expect(Object.keys(files)).toEqual(["/main.js"]); const bundle = files["/main.js"]; - bundle.should.containEql("function __webpack_require__("); - bundle.should.containEql("__webpack_require__(/*! ./a */ 0);"); - bundle.should.containEql("./c.js"); - bundle.should.containEql("./a.js"); - bundle.should.containEql("This is a"); - bundle.should.containEql("This is c"); - bundle.should.not.containEql("2: function("); - bundle.should.not.containEql("window"); - bundle.should.not.containEql("jsonp"); - bundle.should.not.containEql("fixtures"); + expect(bundle).toMatch("function __webpack_require__("); + expect(bundle).toMatch("__webpack_require__(/*! ./a */ 0);"); + expect(bundle).toMatch("./c.js"); + expect(bundle).toMatch("./a.js"); + expect(bundle).toMatch("This is a"); + expect(bundle).toMatch("This is c"); + expect(bundle).not.toMatch("2: function("); + expect(bundle).not.toMatch("window"); + expect(bundle).not.toMatch("jsonp"); + expect(bundle).not.toMatch("fixtures"); done(); }); }); it("should compile a complex file", done => { compile("./main1", {}, (stats, files) => { - files.should.have.property("/main.js").have.type("string"); - Object.keys(files).should.be.eql(["/main.js"]); + expect(Object.keys(files)).toEqual(["/main.js"]); const bundle = files["/main.js"]; - bundle.should.containEql("function __webpack_require__("); - bundle.should.containEql("__webpack_require__(/*! ./a */"); - bundle.should.containEql("./main1.js"); - bundle.should.containEql("./a.js"); - bundle.should.containEql("./b.js"); - bundle.should.containEql("./node_modules/m1/a.js"); - bundle.should.containEql("This is a"); - bundle.should.containEql("This is b"); - bundle.should.containEql("This is m1/a"); - bundle.should.not.containEql("4: function("); - bundle.should.not.containEql("window"); - bundle.should.not.containEql("jsonp"); - bundle.should.not.containEql("fixtures"); + expect(bundle).toMatch("function __webpack_require__("); + expect(bundle).toMatch("__webpack_require__(/*! ./a */"); + expect(bundle).toMatch("./main1.js"); + expect(bundle).toMatch("./a.js"); + expect(bundle).toMatch("./b.js"); + expect(bundle).toMatch("./node_modules/m1/a.js"); + expect(bundle).toMatch("This is a"); + expect(bundle).toMatch("This is b"); + expect(bundle).toMatch("This is m1/a"); + expect(bundle).not.toMatch("4: function("); + expect(bundle).not.toMatch("window"); + expect(bundle).not.toMatch("jsonp"); + expect(bundle).not.toMatch("fixtures"); done(); }); }); it("should compile a file with transitive dependencies", done => { compile("./abc", {}, (stats, files) => { - files.should.have.property("/main.js").have.type("string"); - Object.keys(files).should.be.eql(["/main.js"]); + expect(Object.keys(files)).toEqual(["/main.js"]); const bundle = files["/main.js"]; - bundle.should.containEql("function __webpack_require__("); - bundle.should.containEql("__webpack_require__(/*! ./a */"); - bundle.should.containEql("__webpack_require__(/*! ./b */"); - bundle.should.containEql("__webpack_require__(/*! ./c */"); - bundle.should.containEql("./abc.js"); - bundle.should.containEql("./a.js"); - bundle.should.containEql("./b.js"); - bundle.should.containEql("./c.js"); - bundle.should.containEql("This is a"); - bundle.should.containEql("This is b"); - bundle.should.containEql("This is c"); - bundle.should.not.containEql("4: function("); - bundle.should.not.containEql("window"); - bundle.should.not.containEql("jsonp"); - bundle.should.not.containEql("fixtures"); + expect(bundle).toMatch("function __webpack_require__("); + expect(bundle).toMatch("__webpack_require__(/*! ./a */"); + expect(bundle).toMatch("__webpack_require__(/*! ./b */"); + expect(bundle).toMatch("__webpack_require__(/*! ./c */"); + expect(bundle).toMatch("./abc.js"); + expect(bundle).toMatch("./a.js"); + expect(bundle).toMatch("./b.js"); + expect(bundle).toMatch("./c.js"); + expect(bundle).toMatch("This is a"); + expect(bundle).toMatch("This is b"); + expect(bundle).toMatch("This is c"); + expect(bundle).not.toMatch("4: function("); + expect(bundle).not.toMatch("window"); + expect(bundle).not.toMatch("jsonp"); + expect(bundle).not.toMatch("fixtures"); done(); }); }); it("should compile a file with multiple chunks", done => { compile("./chunks", {}, (stats, files) => { - stats.chunks.length.should.be.eql(2); - files.should.have.property("/main.js").have.type("string"); - files.should.have.property("/0.js").have.type("string"); - Object.keys(files).should.be.eql(["/0.js", "/main.js"]); + expect(stats.chunks).toHaveLength(2); + expect(Object.keys(files)).toEqual(["/0.js", "/main.js"]); const bundle = files["/main.js"]; const chunk = files["/0.js"]; - bundle.should.containEql("function __webpack_require__("); - bundle.should.containEql("__webpack_require__(/*! ./b */"); - chunk.should.not.containEql("__webpack_require__(/* ./b */"); - bundle.should.containEql("./chunks.js"); - chunk.should.containEql("./a.js"); - chunk.should.containEql("./b.js"); - chunk.should.containEql("This is a"); - bundle.should.not.containEql("This is a"); - chunk.should.containEql("This is b"); - bundle.should.not.containEql("This is b"); - bundle.should.not.containEql("4: function("); - bundle.should.not.containEql("fixtures"); - chunk.should.not.containEql("fixtures"); - bundle.should.containEql("webpackJsonp"); - chunk.should.containEql('window["webpackJsonp"] || []).push'); + expect(bundle).toMatch("function __webpack_require__("); + expect(bundle).toMatch("__webpack_require__(/*! ./b */"); + expect(chunk).not.toMatch("__webpack_require__(/* ./b */"); + expect(bundle).toMatch("./chunks.js"); + expect(chunk).toMatch("./a.js"); + expect(chunk).toMatch("./b.js"); + expect(chunk).toMatch("This is a"); + expect(bundle).not.toMatch("This is a"); + expect(chunk).toMatch("This is b"); + expect(bundle).not.toMatch("This is b"); + expect(bundle).not.toMatch("4: function("); + expect(bundle).not.toMatch("fixtures"); + expect(chunk).not.toMatch("fixtures"); + expect(bundle).toMatch("webpackJsonp"); + expect(chunk).toMatch('window["webpackJsonp"] || []).push'); done(); }); }); @@ -187,19 +180,19 @@ describe("Compiler", () => { }); describe("purgeInputFileSystem", () => { it("invokes purge() if inputFileSystem.purge", done => { - const mockPurge = sinon.spy(); + const mockPurge = jest.fn(); compiler.inputFileSystem = { purge: mockPurge }; compiler.purgeInputFileSystem(); - mockPurge.callCount.should.be.exactly(1); + expect(mockPurge.mock.calls.length).toBe(1); done(); }); it("does NOT invoke purge() if !inputFileSystem.purge", done => { - const mockPurge = sinon.spy(); + const mockPurge = jest.fn(); compiler.inputFileSystem = null; compiler.purgeInputFileSystem(); - mockPurge.callCount.should.be.exactly(0); + expect(mockPurge.mock.calls.length).toBe(0); done(); }); }); @@ -207,46 +200,46 @@ describe("Compiler", () => { it("returns booleanized this.parentCompilation", done => { compiler.parentCompilation = "stringyStringString"; const response1 = compiler.isChild(); - response1.should.be.exactly(true); + expect(response1).toBe(true); compiler.parentCompilation = 123456789; const response2 = compiler.isChild(); - response2.should.be.exactly(true); + expect(response2).toBe(true); compiler.parentCompilation = { what: "I belong to an object" }; const response3 = compiler.isChild(); - response3.should.be.exactly(true); + expect(response3).toBe(true); compiler.parentCompilation = ["Array", 123, true, null, [], () => {}]; const response4 = compiler.isChild(); - response4.should.be.exactly(true); + expect(response4).toBe(true); compiler.parentCompilation = false; const response5 = compiler.isChild(); - response5.should.be.exactly(false); + expect(response5).toBe(false); compiler.parentCompilation = 0; const response6 = compiler.isChild(); - response6.should.be.exactly(false); + expect(response6).toBe(false); compiler.parentCompilation = null; const response7 = compiler.isChild(); - response7.should.be.exactly(false); + expect(response7).toBe(false); compiler.parentCompilation = ""; const response8 = compiler.isChild(); - response8.should.be.exactly(false); + expect(response8).toBe(false); compiler.parentCompilation = NaN; const response9 = compiler.isChild(); - response9.should.be.exactly(false); + expect(response9).toBe(false); done(); }); }); }); - it("should not emit on errors", function(done) { + it("should not emit on errors", done => { const compiler = webpack({ context: __dirname, mode: "production", @@ -264,7 +257,7 @@ describe("Compiler", () => { done(); }); }); - it("should not emit on errors (watch)", function(done) { + it("should not emit on errors (watch)", done => { const compiler = webpack({ context: __dirname, mode: "production", diff --git a/test/ConfigTestCases.test.js b/test/ConfigTestCases.test.js index 64cd0f2eeff..4f3808341bd 100644 --- a/test/ConfigTestCases.test.js +++ b/test/ConfigTestCases.test.js @@ -1,22 +1,24 @@ "use strict"; -/* globals describe it */ -require("should"); +/* globals describe expect it beforeAll */ const path = require("path"); const fs = require("fs"); const vm = require("vm"); const mkdirp = require("mkdirp"); -const Test = require("mocha/lib/test"); +const rimraf = require("rimraf"); const checkArrayExpectation = require("./checkArrayExpectation"); +const FakeDocument = require("./helpers/FakeDocument"); const Stats = require("../lib/Stats"); const webpack = require("../lib/webpack"); -const prepareOptions = require("../lib/prepareOptions"); +const prepareOptions = require("./helpers/prepareOptions"); describe("ConfigTestCases", () => { const casesPath = path.join(__dirname, "configCases"); let categories = fs.readdirSync(casesPath); + jest.setTimeout(10000); + categories = categories.map(cat => { return { name: cat, @@ -40,8 +42,7 @@ describe("ConfigTestCases", () => { categories.forEach(category => { describe(category.name, () => { category.tests.forEach(testName => { - const suite = describe(testName, () => {}); - it(testName + " should compile", function(done) { + describe(testName, function() { const testDirectory = path.join(casesPath, category.name, testName); const outputDirectory = path.join( __dirname, @@ -50,185 +51,243 @@ describe("ConfigTestCases", () => { category.name, testName ); - const options = prepareOptions( - require(path.join(testDirectory, "webpack.config.js")) - ); - const optionsArr = [].concat(options); - optionsArr.forEach((options, idx) => { - if (!options.context) options.context = testDirectory; - if (!options.mode) options.mode = "production"; - if (!options.optimization) options.optimization = {}; - if (options.optimization.minimize === undefined) - options.optimization.minimize = false; - if (!options.entry) options.entry = "./index.js"; - if (!options.target) options.target = "async-node"; - if (!options.output) options.output = {}; - if (!options.output.path) options.output.path = outputDirectory; - if (typeof options.output.pathinfo === "undefined") - options.output.pathinfo = true; - if (!options.output.filename) - options.output.filename = "bundle" + idx + ".js"; - }); - let testConfig = { - findBundle: function(i, options) { - if ( - fs.existsSync( - path.join(options.output.path, "bundle" + i + ".js") - ) - ) { - return "./bundle" + i + ".js"; - } - }, - timeout: 30000 - }; - try { - // try to load a test file - testConfig = Object.assign( - testConfig, - require(path.join(testDirectory, "test.config.js")) - ); - } catch (e) {} // eslint-disable-line no-empty + const exportedTests = []; + const exportedBeforeEach = []; + const exportedAfterEach = []; + it( + testName + " should compile", + () => + new Promise((resolve, reject) => { + const done = err => { + if (err) return reject(err); + resolve(); + }; + rimraf.sync(outputDirectory); + mkdirp.sync(outputDirectory); + const options = prepareOptions( + require(path.join(testDirectory, "webpack.config.js")), + { testPath: outputDirectory } + ); + const optionsArr = [].concat(options); + optionsArr.forEach((options, idx) => { + if (!options.context) options.context = testDirectory; + if (!options.mode) options.mode = "production"; + if (!options.optimization) options.optimization = {}; + if (options.optimization.minimize === undefined) + options.optimization.minimize = false; + if (!options.entry) options.entry = "./index.js"; + if (!options.target) options.target = "async-node"; + if (!options.output) options.output = {}; + if (!options.output.path) + options.output.path = outputDirectory; + if (typeof options.output.pathinfo === "undefined") + options.output.pathinfo = true; + if (!options.output.filename) + options.output.filename = "bundle" + idx + ".js"; + }); + let testConfig = { + findBundle: function(i, options) { + if ( + fs.existsSync( + path.join(options.output.path, "bundle" + i + ".js") + ) + ) { + return "./bundle" + i + ".js"; + } + }, + timeout: 30000 + }; + try { + // try to load a test file + testConfig = Object.assign( + testConfig, + require(path.join(testDirectory, "test.config.js")) + ); + } catch (e) { + // ignored + } - this.timeout(testConfig.timeout); + webpack(options, (err, stats) => { + if (err) { + const fakeStats = { + errors: [err.stack] + }; + if ( + checkArrayExpectation( + testDirectory, + fakeStats, + "error", + "Error", + done + ) + ) + return; + // Wait for uncaught errors to occur + return setTimeout(done, 200); + } + const statOptions = Stats.presetToOptions("verbose"); + statOptions.colors = false; + mkdirp.sync(outputDirectory); + fs.writeFileSync( + path.join(outputDirectory, "stats.txt"), + stats.toString(statOptions), + "utf-8" + ); + const jsonStats = stats.toJson({ + errorDetails: true + }); + if ( + checkArrayExpectation( + testDirectory, + jsonStats, + "error", + "Error", + done + ) + ) + return; + if ( + checkArrayExpectation( + testDirectory, + jsonStats, + "warning", + "Warning", + done + ) + ) + return; - webpack(options, (err, stats) => { - if (err) { - const fakeStats = { - errors: [err.stack] - }; - if ( - checkArrayExpectation( - testDirectory, - fakeStats, - "error", - "Error", - done - ) - ) - return; - // Wait for uncaught errors to occur - return setTimeout(done, 200); - } - const statOptions = Stats.presetToOptions("verbose"); - statOptions.colors = false; - mkdirp.sync(outputDirectory); - fs.writeFileSync( - path.join(outputDirectory, "stats.txt"), - stats.toString(statOptions), - "utf-8" - ); - const jsonStats = stats.toJson({ - errorDetails: true - }); - if ( - checkArrayExpectation( - testDirectory, - jsonStats, - "error", - "Error", - done - ) - ) - return; - if ( - checkArrayExpectation( - testDirectory, - jsonStats, - "warning", - "Warning", - done - ) - ) - return; - let exportedTests = 0; + function _it(title, fn) { + exportedTests.push({ + title, + fn, + timeout: testConfig.timeout + }); + } - function _it(title, fn) { - const test = new Test(title, fn); - suite.addTest(test); - exportedTests++; - return test; - } + function _beforeEach(fn) { + return exportedBeforeEach.push(fn); + } - const globalContext = { - console: console - }; + function _afterEach(fn) { + return exportedAfterEach.push(fn); + } - function _require(currentDirectory, module) { - if (Array.isArray(module) || /^\.\.?\//.test(module)) { - let fn; - let content; - let p; - if (Array.isArray(module)) { - p = path.join(currentDirectory, module[0]); - content = module - .map(arg => { - p = path.join(currentDirectory, arg); - return fs.readFileSync(p, "utf-8"); - }) - .join("\n"); - } else { - p = path.join(currentDirectory, module); - content = fs.readFileSync(p, "utf-8"); - } - if ( - options.target === "web" || - options.target === "webworker" - ) { - fn = vm.runInNewContext( - "(function(require, module, exports, __dirname, __filename, it, window) {" + - content + - "\n})", - globalContext, - p - ); - } else { - fn = vm.runInThisContext( - "(function(require, module, exports, __dirname, __filename, it) {" + - content + - "\n})", - p - ); - } - const m = { - exports: {} - }; - fn.call( - m.exports, - _require.bind(null, path.dirname(p)), - m, - m.exports, - path.dirname(p), - p, - _it, - globalContext - ); - return m.exports; - } else if (testConfig.modules && module in testConfig.modules) { - return testConfig.modules[module]; - } else return require(module); - } - let filesCount = 0; + const globalContext = { + console: console, + expect: expect, + setTimeout: setTimeout, + clearTimeout: clearTimeout, + document: new FakeDocument() + }; + + function _require(currentDirectory, module) { + if (Array.isArray(module) || /^\.\.?\//.test(module)) { + let fn; + let content; + let p; + if (Array.isArray(module)) { + p = path.join(currentDirectory, module[0]); + content = module + .map(arg => { + p = path.join(currentDirectory, arg); + return fs.readFileSync(p, "utf-8"); + }) + .join("\n"); + } else { + p = path.join(currentDirectory, module); + content = fs.readFileSync(p, "utf-8"); + } + if ( + options.target === "web" || + options.target === "webworker" + ) { + fn = vm.runInNewContext( + "(function(require, module, exports, __dirname, __filename, it, beforeEach, afterEach, expect, jest, window) {" + + content + + "\n})", + globalContext, + p + ); + } else { + fn = vm.runInThisContext( + "(function(require, module, exports, __dirname, __filename, it, beforeEach, afterEach, expect, jest) {" + + "global.expect = expect; " + + content + + "\n})", + p + ); + } + const m = { + exports: {} + }; + fn.call( + m.exports, + _require.bind(null, path.dirname(p)), + m, + m.exports, + path.dirname(p), + p, + _it, + _beforeEach, + _afterEach, + expect, + jest, + globalContext + ); + return m.exports; + } else if ( + testConfig.modules && + module in testConfig.modules + ) { + return testConfig.modules[module]; + } else return require(module); + } + let filesCount = 0; - if (testConfig.noTests) return process.nextTick(done); - for (let i = 0; i < optionsArr.length; i++) { - const bundlePath = testConfig.findBundle(i, optionsArr[i]); - if (bundlePath) { - filesCount++; - _require(outputDirectory, bundlePath); - } - } - // give a free pass to compilation that generated an error - if (!jsonStats.errors.length && filesCount !== optionsArr.length) - return done( - new Error( - "Should have found at least one bundle file per webpack config" - ) - ); - if (exportedTests < filesCount) - return done(new Error("No tests exported by test case")); - if (testConfig.afterExecute) testConfig.afterExecute(); - process.nextTick(done); - }); + if (testConfig.noTests) return process.nextTick(done); + for (let i = 0; i < optionsArr.length; i++) { + const bundlePath = testConfig.findBundle(i, optionsArr[i]); + if (bundlePath) { + filesCount++; + _require(outputDirectory, bundlePath); + } + } + // give a free pass to compilation that generated an error + if ( + !jsonStats.errors.length && + filesCount !== optionsArr.length + ) + return done( + new Error( + "Should have found at least one bundle file per webpack config" + ) + ); + if (exportedTests.length < filesCount) + return done(new Error("No tests exported by test case")); + if (testConfig.afterExecute) testConfig.afterExecute(); + const asyncSuite = describe(`ConfigTestCases ${ + category.name + } ${testName} exported tests`, () => { + exportedBeforeEach.forEach(beforeEach); + exportedAfterEach.forEach(afterEach); + exportedTests.forEach( + ({ title, fn, timeout }) => + fn + ? fit(title, fn, timeout) + : fit(title, () => {}).pend("Skipped") + ); + }); + // workaround for jest running clearSpies on the wrong suite (invoked by clearResourcesForRunnable) + asyncSuite.disabled = true; + + jasmine + .getEnv() + .execute([asyncSuite.id], asyncSuite) + .then(done, done); + }); + }) + ); }); }); }); diff --git a/test/ContextModuleFactory.unittest.js b/test/ContextModuleFactory.unittest.js index 17b058b2f2e..d4bec304cef 100644 --- a/test/ContextModuleFactory.unittest.js +++ b/test/ContextModuleFactory.unittest.js @@ -1,17 +1,17 @@ /* globals describe, it, beforeEach */ "use strict"; -require("should"); + const MemoryFs = require("memory-fs"); const ContextModuleFactory = require("../lib/ContextModuleFactory"); -describe("ContextModuleFactory", function() { - describe("resolveDependencies", function() { +describe("ContextModuleFactory", () => { + describe("resolveDependencies", () => { let factory, memfs; - beforeEach(function() { + beforeEach(() => { factory = new ContextModuleFactory([]); memfs = new MemoryFs(); }); - it("should not report an error when ENOENT errors happen", function(done) { + it("should not report an error when ENOENT errors happen", done => { memfs.readdir = (dir, callback) => { setTimeout(() => callback(null, ["/file"])); }; @@ -28,14 +28,14 @@ describe("ContextModuleFactory", function() { regExp: /.*/ }, (err, res) => { - (!!err).should.be.false(); - res.should.be.an.Array(); - res.length.should.be.exactly(0); + expect(err).toBeFalsy(); + expect(Array.isArray(res)).toBe(true); + expect(res.length).toBe(0); done(); } ); }); - it("should report an error when non-ENOENT errors happen", function(done) { + it("should report an error when non-ENOENT errors happen", done => { memfs.readdir = (dir, callback) => { setTimeout(() => callback(null, ["/file"])); }; @@ -52,8 +52,8 @@ describe("ContextModuleFactory", function() { regExp: /.*/ }, (err, res) => { - err.should.be.an.Error(); - (!!res).should.be.false(); + expect(err).toBeInstanceOf(Error); + expect(res).toBeFalsy(); done(); } ); diff --git a/test/DelegatedModule.unittest.js b/test/DelegatedModule.unittest.js index fdfc9934c70..977adbd50e3 100644 --- a/test/DelegatedModule.unittest.js +++ b/test/DelegatedModule.unittest.js @@ -1,10 +1,10 @@ /* globals describe, it, beforeEach */ "use strict"; -require("should"); + const DelegatedModule = require("../lib/DelegatedModule"); -describe("DelegatedModule", function() { - describe("#updateHash", function() { +describe("DelegatedModule", () => { + describe("#updateHash", () => { const sourceRequest = "dll-reference dll_e54c0fb67f8152792ad2"; const data = { id: "/xg9" @@ -13,7 +13,7 @@ describe("DelegatedModule", function() { const userRequest = "./library.js"; let hashedText; let hash; - beforeEach(function() { + beforeEach(() => { hashedText = ""; hash = { update: text => { @@ -28,11 +28,11 @@ describe("DelegatedModule", function() { ); delegatedModule.updateHash(hash); }); - it("updates hash with delegated module ID", function() { - hashedText.should.containEql("/xg9"); + it("updates hash with delegated module ID", () => { + expect(hashedText).toMatch("/xg9"); }); - it("updates hash with delegation type", function() { - hashedText.should.containEql("require"); + it("updates hash with delegation type", () => { + expect(hashedText).toMatch("require"); }); }); }); diff --git a/test/DependenciesBlockVariable.unittest.js b/test/DependenciesBlockVariable.unittest.js deleted file mode 100644 index f056429f5a5..00000000000 --- a/test/DependenciesBlockVariable.unittest.js +++ /dev/null @@ -1,93 +0,0 @@ -"use strict"; - -const should = require("should"); -const sinon = require("sinon"); -const DependenciesBlockVariable = require("../lib/DependenciesBlockVariable"); - -describe("DependenciesBlockVariable", () => { - let DependenciesBlockVariableInstance, dependencyMock, sandbox; - - before(() => { - sandbox = sinon.sandbox.create(); - dependencyMock = { - constructor: { - name: "DependencyMock" - }, - disconnect: sandbox.spy(), - updateHash: sandbox.spy() - }; - DependenciesBlockVariableInstance = new DependenciesBlockVariable( - "dependencies-name", - "expression", - [dependencyMock] - ); - }); - - afterEach(() => sandbox.restore()); - - describe("hasDependencies", () => - it("returns `true` if has dependencies", () => - should(DependenciesBlockVariableInstance.hasDependencies()).be.true())); - - describe("disconnect", () => - it("trigger dependencies disconnection", () => { - DependenciesBlockVariableInstance.disconnect(); - should(dependencyMock.disconnect.calledOnce).be.true(); - })); - - describe("updateHash", () => { - let hash; - before(() => { - hash = { - update: sandbox.spy() - }; - DependenciesBlockVariableInstance.updateHash(hash); - }); - - it("should update hash dependencies with name", () => - should(hash.update.calledWith("dependencies-name")).be.true()); - - it("should update hash dependencies with expression", () => - should(hash.update.calledWith("expression")).be.true()); - - it("should update hash inside dependencies", () => - should(dependencyMock.updateHash.calledOnce).be.true()); - }); - - describe("expressionSource", () => { - let dependencyTemplates, applyMock; - - before(() => (applyMock = sandbox.spy())); - - it("applies information inside dependency templates", () => { - dependencyTemplates = { - get: function() { - return { - apply: applyMock - }; - } - }; - DependenciesBlockVariableInstance.expressionSource( - dependencyTemplates, - {}, - {} - ); - should(applyMock.calledOnce).be.true(); - }); - - it("applies information inside dependency templates", () => { - dependencyTemplates = { - get: function() { - return false; - } - }; - should(() => { - DependenciesBlockVariableInstance.expressionSource( - dependencyTemplates, - {}, - {} - ); - }).throw("No template for dependency: DependencyMock"); - }); - }); -}); diff --git a/test/Errors.test.js b/test/Errors.test.js index 5f08dfd5d01..ab5c5afb332 100644 --- a/test/Errors.test.js +++ b/test/Errors.test.js @@ -1,7 +1,6 @@ "use strict"; /*globals describe it */ -const should = require("should"); const path = require("path"); const webpack = require("../lib/webpack"); @@ -9,14 +8,16 @@ const webpack = require("../lib/webpack"); const base = path.join(__dirname, "fixtures", "errors"); describe("Errors", () => { + jest.setTimeout(20000); + function customOutputFilesystem(c) { const files = {}; c.outputFileSystem = { join: path.join.bind(path), - mkdirp: function(path, callback) { + mkdirp(path, callback) { callback(); }, - writeFile: function(name, content, callback) { + writeFile(name, content, callback) { files[name] = content.toString("utf-8"); callback(); } @@ -30,18 +31,27 @@ describe("Errors", () => { customOutputFilesystem(c); c.run((err, stats) => { if (err) throw err; - should.strictEqual(typeof stats, "object"); + expect(typeof stats).toBe("object"); stats = stats.toJson({ errorDetails: false }); - should.strictEqual(typeof stats, "object"); - stats.should.have.property("errors"); - stats.should.have.property("warnings"); - Array.isArray(stats.errors).should.be.ok(); // eslint-disable-line no-unused-expressions - Array.isArray(stats.warnings).should.be.ok(); // eslint-disable-line no-unused-expressions + expect(typeof stats).toBe("object"); + expect(stats).toHaveProperty("errors"); + expect(stats).toHaveProperty("warnings"); + expect(Array.isArray(stats.errors)).toBe(true); + expect(Array.isArray(stats.warnings)).toBe(true); callback(stats.errors, stats.warnings); }); } + + function getErrorsPromise(options, callback) { + return new Promise((resolve, reject) => { + getErrors(options, (errors, warnings) => { + callback(errors, warnings); + resolve(); + }); + }); + } it("should throw an error if file doesn't exist", done => { getErrors( { @@ -49,19 +59,19 @@ describe("Errors", () => { entry: "./missingFile" }, (errors, warnings) => { - errors.length.should.be.eql(2); - warnings.length.should.be.eql(0); + expect(errors).toHaveLength(2); + expect(warnings).toHaveLength(0); errors.sort(); let lines = errors[0].split("\n"); - lines[0].should.match(/missingFile.js/); - lines[1].should.match(/^Module not found/); - lines[1].should.match(/\.\/dir\/missing2/); - lines[2].should.match(/missingFile.js 12:9/); + expect(lines[0]).toMatch(/missingFile.js/); + expect(lines[1]).toMatch(/^Module not found/); + expect(lines[1]).toMatch(/\.\/dir\/missing2/); + expect(lines[2]).toMatch(/missingFile.js 12:9/); lines = errors[1].split("\n"); - lines[0].should.match(/missingFile.js/); - lines[1].should.match(/^Module not found/); - lines[1].should.match(/\.\/missing/); - lines[2].should.match(/missingFile.js 4:0/); + expect(lines[0]).toMatch(/missingFile.js/); + expect(lines[1]).toMatch(/^Module not found/); + expect(lines[1]).toMatch(/\.\/missing/); + expect(lines[2]).toMatch(/missingFile.js 4:0/); done(); } ); @@ -73,11 +83,13 @@ describe("Errors", () => { entry: "./require.extensions" }, (errors, warnings) => { - errors.length.should.be.eql(0); - warnings.length.should.be.eql(1); + expect(errors).toHaveLength(0); + expect(warnings).toHaveLength(1); const lines = warnings[0].split("\n"); - lines[0].should.match(/require.extensions\.js/); - lines[1].should.match(/require.extensions is not supported by webpack/); + expect(lines[0]).toMatch(/require.extensions\.js/); + expect(lines[1]).toMatch( + /require.extensions is not supported by webpack/ + ); done(); } ); @@ -90,17 +102,17 @@ describe("Errors", () => { }, (errors, warnings) => { if (errors.length === 0) { - warnings.length.should.be.eql(1); + expect(warnings).toHaveLength(1); const lines = warnings[0].split("\n"); - lines[4].should.match(/FILE\.js/); - lines[5].should.match(/Used by/); - lines[6].should.match(/case-sensitive/); - lines[7].should.match(/file\.js/); - lines[8].should.match(/Used by/); - lines[9].should.match(/case-sensitive/); + expect(lines[4]).toMatch(/FILE\.js/); + expect(lines[5]).toMatch(/Used by/); + expect(lines[6]).toMatch(/case-sensitive/); + expect(lines[7]).toMatch(/file\.js/); + expect(lines[8]).toMatch(/Used by/); + expect(lines[9]).toMatch(/case-sensitive/); } else { - errors.length.should.be.eql(1); - warnings.length.should.be.eql(0); + expect(errors).toHaveLength(1); + expect(warnings).toHaveLength(0); } done(); } @@ -112,13 +124,13 @@ describe("Errors", () => { entry: "./entry-point" }, (errors, warnings) => { - errors.length.should.be.eql(0); - warnings.length.should.be.eql(1); + expect(errors).toHaveLength(0); + expect(warnings).toHaveLength(1); let lines = warnings[0].split("\n"); - lines[0].should.match(/configuration/); - lines[1].should.match(/mode/); - lines[1].should.match(/development/); - lines[1].should.match(/production/); + expect(lines[0]).toMatch(/configuration/); + expect(lines[1]).toMatch(/mode/); + expect(lines[1]).toMatch(/development/); + expect(lines[1]).toMatch(/production/); done(); } ); @@ -130,8 +142,8 @@ describe("Errors", () => { entry: "./no-errors-deprecate" }, (errors, warnings) => { - errors.length.should.be.eql(0); - warnings.length.should.be.eql(0); + expect(errors).toHaveLength(0); + expect(warnings).toHaveLength(0); done(); } ); @@ -143,19 +155,19 @@ describe("Errors", () => { entry: "./missingFile" }, (errors, warnings) => { - errors.length.should.be.eql(2); - warnings.length.should.be.eql(0); + expect(errors).toHaveLength(2); + expect(warnings).toHaveLength(0); errors.sort(); let lines = errors[0].split("\n"); - lines[0].should.match(/missingFile.js/); - lines[1].should.match(/^Module not found/); - lines[1].should.match(/\.\/dir\/missing2/); - lines[2].should.match(/missingFile.js 12:9/); + expect(lines[0]).toMatch(/missingFile.js/); + expect(lines[1]).toMatch(/^Module not found/); + expect(lines[1]).toMatch(/\.\/dir\/missing2/); + expect(lines[2]).toMatch(/missingFile.js 12:9/); lines = errors[1].split("\n"); - lines[0].should.match(/missingFile.js/); - lines[1].should.match(/^Module not found/); - lines[1].should.match(/\.\/missing/); - lines[2].should.match(/missingFile.js 4:0/); + expect(lines[0]).toMatch(/missingFile.js/); + expect(lines[1]).toMatch(/^Module not found/); + expect(lines[1]).toMatch(/\.\/missing/); + expect(lines[2]).toMatch(/missingFile.js 4:0/); done(); } ); @@ -175,16 +187,174 @@ describe("Errors", () => { plugins: [new webpack.HotModuleReplacementPlugin()] }, (errors, warnings) => { - errors.length.should.be.eql(3); - warnings.length.should.be.eql(0); + expect(errors).toHaveLength(3); + expect(warnings).toHaveLength(0); errors.forEach(error => { const lines = error.split("\n"); - lines[0].should.match(/chunk (a|b|c)/); - lines[2].should.match(/\[chunkhash\].js/); - lines[2].should.match(/use \[hash\] instead/); + expect(lines[0]).toMatch(/chunk (a|b|c)/); + expect(lines[2]).toMatch(/\[chunkhash\].js/); + expect(lines[2]).toMatch(/use \[hash\] instead/); }); done(); } ); }); + it("should show loader name when emit/throw errors or warnings from loaders", () => { + return Promise.all([ + getErrorsPromise( + { + mode: "development", + entry: "./entry-point-error-loader-required.js" + }, + (errors, warnings) => { + expect(warnings).toHaveLength(1); + expect(warnings[0].split("\n")[1]).toMatch( + /^Module Warning \(from .\/emit-error-loader.js\):$/ + ); + expect(errors).toHaveLength(1); + expect(errors[0].split("\n")[1]).toMatch( + /^Module Error \(from .\/emit-error-loader.js\):$/ + ); + } + ), + getErrorsPromise( + { + mode: "development", + entry: path.resolve(base, "./emit-error-loader") + "!./entry-point.js" + }, + (errors, warnings) => { + expect(warnings).toHaveLength(1); + expect(warnings[0].split("\n")[1]).toMatch( + /^Module Warning \(from .\/emit-error-loader.js\):$/ + ); + expect(errors).toHaveLength(1); + expect(errors[0].split("\n")[1]).toMatch( + /^Module Error \(from .\/emit-error-loader.js\):$/ + ); + } + ), + getErrorsPromise( + { + mode: "development", + entry: "./not-a-json.js", + module: { + rules: [ + { + test: /not-a-json\.js$/, + use: [ + "json-loader", + { + loader: path.resolve(base, "./emit-error-loader") + } + ] + } + ] + } + }, + (errors, warnings) => { + expect(warnings).toHaveLength(1); + expect(warnings[0].split("\n")[1]).toMatch( + /^Module Warning \(from .\/emit-error-loader.js\):$/ + ); + expect(errors).toHaveLength(2); + expect(errors[0].split("\n")[1]).toMatch( + /^Module Error \(from .\/emit-error-loader.js\):$/ + ); + expect(errors[1].split("\n")[1]).toMatch( + /^Module build failed \(from \(webpack\)\/node_modules\/json-loader\/index.js\):$/ + ); + } + ), + getErrorsPromise( + { + mode: "development", + entry: "./entry-point.js", + module: { + rules: [ + { + test: /entry-point\.js$/, + use: path.resolve(base, "./async-error-loader") + } + ] + } + }, + (errors, warnings) => { + expect(errors).toHaveLength(1); + expect(errors[0].split("\n")[1]).toMatch( + /^Module build failed \(from .\/async-error-loader.js\):$/ + ); + } + ), + getErrorsPromise( + { + mode: "development", + entry: "./entry-point.js", + module: { + rules: [ + { + test: /entry-point\.js$/, + use: path.resolve(base, "./throw-error-loader") + } + ] + } + }, + (errors, warnings) => { + expect(errors).toHaveLength(1); + expect(errors[0].split("\n")[1]).toMatch( + /^Module build failed \(from .\/throw-error-loader.js\):$/ + ); + } + ), + getErrorsPromise( + { + mode: "development", + entry: "./entry-point.js", + module: { + rules: [ + { + test: /entry-point\.js$/, + use: path.resolve(base, "./irregular-error-loader") + } + ] + } + }, + (errors, warnings) => { + expect(warnings).toHaveLength(2); + expect(warnings[0].split("\n")[1]).toMatch( + /^Module Warning \(from .\/irregular-error-loader.js\):$/ + ); + expect(warnings[1].split("\n")[1]).toMatch( + /^Module Warning \(from .\/irregular-error-loader.js\):$/ + ); + + expect(errors).toHaveLength(3); + expect(errors[0].split("\n")[1]).toMatch( + /^Module Error \(from .\/irregular-error-loader.js\):$/ + ); + expect(errors[1].split("\n")[1]).toMatch( + /^Module Error \(from .\/irregular-error-loader.js\):$/ + ); + expect(errors[2].split("\n")[1]).toMatch( + /^Module build failed \(from .\/irregular-error-loader.js\):$/ + ); + } + ) + ]); + }); + it("should throw a build error if no source be returned after run loaders", done => { + getErrors( + { + mode: "development", + entry: path.resolve(base, "./no-return-loader") + "!./entry-point.js" + }, + (errors, warnings) => { + expect(errors).toHaveLength(1); + const messages = errors[0].split("\n"); + expect(messages[1]).toMatch( + /^Module build failed: Error: Final loader \(.+\) didn't return a Buffer or String/ + ); + done(); + } + ); + }); }); diff --git a/test/Examples.test.js b/test/Examples.test.js index d298cf8c1cf..527d7cb3ca6 100644 --- a/test/Examples.test.js +++ b/test/Examples.test.js @@ -1,7 +1,6 @@ "use strict"; /* globals describe it */ -require("should"); const path = require("path"); const fs = require("fs"); const webpack = require("../"); @@ -12,50 +11,52 @@ describe("Examples", () => { examples.forEach(examplePath => { const filterPath = path.join(examplePath, "test.filter.js"); + const relativePath = path.relative(basePath, examplePath); if (fs.existsSync(filterPath) && !require(filterPath)()) { - describe.skip(path.relative(basePath, examplePath), () => it("filtered")); + describe.skip(relativePath, () => it("filtered")); return; } - it("should compile " + path.relative(basePath, examplePath), function( - done - ) { - this.timeout(30000); - let options = {}; - let webpackConfigPath = path.join(examplePath, "webpack.config.js"); - webpackConfigPath = - webpackConfigPath.substr(0, 1).toUpperCase() + - webpackConfigPath.substr(1); - if (fs.existsSync(webpackConfigPath)) - options = require(webpackConfigPath); - if (Array.isArray(options)) options.forEach(processOptions); - else processOptions(options); + it( + "should compile " + relativePath, + function(done) { + let options = {}; + let webpackConfigPath = path.join(examplePath, "webpack.config.js"); + webpackConfigPath = + webpackConfigPath.substr(0, 1).toUpperCase() + + webpackConfigPath.substr(1); + if (fs.existsSync(webpackConfigPath)) + options = require(webpackConfigPath); + if (Array.isArray(options)) options.forEach(processOptions); + else processOptions(options); - function processOptions(options) { - options.context = examplePath; - options.output = options.output || {}; - options.output.pathinfo = true; - options.output.path = path.join(examplePath, "dist"); - options.output.publicPath = "dist/"; - if (!options.entry) options.entry = "./example.js"; - if (!options.plugins) options.plugins = []; - // To support deprecated loaders - // TODO remove in webpack 5 - options.plugins.push( - new webpack.LoaderOptionsPlugin({ - options: {} - }) - ); - } - webpack(options, (err, stats) => { - if (err) return done(err); - stats = stats.toJson({ - errorDetails: true - }); - if (stats.errors.length > 0) { - return done(new Error(stats.errors[0])); + function processOptions(options) { + options.context = examplePath; + options.output = options.output || {}; + options.output.pathinfo = true; + options.output.path = path.join(examplePath, "dist"); + options.output.publicPath = "dist/"; + if (!options.entry) options.entry = "./example.js"; + if (!options.plugins) options.plugins = []; + // To support deprecated loaders + // TODO remove in webpack 5 + options.plugins.push( + new webpack.LoaderOptionsPlugin({ + options: {} + }) + ); } - done(); - }); - }); + webpack(options, (err, stats) => { + if (err) return done(err); + stats = stats.toJson({ + errorDetails: true + }); + if (stats.errors.length > 0) { + return done(new Error(stats.errors[0])); + } + done(); + }); + }, + 45000 + ); }); }); diff --git a/test/ExternalModule.unittest.js b/test/ExternalModule.unittest.js index 5d90bfff481..075c4600919 100644 --- a/test/ExternalModule.unittest.js +++ b/test/ExternalModule.unittest.js @@ -1,71 +1,70 @@ /* globals describe, it, beforeEach */ "use strict"; -require("should"); -const sinon = require("sinon"); + const ExternalModule = require("../lib/ExternalModule"); const OriginalSource = require("webpack-sources").OriginalSource; const RawSource = require("webpack-sources").RawSource; -describe("ExternalModule", function() { +describe("ExternalModule", () => { let externalModule; let request; let type; - beforeEach(function() { + beforeEach(() => { request = "some/request"; type = "some-type"; externalModule = new ExternalModule(request, type, `${type} ${request}`); }); - describe("#identifier", function() { - it("returns an identifier for this module", function() { + describe("#identifier", () => { + it("returns an identifier for this module", () => { const expected = `external "${request}"`; - externalModule.identifier().should.eql(expected); + expect(externalModule.identifier()).toBe(expected); }); }); - describe("#readableIdentifier", function() { - it("returns an identifier for this module", function() { + describe("#readableIdentifier", () => { + it("returns an identifier for this module", () => { const expected = `external "${request}"`; - externalModule.identifier().should.eql(expected); + expect(externalModule.identifier()).toBe(expected); }); }); - describe("#needRebuild", function() { - it("always returns false", function() { - externalModule.needRebuild().should.eql(false); + describe("#needRebuild", () => { + it("always returns false", () => { + expect(externalModule.needRebuild()).toBe(false); }); }); - describe("#size", function() { - it("always returns 42", function() { - externalModule.size().should.eql(42); + describe("#size", () => { + it("always returns 42", () => { + expect(externalModule.size()).toBe(42); }); }); - describe("#source", function() { - it("calls getSource with the result of getSourceString", function() { + describe("#source", () => { + it("calls getSource with the result of getSourceString", () => { // set up const expectedString = "something expected stringy"; const expectedSource = "something expected source"; - externalModule.getSource = sinon.stub().returns(expectedSource); - externalModule.getSourceString = sinon.stub().returns(expectedString); + externalModule.getSource = jest.fn(() => expectedSource); + externalModule.getSourceString = jest.fn(() => expectedString); // invoke const result = externalModule.source(); // check - externalModule.getSource.callCount.should.eql(1); - externalModule.getSourceString.callCount.should.eql(1); - externalModule.getSource.args[0][0].should.eql(expectedString); - result.should.eql(expectedSource); + expect(externalModule.getSource.mock.calls.length).toBe(1); + expect(externalModule.getSourceString.mock.calls.length).toBe(1); + expect(externalModule.getSource.mock.calls[0][0]).toBe(expectedString); + expect(result).toEqual(expectedSource); }); }); - describe("#getSource", function() { - describe("given it should use source maps", function() { - beforeEach(function() { + describe("#getSource", () => { + describe("given it should use source maps", () => { + beforeEach(() => { externalModule.useSourceMap = true; }); - it("returns an instance of OriginalSource", function() { + it("returns an instance of OriginalSource", () => { // set up const someSourceString = "some source string"; @@ -73,14 +72,14 @@ describe("ExternalModule", function() { const result = externalModule.getSource(someSourceString); // check - result.should.be.instanceOf(OriginalSource); + expect(result).toBeInstanceOf(OriginalSource); }); }); - describe("given it does not use source maps", function() { - beforeEach(function() { + describe("given it does not use source maps", () => { + beforeEach(() => { externalModule.useSourceMap = false; }); - it("returns an instance of RawSource", function() { + it("returns an instance of RawSource", () => { // set up const someSourceString = "some source string"; @@ -88,14 +87,14 @@ describe("ExternalModule", function() { const result = externalModule.getSource(someSourceString); // check - result.should.be.instanceOf(RawSource); + expect(result).toBeInstanceOf(RawSource); }); }); }); - describe("#getSourceForGlobalVariableExternal", function() { - describe("given an array as variable name in the global namespace", function() { - it("use the array as lookup in the global object", function() { + describe("#getSourceForGlobalVariableExternal", () => { + describe("given an array as variable name in the global namespace", () => { + it("use the array as lookup in the global object", () => { // set up const type = "window"; const varName = ["foo", "bar"]; @@ -109,11 +108,11 @@ describe("ExternalModule", function() { ); // check - result.should.eql(expected); + expect(result).toEqual(expected); }); }); - describe("given an single variable name", function() { - it("look it up in the global namespace", function() { + describe("given an single variable name", () => { + it("look it up in the global namespace", () => { // set up const type = "window"; const varName = "foo"; @@ -126,14 +125,14 @@ describe("ExternalModule", function() { ); // check - result.should.eql(expected); + expect(result).toEqual(expected); }); }); }); - describe("#getSourceForCommonJsExternal", function() { - describe("given an array as names in the global namespace", function() { - it("use the first to require a module and the rest as lookup on the required module", function() { + describe("#getSourceForCommonJsExternal", () => { + describe("given an array as names in the global namespace", () => { + it("use the first to require a module and the rest as lookup on the required module", () => { // set up const varName = ["module", "look", "up"]; const expected = 'module.exports = require(module)["look"]["up"];'; @@ -145,11 +144,11 @@ describe("ExternalModule", function() { ); // check - result.should.eql(expected); + expect(result).toEqual(expected); }); }); - describe("given an single variable name", function() { - it("require a module with that name", function() { + describe("given an single variable name", () => { + it("require a module with that name", () => { // set up const type = "window"; const varName = "foo"; @@ -162,17 +161,17 @@ describe("ExternalModule", function() { ); // check - result.should.eql(expected); + expect(result).toEqual(expected); }); }); }); - describe("#checkExternalVariable", function() { - it("creates a check that fails if a variable does not exist", function() { + describe("#checkExternalVariable", () => { + it("creates a check that fails if a variable does not exist", () => { // set up const variableToCheck = "foo"; const request = "bar"; - const expected = `if(typeof foo === 'undefined') {var e = new Error("Cannot find module \\"bar\\""); e.code = 'MODULE_NOT_FOUND'; throw e;} + const expected = `if(typeof foo === 'undefined') {var e = new Error("Cannot find module 'bar'"); e.code = 'MODULE_NOT_FOUND'; throw e;} `; // invoke @@ -182,12 +181,12 @@ describe("ExternalModule", function() { ); // check - result.should.eql(expected); + expect(result).toEqual(expected); }); }); - describe("#getSourceForAmdOrUmdExternal", function() { - it("looks up a global variable as specified by the id", function() { + describe("#getSourceForAmdOrUmdExternal", () => { + it("looks up a global variable as specified by the id", () => { // set up const id = "someId"; const optional = false; @@ -201,14 +200,14 @@ describe("ExternalModule", function() { ); // check - result.should.eql(expected); + expect(result).toEqual(expected); }); describe("given an optional check is set", function() { - it("ads a check for the existence of the variable before looking it up", function() { + it("ads a check for the existence of the variable before looking it up", () => { // set up const id = "someId"; const optional = true; - const expected = `if(typeof __WEBPACK_EXTERNAL_MODULE_someId__ === 'undefined') {var e = new Error("Cannot find module \\"some/request\\""); e.code = 'MODULE_NOT_FOUND'; throw e;} + const expected = `if(typeof __WEBPACK_EXTERNAL_MODULE_someId__ === 'undefined') {var e = new Error("Cannot find module 'some/request'"); e.code = 'MODULE_NOT_FOUND'; throw e;} module.exports = __WEBPACK_EXTERNAL_MODULE_someId__;`; // invoke @@ -219,13 +218,13 @@ module.exports = __WEBPACK_EXTERNAL_MODULE_someId__;`; ); // check - result.should.eql(expected); + expect(result).toEqual(expected); }); }); }); - describe("#getSourceForDefaultCase", function() { - it("returns the given request as lookup", function() { + describe("#getSourceForDefaultCase", () => { + it("returns the given request as lookup", () => { // set up const optional = false; const expected = "module.exports = some/request;"; @@ -234,13 +233,13 @@ module.exports = __WEBPACK_EXTERNAL_MODULE_someId__;`; const result = externalModule.getSourceForDefaultCase(optional, request); // check - result.should.eql(expected); + expect(result).toEqual(expected); }); describe("given an optional check is requested", function() { - it("checks for the existence of the request setting it", function() { + it("checks for the existence of the request setting it", () => { // set up const optional = true; - const expected = `if(typeof some/request === 'undefined') {var e = new Error("Cannot find module \\"some/request\\""); e.code = 'MODULE_NOT_FOUND'; throw e;} + const expected = `if(typeof some/request === 'undefined') {var e = new Error("Cannot find module 'some/request'"); e.code = 'MODULE_NOT_FOUND'; throw e;} module.exports = some/request;`; // invoke @@ -250,15 +249,15 @@ module.exports = some/request;`; ); // check - result.should.eql(expected); + expect(result).toEqual(expected); }); }); }); - describe("#updateHash", function() { + describe("#updateHash", () => { let hashedText; let hash; - beforeEach(function() { + beforeEach(() => { hashedText = ""; hash = { update: text => { @@ -268,21 +267,21 @@ module.exports = some/request;`; externalModule.id = 12345678; externalModule.updateHash(hash); }); - it("updates hash with request", function() { - hashedText.should.containEql("some/request"); + it("updates hash with request", () => { + expect(hashedText).toMatch("some/request"); }); - it("updates hash with type", function() { - hashedText.should.containEql("some-type"); + it("updates hash with type", () => { + expect(hashedText).toMatch("some-type"); }); - it("updates hash with module id", function() { - hashedText.should.containEql("12345678"); + it("updates hash with module id", () => { + expect(hashedText).toMatch("12345678"); }); }); - describe("#updateHash without optional", function() { + describe("#updateHash without optional", () => { let hashedText; let hash; - beforeEach(function() { + beforeEach(() => { hashedText = ""; hash = { update: text => { @@ -293,17 +292,17 @@ module.exports = some/request;`; externalModule.id = 12345678; externalModule.updateHash(hash); }); - it("updates hash with request", function() { - hashedText.should.containEql("some/request"); + it("updates hash with request", () => { + expect(hashedText).toMatch("some/request"); }); - it("updates hash with type", function() { - hashedText.should.containEql("some-type"); + it("updates hash with type", () => { + expect(hashedText).toMatch("some-type"); }); - it("updates hash with optional flag", function() { - hashedText.should.containEql("false"); + it("updates hash with optional flag", () => { + expect(hashedText).toMatch("false"); }); - it("updates hash with module id", function() { - hashedText.should.containEql("12345678"); + it("updates hash with module id", () => { + expect(hashedText).toMatch("12345678"); }); }); }); diff --git a/test/HarmonyExportImportedSpecifierDependency.unittest.js b/test/HarmonyExportImportedSpecifierDependency.unittest.js index 3f70bc93bc7..29b25745575 100644 --- a/test/HarmonyExportImportedSpecifierDependency.unittest.js +++ b/test/HarmonyExportImportedSpecifierDependency.unittest.js @@ -1,7 +1,6 @@ /* globals describe, it, beforeEach */ "use strict"; -const should = require("should"); const HarmonyExportImportedSpecifierDependency = require("../lib/dependencies/HarmonyExportImportedSpecifierDependency"); describe("HarmonyExportImportedSpecifierDependency", () => { @@ -9,8 +8,8 @@ describe("HarmonyExportImportedSpecifierDependency", () => { it("should return empty string on missing module", () => { // see e.g. PR #4368 var instance = new HarmonyExportImportedSpecifierDependency(); - should(instance.getHashValue(undefined)).be.eql(""); - should(instance.getHashValue(null)).be.eql(""); + expect(instance.getHashValue(undefined)).toBe(""); + expect(instance.getHashValue(null)).toBe(""); }); }); }); diff --git a/test/HotModuleReplacementPlugin.test.js b/test/HotModuleReplacementPlugin.test.js index e56529d10d4..c86df04ed75 100644 --- a/test/HotModuleReplacementPlugin.test.js +++ b/test/HotModuleReplacementPlugin.test.js @@ -1,38 +1,54 @@ "use strict"; -require("should"); const path = require("path"); const fs = require("fs"); +const mkdirp = require("mkdirp"); const webpack = require("../"); -describe("HotModuleReplacementPlugin", function() { - this.timeout(10000); +describe("HotModuleReplacementPlugin", () => { + jest.setTimeout(20000); it("should not have circular hashes but equal if unmodified", done => { - const entryFile = path.join(__dirname, "js", "entry.js"); + const entryFile = path.join( + __dirname, + "js", + "HotModuleReplacementPlugin", + "entry.js" + ); const statsFile1 = path.join( __dirname, "js", + "HotModuleReplacementPlugin", "HotModuleReplacementPlugin.test.stats1.txt" ); const statsFile2 = path.join( __dirname, "js", + "HotModuleReplacementPlugin", "HotModuleReplacementPlugin.test.stats2.txt" ); - const recordsFile = path.join(__dirname, "js", "records.json"); + const recordsFile = path.join( + __dirname, + "js", + "HotModuleReplacementPlugin", + "records.json" + ); try { - fs.mkdirSync(path.join(__dirname, "js")); - } catch (e) {} // eslint-disable-line no-empty + mkdirp.sync(path.join(__dirname, "js", "HotModuleReplacementPlugin")); + } catch (e) { + // empty + } try { fs.unlinkSync(recordsFile); - } catch (e) {} // eslint-disable-line no-empty + } catch (e) { + // empty + } const compiler = webpack({ cache: false, entry: entryFile, recordsPath: recordsFile, output: { - path: path.join(__dirname, "js") + path: path.join(__dirname, "js", "HotModuleReplacementPlugin") }, plugins: [ new webpack.HotModuleReplacementPlugin(), @@ -48,28 +64,19 @@ describe("HotModuleReplacementPlugin", function() { if (err) throw err; const lastHash1 = stats.toJson().hash; fs.writeFileSync(statsFile2, stats.toString()); - lastHash1.should.be.eql( - oldHash1, - "hash shouldn't change when bundle stay equal" - ); + expect(lastHash1).toBe(oldHash1); // hash shouldn't change when bundle stay equal fs.writeFileSync(entryFile, "2", "utf-8"); compiler.run((err, stats) => { if (err) throw err; const lastHash2 = stats.toJson().hash; fs.writeFileSync(statsFile1, stats.toString()); - lastHash2.should.not.be.eql( - lastHash1, - "hash should change when bundle changes" - ); + expect(lastHash2).not.toBe(lastHash1); // hash should change when bundle changes fs.writeFileSync(entryFile, "1", "utf-8"); compiler.run((err, stats) => { if (err) throw err; const currentHash1 = stats.toJson().hash; fs.writeFileSync(statsFile2, stats.toString()); - currentHash1.should.not.be.eql( - lastHash1, - "hash shouldn't change to the first hash if bundle changed back to first bundle" - ); + expect(currentHash1).not.toBe(lastHash1); // hash shouldn't change to the first hash if bundle changed back to first bundle fs.writeFileSync(entryFile, "2", "utf-8"); compiler.run((err, stats) => { if (err) throw err; @@ -77,10 +84,10 @@ describe("HotModuleReplacementPlugin", function() { fs.writeFileSync(statsFile1, stats.toString()); compiler.run((err, stats) => { if (err) throw err; - stats.toJson().hash.should.be.eql(currentHash2); - currentHash2.should.not.be.eql(lastHash2); - currentHash1.should.not.be.eql(currentHash2); - lastHash1.should.not.be.eql(lastHash2); + expect(stats.toJson().hash).toBe(currentHash2); + expect(currentHash2).not.toBe(lastHash2); + expect(currentHash1).not.toBe(currentHash2); + expect(lastHash1).not.toBe(lastHash2); done(); }); }); diff --git a/test/HotTestCases.test.js b/test/HotTestCases.test.js index e9d4254e912..22a5f852eb2 100644 --- a/test/HotTestCases.test.js +++ b/test/HotTestCases.test.js @@ -1,10 +1,9 @@ "use strict"; -require("should"); +/* globals expect fit */ const path = require("path"); const fs = require("fs"); const vm = require("vm"); -const Test = require("mocha/lib/test"); const checkArrayExpectation = require("./checkArrayExpectation"); const webpack = require("../lib/webpack"); @@ -25,88 +24,60 @@ describe("HotTestCases", () => { categories.forEach(category => { describe(category.name, () => { category.tests.forEach(testName => { - const suite = describe(testName, function() { - this.timeout(10000); - }); - it(testName + " should compile", function(done) { - this.timeout(10000); - const testDirectory = path.join(casesPath, category.name, testName); - const outputDirectory = path.join( - __dirname, - "js", - "hot-cases", - category.name, - testName - ); - const recordsPath = path.join(outputDirectory, "records.json"); - if (fs.existsSync(recordsPath)) fs.unlinkSync(recordsPath); - const fakeUpdateLoaderOptions = { - updateIndex: 0 - }; - const configPath = path.join(testDirectory, "webpack.config.js"); - let options = {}; - if (fs.existsSync(configPath)) options = require(configPath); - if (!options.mode) options.mode = "development"; - if (!options.context) options.context = testDirectory; - if (!options.entry) options.entry = "./index.js"; - if (!options.output) options.output = {}; - if (!options.output.path) options.output.path = outputDirectory; - if (!options.output.filename) options.output.filename = "bundle.js"; - if (options.output.pathinfo === undefined) - options.output.pathinfo = true; - if (!options.module) options.module = {}; - if (!options.module.rules) options.module.rules = []; - options.module.rules.push({ - test: /\.js$/, - loader: path.join(__dirname, "hotCases", "fake-update-loader.js"), - enforce: "pre" - }); - if (!options.target) options.target = "async-node"; - if (!options.plugins) options.plugins = []; - options.plugins.push( - new webpack.HotModuleReplacementPlugin(), - new webpack.NamedModulesPlugin(), - new webpack.LoaderOptionsPlugin(fakeUpdateLoaderOptions) - ); - if (!options.recordsPath) options.recordsPath = recordsPath; - const compiler = webpack(options); - compiler.run((err, stats) => { - if (err) return done(err); - const jsonStats = stats.toJson({ - errorDetails: true - }); - if ( - checkArrayExpectation( - testDirectory, - jsonStats, - "error", - "Error", - done - ) - ) - return; - if ( - checkArrayExpectation( - testDirectory, - jsonStats, - "warning", - "Warning", - done - ) - ) - return; - let exportedTests = 0; - - function _it(title, fn) { - const test = new Test(title, fn); - test.timeout(5000); - suite.addTest(test); - exportedTests++; - return test; - } - - function _next(callback) { - fakeUpdateLoaderOptions.updateIndex++; + describe( + testName, + () => { + let exportedTests = []; + it(testName + " should compile", done => { + const testDirectory = path.join( + casesPath, + category.name, + testName + ); + const outputDirectory = path.join( + __dirname, + "js", + "hot-cases", + category.name, + testName + ); + const recordsPath = path.join(outputDirectory, "records.json"); + if (fs.existsSync(recordsPath)) fs.unlinkSync(recordsPath); + const fakeUpdateLoaderOptions = { + updateIndex: 0 + }; + const configPath = path.join(testDirectory, "webpack.config.js"); + let options = {}; + if (fs.existsSync(configPath)) options = require(configPath); + if (!options.mode) options.mode = "development"; + if (!options.context) options.context = testDirectory; + if (!options.entry) options.entry = "./index.js"; + if (!options.output) options.output = {}; + if (!options.output.path) options.output.path = outputDirectory; + if (!options.output.filename) + options.output.filename = "bundle.js"; + if (options.output.pathinfo === undefined) + options.output.pathinfo = true; + if (!options.module) options.module = {}; + if (!options.module.rules) options.module.rules = []; + options.module.rules.push({ + test: /\.js$/, + loader: path.join( + __dirname, + "hotCases", + "fake-update-loader.js" + ), + enforce: "pre" + }); + if (!options.target) options.target = "async-node"; + if (!options.plugins) options.plugins = []; + options.plugins.push( + new webpack.HotModuleReplacementPlugin(), + new webpack.NamedModulesPlugin(), + new webpack.LoaderOptionsPlugin(fakeUpdateLoaderOptions) + ); + if (!options.recordsPath) options.recordsPath = recordsPath; + const compiler = webpack(options); compiler.run((err, stats) => { if (err) return done(err); const jsonStats = stats.toJson({ @@ -117,59 +88,117 @@ describe("HotTestCases", () => { testDirectory, jsonStats, "error", - "errors" + fakeUpdateLoaderOptions.updateIndex, "Error", done ) - ) + ) { return; + } if ( checkArrayExpectation( testDirectory, jsonStats, "warning", - "warnings" + fakeUpdateLoaderOptions.updateIndex, "Warning", done ) - ) + ) { return; - if (callback) callback(jsonStats); - }); - } + } + + function _it(title, fn) { + exportedTests.push({ title, fn, timeout: 10000 }); + } - function _require(module) { - if (module.substr(0, 2) === "./") { - const p = path.join(outputDirectory, module); - const fn = vm.runInThisContext( - "(function(require, module, exports, __dirname, __filename, it, NEXT, STATS) {" + - fs.readFileSync(p, "utf-8") + - "\n})", - p - ); - const m = { - exports: {} - }; - fn.call( - m.exports, - _require, - m, - m.exports, - outputDirectory, - p, - _it, - _next, - jsonStats - ); - return m.exports; - } else return require(module); - } - _require("./bundle.js"); - if (exportedTests < 1) - return done(new Error("No tests exported by test case")); - process.nextTick(done); - }); - }); + function _next(callback) { + fakeUpdateLoaderOptions.updateIndex++; + compiler.run((err, stats) => { + if (err) return done(err); + const jsonStats = stats.toJson({ + errorDetails: true + }); + if ( + checkArrayExpectation( + testDirectory, + jsonStats, + "error", + "errors" + fakeUpdateLoaderOptions.updateIndex, + "Error", + done + ) + ) { + return; + } + if ( + checkArrayExpectation( + testDirectory, + jsonStats, + "warning", + "warnings" + fakeUpdateLoaderOptions.updateIndex, + "Warning", + done + ) + ) { + return; + } + if (callback) callback(jsonStats); + }); + } + + function _require(module) { + if (module.substr(0, 2) === "./") { + const p = path.join(outputDirectory, module); + const fn = vm.runInThisContext( + "(function(require, module, exports, __dirname, __filename, it, expect, NEXT, STATS) {" + + "global.expect = expect;" + + fs.readFileSync(p, "utf-8") + + "\n})", + p + ); + const m = { + exports: {} + }; + fn.call( + m.exports, + _require, + m, + m.exports, + outputDirectory, + p, + _it, + expect, + _next, + jsonStats + ); + return m.exports; + } else return require(module); + } + _require("./bundle.js"); + if (exportedTests.length < 1) + return done(new Error("No tests exported by test case")); + + const asyncSuite = describe(`HotTestCases ${ + category.name + } ${testName} exported tests`, () => { + exportedTests.forEach(({ title, fn, timeout }) => { + jest.setTimeout(10000); + return fn + ? fit(title, fn, timeout) + : fit(title, () => {}).pend("Skipped"); + }); + }); + // workaround for jest running clearSpies on the wrong suite (invoked by clearResourcesForRunnable) + asyncSuite.disabled = true; + + jasmine + .getEnv() + .execute([asyncSuite.id], asyncSuite) + .then(done, done); + }); + }); + }, + 10000 + ); }); }); }); diff --git a/test/Integration.test.js b/test/Integration.test.js index 64afab276c2..a09f0c8e3ca 100644 --- a/test/Integration.test.js +++ b/test/Integration.test.js @@ -1,12 +1,10 @@ "use strict"; -require("should"); const path = require("path"); - const webpack = require("../lib/webpack"); -describe("Integration", function() { - this.timeout(5000); +describe("Integration", () => { + jest.setTimeout(10000); it("should compile library1", done => { webpack( { @@ -23,8 +21,8 @@ describe("Integration", function() { }, (err, stats) => { if (err) throw err; - stats.hasErrors().should.be.not.ok(); - stats.hasWarnings().should.be.not.ok(); + expect(stats.hasErrors()).toBe(false); + expect(stats.hasWarnings()).toBe(false); done(); } ); @@ -58,13 +56,6 @@ describe("Integration", function() { optimization: { minimize: false }, - resolve: { - // cannot resolve should outside the outermost node_modules - // so it is injected here - alias: { - should: require.resolve("should") - } - }, plugins: [ new webpack.optimize.LimitChunkCountPlugin({ maxChunks: 1 @@ -104,8 +95,8 @@ describe("Integration", function() { }, (err, stats) => { if (err) throw err; - stats.hasErrors().should.be.not.ok(); - stats.hasWarnings().should.be.not.ok(); + expect(stats.hasErrors()).toBe(false); + expect(stats.hasWarnings()).toBe(false); done(); } ); diff --git a/test/LocalModulesHelpers.unittest.js b/test/LocalModulesHelpers.unittest.js index 8f0fd513a20..b858697073a 100644 --- a/test/LocalModulesHelpers.unittest.js +++ b/test/LocalModulesHelpers.unittest.js @@ -1,7 +1,6 @@ /* globals describe, it */ "use strict"; -const should = require("should"); const LocalModulesHelpers = require("../lib/dependencies/LocalModulesHelpers"); describe("LocalModulesHelpers", () => { @@ -11,15 +10,18 @@ describe("LocalModulesHelpers", () => { module: "module_sample", localModules: ["first", "second"] }; - should(LocalModulesHelpers.addLocalModule(state, "local_module_sample")) - .be.an.instanceOf(Object) - .and.have.properties({ - module: "module_sample", - name: "local_module_sample", - idx: 2, - used: false - }); - should(state.localModules.length).be.eql(3); + const localModule = LocalModulesHelpers.addLocalModule( + state, + "local_module_sample" + ); + expect(localModule).toBeInstanceOf(Object); + expect(localModule).toMatchObject({ + module: "module_sample", + name: "local_module_sample", + idx: 2, + used: false + }); + expect(state.localModules.length).toBe(3); }); }); @@ -36,9 +38,9 @@ describe("LocalModulesHelpers", () => { } ] }; - should( + expect( LocalModulesHelpers.getLocalModule(state, "local_module_sample") - ).be.eql(null); + ).toBe(null); }); it("returns local module information", () => { @@ -53,7 +55,7 @@ describe("LocalModulesHelpers", () => { } ] }; - should(LocalModulesHelpers.getLocalModule(state, "first")).be.eql({ + expect(LocalModulesHelpers.getLocalModule(state, "first")).toEqual({ name: "first" }); }); diff --git a/test/ModuleDependencyError.unittest.js b/test/ModuleDependencyError.unittest.js index cd01f0765a2..3e54fd79c7f 100644 --- a/test/ModuleDependencyError.unittest.js +++ b/test/ModuleDependencyError.unittest.js @@ -1,15 +1,14 @@ "use strict"; const path = require("path"); -require("should"); const ModuleDependencyError = require("../lib/ModuleDependencyError"); describe("ModuleDependencyError", () => { let env; - beforeEach(() => (env = {})); - - it("is a function", () => ModuleDependencyError.should.be.a.Function()); + beforeEach(() => { + env = {}; + }); describe("when new error created", () => { beforeEach(() => { @@ -21,27 +20,34 @@ describe("ModuleDependencyError", () => { ); }); - it("is an error", () => env.moduleDependencyError.should.be.an.Error()); + it("is an error", () => { + expect(env.moduleDependencyError).toBeInstanceOf(Error); + }); - it("has a name property", () => - env.moduleDependencyError.name.should.be.exactly( - "ModuleDependencyError" - )); + it("has a name property", () => { + expect(env.moduleDependencyError.name).toBe("ModuleDependencyError"); + }); - it("has a message property", () => - env.moduleDependencyError.message.should.be.exactly( - "Location Error Message" - )); + it("has a message property", () => { + expect(env.moduleDependencyError.message).toBe("Error Message"); + }); - it("has a details property", () => - env.moduleDependencyError.details.should.containEql( + it("has a loc property", () => { + expect(env.moduleDependencyError.loc).toBe("Location"); + }); + + it("has a details property", () => { + expect(env.moduleDependencyError.details).toMatch( path.join("test", "ModuleDependencyError.unittest.js:") - )); + ); + }); - it("has an origin property", () => - env.moduleDependencyError.origin.should.be.exactly("myModule")); + it("has an module property", () => { + expect(env.moduleDependencyError.module).toBe("myModule"); + }); - it("has an error property", () => - env.moduleDependencyError.error.should.be.exactly(env.error)); + it("has an error property", () => { + expect(env.moduleDependencyError.error).toBe(env.error); + }); }); }); diff --git a/test/ModuleReason.unittest.js b/test/ModuleReason.unittest.js index b72519024c9..56a6cc25c01 100644 --- a/test/ModuleReason.unittest.js +++ b/test/ModuleReason.unittest.js @@ -4,7 +4,6 @@ const Module = require("../lib/Module"); const Chunk = require("../lib/Chunk"); const Dependency = require("../lib/Dependency"); const ModuleReason = require("../lib/ModuleReason"); -const should = require("should"); describe("ModuleReason", () => { let myModule; @@ -23,12 +22,13 @@ describe("ModuleReason", () => { }); describe("hasChunk", () => { - it("returns false when chunk is not present", () => - should(myModuleReason.hasChunk(myChunk)).be.false()); + it("returns false when chunk is not present", () => { + expect(myModuleReason.hasChunk(myChunk)).toBe(false); + }); it("returns true when chunk is present", () => { myModuleReason.module.addChunk(myChunk); - should(myModuleReason.hasChunk(myChunk)).be.true(); + expect(myModuleReason.hasChunk(myChunk)).toBe(true); }); }); @@ -37,15 +37,15 @@ describe("ModuleReason", () => { myModuleReason.module.addChunk(myChunk); myModuleReason.rewriteChunks(myChunk, [myChunk2]); - should(myModuleReason.hasChunk(myChunk)).be.false(); - should(myModuleReason.hasChunk(myChunk2)).be.true(); + expect(myModuleReason.hasChunk(myChunk)).toBe(false); + expect(myModuleReason.hasChunk(myChunk2)).toBe(true); }); it("if old chunk is not present, new chunks are not added", () => { myModuleReason.rewriteChunks(myChunk, [myChunk2]); - should(myModuleReason.hasChunk(myChunk)).be.false(); - should(myModuleReason.hasChunk(myChunk2)).be.false(); + expect(myModuleReason.hasChunk(myChunk)).toBe(false); + expect(myModuleReason.hasChunk(myChunk2)).toBe(false); }); it("if already rewritten chunk is present, it is replaced with new chunks", () => { @@ -53,8 +53,8 @@ describe("ModuleReason", () => { myModuleReason.rewriteChunks(myChunk, [myChunk2]); myModuleReason.rewriteChunks(myChunk2, [myChunk]); - should(myModuleReason.hasChunk(myChunk)).be.true(); - should(myModuleReason.hasChunk(myChunk2)).be.false(); + expect(myModuleReason.hasChunk(myChunk)).toBe(true); + expect(myModuleReason.hasChunk(myChunk2)).toBe(false); }); }); }); diff --git a/test/MultiCompiler.test.js b/test/MultiCompiler.test.js index bb3a11f7e10..92ff2dc6848 100644 --- a/test/MultiCompiler.test.js +++ b/test/MultiCompiler.test.js @@ -2,7 +2,6 @@ /* globals describe it */ const path = require("path"); -const should = require("should"); const MemoryFs = require("memory-fs"); const webpack = require("../"); @@ -22,6 +21,8 @@ const createMultiCompiler = () => { }; describe("MultiCompiler", function() { + jest.setTimeout(20000); + it("should trigger 'run' for each child compiler", done => { const compiler = createMultiCompiler(); let called = 0; @@ -31,7 +32,7 @@ describe("MultiCompiler", function() { if (err) { throw err; } else { - should(called).be.equal(2); + expect(called).toBe(2); done(); } }); @@ -47,7 +48,7 @@ describe("MultiCompiler", function() { throw err; } else { watcher.close(); - should(called).be.equal(2); + expect(called).toBe(2); done(); } }); @@ -64,11 +65,11 @@ describe("MultiCompiler", function() { }); it("should not be run twice at a time (watch)", function(done) { const compiler = createMultiCompiler(); - compiler.watch({}, (err, stats) => { + const watcher = compiler.watch({}, (err, stats) => { if (err) return done(err); }); compiler.watch({}, (err, stats) => { - if (err) return done(); + if (err) return watcher.close(done); }); }); it("should not be run twice at a time (run - watch)", function(done) { @@ -82,11 +83,12 @@ describe("MultiCompiler", function() { }); it("should not be run twice at a time (watch - run)", function(done) { const compiler = createMultiCompiler(); - compiler.watch({}, (err, stats) => { + let watcher; + watcher = compiler.watch({}, (err, stats) => { if (err) return done(err); }); compiler.run((err, stats) => { - if (err) return done(); + if (err) return watcher.close(done); }); }); it("should not be run twice at a time (instance cb)", function(done) { @@ -123,9 +125,10 @@ describe("MultiCompiler", function() { compiler.run((err, stats) => { if (err) return done(err); - compiler.watch({}, (err, stats) => { + let watcher; + watcher = compiler.watch({}, (err, stats) => { if (err) return done(err); - done(); + watcher.close(done); }); }); }); @@ -147,9 +150,10 @@ describe("MultiCompiler", function() { if (err) return done(err); }); watching.close(() => { - compiler.watch({}, (err, stats) => { + let watcher; + watcher = compiler.watch({}, (err, stats) => { if (err) return done(err); - done(); + watcher.close(done); }); }); }); diff --git a/test/MultiStats.unittest.js b/test/MultiStats.unittest.js index 6d096bbb00f..6137dc3c6c5 100644 --- a/test/MultiStats.unittest.js +++ b/test/MultiStats.unittest.js @@ -1,6 +1,5 @@ "use strict"; -require("should"); const packageJSON = require("../package.json"); const MultiStats = require("../lib/MultiStats"); @@ -36,7 +35,9 @@ describe("MultiStats", () => { packageJSON.version = "1.2.3"; }); - afterEach(() => (packageJSON.version = packageVersion)); + afterEach(() => { + packageJSON.version = packageVersion; + }); describe("created", () => { beforeEach(() => { @@ -51,8 +52,9 @@ describe("MultiStats", () => { myMultiStats = new MultiStats(stats); }); - it("creates a hash string", () => - myMultiStats.hash.should.be.exactly("abc123xyz890")); + it("creates a hash string", () => { + expect(myMultiStats.hash).toBe("abc123xyz890"); + }); }); describe("hasErrors", () => { @@ -69,8 +71,9 @@ describe("MultiStats", () => { myMultiStats = new MultiStats(stats); }); - it("returns true", () => - myMultiStats.hasErrors().should.be.exactly(true)); + it("returns true", () => { + expect(myMultiStats.hasErrors()).toBe(true); + }); }); describe("when one has an error", () => { @@ -84,8 +87,9 @@ describe("MultiStats", () => { myMultiStats = new MultiStats(stats); }); - it("returns true", () => - myMultiStats.hasErrors().should.be.exactly(true)); + it("returns true", () => { + expect(myMultiStats.hasErrors()).toBe(true); + }); }); describe("when none have errors", () => { @@ -94,8 +98,9 @@ describe("MultiStats", () => { myMultiStats = new MultiStats(stats); }); - it("returns false", () => - myMultiStats.hasErrors().should.be.exactly(false)); + it("returns false", () => { + expect(myMultiStats.hasErrors()).toBe(false); + }); }); }); @@ -113,8 +118,9 @@ describe("MultiStats", () => { myMultiStats = new MultiStats(stats); }); - it("returns true", () => - myMultiStats.hasWarnings().should.be.exactly(true)); + it("returns true", () => { + expect(myMultiStats.hasWarnings()).toBe(true); + }); }); describe("when one has a warning", () => { @@ -128,8 +134,9 @@ describe("MultiStats", () => { myMultiStats = new MultiStats(stats); }); - it("returns true", () => - myMultiStats.hasWarnings().should.be.exactly(true)); + it("returns true", () => { + expect(myMultiStats.hasWarnings()).toBe(true); + }); }); describe("when none have warnings", () => { @@ -138,8 +145,9 @@ describe("MultiStats", () => { myMultiStats = new MultiStats(stats); }); - it("returns false", () => - myMultiStats.hasWarnings().should.be.exactly(false)); + it("returns false", () => { + expect(myMultiStats.hasWarnings()).toBe(false); + }); }); }); @@ -175,7 +183,7 @@ describe("MultiStats", () => { version: false, hash: false }); - result.should.deepEqual({ + expect(result).toEqual({ errors: ["(abc123-compilation) abc123-error"], warnings: [ "(abc123-compilation) abc123-warning", @@ -200,7 +208,7 @@ describe("MultiStats", () => { it("returns plain object representation with json set to true", () => { myMultiStats = new MultiStats(stats); result = myMultiStats.toJson(true); - result.should.deepEqual({ + expect(result).toEqual({ errors: ["(abc123-compilation) abc123-error"], warnings: [ "(abc123-compilation) abc123-warning", @@ -244,7 +252,7 @@ describe("MultiStats", () => { }); it("returns string representation", () => { - result.should.be.exactly( + expect(result).toEqual( "Hash: abc123xyz890\n" + "Version: webpack 1.2.3\n" + "Child abc123-compilation:\n" + diff --git a/test/MultiWatching.unittest.js b/test/MultiWatching.unittest.js index e5b41ba99b8..0977f3cfad6 100644 --- a/test/MultiWatching.unittest.js +++ b/test/MultiWatching.unittest.js @@ -2,14 +2,12 @@ const Tapable = require("tapable").Tapable; const SyncHook = require("tapable").SyncHook; -require("should"); -const sinon = require("sinon"); const MultiWatching = require("../lib/MultiWatching"); -const createWatching = function() { +const createWatching = () => { return { - invalidate: sinon.spy(), - close: sinon.spy() + invalidate: jest.fn(), + close: jest.fn() }; }; @@ -24,7 +22,9 @@ const createCompiler = () => { }; describe("MultiWatching", () => { - let watchings, compiler, myMultiWatching; + let watchings; + let compiler; + let myMultiWatching; beforeEach(() => { watchings = [createWatching(), createWatching()]; @@ -33,33 +33,36 @@ describe("MultiWatching", () => { }); describe("invalidate", () => { - beforeEach(() => myMultiWatching.invalidate()); + beforeEach(() => { + myMultiWatching.invalidate(); + }); it("invalidates each watching", () => { - watchings[0].invalidate.callCount.should.be.exactly(1); - watchings[1].invalidate.callCount.should.be.exactly(1); + expect(watchings[0].invalidate.mock.calls.length).toBe(1); + expect(watchings[1].invalidate.mock.calls.length).toBe(1); }); }); describe("close", () => { let callback; - const callClosedFinishedCallback = watching => - watching.close.getCall(0).args[0](); + const callClosedFinishedCallback = watching => { + watching.close.mock.calls[0][0](); + }; beforeEach(() => { - callback = sinon.spy(); + callback = jest.fn(); myMultiWatching.close(callback); }); it("closes each watching", () => { - watchings[0].close.callCount.should.be.exactly(1); - watchings[1].close.callCount.should.be.exactly(1); + expect(watchings[0].close.mock.calls.length).toBe(1); + expect(watchings[1].close.mock.calls.length).toBe(1); }); it("calls callback after each watching has closed", () => { callClosedFinishedCallback(watchings[0]); callClosedFinishedCallback(watchings[1]); - callback.callCount.should.be.exactly(1); + expect(callback.mock.calls.length).toBe(1); }); }); }); diff --git a/test/NodeTemplatePlugin.test.js b/test/NodeTemplatePlugin.test.js index 473a4e19b08..6080e6d0b42 100644 --- a/test/NodeTemplatePlugin.test.js +++ b/test/NodeTemplatePlugin.test.js @@ -1,8 +1,6 @@ /* global describe, it */ "use strict"; -require("should"); - const path = require("path"); const webpack = require("../lib/webpack"); @@ -14,7 +12,7 @@ describe("NodeTemplatePlugin", () => { context: path.join(__dirname, "fixtures", "nodetest"), target: "node", output: { - path: path.join(__dirname, "js"), + path: path.join(__dirname, "js", "NodeTemplatePlugin"), filename: "result.js", chunkFilename: "[hash].result.[id].js", library: "abc", @@ -24,16 +22,16 @@ describe("NodeTemplatePlugin", () => { }, (err, stats) => { if (err) return err; - stats.hasErrors().should.be.not.ok(); - stats.hasWarnings().should.be.not.ok(); + expect(stats.hasErrors()).toBe(false); + expect(stats.hasWarnings()).toBe(false); // eslint-disable-next-line node/no-missing-require - const result = require("./js/result").abc; - result.nextTick.should.be.equal(process.nextTick); - result.fs.should.be.equal(require("fs")); + const result = require("./js/NodeTemplatePlugin/result").abc; + expect(result.nextTick).toBe(process.nextTick); + expect(result.fs).toBe(require("fs")); result.loadChunk(456, chunk => { - chunk.should.be.eql(123); + expect(chunk).toBe(123); result.loadChunk(567, chunk => { - chunk.should.be.eql({ + expect(chunk).toEqual({ a: 1 }); done(); @@ -50,7 +48,7 @@ describe("NodeTemplatePlugin", () => { context: path.join(__dirname, "fixtures", "nodetest"), target: "node", output: { - path: path.join(__dirname, "js"), + path: path.join(__dirname, "js", "NodeTemplatePluginSingle"), filename: "result2.js", chunkFilename: "[hash].result2.[id].js", library: "def", @@ -66,17 +64,17 @@ describe("NodeTemplatePlugin", () => { }, (err, stats) => { if (err) return err; - stats.hasErrors().should.be.not.ok(); + expect(stats.hasErrors()).toBe(false); // eslint-disable-next-line node/no-missing-require - const result = require("./js/result2"); - result.nextTick.should.be.equal(process.nextTick); - result.fs.should.be.equal(require("fs")); + const result = require("./js/NodeTemplatePluginSingle/result2"); + expect(result.nextTick).toBe(process.nextTick); + expect(result.fs).toBe(require("fs")); const sameTick = true; result.loadChunk(456, chunk => { - chunk.should.be.eql(123); - sameTick.should.be.eql(true); + expect(chunk).toBe(123); + expect(sameTick).toBe(true); result.loadChunk(567, chunk => { - chunk.should.be.eql({ + expect(chunk).toEqual({ a: 1 }); done(); diff --git a/test/NodeWatchFileSystem.unittest.js b/test/NodeWatchFileSystem.unittest.js deleted file mode 100644 index 4c0d55c5b58..00000000000 --- a/test/NodeWatchFileSystem.unittest.js +++ /dev/null @@ -1,338 +0,0 @@ -/* globals describe it */ - -var should = require("should"); -var NodeWatchFileSystem = require("../lib/node/NodeWatchFileSystem"); - -describe("NodeWatchFileSystem", function() { - it("should throw if 'files' argument is not an array", function() { - should(function() { - new NodeWatchFileSystem().watch(undefined); - }).throw("Invalid arguments: 'files'"); - }); - - it("should throw if 'dirs' argument is not an array", function() { - should(function() { - new NodeWatchFileSystem().watch([], undefined); - }).throw("Invalid arguments: 'dirs'"); - }); - - it("should throw if 'missing' argument is not an array", function() { - should(function() { - new NodeWatchFileSystem().watch([], [], undefined); - }).throw("Invalid arguments: 'missing'"); - }); - - it("should throw if 'starttime' argument is missing", function() { - should(function() { - new NodeWatchFileSystem().watch([], [], [], "42", {}, function() {}); - }).throw("Invalid arguments: 'startTime'"); - }); - - it("should throw if 'callback' argument is missing", function() { - should(function() { - new NodeWatchFileSystem().watch([], [], [], 42, {}, undefined); - }).throw("Invalid arguments: 'callback'"); - }); - - it("should throw if 'options' argument is invalid", function() { - should(function() { - new NodeWatchFileSystem().watch([], [], [], 42, "options", function() {}); - }).throw("Invalid arguments: 'options'"); - }); - - it("should throw if 'callbackUndelayed' argument is invalid", function() { - should(function() { - new NodeWatchFileSystem().watch( - [], - [], - [], - 42, - {}, - function() {}, - "undefined" - ); - }).throw("Invalid arguments: 'callbackUndelayed'"); - }); - - if (process.env.NO_WATCH_TESTS) { - it("long running tests excluded"); - return; - } - - var path = require("path"); - var fs = require("fs"); - var fixtures = path.join(__dirname, "fixtures"); - var fileDirect = path.join(fixtures, "watched-file.txt"); - var fileSubdir = path.join(fixtures, "subdir", "watched-file.txt"); - - this.timeout(10000); - - it("should register a file change (change delayed)", function(done) { - var startTime = new Date().getTime(); - var wfs = new NodeWatchFileSystem(); - var watcher = wfs.watch( - [fileDirect], - [], - [], - startTime, - { - aggregateTimeout: 1000 - }, - function( - err, - filesModified, - dirsModified, - missingCreated, - fileTimestamps - ) { - if (err) throw err; - filesModified.should.be.eql([fileDirect]); - dirsModified.should.be.eql([]); - (typeof fileTimestamps.get(fileDirect)).should.be.eql("number"); - watcher.close(); - done(); - } - ); - - setTimeout(function() { - fs.writeFile(fileDirect, "", function() {}); - }, 500); - }); - it("should register a file change (watch delayed)", function(done) { - var startTime = new Date().getTime(); - setTimeout(function() { - var wfs = new NodeWatchFileSystem(); - var watcher = wfs.watch( - [fileDirect], - [], - [], - startTime, - { - aggregateTimeout: 1000 - }, - function( - err, - filesModified, - dirsModified, - missingCreated, - fileTimestamps - ) { - if (err) throw err; - filesModified.should.be.eql([fileDirect]); - dirsModified.should.be.eql([]); - (typeof fileTimestamps.get(fileDirect)).should.be.eql("number"); - watcher.close(); - done(); - } - ); - }, 500); - - fs.writeFile(fileDirect, "", function() {}); - }); - it("should register a context change (change delayed)", function(done) { - var startTime = new Date().getTime(); - var wfs = new NodeWatchFileSystem(); - var watcher = wfs.watch( - [], - [fixtures], - [], - startTime, - { - aggregateTimeout: 1000 - }, - function( - err, - filesModified, - dirsModified, - missingCreated, - fileTimestamps, - dirTimestamps - ) { - if (err) throw err; - filesModified.should.be.eql([]); - dirsModified.should.be.eql([fixtures]); - (typeof dirTimestamps.get(fixtures)).should.be.eql("number"); - watcher.close(); - done(); - } - ); - - setTimeout(function() { - fs.writeFile(fileDirect, "", function() {}); - }, 500); - }); - it("should register a context change (watch delayed)", function(done) { - var startTime = new Date().getTime(); - setTimeout(function() { - var wfs = new NodeWatchFileSystem(); - var watcher = wfs.watch( - [], - [fixtures], - [], - startTime, - { - aggregateTimeout: 1000 - }, - function( - err, - filesModified, - dirsModified, - missingCreated, - fileTimestamps, - dirTimestamps - ) { - if (err) throw err; - filesModified.should.be.eql([]); - dirsModified.should.be.eql([fixtures]); - (typeof dirTimestamps.get(fixtures)).should.be.eql("number"); - watcher.close(); - done(); - } - ); - }, 500); - - fs.writeFile(fileDirect, "", function() {}); - }); - it("should register a context change (change delayed, subdirectory)", function(done) { - var startTime = new Date().getTime(); - var wfs = new NodeWatchFileSystem(); - var watcher = wfs.watch( - [], - [fixtures], - [], - startTime, - { - aggregateTimeout: 1000 - }, - function( - err, - filesModified, - dirsModified, - missingCreated, - fileTimestamps, - dirTimestamps - ) { - if (err) throw err; - filesModified.should.be.eql([]); - dirsModified.should.be.eql([fixtures]); - (typeof dirTimestamps.get(fixtures)).should.be.eql("number"); - watcher.close(); - done(); - } - ); - - setTimeout(function() { - fs.writeFile(fileSubdir, "", function() {}); - }, 500); - }); - it("should register a context change (watch delayed, subdirectory)", function(done) { - var startTime = new Date().getTime(); - setTimeout(function() { - var wfs = new NodeWatchFileSystem(); - var watcher = wfs.watch( - [], - [fixtures], - [], - startTime, - { - aggregateTimeout: 1000 - }, - function( - err, - filesModified, - dirsModified, - missingCreated, - fileTimestamps, - dirTimestamps - ) { - if (err) throw err; - filesModified.should.be.eql([]); - dirsModified.should.be.eql([fixtures]); - (typeof dirTimestamps.get(fixtures)).should.be.eql("number"); - watcher.close(); - done(); - } - ); - }, 500); - - fs.writeFile(fileSubdir, "", function() {}); - }); - it("should allow to combine all", function(done) { - var startTime = new Date().getTime(); - setTimeout(function() { - var wfs = new NodeWatchFileSystem(); - var watcher = wfs.watch( - [fileDirect, fileSubdir], - [fixtures], - [], - startTime, - { - aggregateTimeout: 1000 - }, - function( - err, - filesModified, - dirsModified, - missingCreated, - fileTimestamps, - dirTimestamps - ) { - if (err) throw err; - filesModified.should.be.eql([fileSubdir, fileDirect]); - dirsModified.should.be.eql([fixtures]); - (typeof fileTimestamps.get(fileDirect)).should.be.eql("number"); - (typeof fileTimestamps.get(fileSubdir)).should.be.eql("number"); - (typeof dirTimestamps.get(fixtures)).should.be.eql("number"); - watcher.close(); - done(); - } - ); - }, 500); - - fs.writeFile(fileDirect, "", function() {}); - fs.writeFile(fileSubdir, "", function() {}); - }); - it("should sum up multiple changes", function(done) { - var startTime = new Date().getTime(); - var wfs = new NodeWatchFileSystem(); - var watcher = wfs.watch( - [fileDirect, fileSubdir], - [fixtures], - [], - startTime, - { - aggregateTimeout: 1000 - }, - function( - err, - filesModified, - dirsModified, - missingCreated, - fileTimestamps, - dirTimestamps - ) { - if (err) throw err; - filesModified.should.be.eql([fileSubdir, fileDirect]); - dirsModified.should.be.eql([fixtures]); - (typeof fileTimestamps.get(fileDirect)).should.be.eql("number"); - (typeof fileTimestamps.get(fileSubdir)).should.be.eql("number"); - (typeof dirTimestamps.get(fixtures)).should.be.eql("number"); - watcher.close(); - done(); - } - ); - - setTimeout(function() { - fs.writeFile(fileDirect, "", function() {}); - setTimeout(function() { - fs.writeFile(fileDirect, "", function() {}); - setTimeout(function() { - fs.writeFile(fileDirect, "", function() {}); - setTimeout(function() { - fs.writeFile(fileSubdir, "", function() {}); - }, 500); - }, 500); - }, 500); - }, 500); - }); -}); diff --git a/test/NormalModule.unittest.js b/test/NormalModule.unittest.js index eb5afce61c9..329001bc23b 100644 --- a/test/NormalModule.unittest.js +++ b/test/NormalModule.unittest.js @@ -1,14 +1,13 @@ /* globals describe, it, beforeEach, afterEach */ "use strict"; -require("should"); -const sinon = require("sinon"); + const NormalModule = require("../lib/NormalModule"); const NullDependency = require("../lib/dependencies/NullDependency"); const SourceMapSource = require("webpack-sources").SourceMapSource; const OriginalSource = require("webpack-sources").OriginalSource; const RawSource = require("webpack-sources").RawSource; -describe("NormalModule", function() { +describe("NormalModule", () => { let normalModule; let request; let userRequest; @@ -16,12 +15,12 @@ describe("NormalModule", function() { let loaders; let resource; let parser; - beforeEach(function() { - request = "some/request"; - userRequest = "some/userRequest"; + beforeEach(() => { + request = "/some/request"; + userRequest = "/some/userRequest"; rawRequest = "some/rawRequest"; loaders = []; - resource = "some/resource"; + resource = "/some/resource"; parser = { parse() {} }; @@ -40,41 +39,41 @@ describe("NormalModule", function() { cacheable: true }; }); - describe("#identifier", function() { - it("returns an identifier for this module", function() { - normalModule.identifier().should.eql(request); + describe("#identifier", () => { + it("returns an identifier for this module", () => { + expect(normalModule.identifier()).toBe(request); }); - it("returns an identifier from toString", function() { + it("returns an identifier from toString", () => { normalModule.debugId = 1000; - normalModule.toString().should.eql("Module[1000]"); + expect(normalModule.toString()).toBe("Module[1000]"); normalModule.id = 1; - normalModule.toString().should.eql("Module[1]"); + expect(normalModule.toString()).toBe("Module[1]"); }); }); - describe("#readableIdentifier", function() { - it("calls the given requestShortener with the user request", function() { - const spy = sinon.spy(); + describe("#readableIdentifier", () => { + it("calls the given requestShortener with the user request", () => { + const spy = jest.fn(); normalModule.readableIdentifier({ shorten: spy }); - spy.callCount.should.eql(1); - spy.args[0][0].should.eql(userRequest); + expect(spy.mock.calls.length).toBe(1); + expect(spy.mock.calls[0][0]).toBe(userRequest); }); }); - describe("#libIdent", function() { - it("contextifies the userRequest of the module", function() { - normalModule - .libIdent({ - context: "some/context" + describe("#libIdent", () => { + it("contextifies the userRequest of the module", () => { + expect( + normalModule.libIdent({ + context: "/some/context" }) - .should.eql("../userRequest"); + ).toBe("../userRequest"); }); - describe("given a userRequest containing loaders", function() { - beforeEach(function() { + describe("given a userRequest containing loaders", () => { + beforeEach(() => { userRequest = - "some/userRequest!some/other/userRequest!some/thing/is/off/here"; + "/some/userRequest!/some/other/userRequest!/some/thing/is/off/here"; normalModule = new NormalModule({ type: "javascript/auto", request, @@ -85,20 +84,18 @@ describe("NormalModule", function() { parser }); }); - it("contextifies every path in the userRequest", function() { - normalModule - .libIdent({ - context: "some/context" + it("contextifies every path in the userRequest", () => { + expect( + normalModule.libIdent({ + context: "/some/context" }) - .should.eql( - "../userRequest!../other/userRequest!../thing/is/off/here" - ); + ).toBe("../userRequest!../other/userRequest!../thing/is/off/here"); }); }); - describe("given a userRequest containing query parameters", function() { - it("ignores paths in query parameters", function() { + describe("given a userRequest containing query parameters", () => { + it("ignores paths in query parameters", () => { userRequest = - "some/context/loader?query=foo\\bar&otherPath=testpath/other"; + "F:\\some\\context\\loader?query=foo\\bar&otherPath=testpath/other"; normalModule = new NormalModule({ type: "javascript/auto", request, @@ -108,22 +105,22 @@ describe("NormalModule", function() { resource, parser }); - normalModule - .libIdent({ - context: "some/context" + expect( + normalModule.libIdent({ + context: "F:\\some\\context" }) - .should.eql("./loader?query=foo\\bar&otherPath=testpath/other"); + ).toBe("./loader?query=foo\\bar&otherPath=testpath/other"); }); }); }); - describe("#nameForCondition", function() { - it("return the resource", function() { - normalModule.nameForCondition().should.eql(resource); + describe("#nameForCondition", () => { + it("return the resource", () => { + expect(normalModule.nameForCondition()).toBe(resource); }); - describe("given a resource containing a ?-sign", function() { + describe("given a resource containing a ?-sign", () => { const baseResource = "some/resource"; - beforeEach(function() { + beforeEach(() => { resource = baseResource + "?some=query"; normalModule = new NormalModule({ type: "javascript/auto", @@ -135,99 +132,67 @@ describe("NormalModule", function() { parser }); }); - it("return only the part before the ?-sign", function() { - normalModule.nameForCondition().should.eql(baseResource); + it("return only the part before the ?-sign", () => { + expect(normalModule.nameForCondition()).toBe(baseResource); }); }); }); - describe("#createSourceForAsset", function() { + describe("#createSourceForAsset", () => { let name; let content; let sourceMap; - beforeEach(function() { + beforeEach(() => { name = "some name"; content = "some content"; sourceMap = "some sourcemap"; }); - describe("given no sourcemap", function() { - it("returns a RawSource", function() { - normalModule - .createSourceForAsset(name, content) - .should.be.instanceOf(RawSource); + describe("given no sourcemap", () => { + it("returns a RawSource", () => { + expect(normalModule.createSourceForAsset(name, content)).toBeInstanceOf( + RawSource + ); }); }); - describe("given a string as the sourcemap", function() { - it("returns a OriginalSource", function() { - normalModule - .createSourceForAsset(name, content, sourceMap) - .should.be.instanceOf(OriginalSource); + describe("given a string as the sourcemap", () => { + it("returns a OriginalSource", () => { + expect( + normalModule.createSourceForAsset(name, content, sourceMap) + ).toBeInstanceOf(OriginalSource); }); }); - describe("given a some other kind of sourcemap", function() { - beforeEach(function() { + describe("given a some other kind of sourcemap", () => { + beforeEach(() => { sourceMap = () => {}; }); - it("returns a SourceMapSource", function() { - normalModule - .createSourceForAsset(name, content, sourceMap) - .should.be.instanceOf(SourceMapSource); + it("returns a SourceMapSource", () => { + expect( + normalModule.createSourceForAsset(name, content, sourceMap) + ).toBeInstanceOf(SourceMapSource); }); }); }); - describe("#originalSource", function() { + describe("#originalSource", () => { let expectedSource = "some source"; - beforeEach(function() { + beforeEach(() => { normalModule._source = new RawSource(expectedSource); }); - it("returns an original Source", function() { - normalModule.originalSource().should.eql(normalModule._source); + it("returns an original Source", () => { + expect(normalModule.originalSource()).toBe(normalModule._source); }); }); - describe("#updateHashWithSource", function() { - let hashSpy; - let hash; - beforeEach(function() { - hashSpy = sinon.spy(); - hash = { - update: hashSpy - }; - }); - describe("without the module having any source", function() { - beforeEach(function() { - normalModule._source = null; - }); - it('calls hash function with "null"', function() { - normalModule.updateHashWithSource(hash); - hashSpy.callCount.should.eql(1); - hashSpy.args[0][0].should.eql("null"); - }); - }); - describe("without the module having source", function() { - let expectedSource = "some source"; - beforeEach(function() { - normalModule._source = new RawSource(expectedSource); - }); - it('calls hash function with "source" and then the actual source of the module', function() { - normalModule.updateHashWithSource(hash); - hashSpy.callCount.should.eql(2); - hashSpy.args[0][0].should.eql("source"); - hashSpy.args[1][0].should.eql(expectedSource); - }); - }); - }); - describe("#hasDependencies", function() { - it("returns true if has dependencies", function() { + describe("#hasDependencies", () => { + it("returns true if has dependencies", () => { normalModule.addDependency(new NullDependency()); - normalModule.hasDependencies().should.eql(true); + expect(normalModule.hasDependencies()).toBe(true); }); - it("returns false if has dependencies", function() { - normalModule.hasDependencies().should.eql(false); + it("returns false if has dependencies", () => { + expect(normalModule.hasDependencies()).toBe(false); }); }); - describe("#needRebuild", function() { + describe("#needRebuild", () => { let fileTimestamps; let contextTimestamps; let fileDependencies; @@ -240,7 +205,7 @@ describe("NormalModule", function() { normalModule.buildInfo.contextDependencies = contextDependencies; } - beforeEach(function() { + beforeEach(() => { fileA = "fileA"; fileB = "fileB"; fileDependencies = [fileA, fileB]; @@ -250,178 +215,178 @@ describe("NormalModule", function() { normalModule.buildTimestamp = 2; setDeps(fileDependencies, contextDependencies); }); - describe("given all timestamps are older than the buildTimestamp", function() { - it("returns false", function() { - normalModule - .needRebuild(fileTimestamps, contextTimestamps) - .should.eql(false); + describe("given all timestamps are older than the buildTimestamp", () => { + it("returns false", () => { + expect( + normalModule.needRebuild(fileTimestamps, contextTimestamps) + ).toBe(false); }); }); - describe("given a file timestamp is newer than the buildTimestamp", function() { - beforeEach(function() { + describe("given a file timestamp is newer than the buildTimestamp", () => { + beforeEach(() => { fileTimestamps.set(fileA, 3); }); - it("returns true", function() { - normalModule - .needRebuild(fileTimestamps, contextTimestamps) - .should.eql(true); + it("returns true", () => { + expect( + normalModule.needRebuild(fileTimestamps, contextTimestamps) + ).toBe(true); }); }); - describe("given a no file timestamp exists", function() { - beforeEach(function() { + describe("given a no file timestamp exists", () => { + beforeEach(() => { fileTimestamps = new Map(); }); - it("returns true", function() { - normalModule - .needRebuild(fileTimestamps, contextTimestamps) - .should.eql(true); + it("returns true", () => { + expect( + normalModule.needRebuild(fileTimestamps, contextTimestamps) + ).toBe(true); }); }); - describe("given a context timestamp is newer than the buildTimestamp", function() { - beforeEach(function() { + describe("given a context timestamp is newer than the buildTimestamp", () => { + beforeEach(() => { contextTimestamps.set(fileA, 3); }); - it("returns true", function() { - normalModule - .needRebuild(fileTimestamps, contextTimestamps) - .should.eql(true); + it("returns true", () => { + expect( + normalModule.needRebuild(fileTimestamps, contextTimestamps) + ).toBe(true); }); }); - describe("given a no context timestamp exists", function() { - beforeEach(function() { + describe("given a no context timestamp exists", () => { + beforeEach(() => { contextTimestamps = new Map(); }); - it("returns true", function() { - normalModule - .needRebuild(fileTimestamps, contextTimestamps) - .should.eql(true); + it("returns true", () => { + expect( + normalModule.needRebuild(fileTimestamps, contextTimestamps) + ).toBe(true); }); }); }); - describe("#applyNoParseRule", function() { + describe("#applyNoParseRule", () => { let rule; let content; - describe("given a string as rule", function() { - beforeEach(function() { + describe("given a string as rule", () => { + beforeEach(() => { rule = "some-rule"; }); - describe("and the content starting with the string specified in rule", function() { - beforeEach(function() { + describe("and the content starting with the string specified in rule", () => { + beforeEach(() => { content = rule + "some-content"; }); - it("returns true", function() { - normalModule.shouldPreventParsing(rule, content).should.eql(true); + it("returns true", () => { + expect(normalModule.shouldPreventParsing(rule, content)).toBe(true); }); }); - describe("and the content does not start with the string specified in rule", function() { - beforeEach(function() { + describe("and the content does not start with the string specified in rule", () => { + beforeEach(() => { content = "some-content"; }); - it("returns false", function() { - normalModule.shouldPreventParsing(rule, content).should.eql(false); + it("returns false", () => { + expect(normalModule.shouldPreventParsing(rule, content)).toBe(false); }); }); }); - describe("given a regex as rule", function() { - beforeEach(function() { + describe("given a regex as rule", () => { + beforeEach(() => { rule = /some-rule/; }); - describe("and the content matches the rule", function() { - beforeEach(function() { + describe("and the content matches the rule", () => { + beforeEach(() => { content = rule + "some-content"; }); - it("returns true", function() { - normalModule.shouldPreventParsing(rule, content).should.eql(true); + it("returns true", () => { + expect(normalModule.shouldPreventParsing(rule, content)).toBe(true); }); }); - describe("and the content does not match the rule", function() { - beforeEach(function() { + describe("and the content does not match the rule", () => { + beforeEach(() => { content = "some-content"; }); - it("returns false", function() { - normalModule.shouldPreventParsing(rule, content).should.eql(false); + it("returns false", () => { + expect(normalModule.shouldPreventParsing(rule, content)).toBe(false); }); }); }); }); - describe("#shouldPreventParsing", function() { + describe("#shouldPreventParsing", () => { let applyNoParseRuleSpy; - beforeEach(function() { - applyNoParseRuleSpy = sinon.stub(); + beforeEach(() => { + applyNoParseRuleSpy = jest.fn(); normalModule.applyNoParseRule = applyNoParseRuleSpy; }); - describe("given no noParseRule", function() { - it("returns false", function() { - normalModule.shouldPreventParsing().should.eql(false); - applyNoParseRuleSpy.callCount.should.eql(0); + describe("given no noParseRule", () => { + it("returns false", () => { + expect(normalModule.shouldPreventParsing()).toBe(false); + expect(applyNoParseRuleSpy.mock.calls.length).toBe(0); }); }); - describe("given a noParseRule", function() { + describe("given a noParseRule", () => { let returnValOfSpy; - beforeEach(function() { + beforeEach(() => { returnValOfSpy = true; - applyNoParseRuleSpy.returns(returnValOfSpy); + applyNoParseRuleSpy.mockReturnValue(returnValOfSpy); }); - describe("that is a string", function() { - it("calls and returns whatever applyNoParseRule returns", function() { - normalModule - .shouldPreventParsing("some rule") - .should.eql(returnValOfSpy); - applyNoParseRuleSpy.callCount.should.eql(1); + describe("that is a string", () => { + it("calls and returns whatever applyNoParseRule returns", () => { + expect(normalModule.shouldPreventParsing("some rule")).toBe( + returnValOfSpy + ); + expect(applyNoParseRuleSpy.mock.calls.length).toBe(1); }); }); - describe("that is a regex", function() { - it("calls and returns whatever applyNoParseRule returns", function() { - normalModule - .shouldPreventParsing("some rule") - .should.eql(returnValOfSpy); - applyNoParseRuleSpy.callCount.should.eql(1); + describe("that is a regex", () => { + it("calls and returns whatever applyNoParseRule returns", () => { + expect(normalModule.shouldPreventParsing("some rule")).toBe( + returnValOfSpy + ); + expect(applyNoParseRuleSpy.mock.calls.length).toBe(1); }); }); - describe("that is an array", function() { - describe("of strings and or regexs", function() { + describe("that is an array", () => { + describe("of strings and or regexs", () => { let someRules; - beforeEach(function() { + beforeEach(() => { someRules = ["some rule", /some rule1/, "some rule2"]; }); - describe("and none of them match", function() { - beforeEach(function() { + describe("and none of them match", () => { + beforeEach(() => { returnValOfSpy = false; - applyNoParseRuleSpy.returns(returnValOfSpy); + applyNoParseRuleSpy.mockReturnValue(returnValOfSpy); }); - it("returns false", function() { - normalModule - .shouldPreventParsing(someRules) - .should.eql(returnValOfSpy); - applyNoParseRuleSpy.callCount.should.eql(3); + it("returns false", () => { + expect(normalModule.shouldPreventParsing(someRules)).toBe( + returnValOfSpy + ); + expect(applyNoParseRuleSpy.mock.calls.length).toBe(3); }); }); - describe("and the first of them matches", function() { - beforeEach(function() { + describe("and the first of them matches", () => { + beforeEach(() => { returnValOfSpy = true; - applyNoParseRuleSpy.returns(returnValOfSpy); + applyNoParseRuleSpy.mockReturnValue(returnValOfSpy); }); - it("returns true", function() { - normalModule - .shouldPreventParsing(someRules) - .should.eql(returnValOfSpy); - applyNoParseRuleSpy.callCount.should.eql(1); + it("returns true", () => { + expect(normalModule.shouldPreventParsing(someRules)).toBe( + returnValOfSpy + ); + expect(applyNoParseRuleSpy.mock.calls.length).toBe(1); }); }); - describe("and the last of them matches", function() { - beforeEach(function() { + describe("and the last of them matches", () => { + beforeEach(() => { returnValOfSpy = true; - applyNoParseRuleSpy.onCall(0).returns(false); - applyNoParseRuleSpy.onCall(1).returns(false); - applyNoParseRuleSpy.onCall(2).returns(true); + applyNoParseRuleSpy.mockReturnValueOnce(false); + applyNoParseRuleSpy.mockReturnValueOnce(false); + applyNoParseRuleSpy.mockReturnValue(true); }); - it("returns true", function() { - normalModule - .shouldPreventParsing(someRules) - .should.eql(returnValOfSpy); - applyNoParseRuleSpy.callCount.should.eql(3); + it("returns true", () => { + expect(normalModule.shouldPreventParsing(someRules)).toBe( + returnValOfSpy + ); + expect(applyNoParseRuleSpy.mock.calls.length).toBe(3); }); }); }); diff --git a/test/NullDependency.unittest.js b/test/NullDependency.unittest.js index d8862ed3842..958027bddd4 100644 --- a/test/NullDependency.unittest.js +++ b/test/NullDependency.unittest.js @@ -1,7 +1,5 @@ "use strict"; -require("should"); -const sinon = require("sinon"); const NullDependency = require("../lib/dependencies/NullDependency"); describe("NullDependency", () => { @@ -9,36 +7,43 @@ describe("NullDependency", () => { beforeEach(() => (env = {})); - it("is a function", () => NullDependency.should.be.a.Function()); + it("is a function", () => { + expect(NullDependency).toBeTypeOf("function"); + }); describe("when created", () => { beforeEach(() => (env.nullDependency = new NullDependency())); - it("has a null type", () => - env.nullDependency.type.should.be.exactly("null")); + it("has a null type", () => { + expect(env.nullDependency.type).toBe("null"); + }); - it("has update hash function", () => - env.nullDependency.updateHash.should.be.Function()); + it("has update hash function", () => { + expect(env.nullDependency.updateHash).toBeTypeOf("function"); + }); it("does not update hash", () => { const hash = { - update: sinon.stub() + update: jest.fn() }; env.nullDependency.updateHash(hash); - hash.update.called.should.be.false(); + expect(hash.update).not.toHaveBeenCalled(); }); }); describe("Template", () => { - it("is a function", () => NullDependency.Template.should.be.a.Function()); + it("is a function", () => { + expect(NullDependency.Template).toBeTypeOf("function"); + }); describe("when created", () => { - beforeEach( - () => (env.nullDependencyTemplate = new NullDependency.Template()) - ); + beforeEach(() => { + env.nullDependencyTemplate = new NullDependency.Template(); + }); - it("has apply function", () => - env.nullDependencyTemplate.apply.should.be.Function()); + it("has apply function", () => { + expect(env.nullDependencyTemplate.apply).toBeTypeOf("function"); + }); }); }); }); diff --git a/test/Parser.unittest.js b/test/Parser.unittest.js index da31c04da0b..3d3fdeeca8a 100644 --- a/test/Parser.unittest.js +++ b/test/Parser.unittest.js @@ -1,7 +1,5 @@ "use strict"; -const should = require("should"); - const Parser = require("../lib/Parser"); const BasicEvaluatedExpression = require("../lib/BasicEvaluatedExpression"); @@ -308,8 +306,8 @@ describe("Parser", () => { return true; }); const actual = testParser.parse(source); - should.strictEqual(typeof actual, "object"); - actual.should.be.eql(state); + expect(typeof actual).toBe("object"); + expect(actual).toEqual(state); }); }); @@ -334,13 +332,13 @@ describe("Parser", () => { }); const actual = testParser.parse(source); - should.strictEqual(typeof actual, "object"); - should.strictEqual(typeof actual.comments, "object"); + expect(typeof actual).toBe("object"); + expect(typeof actual.comments).toBe("object"); actual.comments.forEach((element, index) => { - should.strictEqual(typeof element.type, "string"); - should.strictEqual(typeof element.value, "string"); - element.type.should.be.eql(state[index].type); - element.value.should.be.eql(state[index].value); + expect(typeof element.type).toBe("string"); + expect(typeof element.value).toBe("string"); + expect(element.type).toBe(state[index].type); + expect(element.value).toBe(state[index].value); }); }); @@ -480,7 +478,8 @@ describe("Parser", () => { "template=[start string=start],[mid string=mid],[end string=end]", // eslint-disable-next-line no-template-curly-in-string "`start${'str'}mid${obj2}end`": - "template=[start${'str'}mid string=startstrmid],[end string=end]", // eslint-disable-line no-template-curly-in-string + // eslint-disable-next-line no-template-curly-in-string + "template=[start${'str'}mid string=startstrmid],[end string=end]", "'abc'.substr(1)": "string=bc", "'abcdef'.substr(2, 3)": "string=cde", "'abcdef'.substring(2, 3)": "string=c", @@ -545,7 +544,7 @@ describe("Parser", () => { it("should eval " + key, () => { const evalExpr = evaluateInParser(key); - evalExprToString(evalExpr).should.be.eql( + expect(evalExprToString(evalExpr)).toBe( testCases[key] ? key + " " + testCases[key] : key ); }); @@ -565,7 +564,7 @@ describe("Parser", () => { const expr = cases[name]; it(name, () => { const actual = parser.parse(expr); - should.strictEqual(typeof actual, "object"); + expect(typeof actual).toBe("object"); }); }); }); @@ -598,7 +597,7 @@ describe("Parser", () => { Object.keys(cases).forEach(name => { it(name, () => { const actual = parser.parse(cases[name][0]); - actual.should.be.eql(cases[name][1]); + expect(actual).toEqual(cases[name][1]); }); }); }); @@ -614,7 +613,22 @@ describe("Parser", () => { const expr = cases[name]; it(name, () => { const actual = Parser.parse(expr); - should.strictEqual(typeof actual, "object"); + expect(typeof actual).toBe("object"); + }); + }); + }); + }); + + describe("optional catch binding support", () => { + describe("should accept", () => { + const cases = { + "optional binding": "try {} catch {}" + }; + Object.keys(cases).forEach(name => { + const expr = cases[name]; + it(name, () => { + const actual = Parser.parse(expr); + expect(typeof actual).toBe("object"); }); }); }); diff --git a/test/ProfilingPlugin.unittest.js b/test/ProfilingPlugin.unittest.js index f0b97a7727d..0528c9ecb7d 100644 --- a/test/ProfilingPlugin.unittest.js +++ b/test/ProfilingPlugin.unittest.js @@ -1,6 +1,5 @@ "use strict"; -require("should"); const ProfilingPlugin = require("../lib/debug/ProfilingPlugin"); describe("Profiling Plugin", () => { @@ -8,67 +7,36 @@ describe("Profiling Plugin", () => { const plugin = new ProfilingPlugin({ outputPath: "invest_in_doge_coin" }); - plugin.outputPath.should.equal("invest_in_doge_coin"); + expect(plugin.outputPath).toBe("invest_in_doge_coin"); }); it("should handle no options", () => { const plugin = new ProfilingPlugin(); - plugin.outputPath.should.equal("events.json"); + expect(plugin.outputPath).toBe("events.json"); }); - it("should handle when unable to require the inspector", done => { + it("should handle when unable to require the inspector", () => { const profiler = new ProfilingPlugin.Profiler(); - - profiler - .startProfiling() - .then(() => { - done(); - }) - .catch(e => { - done(e); - }); + return profiler.startProfiling(); }); - it("should handle when unable to start a profiling session", done => { + it("should handle when unable to start a profiling session", () => { const profiler = new ProfilingPlugin.Profiler({ Session() { throw new Error("Sean Larkin was here."); } }); - profiler - .startProfiling() - .then(() => { - done(); - }) - .catch(e => { - done(e); - }); + return profiler.startProfiling(); }); - it("handles sending a profiling message when no session", done => { + it("handles sending a profiling message when no session", () => { const profiler = new ProfilingPlugin.Profiler(); - - profiler - .sendCommand("randy", "is a puppers") - .then(() => { - done(); - }) - .catch(e => { - done(e); - }); + return profiler.sendCommand("randy", "is a puppers"); }); - it("handles destroying when no session", done => { + it("handles destroying when no session", () => { const profiler = new ProfilingPlugin.Profiler(); - - profiler - .destroy() - .then(() => { - done(); - }) - .catch(e => { - done(e); - }); + return profiler.destroy(); }); }); diff --git a/test/ProgressPlugin.test.js b/test/ProgressPlugin.test.js new file mode 100644 index 00000000000..bfa2691591a --- /dev/null +++ b/test/ProgressPlugin.test.js @@ -0,0 +1,40 @@ +"use strict"; + +const path = require("path"); +const MemoryFs = require("memory-fs"); +const webpack = require("../"); + +const createMultiCompiler = () => { + const compiler = webpack([ + { + context: path.join(__dirname, "fixtures"), + entry: "./a.js" + }, + { + context: path.join(__dirname, "fixtures"), + entry: "./b.js" + } + ]); + compiler.outputFileSystem = new MemoryFs(); + return compiler; +}; + +describe("ProgressPlugin", function() { + it("should not contain NaN as a percentage when it is applied to MultiCompiler", function(done) { + const compiler = createMultiCompiler(); + + let percentage = 0; + new webpack.ProgressPlugin((p, msg, ...args) => { + percentage += p; + }).apply(compiler); + + compiler.run(err => { + if (err) { + throw err; + } else { + expect(percentage).not.toBe(NaN); + done(); + } + }); + }); +}); diff --git a/test/README.md b/test/README.md index 05b25ccce10..f648f049744 100644 --- a/test/README.md +++ b/test/README.md @@ -4,16 +4,25 @@ Every pull request that you submit to webpack (besides README and spelling corre But don't give up hope!!! Although our tests may appear complex and overwhelming, once you become familiar with the test suite and structure, adding and creating tests will be fun and beneficial as you work inside the codebase! ❤ ## tl;dr -* Clone repo -* Run tests (this automatically runs the setup) - * `yarn test` +Run all tests (this automatically runs the setup): +```sh +yarn test +``` -* To run an individual suite: (recommended during development for easier isolated diffs) +Run an individual suite: +```sh +yarn jest ConfigTestCases +``` -Example: `$(npm bin)/mocha --grep ConfigTestCases` +Watch mode: +```sh +yarn jest --watch ConfigTestCases +``` + +See also: [Jest CLI docs](https://facebook.github.io/jest/docs/cli.html) ## Test suite overview -We use MochaJS for our tests. For more information on Mocha you can visit their [homepage](https://mochajs.org/)! +We use Jest for our tests. For more information on Jest you can visit their [homepage](https://facebook.github.io/jest/)! ### Class Tests All test files can be found in *.test.js. There are many tests that simply test API's of a specific class/file (such as `Compiler`, `Errors`, Integration, `Parser`, `RuleSet`, Validation). @@ -37,11 +46,23 @@ In addition to an `index.js`, these configCases require a `webpack.config.js` is #### statsCases (`StatsTestCases.test.js`) Stats cases are similar to configCases except specifically focusing on the `expected` output of your stats. Instead of writing to the console, however the output of stats will be written to disk. -By default, the "expected" outcome is a pain to write by hand so instead when statsCases are run the following happens: +By default, the "expected" outcome is a pain to write by hand so instead when statsCases are run, runner is checking output using jest's awesome snapshot functionality. + +Basically you don't need to write any expected behaviors your self. The assumption is that the stats output from your test code is what you expect. + +Please follow the approach described bellow: + +* write your test code in ```statsCases/``` folder by creating a separate folder for it, for example +```statsCases/some-file-import-stats/index.js``` +``` + import(./someModule); +``` +** dont's forget the ```webpack.config.js``` +* run the test +* jest will automatically add the output from your test code to ```StatsTestCases.test.js.snap``` and you can always check your results there +* Next time test will run -> runner will compare results against your output written to snapshot previously -* Checks for `expected.txt` file containing expected results. -* If the `expected.txt` doesn't match what is output, then an `actual.txt` stats output file will be created and the test will fail. (A typical workflow for stats cases is to fail the test and copy the results from `actual.txt` to `expected.txt`.) -* If the actual output matches `expected.txt`, the tests passes and you are free to submit that PR with pride!!! +You can read more about SnapShot testing [right here](https://facebook.github.io/jest/docs/en/snapshot-testing.html) ## Questions? Comments? If you are still nervous or don't quite understand, please submit an issue and tag us in it, and provide a relevant PR while working on! diff --git a/test/RawModule.unittest.js b/test/RawModule.unittest.js index e4e7b87938b..8d3e6b90f3a 100644 --- a/test/RawModule.unittest.js +++ b/test/RawModule.unittest.js @@ -4,29 +4,25 @@ const RawModule = require("../lib/RawModule"); const OriginalSource = require("webpack-sources").OriginalSource; const RawSource = require("webpack-sources").RawSource; const RequestShortener = require("../lib/RequestShortener"); -const should = require("should"); const path = require("path"); const crypto = require("crypto"); describe("RawModule", () => { - let myRawModule; - - before(() => { - const source = "sourceStr attribute"; - const identifier = "identifierStr attribute"; - const readableIdentifier = "readableIdentifierStr attribute"; - myRawModule = new RawModule(source, identifier, readableIdentifier); - }); + const source = "sourceStr attribute"; + const identifier = "identifierStr attribute"; + const readableIdentifier = "readableIdentifierStr attribute"; + const myRawModule = new RawModule(source, identifier, readableIdentifier); describe("identifier", () => { - it("returns value for identifierStr attribute", () => - should(myRawModule.identifier()).be.exactly("identifierStr attribute")); + it("returns value for identifierStr attribute", () => { + expect(myRawModule.identifier()).toBe("identifierStr attribute"); + }); }); describe("size", () => { it('returns value for sourceStr attribute"s length property', () => { const sourceStrLength = myRawModule.sourceStr.length; - should(myRawModule.size()).be.exactly(sourceStrLength); + expect(myRawModule.size()).toBe(sourceStrLength); }); }); @@ -36,13 +32,15 @@ describe("RawModule", () => { "on readableIdentifierStr attribute", () => { const requestShortener = new RequestShortener(path.resolve()); - should.exist(myRawModule.readableIdentifier(requestShortener)); + expect(myRawModule.readableIdentifier(requestShortener)).toBeDefined(); } ); }); describe("needRebuild", () => { - it("returns false", () => should(myRawModule.needRebuild()).be.false()); + it("returns false", () => { + expect(myRawModule.needRebuild()).toBe(false); + }); }); describe("source", () => { @@ -55,7 +53,7 @@ describe("RawModule", () => { myRawModule.identifier() ); myRawModule.useSourceMap = true; - myRawModule.source().should.match(originalSource); + expect(myRawModule.source()).toEqual(originalSource); } ); @@ -65,7 +63,7 @@ describe("RawModule", () => { () => { const rawSource = new RawSource(myRawModule.sourceStr); myRawModule.useSourceMap = false; - myRawModule.source().should.match(rawSource); + expect(myRawModule.source()).toEqual(rawSource); } ); }); @@ -80,7 +78,7 @@ describe("RawModule", () => { const hashFoo = hashModule(new RawModule('"foo"')); const hashBar = hashModule(new RawModule('"bar"')); - hashFoo.should.not.equal(hashBar); + expect(hashFoo).not.toBe(hashBar); }); }); }); diff --git a/test/RemovedPlugins.unittest.js b/test/RemovedPlugins.unittest.js index 1f5f2b30b95..915ee0e116c 100644 --- a/test/RemovedPlugins.unittest.js +++ b/test/RemovedPlugins.unittest.js @@ -1,18 +1,18 @@ const webpack = require("../lib/webpack"); const RemovedPluginError = require("../lib/RemovedPluginError"); -require("should"); describe("removed plugin errors", () => { it("should error when accessing removed plugins", () => { - (() => webpack.optimize.UglifyJsPlugin).should.throw(RemovedPluginError, { - message: /webpack\.optimize\.UglifyJsPlugin has been removed, please use config\.optimization\.minimize instead\./ - }); + expect(() => webpack.optimize.UglifyJsPlugin).toThrow(RemovedPluginError); + expect( + () => webpack.optimize.UglifyJsPlugin + ).toThrowErrorMatchingSnapshot(); - (() => webpack.optimize.CommonsChunkPlugin).should.throw( - RemovedPluginError, - { - message: /webpack\.optimize\.CommonsChunkPlugin has been removed, please use config\.optimization\.splitChunks instead\./ - } + expect(() => webpack.optimize.CommonsChunkPlugin).toThrow( + RemovedPluginError ); + expect( + () => webpack.optimize.CommonsChunkPlugin + ).toThrowErrorMatchingSnapshot(); }); }); diff --git a/test/RuleSet.unittest.js b/test/RuleSet.unittest.js index 69b6a444d27..c62b7bb64fb 100644 --- a/test/RuleSet.unittest.js +++ b/test/RuleSet.unittest.js @@ -1,7 +1,5 @@ "use strict"; -const should = require("should"); - const RuleSet = require("../lib/RuleSet"); function match(ruleSet, resource) { @@ -23,11 +21,11 @@ function match(ruleSet, resource) { describe("RuleSet", () => { it("should create RuleSet with a blank array", () => { const loader = new RuleSet([]); - loader.rules.should.eql([]); + expect(loader.rules).toEqual([]); }); it("should create RuleSet and match with empty array", () => { const loader = new RuleSet([]); - match(loader, "something").should.eql([]); + expect(match(loader, "something")).toEqual([]); }); it("should not match with loaders array", () => { const loader = new RuleSet([ @@ -36,7 +34,7 @@ describe("RuleSet", () => { loader: "css" } ]); - match(loader, "something").should.eql([]); + expect(match(loader, "something")).toEqual([]); }); it("should match with regex", () => { @@ -46,7 +44,7 @@ describe("RuleSet", () => { loader: "css" } ]); - match(loader, "style.css").should.eql(["css"]); + expect(match(loader, "style.css")).toEqual(["css"]); }); it("should match with string", () => { @@ -56,7 +54,7 @@ describe("RuleSet", () => { loader: "css" } ]); - match(loader, "style.css").should.eql(["css"]); + expect(match(loader, "style.css")).toEqual(["css"]); }); it("should match with function", () => { @@ -68,11 +66,11 @@ describe("RuleSet", () => { loader: "css" } ]); - match(loader, "style.css").should.eql(["css"]); + expect(match(loader, "style.css")).toEqual(["css"]); }); it("should throw if invalid test", () => { - should.throws(() => { + expect(() => { const loader = new RuleSet([ { test: { @@ -81,8 +79,8 @@ describe("RuleSet", () => { loader: "css" } ]); - match(loader, "style.css").should.eql(["css"]); - }, /Unexcepted property invalid in condition/); + match(loader, "style.css"); + }).toThrow(/Unexcepted property invalid in condition/); }); it("should accept multiple test array that all match", () => { @@ -92,7 +90,7 @@ describe("RuleSet", () => { loader: "css" } ]); - match(loader, "style.css").should.eql(["css"]); + expect(match(loader, "style.css")).toEqual(["css"]); }); it("should accept multiple test array that not all match", () => { @@ -102,7 +100,7 @@ describe("RuleSet", () => { loader: "css" } ]); - match(loader, "style.css").should.eql(["css"]); + expect(match(loader, "style.css")).toEqual(["css"]); }); it("should not match if include does not match", () => { @@ -113,7 +111,7 @@ describe("RuleSet", () => { loader: "css" } ]); - match(loader, "style.css").should.eql([]); + expect(match(loader, "style.css")).toEqual([]); }); it("should match if include matches", () => { @@ -124,7 +122,7 @@ describe("RuleSet", () => { loader: "css" } ]); - match(loader, "style.css").should.eql(["css"]); + expect(match(loader, "style.css")).toEqual(["css"]); }); it("should not match if exclude matches", () => { @@ -135,7 +133,7 @@ describe("RuleSet", () => { loader: "css" } ]); - match(loader, "style.css").should.eql([]); + expect(match(loader, "style.css")).toEqual([]); }); it("should match if exclude does not match", () => { @@ -146,7 +144,7 @@ describe("RuleSet", () => { loader: "css" } ]); - match(loader, "style.css").should.eql(["css"]); + expect(match(loader, "style.css")).toEqual(["css"]); }); it("should work if a loader is applied to all files", () => { @@ -155,8 +153,8 @@ describe("RuleSet", () => { loader: "css" } ]); - match(loader, "style.css").should.eql(["css"]); - match(loader, "scripts.js").should.eql(["css"]); + expect(match(loader, "style.css")).toEqual(["css"]); + expect(match(loader, "scripts.js")).toEqual(["css"]); }); it("should work with using loader as string", () => { @@ -166,7 +164,7 @@ describe("RuleSet", () => { loader: "css" } ]); - match(loader, "style.css").should.eql(["css"]); + expect(match(loader, "style.css")).toEqual(["css"]); }); it("should work with using loader as array", () => { @@ -176,7 +174,7 @@ describe("RuleSet", () => { loader: ["css"] } ]); - match(loader, "style.css").should.eql(["css"]); + expect(match(loader, "style.css")).toEqual(["css"]); }); it("should work with using loaders as string", () => { @@ -186,7 +184,7 @@ describe("RuleSet", () => { loaders: "css" } ]); - match(loader, "style.css").should.eql(["css"]); + expect(match(loader, "style.css")).toEqual(["css"]); }); it("should work with using loaders as array", () => { @@ -196,11 +194,11 @@ describe("RuleSet", () => { loaders: ["css"] } ]); - match(loader, "style.css").should.eql(["css"]); + expect(match(loader, "style.css")).toEqual(["css"]); }); it("should throw if using loaders with non-string or array", () => { - should.throws(function() { + expect(() => { const loader = new RuleSet([ { test: /\.css$/, @@ -209,8 +207,8 @@ describe("RuleSet", () => { } } ]); - match(loader, "style.css").should.eql(["css"]); - }, /No loader specified/); + match(loader, "style.css"); + }).toThrow(/No loader specified/); }); it("should work with using loader with inline query", () => { @@ -220,7 +218,7 @@ describe("RuleSet", () => { loader: "css?modules=1" } ]); - match(loader, "style.css").should.eql(["css?modules=1"]); + expect(match(loader, "style.css")).toEqual(["css?modules=1"]); }); it("should work with using loader with string query", () => { @@ -231,7 +229,7 @@ describe("RuleSet", () => { query: "modules=1" } ]); - match(loader, "style.css").should.eql(["css?modules=1"]); + expect(match(loader, "style.css")).toEqual(["css?modules=1"]); }); it("should work with using loader with object query", () => { @@ -244,7 +242,7 @@ describe("RuleSet", () => { } } ]); - match(loader, "style.css").should.eql(['css?{"modules":1}']); + expect(match(loader, "style.css")).toEqual(['css?{"modules":1}']); }); it("should work with using array loaders with basic object notation", () => { @@ -258,11 +256,11 @@ describe("RuleSet", () => { ] } ]); - match(loader, "style.css").should.eql(["css"]); + expect(match(loader, "style.css")).toEqual(["css"]); }); it("should throw if using array loaders with object notation without specifying a loader", () => { - should.throws(() => { + expect(() => { const loader = new RuleSet([ { test: /\.css$/, @@ -274,7 +272,7 @@ describe("RuleSet", () => { } ]); match(loader, "style.css"); - }, /No loader specified/); + }).toThrow(/No loader specified/); }); it("should work with using array loaders with object notation", () => { @@ -289,7 +287,7 @@ describe("RuleSet", () => { ] } ]); - match(loader, "style.css").should.eql(["css?modules=1"]); + expect(match(loader, "style.css")).toEqual(["css?modules=1"]); }); it("should work with using multiple array loaders with object notation", () => { @@ -308,7 +306,7 @@ describe("RuleSet", () => { ] } ]); - match(loader, "style.css").should.eql([ + expect(match(loader, "style.css")).toEqual([ "style?filesize=1000", "css?modules=1" ]); @@ -321,14 +319,14 @@ describe("RuleSet", () => { loaders: "style?filesize=1000!css?modules=1" } ]); - match(loader, "style.css").should.eql([ + expect(match(loader, "style.css")).toEqual([ "style?filesize=1000", "css?modules=1" ]); }); it("should throw if using array loaders with a single legacy", () => { - should.throws(() => { + expect(() => { const loader = new RuleSet([ { test: /\.css$/, @@ -336,8 +334,8 @@ describe("RuleSet", () => { query: "modules=1" } ]); - match(loader, "style.css").should.eql(["css"]); - }, /options\/query cannot be used with loaders/); + match(loader, "style.css"); + }).toThrow(/options\/query cannot be used with loaders/); }); it("should work when using array loaders", () => { @@ -347,7 +345,7 @@ describe("RuleSet", () => { loaders: ["style-loader", "css-loader"] } ]); - match(loader, "style.css").should.eql(["style-loader", "css-loader"]); + expect(match(loader, "style.css")).toEqual(["style-loader", "css-loader"]); }); it("should work when using an array of functions returning a loader", () => { @@ -368,7 +366,7 @@ describe("RuleSet", () => { ] } ]); - match(loader, "style.css").should.eql(["style-loader", "css-loader"]); + expect(match(loader, "style.css")).toEqual(["style-loader", "css-loader"]); }); it("should work when using an array of either functions or strings returning a loader", () => { @@ -385,7 +383,7 @@ describe("RuleSet", () => { ] } ]); - match(loader, "style.css").should.eql(["style-loader", "css-loader"]); + expect(match(loader, "style.css")).toEqual(["style-loader", "css-loader"]); }); it("should work when using an array of functions returning either a loader object or loader name string", () => { @@ -404,37 +402,35 @@ describe("RuleSet", () => { ] } ]); - match(loader, "style.css").should.eql(["style-loader", "css-loader"]); + expect(match(loader, "style.css")).toEqual(["style-loader", "css-loader"]); }); it("should throw if using array loaders with invalid type", () => { - should.throws(() => { + expect(() => { const loader = new RuleSet([ { test: /\.css$/, loaders: ["style-loader", "css-loader", 5] } ]); - match(loader, "style.css").should.eql(["css"]); - }, /No loader specified/); + match(loader, "style.css"); + }).toThrow(/No loader specified/); }); describe("when exclude array holds an undefined item", () => { function errorHasContext(err) { - if ( + return ( /Expected condition but got falsy value/.test(err) && /test/.test(err) && /include/.test(err) && /exclude/.test(err) && /node_modules/.test(err) && /undefined/.test(err) - ) { - return true; - } + ); } it("should throw with context", () => { - should.throws(() => { + try { const loader = new RuleSet([ { test: /\.css$/, @@ -443,11 +439,14 @@ describe("RuleSet", () => { exclude: ["node_modules", undefined] } ]); - match(loader, "style.css").should.eql(["css"]); - }, errorHasContext); + match(loader, "style.css"); + throw new Error("unreachable"); + } catch (e) { + expect(errorHasContext(e.message)).toBe(true); + } }); it("in resource should throw with context", () => { - should.throws(() => { + try { const loader = new RuleSet([ { resource: { @@ -457,12 +456,14 @@ describe("RuleSet", () => { } } ]); - match(loader, "style.css").should.eql(["css"]); - }, errorHasContext); + match(loader, "style.css"); + throw new Error("unreachable"); + } catch (e) { + expect(errorHasContext(e.message)).toBe(true); + } }); - it("in issuer should throw with context", () => { - should.throws(() => { + try { const loader = new RuleSet([ { issuer: { @@ -472,8 +473,11 @@ describe("RuleSet", () => { } } ]); - match(loader, "style.css").should.eql(["css"]); - }, errorHasContext); + match(loader, "style.css"); + throw new Error("unreachable"); + } catch (e) { + expect(errorHasContext(e.message)).toBe(true); + } }); }); }); diff --git a/test/Schemas.lint.js b/test/Schemas.lint.js index 619c80eced4..50fff3badb6 100644 --- a/test/Schemas.lint.js +++ b/test/Schemas.lint.js @@ -2,7 +2,6 @@ const fs = require("fs"); const path = require("path"); -require("should"); const glob = require("glob"); const rootDir = path.resolve(__dirname, ".."); @@ -30,9 +29,9 @@ describe("Schemas", () => { if (content) { it("should be formated correctly", () => { - fileContent - .replace(/\r\n?/g, "\n") - .should.be.eql(JSON.stringify(content, 0, 2) + "\n"); + expect(fileContent.replace(/\r\n?/g, "\n")).toBe( + JSON.stringify(content, 0, 2) + "\n" + ); }); const arrayProperties = ["oneOf", "anyOf", "allOf"]; @@ -61,8 +60,8 @@ describe("Schemas", () => { const validateProperty = property => { it("should have description set", () => { - property.should.be.property("description").be.type("string"); - property.description.length.should.be.above(1); + expect(typeof property.description).toBe("string"); + expect(property.description.length).toBeGreaterThan(1); }); }; @@ -120,7 +119,7 @@ describe("Schemas", () => { } if ("properties" in item) { it("should have additionalProperties set to some value when describing properties", () => { - item.should.be.property("additionalProperties"); + expect(item.additionalProperties).toBeDefined(); }); Object.keys(item.properties).forEach(name => { describe(`> '${name}'`, () => { diff --git a/test/SideEffectsFlagPlugin.unittest.js b/test/SideEffectsFlagPlugin.unittest.js index 3b4a7e29102..a0e9c9830c0 100644 --- a/test/SideEffectsFlagPlugin.unittest.js +++ b/test/SideEffectsFlagPlugin.unittest.js @@ -4,100 +4,108 @@ const SideEffectsFlagPlugin = require("../lib/optimize/SideEffectsFlagPlugin"); describe("SideEffectsFlagPlugin", () => { it("should assume true", () => { - SideEffectsFlagPlugin.moduleHasSideEffects( - "./foo/bar.js", - undefined - ).should.eql(true); + expect( + SideEffectsFlagPlugin.moduleHasSideEffects("./foo/bar.js", undefined) + ).toBe(true); }); it("should understand boolean values", () => { - SideEffectsFlagPlugin.moduleHasSideEffects("./foo/bar.js", true).should.eql( - true - ); - SideEffectsFlagPlugin.moduleHasSideEffects( - "./foo/bar.js", - false - ).should.eql(false); + expect( + SideEffectsFlagPlugin.moduleHasSideEffects("./foo/bar.js", true) + ).toBe(true); + expect( + SideEffectsFlagPlugin.moduleHasSideEffects("./foo/bar.js", false) + ).toBe(false); }); it("should understand a glob", () => { - SideEffectsFlagPlugin.moduleHasSideEffects( - "./src/x/y/z.js", - "./src/**/*.js" - ).should.eql(true); - SideEffectsFlagPlugin.moduleHasSideEffects( - "./x.js", - "./src/**/*.js" - ).should.eql(false); - SideEffectsFlagPlugin.moduleHasSideEffects( - "./src/x/y/z.js", - "./**/src/x/y/z.js" - ).should.eql(true); - SideEffectsFlagPlugin.moduleHasSideEffects( - "./src/x/y/z.js", - "**.js" - ).should.eql(true); - SideEffectsFlagPlugin.moduleHasSideEffects( - "./src/x/y/z.js", - "./src/**/z.js" - ).should.eql(true); - SideEffectsFlagPlugin.moduleHasSideEffects( - "./src/x/y/z.js", - "./**/x/**/z.js" - ).should.eql(true); - SideEffectsFlagPlugin.moduleHasSideEffects( - "./src/x/y/z.js", - "./**/src/**" - ).should.eql(true); - SideEffectsFlagPlugin.moduleHasSideEffects( - "./src/x/y/z.js", - "./**/src/*" - ).should.eql(false); - SideEffectsFlagPlugin.moduleHasSideEffects( - "./src/x/y/z.js", - "*.js" - ).should.eql(true); - SideEffectsFlagPlugin.moduleHasSideEffects( - "./src/x/y/z.js", - "x/**/z.js" - ).should.eql(false); - SideEffectsFlagPlugin.moduleHasSideEffects( - "./src/x/y/z.js", - "src/**/z.js" - ).should.eql(true); - SideEffectsFlagPlugin.moduleHasSideEffects( - "./src/x/y/z.js", - "src/**/{x,y,z}.js" - ).should.eql(true); - SideEffectsFlagPlugin.moduleHasSideEffects( - "./src/x/y/z.js", - "src/**/[x-z].js" - ).should.eql(true); - SideEffectsFlagPlugin.moduleHasSideEffects( - "./src/x/y/z.js", - "src/**/[[:lower:]].js" - ).should.eql(true); - SideEffectsFlagPlugin.moduleHasSideEffects( - "./src/x/y/z.js", - "!*.js" - ).should.eql(false); - SideEffectsFlagPlugin.moduleHasSideEffects( - "./src/x/y/z.js", - "!**/*.js" - ).should.eql(false); + expect( + SideEffectsFlagPlugin.moduleHasSideEffects( + "./src/x/y/z.js", + "./src/**/*.js" + ) + ).toBe(true); + expect( + SideEffectsFlagPlugin.moduleHasSideEffects("./x.js", "./src/**/*.js") + ).toBe(false); + expect( + SideEffectsFlagPlugin.moduleHasSideEffects( + "./src/x/y/z.js", + "./**/src/x/y/z.js" + ) + ).toBe(true); + expect( + SideEffectsFlagPlugin.moduleHasSideEffects("./src/x/y/z.js", "**.js") + ).toBe(true); + expect( + SideEffectsFlagPlugin.moduleHasSideEffects( + "./src/x/y/z.js", + "./src/**/z.js" + ) + ).toBe(true); + expect( + SideEffectsFlagPlugin.moduleHasSideEffects( + "./src/x/y/z.js", + "./**/x/**/z.js" + ) + ).toBe(true); + expect( + SideEffectsFlagPlugin.moduleHasSideEffects( + "./src/x/y/z.js", + "./**/src/**" + ) + ).toBe(true); + expect( + SideEffectsFlagPlugin.moduleHasSideEffects("./src/x/y/z.js", "./**/src/*") + ).toBe(false); + expect( + SideEffectsFlagPlugin.moduleHasSideEffects("./src/x/y/z.js", "*.js") + ).toBe(true); + expect( + SideEffectsFlagPlugin.moduleHasSideEffects("./src/x/y/z.js", "x/**/z.js") + ).toBe(false); + expect( + SideEffectsFlagPlugin.moduleHasSideEffects( + "./src/x/y/z.js", + "src/**/z.js" + ) + ).toBe(true); + expect( + SideEffectsFlagPlugin.moduleHasSideEffects( + "./src/x/y/z.js", + "src/**/{x,y,z}.js" + ) + ).toBe(true); + expect( + SideEffectsFlagPlugin.moduleHasSideEffects( + "./src/x/y/z.js", + "src/**/[x-z].js" + ) + ).toBe(true); + expect( + SideEffectsFlagPlugin.moduleHasSideEffects( + "./src/x/y/z.js", + "src/**/[[:lower:]].js" + ) + ).toBe(true); + expect( + SideEffectsFlagPlugin.moduleHasSideEffects("./src/x/y/z.js", "!*.js") + ).toBe(false); + expect( + SideEffectsFlagPlugin.moduleHasSideEffects("./src/x/y/z.js", "!**/*.js") + ).toBe(false); }); it("should understand arrays", () => { const array = ["./src/**/*.js", "./dirty.js"]; - SideEffectsFlagPlugin.moduleHasSideEffects( - "./src/x/y/z.js", - array - ).should.eql(true); - SideEffectsFlagPlugin.moduleHasSideEffects("./dirty.js", array).should.eql( - true - ); - SideEffectsFlagPlugin.moduleHasSideEffects("./clean.js", array).should.eql( - false - ); + expect( + SideEffectsFlagPlugin.moduleHasSideEffects("./src/x/y/z.js", array) + ).toBe(true); + expect( + SideEffectsFlagPlugin.moduleHasSideEffects("./dirty.js", array) + ).toBe(true); + expect( + SideEffectsFlagPlugin.moduleHasSideEffects("./clean.js", array) + ).toBe(false); }); }); diff --git a/test/SizeFormatHelpers.unittest.js b/test/SizeFormatHelpers.unittest.js index 7d3f8c84208..5fd6558271b 100644 --- a/test/SizeFormatHelpers.unittest.js +++ b/test/SizeFormatHelpers.unittest.js @@ -1,47 +1,49 @@ /* globals describe, it, beforeEach */ "use strict"; -const should = require("should"); const SizeFormatHelpers = require("../lib/SizeFormatHelpers"); describe("SizeFormatHelpers", () => { describe("formatSize", () => { it("should handle zero size", () => { - should(SizeFormatHelpers.formatSize(0)).be.eql("0 bytes"); + expect(SizeFormatHelpers.formatSize(0)).toBe("0 bytes"); }); it("should handle bytes", () => { - should(SizeFormatHelpers.formatSize(1000)).be.eql("1000 bytes"); + expect(SizeFormatHelpers.formatSize(1000)).toBe("1000 bytes"); }); it("should handle integer kibibytes", () => { - should(SizeFormatHelpers.formatSize(2048)).be.eql("2 KiB"); + expect(SizeFormatHelpers.formatSize(2048)).toBe("2 KiB"); }); it("should handle float kibibytes", () => { - should(SizeFormatHelpers.formatSize(2560)).be.eql("2.5 KiB"); + expect(SizeFormatHelpers.formatSize(2560)).toBe("2.5 KiB"); }); it("should handle integer mebibytes", () => { - should(SizeFormatHelpers.formatSize(10 * 1024 * 1024)).be.eql("10 MiB"); + expect(SizeFormatHelpers.formatSize(10 * 1024 * 1024)).toBe("10 MiB"); }); it("should handle float mebibytes", () => { - should(SizeFormatHelpers.formatSize(12.5 * 1024 * 1024)).be.eql( - "12.5 MiB" - ); + expect(SizeFormatHelpers.formatSize(12.5 * 1024 * 1024)).toBe("12.5 MiB"); }); it("should handle integer gibibytes", () => { - should(SizeFormatHelpers.formatSize(3 * 1024 * 1024 * 1024)).be.eql( + expect(SizeFormatHelpers.formatSize(3 * 1024 * 1024 * 1024)).toBe( "3 GiB" ); }); it("should handle float gibibytes", () => { - should(SizeFormatHelpers.formatSize(1.2 * 1024 * 1024 * 1024)).be.eql( + expect(SizeFormatHelpers.formatSize(1.2 * 1024 * 1024 * 1024)).toBe( "1.2 GiB" ); }); + + it("should handle undefined/NaN", () => { + expect(SizeFormatHelpers.formatSize(undefined)).toBe("unknown size"); + expect(SizeFormatHelpers.formatSize(NaN)).toBe("unknown size"); + }); }); }); diff --git a/test/SortableSet.unittest.js b/test/SortableSet.unittest.js index 7bc73584eaa..66968c3b38d 100644 --- a/test/SortableSet.unittest.js +++ b/test/SortableSet.unittest.js @@ -6,7 +6,7 @@ const SortableSet = require("../lib/util/SortableSet"); describe("util/SortableSet", () => { it("Can be constructed like a normal Set", () => { const sortableSet = new SortableSet([1, 1, 1, 1, 1, 4, 5, 2], () => {}); - Array.from(sortableSet).should.eql([1, 4, 5, 2]); + expect(Array.from(sortableSet)).toEqual([1, 4, 5, 2]); }); it("Can sort its content", () => { @@ -15,7 +15,7 @@ describe("util/SortableSet", () => { (a, b) => a - b ); sortableSet.sort(); - Array.from(sortableSet).should.eql([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); + expect(Array.from(sortableSet)).toEqual([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); }); it("Can sort by a specified function", () => { @@ -24,6 +24,6 @@ describe("util/SortableSet", () => { (a, b) => a - b ); sortableSet.sortWith((a, b) => b - a); - Array.from(sortableSet).should.eql([9, 8, 7, 6, 5, 4, 3, 2, 1, 0]); + expect(Array.from(sortableSet)).toEqual([9, 8, 7, 6, 5, 4, 3, 2, 1, 0]); }); }); diff --git a/test/SourceMapDevToolModuleOptionsPlugin.unittest.js b/test/SourceMapDevToolModuleOptionsPlugin.unittest.js index 9b3d0e0fb58..dd348267bd8 100644 --- a/test/SourceMapDevToolModuleOptionsPlugin.unittest.js +++ b/test/SourceMapDevToolModuleOptionsPlugin.unittest.js @@ -1,6 +1,5 @@ "use strict"; -require("should"); const SourceMapDevToolModuleOptionsPlugin = require("../lib/SourceMapDevToolModuleOptionsPlugin"); const applyPluginWithOptions = require("./helpers/applyPluginWithOptions"); @@ -8,47 +7,50 @@ describe("SourceMapDevToolModuleOptionsPlugin", () => { describe("when applied", () => { let eventBindings; - beforeEach(() => (eventBindings = undefined)); + beforeEach(() => { + eventBindings = undefined; + }); describe("with module false and line-to-line false", () => { - beforeEach( - () => - (eventBindings = applyPluginWithOptions( - SourceMapDevToolModuleOptionsPlugin, - { - module: false, - lineToLine: false - } - )) - ); - - it("does not bind any event handlers", () => - eventBindings.length.should.be.exactly(0)); + beforeEach(() => { + eventBindings = applyPluginWithOptions( + SourceMapDevToolModuleOptionsPlugin, + { + module: false, + lineToLine: false + } + ); + }); + + it("does not bind any event handlers", () => { + expect(eventBindings.length).toBe(0); + }); }); describe("with module true", () => { - beforeEach( - () => - (eventBindings = applyPluginWithOptions( - SourceMapDevToolModuleOptionsPlugin, - { - module: true, - lineToLine: false - } - )) - ); - - it("binds one event handler", () => - eventBindings.length.should.be.exactly(1)); + beforeEach(() => { + eventBindings = applyPluginWithOptions( + SourceMapDevToolModuleOptionsPlugin, + { + module: true, + lineToLine: false + } + ); + }); + + it("binds one event handler", () => { + expect(eventBindings.length).toBe(1); + }); describe("event handler", () => { - it("binds to build-module event", () => - eventBindings[0].name.should.be.exactly("build-module")); + it("binds to build-module event", () => { + expect(eventBindings[0].name).toBe("build-module"); + }); it("sets source map flag", () => { const module = {}; eventBindings[0].handler(module); - module.should.deepEqual({ + expect(module).toEqual({ useSourceMap: true }); }); @@ -56,28 +58,28 @@ describe("SourceMapDevToolModuleOptionsPlugin", () => { }); describe("with line-to-line true", () => { - beforeEach( - () => - (eventBindings = applyPluginWithOptions( - SourceMapDevToolModuleOptionsPlugin, - { - module: false, - lineToLine: true - } - )) - ); - - it("binds one event handler", () => - eventBindings.length.should.be.exactly(1)); + beforeEach(() => + (eventBindings = applyPluginWithOptions( + SourceMapDevToolModuleOptionsPlugin, + { + module: false, + lineToLine: true + } + ))); + + it("binds one event handler", () => { + expect(eventBindings.length).toBe(1); + }); describe("event handler", () => { - it("binds to build-module event", () => - eventBindings[0].name.should.be.exactly("build-module")); + it("binds to build-module event", () => { + expect(eventBindings[0].name).toBe("build-module"); + }); it("sets line-to-line flag", () => { const module = {}; eventBindings[0].handler(module); - module.should.deepEqual({ + expect(module).toEqual({ lineToLine: true }); }); @@ -85,29 +87,30 @@ describe("SourceMapDevToolModuleOptionsPlugin", () => { }); describe("with line-to-line object", () => { - beforeEach( - () => - (eventBindings = applyPluginWithOptions( - SourceMapDevToolModuleOptionsPlugin, - { - module: false, - lineToLine: {} - } - )) - ); - - it("binds one event handler", () => - eventBindings.length.should.be.exactly(1)); + beforeEach(() => { + eventBindings = applyPluginWithOptions( + SourceMapDevToolModuleOptionsPlugin, + { + module: false, + lineToLine: {} + } + ); + }); + + it("binds one event handler", () => { + expect(eventBindings.length).toBe(1); + }); describe("event handler", () => { - it("binds to build-module event", () => - eventBindings[0].name.should.be.exactly("build-module")); + it("binds to build-module event", () => { + expect(eventBindings[0].name).toBe("build-module"); + }); describe("when module has no resource", () => { it("makes no changes", () => { const module = {}; eventBindings[0].handler(module); - module.should.deepEqual({}); + expect(module).toEqual({}); }); }); @@ -117,7 +120,7 @@ describe("SourceMapDevToolModuleOptionsPlugin", () => { resource: "foo" }; eventBindings[0].handler(module); - module.should.deepEqual({ + expect(module).toEqual({ lineToLine: true, resource: "foo" }); @@ -130,7 +133,7 @@ describe("SourceMapDevToolModuleOptionsPlugin", () => { resource: "foo?bar" }; eventBindings[0].handler(module); - module.should.deepEqual({ + expect(module).toEqual({ lineToLine: true, resource: "foo?bar" }); diff --git a/test/Stats.test.js b/test/Stats.test.js index d59bc196544..ffe2b8cecfe 100644 --- a/test/Stats.test.js +++ b/test/Stats.test.js @@ -1,13 +1,11 @@ /*globals describe it */ "use strict"; -require("should"); - const webpack = require("../lib/webpack"); const MemoryFs = require("memory-fs"); describe("Stats", () => { - it("should print env string in stats", function(done) { + it("should print env string in stats", done => { const compiler = webpack({ context: __dirname, entry: "./fixtures/a" @@ -16,15 +14,15 @@ describe("Stats", () => { compiler.run((err, stats) => { if (err) return done(err); try { - stats - .toString({ + expect( + stats.toString({ all: false, env: true, _env: "production" }) - .should.be.eql('Environment (--env): "production"'); - stats - .toString({ + ).toBe('Environment (--env): "production"'); + expect( + stats.toString({ all: false, env: true, _env: { @@ -32,15 +30,15 @@ describe("Stats", () => { baz: true } }) - .should.be.eql( - "Environment (--env): {\n" + - ' "prod": [\n' + - ' "foo",\n' + - ' "bar"\n' + - " ],\n" + - ' "baz": true\n' + - "}" - ); + ).toBe( + "Environment (--env): {\n" + + ' "prod": [\n' + + ' "foo",\n' + + ' "bar"\n' + + " ],\n" + + ' "baz": true\n' + + "}" + ); done(); } catch (e) { done(e); diff --git a/test/Stats.unittest.js b/test/Stats.unittest.js index 563a4e23e04..9ee873f1656 100644 --- a/test/Stats.unittest.js +++ b/test/Stats.unittest.js @@ -1,8 +1,6 @@ /*globals describe it */ "use strict"; -require("should"); - const Stats = require("../lib/Stats"); const packageJson = require("../package.json"); @@ -21,9 +19,9 @@ describe( }); const inputPath = "./node_modules/ts-loader!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/app.vue"; - const expectPath = `./src/app.vue (${inputPath})\n`; + const expectPath = `./src/app.vue (${inputPath})`; - mockStats.formatFilePath(inputPath).should.be.exactly(expectPath); + expect(mockStats.formatFilePath(inputPath)).toBe(expectPath); }); }); @@ -38,7 +36,7 @@ describe( context: "" } }); - mockStats.hasErrors().should.be.ok(); + expect(mockStats.hasErrors()).toBe(true); }); it("hasWarnings", () => { const mockStats = new Stats({ @@ -49,7 +47,7 @@ describe( context: "" } }); - mockStats.hasWarnings().should.be.ok(); + expect(mockStats.hasWarnings()).toBe(true); }); }); describe("does not have", () => { @@ -62,7 +60,7 @@ describe( context: "" } }); - mockStats.hasErrors().should.not.be.ok(); + expect(mockStats.hasErrors()).toBe(false); }); it("hasWarnings", () => { const mockStats = new Stats({ @@ -73,7 +71,7 @@ describe( context: "" } }); - mockStats.hasWarnings().should.not.be.ok(); + expect(mockStats.hasWarnings()).toBe(false); }); }); describe("children have", () => { @@ -91,7 +89,7 @@ describe( errors: [], hash: "1234" }); - mockStats.hasErrors().should.be.ok(); + expect(mockStats.hasErrors()).toBe(true); }); it("hasWarnings", () => { const mockStats = new Stats({ @@ -107,7 +105,7 @@ describe( warnings: [], hash: "1234" }); - mockStats.hasWarnings().should.be.ok(); + expect(mockStats.hasWarnings()).toBe(true); }); }); it("formatError handles string errors", () => { @@ -116,6 +114,7 @@ describe( warnings: [], assets: [], entrypoints: new Map(), + namedChunkGroups: new Map(), chunks: [], modules: [], children: [], @@ -131,7 +130,7 @@ describe( } }); const obj = mockStats.toJson(); - obj.errors[0].should.be.equal("firstError"); + expect(obj.errors[0]).toEqual("firstError"); }); }); describe("toJson", () => { @@ -142,6 +141,7 @@ describe( assets: [], entrypoints: new Map(), chunks: [], + namedChunkGroups: new Map(), modules: [], children: [], hash: "1234", @@ -156,12 +156,13 @@ describe( } }); const result = mockStats.toJson(); - result.should.deepEqual({ + expect(result).toEqual({ assets: [], assetsByChunkName: {}, children: [], chunks: [], entrypoints: {}, + namedChunkGroups: {}, filteredAssets: 0, filteredModules: 0, errors: [], @@ -177,29 +178,29 @@ describe( describe("Presets", () => { describe("presetToOptions", () => { it("returns correct object with 'Normal'", () => { - Stats.presetToOptions("Normal").should.eql({}); + expect(Stats.presetToOptions("Normal")).toEqual({}); }); it("truthy values behave as 'normal'", () => { const normalOpts = Stats.presetToOptions("normal"); - Stats.presetToOptions("pizza").should.eql(normalOpts); - Stats.presetToOptions(true).should.eql(normalOpts); - Stats.presetToOptions(1).should.eql(normalOpts); + expect(Stats.presetToOptions("pizza")).toEqual(normalOpts); + expect(Stats.presetToOptions(true)).toEqual(normalOpts); + expect(Stats.presetToOptions(1)).toEqual(normalOpts); - Stats.presetToOptions("verbose").should.not.eql(normalOpts); - Stats.presetToOptions(false).should.not.eql(normalOpts); + expect(Stats.presetToOptions("verbose")).not.toEqual(normalOpts); + expect(Stats.presetToOptions(false)).not.toEqual(normalOpts); }); it("returns correct object with 'none'", () => { - Stats.presetToOptions("none").should.eql({ + expect(Stats.presetToOptions("none")).toEqual({ all: false }); }); it("falsy values behave as 'none'", () => { const noneOpts = Stats.presetToOptions("none"); - Stats.presetToOptions("").should.eql(noneOpts); - Stats.presetToOptions(null).should.eql(noneOpts); - Stats.presetToOptions().should.eql(noneOpts); - Stats.presetToOptions(0).should.eql(noneOpts); - Stats.presetToOptions(false).should.eql(noneOpts); + expect(Stats.presetToOptions("")).toEqual(noneOpts); + expect(Stats.presetToOptions(null)).toEqual(noneOpts); + expect(Stats.presetToOptions()).toEqual(noneOpts); + expect(Stats.presetToOptions(0)).toEqual(noneOpts); + expect(Stats.presetToOptions(false)).toEqual(noneOpts); }); }); }); diff --git a/test/StatsTestCases.test.js b/test/StatsTestCases.test.js index e75a4038397..6ab8049d6d0 100644 --- a/test/StatsTestCases.test.js +++ b/test/StatsTestCases.test.js @@ -1,7 +1,6 @@ /*globals describe it */ "use strict"; -require("should"); const path = require("path"); const fs = require("fs"); @@ -20,8 +19,8 @@ const tests = fs describe("StatsTestCases", () => { tests.forEach(testName => { - it("should print correct stats for " + testName, function(done) { - this.timeout(10000); + it("should print correct stats for " + testName, done => { + jest.setTimeout(10000); let options = { mode: "development", entry: "./index", @@ -71,13 +70,11 @@ describe("StatsTestCases", () => { }); c.run((err, stats) => { if (err) return done(err); - if (/error$/.test(testName)) { - stats.hasErrors().should.be.equal(true); + expect(stats.hasErrors()).toBe(true); } else if (stats.hasErrors()) { return done(new Error(stats.toJson().errors.join("\n\n"))); } - let toStringOptions = { context: path.join(base, testName), colors: false @@ -87,7 +84,6 @@ describe("StatsTestCases", () => { toStringOptions = options.stats; if (toStringOptions === null || typeof toStringOptions !== "object") toStringOptions = Stats.presetToOptions(toStringOptions); - hasColorSetting = typeof options.stats.colors !== "undefined"; if (!toStringOptions.context) toStringOptions.context = path.join(base, testName); @@ -95,9 +91,8 @@ describe("StatsTestCases", () => { if (Array.isArray(options) && !toStringOptions.children) { toStringOptions.children = options.map(o => o.stats); } - let actual = stats.toString(toStringOptions); - (typeof actual).should.be.eql("string"); + expect(typeof actual).toBe("string"); if (!hasColorSetting) { actual = actual .replace(/\u001b\[[0-9;]*m/g, "") @@ -118,25 +113,12 @@ describe("StatsTestCases", () => { "$1 Thu Jan 01 1970 00:00:00 GMT" ); } - actual = actual .replace(/\r\n?/g, "\n") .replace(/[\t ]*Version:.+\n/g, "") .replace(path.join(base, testName), "Xdir/" + testName) .replace(/ dependencies:Xms/g, ""); - const expected = fs - .readFileSync(path.join(base, testName, "expected.txt"), "utf-8") - .replace(/\r/g, ""); - if (actual !== expected) { - fs.writeFileSync( - path.join(base, testName, "actual.txt"), - actual, - "utf-8" - ); - } else if (fs.existsSync(path.join(base, testName, "actual.txt"))) { - fs.unlinkSync(path.join(base, testName, "actual.txt")); - } - actual.should.be.eql(expected); + expect(actual).toMatchSnapshot(); done(); }); }); diff --git a/test/Template.unittest.js b/test/Template.unittest.js index fd1dcc68e18..8b744e9c58c 100644 --- a/test/Template.unittest.js +++ b/test/Template.unittest.js @@ -1,28 +1,23 @@ "use strict"; -require("should"); - const Template = require("../lib/Template"); describe("Template", () => { - it("should generate valid identifiers", () => - Template.toIdentifier("0abc-def9").should.equal("_0abc_def9")); + it("should generate valid identifiers", () => { + expect(Template.toIdentifier("0abc-def9")).toBe("_0abc_def9"); + }); it("should generate valid number identifiers", () => { const items = []; let item; for (let i = 0; i < 80; i += 1) { item = Template.numberToIdentifer(i); - if (item === "") { - throw new Error("empty number identifier"); - } else if (items.indexOf(item) > -1) { - throw new Error("duplicate number identifier"); - } else { - items.push(item); - } + expect(item).not.toBe(""); + expect(items).not.toContain(item); + items.push(item); } }); it("should generate sanitized path identifiers", () => { - Template.toPath("path/to-sdfas/sadfome$$.js").should.equal( + expect(Template.toPath("path/to-sdfas/sadfome$$.js")).toBe( "path-to-sdfas-sadfome$$-js" ); }); diff --git a/test/TestCases.template.js b/test/TestCases.template.js new file mode 100644 index 00000000000..57dab3269db --- /dev/null +++ b/test/TestCases.template.js @@ -0,0 +1,271 @@ +/* global describe it beforeAll expect */ +"use strict"; + +const path = require("path"); +const fs = require("fs"); +const vm = require("vm"); +const mkdirp = require("mkdirp"); +const UglifyJsPlugin = require("uglifyjs-webpack-plugin"); +const checkArrayExpectation = require("./checkArrayExpectation"); + +const Stats = require("../lib/Stats"); +const webpack = require("../lib/webpack"); + +const uglifyJsForTesting = new UglifyJsPlugin({ + cache: false, + parallel: false, + sourceMap: true +}); + +const DEFAULT_OPTIMIZATIONS = { + removeAvailableModules: true, + removeEmptyChunks: true, + mergeDuplicateChunks: true, + flagIncludedChunks: true, + occurrenceOrder: true, + sideEffects: true, + providedExports: true, + usedExports: true, + noEmitOnErrors: false, + concatenateModules: false, + namedModules: false, + minimizer: [uglifyJsForTesting] +}; + +const NO_EMIT_ON_ERRORS_OPTIMIZATIONS = { + noEmitOnErrors: false, + minimizer: [uglifyJsForTesting] +}; + +const casesPath = path.join(__dirname, "cases"); +let categories = fs.readdirSync(casesPath); +categories = categories.map(cat => { + return { + name: cat, + tests: fs + .readdirSync(path.join(casesPath, cat)) + .filter(folder => folder.indexOf("_") < 0) + }; +}); + +const describeCases = config => { + describe(config.name, () => { + categories.forEach(category => { + describe(category.name, function() { + jest.setTimeout(20000); + + category.tests + .filter(test => { + const testDirectory = path.join(casesPath, category.name, test); + const filterPath = path.join(testDirectory, "test.filter.js"); + if (fs.existsSync(filterPath) && !require(filterPath)(config)) { + describe.skip(test, () => it("filtered")); + return false; + } + return true; + }) + .forEach(testName => { + describe(testName, () => { + const testDirectory = path.join( + casesPath, + category.name, + testName + ); + const outputDirectory = path.join( + __dirname, + "js", + config.name, + category.name, + testName + ); + const options = { + context: casesPath, + entry: "./" + category.name + "/" + testName + "/index", + target: "async-node", + devtool: config.devtool, + mode: config.mode || "none", + optimization: config.mode + ? NO_EMIT_ON_ERRORS_OPTIMIZATIONS + : Object.assign( + {}, + config.optimization, + DEFAULT_OPTIMIZATIONS + ), + performance: { + hints: false + }, + output: { + pathinfo: true, + path: outputDirectory, + filename: "bundle.js" + }, + resolve: { + modules: ["web_modules", "node_modules"], + mainFields: [ + "webpack", + "browser", + "web", + "browserify", + ["jam", "main"], + "main" + ], + aliasFields: ["browser"], + extensions: [ + ".mjs", + ".webpack.js", + ".web.js", + ".js", + ".json" + ], + concord: true + }, + resolveLoader: { + modules: [ + "web_loaders", + "web_modules", + "node_loaders", + "node_modules" + ], + mainFields: ["webpackLoader", "webLoader", "loader", "main"], + extensions: [ + ".webpack-loader.js", + ".web-loader.js", + ".loader.js", + ".js" + ] + }, + module: { + rules: [ + { + test: /\.coffee$/, + loader: "coffee-loader" + }, + { + test: /\.pug/, + loader: "pug-loader" + }, + { + test: /\.wat$/i, + loader: "wast-loader", + type: "webassembly/experimental" + } + ] + }, + plugins: (config.plugins || []).concat(function() { + this.hooks.compilation.tap("TestCasesTest", compilation => { + [ + "optimize", + "optimizeModulesBasic", + "optimizeChunksBasic", + "afterOptimizeTree", + "afterOptimizeAssets" + ].forEach(hook => { + compilation.hooks[hook].tap("TestCasesTest", () => + compilation.checkConstraints() + ); + }); + }); + }) + }; + it( + testName + " should compile", + done => { + const exportedTests = []; + webpack(options, (err, stats) => { + if (err) done(err); + const statOptions = Stats.presetToOptions("verbose"); + statOptions.colors = false; + mkdirp.sync(outputDirectory); + fs.writeFileSync( + path.join(outputDirectory, "stats.txt"), + stats.toString(statOptions), + "utf-8" + ); + const jsonStats = stats.toJson({ + errorDetails: true + }); + if ( + checkArrayExpectation( + testDirectory, + jsonStats, + "error", + "Error", + done + ) + ) + return; + if ( + checkArrayExpectation( + testDirectory, + jsonStats, + "warning", + "Warning", + done + ) + ) + return; + + function _it(title, fn) { + exportedTests.push({ title, fn, timeout: 10000 }); + } + + function _require(module) { + if (module.substr(0, 2) === "./") { + const p = path.join(outputDirectory, module); + const fn = vm.runInThisContext( + "(function(require, module, exports, __dirname, it, expect) {" + + "global.expect = expect;" + + fs.readFileSync(p, "utf-8") + + "\n})", + p + ); + const m = { + exports: {}, + webpackTestSuiteModule: true + }; + fn.call( + m.exports, + _require, + m, + m.exports, + outputDirectory, + _it, + expect + ); + return m.exports; + } else return require(module); + } + _require.webpackTestSuiteRequire = true; + _require("./bundle.js"); + if (exportedTests.length === 0) + return done(new Error("No tests exported by test case")); + + const asyncSuite = describe(`${config.name} ${ + category.name + } ${testName} exported tests`, () => { + exportedTests.forEach( + ({ title, fn, timeout }) => + fn + ? fit(title, fn, timeout) + : fit(title, () => {}).pend("Skipped") + ); + }); + // workaround for jest running clearSpies on the wrong suite (invoked by clearResourcesForRunnable) + asyncSuite.disabled = true; + + jasmine + .getEnv() + .execute([asyncSuite.id], asyncSuite) + .then(done, done); + }); + }, + 60000 + ); + }); + }); + }); + }); + }); +}; + +module.exports.describeCases = describeCases; diff --git a/test/TestCases.test.js b/test/TestCases.test.js deleted file mode 100644 index c286fabef61..00000000000 --- a/test/TestCases.test.js +++ /dev/null @@ -1,339 +0,0 @@ -/* global describe, it*/ -"use strict"; - -require("should"); -const path = require("path"); -const fs = require("fs"); -const vm = require("vm"); -const mkdirp = require("mkdirp"); -const Test = require("mocha/lib/test"); -const UglifyJsPlugin = require("uglifyjs-webpack-plugin"); -const checkArrayExpectation = require("./checkArrayExpectation"); - -const Stats = require("../lib/Stats"); -const webpack = require("../lib/webpack"); - -const uglifyJsForTesting = new UglifyJsPlugin({ - cache: false, - parallel: false, - sourceMap: true -}); - -const DEFAULT_OPTIMIZATIONS = { - removeAvailableModules: true, - removeEmptyChunks: true, - mergeDuplicateChunks: true, - flagIncludedChunks: true, - occurrenceOrder: true, - sideEffects: true, - providedExports: true, - usedExports: true, - noEmitOnErrors: false, - concatenateModules: false, - namedModules: false, - minimizer: [uglifyJsForTesting] -}; - -const NO_EMIT_ON_ERRORS_OPTIMIZATIONS = { - noEmitOnErrors: false, - minimizer: [uglifyJsForTesting] -}; - -describe("TestCases", () => { - const casesPath = path.join(__dirname, "cases"); - let categories = fs.readdirSync(casesPath); - categories = categories.map(cat => { - return { - name: cat, - tests: fs - .readdirSync(path.join(casesPath, cat)) - .filter(folder => folder.indexOf("_") < 0) - }; - }); - [ - { - name: "normal" - }, - { - name: "production", - mode: "production" - }, - { - name: "development", - mode: "development", - devtool: "none" - }, - { - name: "hot", - plugins: [new webpack.HotModuleReplacementPlugin()] - }, - { - name: "hot-multi-step", - plugins: [ - new webpack.HotModuleReplacementPlugin({ - multiStep: true - }) - ] - }, - { - name: "devtool-eval", - devtool: "eval" - }, - { - name: "devtool-eval-named-modules", - devtool: "eval", - plugins: [new webpack.NamedModulesPlugin()] - }, - { - name: "devtool-eval-source-map", - devtool: "#eval-source-map" - }, - { - name: "devtool-inline-source-map", - devtool: "inline-source-map" - }, - { - name: "devtool-source-map", - devtool: "#@source-map" - }, - { - name: "devtool-cheap-inline-source-map", - devtool: "cheap-inline-source-map" - }, - { - name: "devtool-cheap-eval-source-map", - devtool: "cheap-eval-source-map" - }, - { - name: "devtool-cheap-eval-module-source-map", - devtool: "cheap-eval-module-source-map" - }, - { - name: "devtool-cheap-source-map", - devtool: "cheap-source-map" - }, - { - name: "minimized-source-map", - mode: "production", - devtool: "eval-cheap-module-source-map", - minimize: true - }, - { - name: "minimized-hashed-modules", - mode: "production", - minimize: true, - plugins: [new webpack.HashedModuleIdsPlugin()] - }, - { - name: "all-combined", - mode: "production", - devtool: "#@source-map", - minimize: true, - plugins: [ - new webpack.HotModuleReplacementPlugin(), - new webpack.NamedModulesPlugin(), - new webpack.NamedChunksPlugin() - ] - } - ].forEach(config => { - describe(config.name, () => { - categories.forEach(category => { - describe(category.name, function() { - this.timeout(30000); - category.tests - .filter(test => { - const testDirectory = path.join(casesPath, category.name, test); - const filterPath = path.join(testDirectory, "test.filter.js"); - if (fs.existsSync(filterPath) && !require(filterPath)(config)) { - describe.skip(test, () => it("filtered")); - return false; - } - return true; - }) - .forEach(testName => { - const suite = describe(testName, () => {}); - it(testName + " should compile", done => { - const testDirectory = path.join( - casesPath, - category.name, - testName - ); - const outputDirectory = path.join( - __dirname, - "js", - config.name, - category.name, - testName - ); - const options = { - context: casesPath, - entry: "./" + category.name + "/" + testName + "/index", - target: "async-node", - devtool: config.devtool, - mode: config.mode || "none", - optimization: config.mode - ? NO_EMIT_ON_ERRORS_OPTIMIZATIONS - : Object.assign( - {}, - config.optimization, - DEFAULT_OPTIMIZATIONS - ), - performance: { - hints: false - }, - output: { - pathinfo: true, - path: outputDirectory, - filename: "bundle.js" - }, - resolve: { - modules: ["web_modules", "node_modules"], - mainFields: [ - "webpack", - "browser", - "web", - "browserify", - ["jam", "main"], - "main" - ], - aliasFields: ["browser"], - extensions: [ - ".mjs", - ".webpack.js", - ".web.js", - ".js", - ".json" - ], - concord: true - }, - resolveLoader: { - modules: [ - "web_loaders", - "web_modules", - "node_loaders", - "node_modules" - ], - mainFields: [ - "webpackLoader", - "webLoader", - "loader", - "main" - ], - extensions: [ - ".webpack-loader.js", - ".web-loader.js", - ".loader.js", - ".js" - ] - }, - module: { - rules: [ - { - test: /\.coffee$/, - loader: "coffee-loader" - }, - { - test: /\.jade$/, - loader: "jade-loader" - } - ] - }, - plugins: (config.plugins || []).concat(function() { - this.hooks.compilation.tap("TestCasesTest", compilation => { - [ - "optimize", - "optimizeModulesBasic", - "optimizeChunksBasic", - "afterOptimizeTree", - "afterOptimizeAssets" - ].forEach(hook => { - compilation.hooks[hook].tap("TestCasesTest", () => - compilation.checkConstraints() - ); - }); - }); - }) - }; - webpack(options, (err, stats) => { - if (err) return done(err); - const statOptions = Stats.presetToOptions("verbose"); - statOptions.colors = false; - mkdirp.sync(outputDirectory); - fs.writeFileSync( - path.join(outputDirectory, "stats.txt"), - stats.toString(statOptions), - "utf-8" - ); - const jsonStats = stats.toJson({ - errorDetails: true - }); - if ( - checkArrayExpectation( - testDirectory, - jsonStats, - "error", - "Error", - done - ) - ) - return; - if ( - checkArrayExpectation( - testDirectory, - jsonStats, - "warning", - "Warning", - done - ) - ) - return; - let exportedTest = 0; - - function _it(title, fn) { - const test = new Test(title, fn); - suite.addTest(test); - exportedTest++; - // WORKAROUND for a v8 bug - // Error objects retrain all scopes in the stacktrace - test._trace = test._trace.message; - - return test; - } - - function _require(module) { - if (module.substr(0, 2) === "./") { - const p = path.join(outputDirectory, module); - const fn = vm.runInThisContext( - "(function(require, module, exports, __dirname, it) {" + - fs.readFileSync(p, "utf-8") + - "\n})", - p - ); - const m = { - exports: {}, - webpackTestSuiteModule: true - }; - fn.call( - m.exports, - _require, - m, - m.exports, - outputDirectory, - _it - ); - return m.exports; - } else return require(module); - } - _require.webpackTestSuiteRequire = true; - _require("./bundle.js"); - if (exportedTest === 0) - return done(new Error("No tests exported by test case")); - done(); - }); - }); - }); - }); - }); - }); - }); -}); diff --git a/test/TestCasesAllCombined.test.js b/test/TestCasesAllCombined.test.js new file mode 100644 index 00000000000..e413ff2c257 --- /dev/null +++ b/test/TestCasesAllCombined.test.js @@ -0,0 +1,16 @@ +const { describeCases } = require("./TestCases.template"); +const webpack = require("../lib/webpack"); + +describe("TestCases", () => { + describeCases({ + name: "all-combined", + mode: "production", + devtool: "#@source-map", + minimize: true, + plugins: [ + new webpack.HotModuleReplacementPlugin(), + new webpack.NamedModulesPlugin(), + new webpack.NamedChunksPlugin() + ] + }); +}); diff --git a/test/TestCasesDevelopment.test.js b/test/TestCasesDevelopment.test.js new file mode 100644 index 00000000000..5d1ec312356 --- /dev/null +++ b/test/TestCasesDevelopment.test.js @@ -0,0 +1,9 @@ +const { describeCases } = require("./TestCases.template"); + +describe("TestCases", () => { + describeCases({ + name: "development", + mode: "development", + devtool: "none" + }); +}); diff --git a/test/TestCasesDevtoolCheapEvalModuleSourceMap.test.js b/test/TestCasesDevtoolCheapEvalModuleSourceMap.test.js new file mode 100644 index 00000000000..9a951ea0f1c --- /dev/null +++ b/test/TestCasesDevtoolCheapEvalModuleSourceMap.test.js @@ -0,0 +1,8 @@ +const { describeCases } = require("./TestCases.template"); + +describe("TestCases", () => { + describeCases({ + name: "devtool-cheap-eval-module-source-map", + devtool: "cheap-eval-module-source-map" + }); +}); diff --git a/test/TestCasesDevtoolCheapEvalSourceMap.test.js b/test/TestCasesDevtoolCheapEvalSourceMap.test.js new file mode 100644 index 00000000000..3bccf31af95 --- /dev/null +++ b/test/TestCasesDevtoolCheapEvalSourceMap.test.js @@ -0,0 +1,8 @@ +const { describeCases } = require("./TestCases.template"); + +describe("TestCases", () => { + describeCases({ + name: "devtool-cheap-eval-source-map", + devtool: "cheap-eval-source-map" + }); +}); diff --git a/test/TestCasesDevtoolCheapInlineSourceMap.test.js b/test/TestCasesDevtoolCheapInlineSourceMap.test.js new file mode 100644 index 00000000000..ce5a4151676 --- /dev/null +++ b/test/TestCasesDevtoolCheapInlineSourceMap.test.js @@ -0,0 +1,8 @@ +const { describeCases } = require("./TestCases.template"); + +describe("TestCases", () => { + describeCases({ + name: "devtool-cheap-inline-source-map", + devtool: "cheap-inline-source-map" + }); +}); diff --git a/test/TestCasesDevtoolCheapSourceMap.test.js b/test/TestCasesDevtoolCheapSourceMap.test.js new file mode 100644 index 00000000000..dd38edcab0b --- /dev/null +++ b/test/TestCasesDevtoolCheapSourceMap.test.js @@ -0,0 +1,8 @@ +const { describeCases } = require("./TestCases.template"); + +describe("TestCases", () => { + describeCases({ + name: "devtool-cheap-source-map", + devtool: "cheap-source-map" + }); +}); diff --git a/test/TestCasesDevtoolEval.test.js b/test/TestCasesDevtoolEval.test.js new file mode 100644 index 00000000000..d03f129781d --- /dev/null +++ b/test/TestCasesDevtoolEval.test.js @@ -0,0 +1,8 @@ +const { describeCases } = require("./TestCases.template"); + +describe("TestCases", () => { + describeCases({ + name: "devtool-eval", + devtool: "eval" + }); +}); diff --git a/test/TestCasesDevtoolEvalNamedModules.test.js b/test/TestCasesDevtoolEvalNamedModules.test.js new file mode 100644 index 00000000000..a3c1cd6997e --- /dev/null +++ b/test/TestCasesDevtoolEvalNamedModules.test.js @@ -0,0 +1,10 @@ +const { describeCases } = require("./TestCases.template"); +const webpack = require("../lib/webpack"); + +describe("TestCases", () => { + describeCases({ + name: "devtool-eval-named-modules", + devtool: "eval", + plugins: [new webpack.NamedModulesPlugin()] + }); +}); diff --git a/test/TestCasesDevtoolEvalSourceMap.test.js b/test/TestCasesDevtoolEvalSourceMap.test.js new file mode 100644 index 00000000000..bb68ab810cd --- /dev/null +++ b/test/TestCasesDevtoolEvalSourceMap.test.js @@ -0,0 +1,8 @@ +const { describeCases } = require("./TestCases.template"); + +describe("TestCases", () => { + describeCases({ + name: "devtool-eval-source-map", + devtool: "#eval-source-map" + }); +}); diff --git a/test/TestCasesDevtoolInlineSourceMap.test.js b/test/TestCasesDevtoolInlineSourceMap.test.js new file mode 100644 index 00000000000..de3dc71272c --- /dev/null +++ b/test/TestCasesDevtoolInlineSourceMap.test.js @@ -0,0 +1,8 @@ +const { describeCases } = require("./TestCases.template"); + +describe("TestCases", () => { + describeCases({ + name: "devtool-inline-source-map", + devtool: "inline-source-map" + }); +}); diff --git a/test/TestCasesDevtoolSourceMap.test.js b/test/TestCasesDevtoolSourceMap.test.js new file mode 100644 index 00000000000..b204305ea67 --- /dev/null +++ b/test/TestCasesDevtoolSourceMap.test.js @@ -0,0 +1,8 @@ +const { describeCases } = require("./TestCases.template"); + +describe("TestCases", () => { + describeCases({ + name: "devtool-source-map", + devtool: "#@source-map" + }); +}); diff --git a/test/TestCasesHot.test.js b/test/TestCasesHot.test.js new file mode 100644 index 00000000000..30c0f2f6c06 --- /dev/null +++ b/test/TestCasesHot.test.js @@ -0,0 +1,9 @@ +const { describeCases } = require("./TestCases.template"); +const webpack = require("../lib/webpack"); + +describe("TestCases", () => { + describeCases({ + name: "hot", + plugins: [new webpack.HotModuleReplacementPlugin()] + }); +}); diff --git a/test/TestCasesHotMultiStep.test.js b/test/TestCasesHotMultiStep.test.js new file mode 100644 index 00000000000..981c1b544c1 --- /dev/null +++ b/test/TestCasesHotMultiStep.test.js @@ -0,0 +1,13 @@ +const { describeCases } = require("./TestCases.template"); +const webpack = require("../lib/webpack"); + +describe("TestCases", () => { + describeCases({ + name: "hot-multi-step", + plugins: [ + new webpack.HotModuleReplacementPlugin({ + multiStep: true + }) + ] + }); +}); diff --git a/test/TestCasesMinimizedHashedModules.test.js b/test/TestCasesMinimizedHashedModules.test.js new file mode 100644 index 00000000000..b28e926b92f --- /dev/null +++ b/test/TestCasesMinimizedHashedModules.test.js @@ -0,0 +1,11 @@ +const { describeCases } = require("./TestCases.template"); +const webpack = require("../lib/webpack"); + +describe("TestCases", () => { + describeCases({ + name: "minimized-hashed-modules", + mode: "production", + minimize: true, + plugins: [new webpack.HashedModuleIdsPlugin()] + }); +}); diff --git a/test/TestCasesMinimizedSourceMap.test.js b/test/TestCasesMinimizedSourceMap.test.js new file mode 100644 index 00000000000..9ec3b57178b --- /dev/null +++ b/test/TestCasesMinimizedSourceMap.test.js @@ -0,0 +1,10 @@ +const { describeCases } = require("./TestCases.template"); + +describe("TestCases", () => { + describeCases({ + name: "minimized-source-map", + mode: "production", + devtool: "eval-cheap-module-source-map", + minimize: true + }); +}); diff --git a/test/TestCasesNormal.test.js b/test/TestCasesNormal.test.js new file mode 100644 index 00000000000..9d975ad2882 --- /dev/null +++ b/test/TestCasesNormal.test.js @@ -0,0 +1,7 @@ +const { describeCases } = require("./TestCases.template"); + +describe("TestCases", () => { + describeCases({ + name: "normal" + }); +}); diff --git a/test/TestCasesProduction.test.js b/test/TestCasesProduction.test.js new file mode 100644 index 00000000000..8708f34d2a4 --- /dev/null +++ b/test/TestCasesProduction.test.js @@ -0,0 +1,8 @@ +const { describeCases } = require("./TestCases.template"); + +describe("TestCases", () => { + describeCases({ + name: "production", + mode: "production" + }); +}); diff --git a/test/Validation.test.js b/test/Validation.test.js index b29e9f5e128..6f29d6a9ee5 100644 --- a/test/Validation.test.js +++ b/test/Validation.test.js @@ -1,8 +1,6 @@ /* globals describe, it */ "use strict"; -require("should"); - const webpack = require("../lib/webpack"); describe("Validation", () => { @@ -201,7 +199,7 @@ describe("Validation", () => { " - configuration has an unknown property 'postcss'. These properties are valid:", " object { mode?, amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry?, externals?, " + "loader?, module?, name?, node?, output?, optimization?, parallelism?, performance?, plugins?, profile?, recordsInputPath?, " + - "recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, stats?, target?, watch?, watchOptions? }", + "recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, serve?, stats?, target?, watch?, watchOptions? }", " For typos: please correct them.", " For loader options: webpack >= v2.0.0 no longer allows custom properties in configuration.", " Loaders should be updated to allow passing options via loader options in module.rules.", @@ -282,11 +280,10 @@ describe("Validation", () => { } }, test(err) { - err.message.should.startWith("Invalid configuration object."); - err.message - .split("\n") - .slice(1)[0] - .should.be.eql(" - configuration.stats should be one of these:"); + expect(err.message).toMatch(/^Invalid configuration object./); + expect(err.message.split("\n").slice(1)[0]).toBe( + " - configuration.stats should be one of these:" + ); } }, { @@ -393,11 +390,8 @@ describe("Validation", () => { return; } - err.message.should.startWith("Invalid configuration object."); - err.message - .split("\n") - .slice(1) - .should.be.eql(testCase.message); + expect(err.message).toMatch(/^Invalid configuration object./); + expect(err.message.split("\n").slice(1)).toEqual(testCase.message); return; } diff --git a/test/WatchDetection.test.js b/test/WatchDetection.test.js index f801a4d7ca1..590c56ef871 100644 --- a/test/WatchDetection.test.js +++ b/test/WatchDetection.test.js @@ -1,7 +1,6 @@ "use strict"; -/*globals describe it before after */ -require("should"); +/*globals describe it */ const path = require("path"); const fs = require("fs"); const MemoryFs = require("memory-fs"); @@ -10,20 +9,21 @@ const webpack = require("../"); describe("WatchDetection", () => { if (process.env.NO_WATCH_TESTS) { - it("long running tests excluded"); + it.skip("long running tests excluded", () => {}); return; } - for (let changeTimeout = 0; changeTimeout < 100; changeTimeout += 10) { + jest.setTimeout(10000); + + for (let changeTimeout = 10; changeTimeout < 100; changeTimeout += 10) { createTestCase(changeTimeout); } - for (let changeTimeout = 100; changeTimeout <= 2000; changeTimeout += 100) { + for (let changeTimeout = 200; changeTimeout <= 2000; changeTimeout += 200) { createTestCase(changeTimeout); } function createTestCase(changeTimeout) { - describe("time between changes " + changeTimeout + "ms", function() { - this.timeout(10000); + describe(`time between changes ${changeTimeout}ms`, () => { const fixturePath = path.join( __dirname, "fixtures", @@ -32,29 +32,41 @@ describe("WatchDetection", () => { const filePath = path.join(fixturePath, "file.js"); const file2Path = path.join(fixturePath, "file2.js"); const loaderPath = path.join(__dirname, "fixtures", "delay-loader.js"); - before(() => { + + beforeAll(() => { try { fs.mkdirSync(fixturePath); - } catch (e) {} // eslint-disable-line no-empty + } catch (e) { + // empty + } fs.writeFileSync(filePath, "require('./file2')", "utf-8"); fs.writeFileSync(file2Path, "original", "utf-8"); }); - after(done => { + + afterAll(done => { setTimeout(() => { try { fs.unlinkSync(filePath); - } catch (e) {} // eslint-disable-line no-empty + } catch (e) { + // empty + } try { fs.unlinkSync(file2Path); - } catch (e) {} // eslint-disable-line no-empty + } catch (e) { + // empty + } try { fs.rmdirSync(fixturePath); - } catch (e) {} // eslint-disable-line no-empty + } catch (e) { + // empty + } done(); }, 100); // cool down a bit }); + it("should build the bundle correctly", done => { const compiler = webpack({ + mode: "development", entry: loaderPath + "!" + filePath, output: { path: "/", @@ -130,7 +142,7 @@ describe("WatchDetection", () => { onChange = null; watcher.close(() => { - setTimeout(done, 1000); + setTimeout(done, 500); }); } diff --git a/test/WatchTestCases.test.js b/test/WatchTestCases.test.js index ea4a3c6f515..a1d957aacbc 100644 --- a/test/WatchTestCases.test.js +++ b/test/WatchTestCases.test.js @@ -1,17 +1,18 @@ +/* global beforeAll expect fit */ "use strict"; -require("should"); const path = require("path"); const fs = require("fs"); const vm = require("vm"); -const Test = require("mocha/lib/test"); const mkdirp = require("mkdirp"); +const rimraf = require("rimraf"); const checkArrayExpectation = require("./checkArrayExpectation"); +const { remove } = require("./helpers/remove"); const Stats = require("../lib/Stats"); const webpack = require("../lib/webpack"); -function copyDiff(src, dest) { +function copyDiff(src, dest, initial) { if (!fs.existsSync(dest)) fs.mkdirSync(dest); const files = fs.readdirSync(src); files.forEach(filename => { @@ -19,33 +20,29 @@ function copyDiff(src, dest) { const destFile = path.join(dest, filename); const directory = fs.statSync(srcFile).isDirectory(); if (directory) { - copyDiff(srcFile, destFile); + copyDiff(srcFile, destFile, initial); } else { var content = fs.readFileSync(srcFile); - if (/^DELETE\s*$/.test(content.toString("utf-8"))) + if (/^DELETE\s*$/.test(content.toString("utf-8"))) { fs.unlinkSync(destFile); - else fs.writeFileSync(destFile, content); - } - }); -} - -function remove(src) { - if (!fs.existsSync(src)) return; - const files = fs.readdirSync(src); - files.forEach(filename => { - const srcFile = path.join(src, filename); - const directory = fs.statSync(srcFile).isDirectory(); - if (directory) { - remove(srcFile); - } else { - fs.unlinkSync(srcFile); + } else { + fs.writeFileSync(destFile, content); + if (initial) { + const longTimeAgo = Date.now() - 1000 * 60 * 60 * 24; + fs.utimesSync( + destFile, + Date.now() - longTimeAgo, + Date.now() - longTimeAgo + ); + } + } } }); } describe("WatchTestCases", () => { if (process.env.NO_WATCH_TESTS) { - it("long running tests excluded"); + it.skip("long running tests excluded", () => {}); return; } @@ -58,17 +55,26 @@ describe("WatchTestCases", () => { tests: fs .readdirSync(path.join(casesPath, cat)) .filter(folder => folder.indexOf("_") < 0) + .filter(testName => { + const testDirectory = path.join(casesPath, cat, testName); + const filterPath = path.join(testDirectory, "test.filter.js"); + if (fs.existsSync(filterPath) && !require(filterPath)()) { + describe.skip(testName, () => it("filtered")); + return false; + } + return true; + }) .sort() }; }); - before(() => { + beforeAll(() => { let dest = path.join(__dirname, "js"); if (!fs.existsSync(dest)) fs.mkdirSync(dest); dest = path.join(__dirname, "js", "watch-src"); if (!fs.existsSync(dest)) fs.mkdirSync(dest); }); categories.forEach(category => { - before(() => { + beforeAll(() => { const dest = path.join(__dirname, "js", "watch-src", category.name); if (!fs.existsSync(dest)) fs.mkdirSync(dest); }); @@ -89,231 +95,264 @@ describe("WatchTestCases", () => { .filter(name => { return fs.statSync(path.join(testDirectory, name)).isDirectory(); }) - .map(name => { - return { - name: name, - suite: describe(name, () => {}) - }; - }); - before(() => remove(tempDirectory)); - it("should compile", function(done) { - this.timeout(45000); - const outputDirectory = path.join( - __dirname, - "js", - "watch", - category.name, - testName - ); - - let options = {}; - const configPath = path.join(testDirectory, "webpack.config.js"); - if (fs.existsSync(configPath)) options = require(configPath); - const applyConfig = options => { - if (!options.mode) options.mode = "development"; - if (!options.context) options.context = tempDirectory; - if (!options.entry) options.entry = "./index.js"; - if (!options.target) options.target = "async-node"; - if (!options.output) options.output = {}; - if (!options.output.path) options.output.path = outputDirectory; - if (typeof options.output.pathinfo === "undefined") - options.output.pathinfo = true; - if (!options.output.filename) - options.output.filename = "bundle.js"; - }; - if (Array.isArray(options)) { - options.forEach(applyConfig); - } else { - applyConfig(options); - } + .map(name => ({ name })); - const state = {}; - let runIdx = 0; - let waitMode = false; - let run = runs[runIdx]; - let triggeringFilename; - let lastHash = ""; - const currentWatchStepModule = require("./helpers/currentWatchStep"); - currentWatchStepModule.step = run.name; - copyDiff(path.join(testDirectory, run.name), tempDirectory); + beforeAll(done => { + rimraf(tempDirectory, done); + }); - setTimeout(() => { - const compiler = webpack(options); - compiler.hooks.invalid.tap( - "WatchTestCasesTest", - (filename, mtime) => { - triggeringFilename = filename; - } + it( + testName + " should compile", + done => { + const outputDirectory = path.join( + __dirname, + "js", + "watch", + category.name, + testName ); - const watching = compiler.watch( - { - aggregateTimeout: 1000 - }, - (err, stats) => { - if (err) return done(err); - if (!stats) - return done(new Error("No stats reported from Compiler")); - if (stats.hash === lastHash) return; - lastHash = stats.hash; - if (run.done && lastHash !== stats.hash) { - return done( - new Error( - "Compilation changed but no change was issued " + - lastHash + - " != " + - stats.hash + - " (run " + - runIdx + - ")\n" + - "Triggering change: " + - triggeringFilename - ) - ); + + let options = {}; + const configPath = path.join(testDirectory, "webpack.config.js"); + if (fs.existsSync(configPath)) options = require(configPath); + const applyConfig = options => { + if (!options.mode) options.mode = "development"; + if (!options.context) options.context = tempDirectory; + if (!options.entry) options.entry = "./index.js"; + if (!options.target) options.target = "async-node"; + if (!options.output) options.output = {}; + if (!options.output.path) options.output.path = outputDirectory; + if (typeof options.output.pathinfo === "undefined") + options.output.pathinfo = true; + if (!options.output.filename) + options.output.filename = "bundle.js"; + }; + if (Array.isArray(options)) { + options.forEach(applyConfig); + } else { + applyConfig(options); + } + + const state = {}; + let runIdx = 0; + let waitMode = false; + let run = runs[runIdx]; + let triggeringFilename; + let lastHash = ""; + const currentWatchStepModule = require("./helpers/currentWatchStep"); + currentWatchStepModule.step = run.name; + copyDiff(path.join(testDirectory, run.name), tempDirectory, true); + + setTimeout(() => { + const compiler = webpack(options); + compiler.hooks.invalid.tap( + "WatchTestCasesTest", + (filename, mtime) => { + triggeringFilename = filename; } - if (waitMode) return; - run.done = true; - if (err) return done(err); - const statOptions = Stats.presetToOptions("verbose"); - statOptions.colors = false; - mkdirp.sync(outputDirectory); - fs.writeFileSync( - path.join(outputDirectory, "stats.txt"), - stats.toString(statOptions), - "utf-8" - ); - const jsonStats = stats.toJson({ - errorDetails: true - }); - if ( - checkArrayExpectation( - path.join(testDirectory, run.name), - jsonStats, - "error", - "Error", - done + ); + const watching = compiler.watch( + { + aggregateTimeout: 1000 + }, + (err, stats) => { + if (err) return done(err); + if (!stats) + return done(new Error("No stats reported from Compiler")); + if (stats.hash === lastHash) return; + lastHash = stats.hash; + if (run.done && lastHash !== stats.hash) { + return done( + new Error( + "Compilation changed but no change was issued " + + lastHash + + " != " + + stats.hash + + " (run " + + runIdx + + ")\n" + + "Triggering change: " + + triggeringFilename + ) + ); + } + if (waitMode) return; + run.done = true; + if (err) return done(err); + const statOptions = Stats.presetToOptions("verbose"); + statOptions.colors = false; + mkdirp.sync(outputDirectory); + fs.writeFileSync( + path.join(outputDirectory, "stats.txt"), + stats.toString(statOptions), + "utf-8" + ); + const jsonStats = stats.toJson({ + errorDetails: true + }); + if ( + checkArrayExpectation( + path.join(testDirectory, run.name), + jsonStats, + "error", + "Error", + done + ) ) - ) - return; - if ( - checkArrayExpectation( - path.join(testDirectory, run.name), - jsonStats, - "warning", - "Warning", - done + return; + if ( + checkArrayExpectation( + path.join(testDirectory, run.name), + jsonStats, + "warning", + "Warning", + done + ) ) - ) - return; - let exportedTests = 0; + return; - function _it(title, fn) { - const test = new Test(title, fn); - run.suite.addTest(test); - exportedTests++; - return test; - } + const exportedTests = []; - const globalContext = { - console: console - }; + function _it(title, fn) { + exportedTests.push({ title, fn, timeout: 45000 }); + } - function _require(currentDirectory, module) { - if (Array.isArray(module) || /^\.\.?\//.test(module)) { - let fn; - let content; - let p; - if (Array.isArray(module)) { - p = path.join(currentDirectory, module[0]); - content = module - .map(arg => { - p = path.join(currentDirectory, arg); - return fs.readFileSync(p, "utf-8"); - }) - .join("\n"); - } else { - p = path.join(currentDirectory, module); - content = fs.readFileSync(p, "utf-8"); - } - if ( - options.target === "web" || - options.target === "webworker" - ) { - fn = vm.runInNewContext( - "(function(require, module, exports, __dirname, __filename, it, WATCH_STEP, STATS_JSON, STATE, window) {" + - content + - "\n})", - globalContext, - p - ); - } else { - fn = vm.runInThisContext( - "(function(require, module, exports, __dirname, __filename, it, WATCH_STEP, STATS_JSON, STATE) {" + - content + - "\n})", - p + const globalContext = { + console: console, + expect: expect + }; + + function _require(currentDirectory, module) { + if (Array.isArray(module) || /^\.\.?\//.test(module)) { + let fn; + let content; + let p; + if (Array.isArray(module)) { + p = path.join(currentDirectory, module[0]); + content = module + .map(arg => { + p = path.join(currentDirectory, arg); + return fs.readFileSync(p, "utf-8"); + }) + .join("\n"); + } else { + p = path.join(currentDirectory, module); + content = fs.readFileSync(p, "utf-8"); + } + if ( + options.target === "web" || + options.target === "webworker" + ) { + fn = vm.runInNewContext( + "(function(require, module, exports, __dirname, __filename, it, WATCH_STEP, STATS_JSON, STATE, expect, window) {" + + content + + "\n})", + globalContext, + p + ); + } else { + fn = vm.runInThisContext( + "(function(require, module, exports, __dirname, __filename, it, WATCH_STEP, STATS_JSON, STATE, expect) {" + + "global.expect = expect;" + + content + + "\n})", + p + ); + } + const m = { + exports: {} + }; + fn.call( + m.exports, + _require.bind(null, path.dirname(p)), + m, + m.exports, + path.dirname(p), + p, + _it, + run.name, + jsonStats, + state, + expect, + globalContext ); - } - const m = { - exports: {} - }; - fn.call( - m.exports, - _require.bind(null, path.dirname(p)), - m, - m.exports, - path.dirname(p), - p, - _it, - run.name, - jsonStats, - state, - globalContext - ); - return module.exports; - } else if ( - testConfig.modules && - module in testConfig.modules - ) { - return testConfig.modules[module]; - } else return require(module); - } + return module.exports; + } else if ( + testConfig.modules && + module in testConfig.modules + ) { + return testConfig.modules[module]; + } else return require.requireActual(module); + } - let testConfig = {}; - try { - // try to load a test file - testConfig = require(path.join( - testDirectory, - "test.config.js" - )); - } catch (e) {} // eslint-disable-line no-empty + let testConfig = {}; + try { + // try to load a test file + testConfig = require(path.join( + testDirectory, + "test.config.js" + )); + } catch (e) { + // empty + } - if (testConfig.noTests) return process.nextTick(done); - _require( - outputDirectory, - testConfig.bundlePath || "./bundle.js" - ); + if (testConfig.noTests) return process.nextTick(done); + _require( + outputDirectory, + testConfig.bundlePath || "./bundle.js" + ); - if (exportedTests < 1) - return done(new Error("No tests exported by test case")); - runIdx++; - if (runIdx < runs.length) { - run = runs[runIdx]; - waitMode = true; - setTimeout(() => { - waitMode = false; - currentWatchStepModule.step = run.name; - copyDiff( - path.join(testDirectory, run.name), - tempDirectory + if (exportedTests.length < 1) + return done(new Error("No tests exported by test case")); + + const continueStep = () => { + runIdx++; + if (runIdx < runs.length) { + run = runs[runIdx]; + waitMode = true; + setTimeout(() => { + waitMode = false; + currentWatchStepModule.step = run.name; + copyDiff( + path.join(testDirectory, run.name), + tempDirectory, + false + ); + }, 1500); + } else { + watching.close(); + + done(); + } + }; + + // Run the tests + const asyncSuite = describe(`WatchTestCases ${ + category.name + } ${testName} step ${run.name}`, () => { + exportedTests.forEach( + ({ title, fn, timeout }) => + fn + ? fit(title, fn, timeout) + : fit(title, () => {}).pend("Skipped") ); - }, 1500); - } else { - watching.close(); - process.nextTick(done); + }); + // workaround for jest running clearSpies on the wrong suite (invoked by clearResourcesForRunnable) + asyncSuite.disabled = true; + + jasmine + .getEnv() + .execute([asyncSuite.id], asyncSuite) + .then(continueStep, done); } - } - ); - }, 300); + ); + }, 300); + }, + 45000 + ); + + afterAll(() => { + remove(tempDirectory); }); }); }); diff --git a/test/WatcherEvents.test.js b/test/WatcherEvents.test.js index 6a74464d2b9..00fc41dbfe5 100644 --- a/test/WatcherEvents.test.js +++ b/test/WatcherEvents.test.js @@ -1,8 +1,7 @@ "use strict"; -/*globals describe it before after */ +/* globals describe it */ const path = require("path"); -require("should"); const MemoryFs = require("memory-fs"); const webpack = require("../"); @@ -28,20 +27,20 @@ const createMultiCompiler = () => { ]); }; -describe("WatcherEvents", function() { +describe("WatcherEvents", () => { if (process.env.NO_WATCH_TESTS) { - it("long running tests excluded"); + it.skip("long running tests excluded", () => {}); return; } - this.timeout(10000); + jest.setTimeout(10000); - it("should emit 'watch-close' when using single-compiler mode and the compiler is not running", function(done) { + it("should emit 'watch-close' when using single-compiler mode and the compiler is not running", done => { let called = false; const compiler = createSingleCompiler(); const watcher = compiler.watch({}, (err, stats) => { - called.should.be.exactly(true); + expect(called).toBe(true); done(err); }); @@ -54,12 +53,12 @@ describe("WatcherEvents", function() { }); }); - it("should emit 'watch-close' when using multi-compiler mode and the compiler is not running", function(done) { + it("should emit 'watch-close' when using multi-compiler mode and the compiler is not running", done => { let called = false; const compiler = createMultiCompiler(); const watcher = compiler.watch({}, (err, stats) => { - called.should.be.exactly(true); + expect(called).toBe(true); done(err); }); diff --git a/test/WebEnvironmentPlugin.unittest.js b/test/WebEnvironmentPlugin.unittest.js index ce1d87f4fc5..137956a0093 100644 --- a/test/WebEnvironmentPlugin.unittest.js +++ b/test/WebEnvironmentPlugin.unittest.js @@ -1,31 +1,23 @@ "use strict"; -const should = require("should"); const WebEnvironmentPlugin = require("../lib/web/WebEnvironmentPlugin"); describe("WebEnvironmentPlugin", () => { - let WebEnvironmentPluginInstance; - - before( - () => - (WebEnvironmentPluginInstance = new WebEnvironmentPlugin( - "inputFileSystem", - "outputFileSystem" - )) - ); - describe("apply", () => { - let compileSpy; - before(() => { - compileSpy = { - outputFileSystem: "otherOutputFileSystem" - }; - WebEnvironmentPluginInstance.apply(compileSpy); - }); + const WebEnvironmentPluginInstance = new WebEnvironmentPlugin( + "inputFileSystem", + "outputFileSystem" + ); + const compileSpy = { + outputFileSystem: "otherOutputFileSystem" + }; - it("should set compiler.outputFileSystem information with the same as set in WebEnvironmentPlugin", () => - should(compileSpy.outputFileSystem).be.eql( + WebEnvironmentPluginInstance.apply(compileSpy); + + it("should set compiler.outputFileSystem information with the same as set in WebEnvironmentPlugin", () => { + expect(compileSpy.outputFileSystem).toBe( WebEnvironmentPluginInstance.outputFileSystem - )); + ); + }); }); }); diff --git a/test/WebpackError.unittest.js b/test/WebpackError.unittest.js index f52692e4bda..cbf90fab499 100644 --- a/test/WebpackError.unittest.js +++ b/test/WebpackError.unittest.js @@ -1,8 +1,8 @@ "use strict"; +const path = require("path"); const util = require("util"); -require("should"); const WebpackError = require("../lib/WebpackError"); describe("WebpackError", () => { @@ -18,12 +18,12 @@ describe("WebpackError", () => { } } - it("Should provide inspect method for use by for util.inspect", function() { + it("Should provide inspect method for use by for util.inspect", () => { const errorStr = util.inspect(new CustomError("Message")); const errorArr = errorStr.split("\n"); - errorArr[0].should.equal("CustomError: CustomMessage"); - errorArr[1].should.containEql("WebpackError.unittest.js"); - errorArr[errorArr.length - 1].should.equal("CustomDetails"); + expect(errorArr[0]).toBe("CustomError: CustomMessage"); + expect(errorArr[1]).toMatch(path.basename(__filename)); + expect(errorArr[errorArr.length - 1]).toBe("CustomDetails"); }); }); diff --git a/test/WebpackMissingModule.unittest.js b/test/WebpackMissingModule.unittest.js index c08f978dae7..73ea0a790c8 100644 --- a/test/WebpackMissingModule.unittest.js +++ b/test/WebpackMissingModule.unittest.js @@ -1,15 +1,14 @@ /* globals describe, it */ "use strict"; -const should = require("should"); const WebpackMissingModule = require("../lib/dependencies/WebpackMissingModule"); describe("WebpackMissingModule", () => { describe("#moduleCode", () => { it("returns an error message based on given error message", () => { const errorMessage = WebpackMissingModule.moduleCode("mock message"); - should(errorMessage).be.eql( - 'var e = new Error("Cannot find module \\"mock message\\""); e.code = \'MODULE_NOT_FOUND\'; throw e;' + expect(errorMessage).toBe( + "var e = new Error(\"Cannot find module 'mock message'\"); e.code = 'MODULE_NOT_FOUND'; throw e;" ); }); }); @@ -17,8 +16,8 @@ describe("WebpackMissingModule", () => { describe("#promise", () => { it("returns an error message based on given error message", () => { const errorMessage = WebpackMissingModule.promise("mock message"); - should(errorMessage).be.eql( - 'Promise.reject(function webpackMissingModule() { var e = new Error("Cannot find module \\"mock message\\""); e.code = \'MODULE_NOT_FOUND\'; return e; }())' + expect(errorMessage).toBe( + "Promise.reject(function webpackMissingModule() { var e = new Error(\"Cannot find module 'mock message'\"); e.code = 'MODULE_NOT_FOUND'; return e; }())" ); }); }); @@ -26,8 +25,8 @@ describe("WebpackMissingModule", () => { describe("#module", () => { it("returns an error message based on given error message", () => { const errorMessage = WebpackMissingModule.module("mock message"); - should(errorMessage).be.eql( - '!(function webpackMissingModule() { var e = new Error("Cannot find module \\"mock message\\""); e.code = \'MODULE_NOT_FOUND\'; throw e; }())' + expect(errorMessage).toBe( + "!(function webpackMissingModule() { var e = new Error(\"Cannot find module 'mock message'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())" ); }); }); diff --git a/test/__snapshots__/ConfigTestCases.test.js.snap b/test/__snapshots__/ConfigTestCases.test.js.snap new file mode 100644 index 00000000000..0dab29d9c95 --- /dev/null +++ b/test/__snapshots__/ConfigTestCases.test.js.snap @@ -0,0 +1,61 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`ConfigTestCases records issue-2991 exported tests should write relative paths to records 1`] = ` +"{ + \\"modules\\": { + \\"byIdentifier\\": { + \\"external \\\\\\"path\\\\\\"\\": 0, + \\"external \\\\\\"fs\\\\\\"\\": 1, + \\"ignored pkgs/somepackage/foo\\": 2, + \\"test.js\\": 3 + }, + \\"usedIds\\": { + \\"0\\": 0, + \\"1\\": 1, + \\"2\\": 2, + \\"3\\": 3 + } + }, + \\"chunks\\": { + \\"byName\\": { + \\"main\\": 0 + }, + \\"bySource\\": {}, + \\"usedIds\\": [ + 0 + ] + } +}" +`; + +exports[`ConfigTestCases records issue-7339 exported tests should write relative dynamic-require paths to records 1`] = ` +"{ + \\"modules\\": { + \\"byIdentifier\\": { + \\"dependencies/foo.js\\": 0, + \\"dependencies/bar.js\\": 1, + \\"external \\\\\\"path\\\\\\"\\": 2, + \\"external \\\\\\"fs\\\\\\"\\": 3, + \\"dependencies sync /^\\\\\\\\.\\\\\\\\/.*$/\\": 4, + \\"test.js\\": 5 + }, + \\"usedIds\\": { + \\"0\\": 0, + \\"1\\": 1, + \\"2\\": 2, + \\"3\\": 3, + \\"4\\": 4, + \\"5\\": 5 + } + }, + \\"chunks\\": { + \\"byName\\": { + \\"main\\": 0 + }, + \\"bySource\\": {}, + \\"usedIds\\": [ + 0 + ] + } +}" +`; diff --git a/test/__snapshots__/RemovedPlugins.unittest.js.snap b/test/__snapshots__/RemovedPlugins.unittest.js.snap new file mode 100644 index 00000000000..ecac2f61a2a --- /dev/null +++ b/test/__snapshots__/RemovedPlugins.unittest.js.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`removed plugin errors should error when accessing removed plugins 1`] = `"webpack.optimize.UglifyJsPlugin has been removed, please use config.optimization.minimize instead."`; + +exports[`removed plugin errors should error when accessing removed plugins 2`] = `"webpack.optimize.CommonsChunkPlugin has been removed, please use config.optimization.splitChunks instead."`; diff --git a/test/__snapshots__/StatsTestCases.test.js.snap b/test/__snapshots__/StatsTestCases.test.js.snap new file mode 100644 index 00000000000..1fe3e735870 --- /dev/null +++ b/test/__snapshots__/StatsTestCases.test.js.snap @@ -0,0 +1,2742 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`StatsTestCases should print correct stats for aggressive-splitting-entry 1`] = ` +"Hash: 4aa5beb3bbe987f505a74aa5beb3bbe987f505a7 +Child fitting: + Hash: 4aa5beb3bbe987f505a7 + Time: Xms + Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + 9ac13fb7087e9ff1b93e.js 1.05 KiB 0 [emitted] + 2b4c8b62a524452d2de1.js 11.1 KiB 1 [emitted] + d1ba53816ff760e185b0.js 1.94 KiB 2 [emitted] + 7b5b0a943e9362bc88c6.js 1.94 KiB 3 [emitted] + Entrypoint main = d1ba53816ff760e185b0.js 7b5b0a943e9362bc88c6.js 2b4c8b62a524452d2de1.js + chunk {0} 9ac13fb7087e9ff1b93e.js 916 bytes <{1}> <{2}> <{3}> + > ./g [4] ./index.js 7:0-13 + [7] ./g.js 916 bytes {0} [built] + chunk {1} 2b4c8b62a524452d2de1.js 1.87 KiB ={2}= ={3}= >{0}< [entry] [rendered] + > ./index main + [3] ./e.js 899 bytes {1} [built] + [4] ./index.js 111 bytes {1} [built] + [6] ./f.js 900 bytes {1} [built] + chunk {2} d1ba53816ff760e185b0.js 1.76 KiB ={1}= ={3}= >{0}< [initial] [rendered] [recorded] aggressive splitted + > ./index main + [0] ./b.js 899 bytes {2} [built] + [5] ./a.js 899 bytes {2} [built] + chunk {3} 7b5b0a943e9362bc88c6.js 1.76 KiB ={1}= ={2}= >{0}< [initial] [rendered] [recorded] aggressive splitted + > ./index main + [1] ./c.js 899 bytes {3} [built] + [2] ./d.js 899 bytes {3} [built] +Child content-change: + Hash: 4aa5beb3bbe987f505a7 + Time: Xms + Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + 9ac13fb7087e9ff1b93e.js 1.05 KiB 0 [emitted] + 2b4c8b62a524452d2de1.js 11.1 KiB 1 [emitted] + d1ba53816ff760e185b0.js 1.94 KiB 2 [emitted] + 7b5b0a943e9362bc88c6.js 1.94 KiB 3 [emitted] + Entrypoint main = d1ba53816ff760e185b0.js 7b5b0a943e9362bc88c6.js 2b4c8b62a524452d2de1.js + chunk {0} 9ac13fb7087e9ff1b93e.js 916 bytes <{1}> <{2}> <{3}> + > ./g [4] ./index.js 7:0-13 + [7] ./g.js 916 bytes {0} [built] + chunk {1} 2b4c8b62a524452d2de1.js 1.87 KiB ={2}= ={3}= >{0}< [entry] [rendered] + > ./index main + [3] ./e.js 899 bytes {1} [built] + [4] ./index.js 111 bytes {1} [built] + [6] ./f.js 900 bytes {1} [built] + chunk {2} d1ba53816ff760e185b0.js 1.76 KiB ={1}= ={3}= >{0}< [initial] [rendered] [recorded] aggressive splitted + > ./index main + [0] ./b.js 899 bytes {2} [built] + [5] ./a.js 899 bytes {2} [built] + chunk {3} 7b5b0a943e9362bc88c6.js 1.76 KiB ={1}= ={2}= >{0}< [initial] [rendered] [recorded] aggressive splitted + > ./index main + [1] ./c.js 899 bytes {3} [built] + [2] ./d.js 899 bytes {3} [built]" +`; + +exports[`StatsTestCases should print correct stats for aggressive-splitting-on-demand 1`] = ` +"Hash: 2e21ab9d4836a0caedb1 +Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names +cf8697fa2c994f39a5d4.js 1.94 KiB 6, 7 [emitted] +fd868baa40dab4fc30fd.js 1.93 KiB 0 [emitted] +79c527bb5bf9cba1dc12.js 1.96 KiB 2 [emitted] +e9d82e81fefd7353e8df.js 1.94 KiB 3, 1 [emitted] +ae76098eeb55b9c448f2.js 1.01 KiB 4 [emitted] +05d92aaacfbffa4b7e56.js 1.94 KiB 5 [emitted] +d6418937dfae4b3ee922.js 1 KiB 1 [emitted] +685acdc95ff4af957f47.js 1 KiB 7 [emitted] +606f48c13070850338b1.js 1.94 KiB 8 [emitted] +c5a8eae840969538f450.js 1.94 KiB 9 [emitted] +7bf22146f3e40919bde5.js 9.7 KiB 10 [emitted] main +fcdf398c8972e4dcf788.js 1.94 KiB 11 [emitted] +Entrypoint main = 7bf22146f3e40919bde5.js +chunk {0} fd868baa40dab4fc30fd.js 1.76 KiB <{10}> ={1}= ={2}= ={3}= ={7}= ={9}= [recorded] aggressive splitted + > ./b ./d ./e ./f ./g [11] ./index.js 5:0-44 + > ./b ./d ./e ./f ./g ./h ./i ./j ./k [11] ./index.js 6:0-72 + [0] ./b.js 899 bytes {0} {5} [built] + [1] ./d.js 899 bytes {0} {8} [built] +chunk {1} d6418937dfae4b3ee922.js 899 bytes <{10}> ={0}= ={2}= ={8}= + > ./c ./d ./e [11] ./index.js 3:0-30 + > ./b ./d ./e ./f ./g [11] ./index.js 5:0-44 + [2] ./e.js 899 bytes {1} {3} [built] +chunk {2} 79c527bb5bf9cba1dc12.js 1.76 KiB <{10}> ={0}= ={1}= ={11}= ={3}= ={6}= ={7}= ={9}= [recorded] aggressive splitted + > ./f ./g ./h ./i ./j ./k [11] ./index.js 4:0-51 + > ./b ./d ./e ./f ./g [11] ./index.js 5:0-44 + > ./b ./d ./e ./f ./g ./h ./i ./j ./k [11] ./index.js 6:0-72 + [3] ./f.js 899 bytes {2} [built] + [4] ./g.js 901 bytes {2} [built] +chunk {3} e9d82e81fefd7353e8df.js 1.76 KiB <{10}> ={0}= ={2}= ={7}= ={9}= [rendered] [recorded] aggressive splitted + > ./b ./d ./e ./f ./g ./h ./i ./j ./k [11] ./index.js 6:0-72 + [2] ./e.js 899 bytes {1} {3} [built] + [6] ./h.js 899 bytes {3} {11} [built] +chunk {4} ae76098eeb55b9c448f2.js 899 bytes <{10}> + > ./a [11] ./index.js 1:0-16 + [10] ./a.js 899 bytes {4} [built] +chunk {5} 05d92aaacfbffa4b7e56.js 1.76 KiB <{10}> + > ./b ./c [11] ./index.js 2:0-23 + [0] ./b.js 899 bytes {0} {5} [built] + [5] ./c.js 899 bytes {5} {8} [built] +chunk {6} cf8697fa2c994f39a5d4.js 1.76 KiB <{10}> ={11}= ={2}= + > ./f ./g ./h ./i ./j ./k [11] ./index.js 4:0-51 + [8] ./j.js 901 bytes {6} {9} [built] + [9] ./k.js 899 bytes {6} {7} [built] +chunk {7} 685acdc95ff4af957f47.js 899 bytes <{10}> ={0}= ={2}= ={3}= ={9}= + > ./b ./d ./e ./f ./g ./h ./i ./j ./k [11] ./index.js 6:0-72 + [9] ./k.js 899 bytes {6} {7} [built] +chunk {8} 606f48c13070850338b1.js 1.76 KiB <{10}> ={1}= [recorded] aggressive splitted + > ./c ./d ./e [11] ./index.js 3:0-30 + [1] ./d.js 899 bytes {0} {8} [built] + [5] ./c.js 899 bytes {5} {8} [built] +chunk {9} c5a8eae840969538f450.js 1.76 KiB <{10}> ={0}= ={2}= ={3}= ={7}= [rendered] [recorded] aggressive splitted + > ./b ./d ./e ./f ./g ./h ./i ./j ./k [11] ./index.js 6:0-72 + [7] ./i.js 899 bytes {9} {11} [built] + [8] ./j.js 901 bytes {6} {9} [built] +chunk {10} 7bf22146f3e40919bde5.js (main) 248 bytes >{0}< >{1}< >{11}< >{2}< >{3}< >{4}< >{5}< >{6}< >{7}< >{8}< >{9}< [entry] [rendered] + > ./index main + [11] ./index.js 248 bytes {10} [built] +chunk {11} fcdf398c8972e4dcf788.js 1.76 KiB <{10}> ={2}= ={6}= [rendered] [recorded] aggressive splitted + > ./f ./g ./h ./i ./j ./k [11] ./index.js 4:0-51 + [6] ./h.js 899 bytes {3} {11} [built] + [7] ./i.js 899 bytes {9} {11} [built]" +`; + +exports[`StatsTestCases should print correct stats for async-commons-chunk 1`] = ` +"Entrypoint main = main.js +chunk {0} 0.js 21 bytes <{3}> ={1}= ={2}= [rendered] reused as split chunk (cache group: default) + > [3] ./index.js 17:1-21:3 + > [3] ./index.js 2:1-5:3 + > ./a ./b [3] ./index.js 9:1-13:3 + [0] ./a.js 21 bytes {0} [built] +chunk {1} 1.js 21 bytes <{3}> ={0}= [rendered] + > ./a ./b [3] ./index.js 9:1-13:3 + [1] ./b.js 21 bytes {1} [built] +chunk {2} 2.js 21 bytes <{3}> ={0}= [rendered] + > [3] ./index.js 17:1-21:3 + [2] ./c.js 21 bytes {2} [built] +chunk {3} main.js (main) 515 bytes >{0}< >{1}< >{2}< [entry] [rendered] + > ./ main + [3] ./index.js 515 bytes {3} [built]" +`; + +exports[`StatsTestCases should print correct stats for async-commons-chunk-auto 1`] = ` +"Child disabled: + Entrypoint main = disabled/main.js + Entrypoint a = disabled/a.js + Entrypoint b = disabled/b.js + Entrypoint c = disabled/c.js + chunk {0} disabled/async-g.js (async-g) 54 bytes <{1}> <{5}> [rendered] + > ./g [] 6:0-47 + > ./g [] 6:0-47 + [2] ./f.js 20 bytes {0} {2} {3} {6} {7} [built] + [8] ./g.js 34 bytes {0} [built] + chunk {1} disabled/async-a.js (async-a) 216 bytes <{4}> >{0}< [rendered] + > ./a [7] ./index.js 1:0-47 + [0] ./d.js 20 bytes {1} {2} {3} {5} {6} {7} [built] + [1] ./node_modules/x.js 20 bytes {1} {2} {3} {5} {6} {7} [built] + [3] ./node_modules/y.js 20 bytes {1} {2} {5} {6} [built] + [5] ./a.js + 1 modules 156 bytes {1} {5} [built] + | ./a.js 121 bytes [built] + | ./e.js 20 bytes [built] + chunk {2} disabled/async-b.js (async-b) 152 bytes <{4}> [rendered] + > ./b [7] ./index.js 2:0-47 + [0] ./d.js 20 bytes {1} {2} {3} {5} {6} {7} [built] + [1] ./node_modules/x.js 20 bytes {1} {2} {3} {5} {6} {7} [built] + [2] ./f.js 20 bytes {0} {2} {3} {6} {7} [built] + [3] ./node_modules/y.js 20 bytes {1} {2} {5} {6} [built] + [4] ./b.js 72 bytes {2} {6} [built] + chunk {3} disabled/async-c.js (async-c) 167 bytes <{4}> [rendered] + > ./c [7] ./index.js 3:0-47 + [0] ./d.js 20 bytes {1} {2} {3} {5} {6} {7} [built] + [1] ./node_modules/x.js 20 bytes {1} {2} {3} {5} {6} {7} [built] + [2] ./f.js 20 bytes {0} {2} {3} {6} {7} [built] + [6] ./c.js + 1 modules 107 bytes {3} {7} [built] + | ./c.js 72 bytes [built] + | ./node_modules/z.js 20 bytes [built] + chunk {4} disabled/main.js (main) 147 bytes >{1}< >{2}< >{3}< [entry] [rendered] + > ./ main + [7] ./index.js 147 bytes {4} [built] + chunk {5} disabled/a.js (a) 216 bytes >{0}< [entry] [rendered] + > ./a a + [0] ./d.js 20 bytes {1} {2} {3} {5} {6} {7} [built] + [1] ./node_modules/x.js 20 bytes {1} {2} {3} {5} {6} {7} [built] + [3] ./node_modules/y.js 20 bytes {1} {2} {5} {6} [built] + [5] ./a.js + 1 modules 156 bytes {1} {5} [built] + | ./a.js 121 bytes [built] + | ./e.js 20 bytes [built] + chunk {6} disabled/b.js (b) 152 bytes [entry] [rendered] + > ./b b + [0] ./d.js 20 bytes {1} {2} {3} {5} {6} {7} [built] + [1] ./node_modules/x.js 20 bytes {1} {2} {3} {5} {6} {7} [built] + [2] ./f.js 20 bytes {0} {2} {3} {6} {7} [built] + [3] ./node_modules/y.js 20 bytes {1} {2} {5} {6} [built] + [4] ./b.js 72 bytes {2} {6} [built] + chunk {7} disabled/c.js (c) 167 bytes [entry] [rendered] + > ./c c + [0] ./d.js 20 bytes {1} {2} {3} {5} {6} {7} [built] + [1] ./node_modules/x.js 20 bytes {1} {2} {3} {5} {6} {7} [built] + [2] ./f.js 20 bytes {0} {2} {3} {6} {7} [built] + [6] ./c.js + 1 modules 107 bytes {3} {7} [built] + | ./c.js 72 bytes [built] + | ./node_modules/z.js 20 bytes [built] +Child default: + Entrypoint main = default/main.js + Entrypoint a = default/a.js + Entrypoint b = default/b.js + Entrypoint c = default/c.js + chunk {0} default/vendors~async-a~async-b~async-c.js (vendors~async-a~async-b~async-c) 20 bytes <{9}> ={1}= ={2}= ={3}= ={5}= ={6}= ={7}= ={8}= >{2}< >{4}< [rendered] split chunk (cache group: vendors) (name: vendors~async-a~async-b~async-c) + > ./a [8] ./index.js 1:0-47 + > ./b [8] ./index.js 2:0-47 + > ./c [8] ./index.js 3:0-47 + [1] ./node_modules/x.js 20 bytes {0} {10} {11} {12} [built] + chunk {1} default/async-a~async-b~async-c.js (async-a~async-b~async-c) 20 bytes <{9}> ={0}= ={2}= ={3}= ={5}= ={6}= ={7}= ={8}= >{2}< >{4}< [rendered] split chunk (cache group: default) (name: async-a~async-b~async-c) + > ./a [8] ./index.js 1:0-47 + > ./b [8] ./index.js 2:0-47 + > ./c [8] ./index.js 3:0-47 + [0] ./d.js 20 bytes {1} {10} {11} {12} [built] + chunk {2} default/async-b~async-c~async-g.js (async-b~async-c~async-g) 20 bytes <{0}> <{1}> <{10}> <{3}> <{5}> <{9}> ={0}= ={1}= ={3}= ={4}= ={6}= ={7}= ={8}= [rendered] split chunk (cache group: default) (name: async-b~async-c~async-g) + > ./g [] 6:0-47 + > ./g [] 6:0-47 + > ./b [8] ./index.js 2:0-47 + > ./c [8] ./index.js 3:0-47 + [2] ./f.js 20 bytes {2} {11} {12} [built] + chunk {3} default/vendors~async-a~async-b.js (vendors~async-a~async-b) 20 bytes <{9}> ={0}= ={1}= ={2}= ={5}= ={6}= >{2}< >{4}< [rendered] split chunk (cache group: vendors) (name: vendors~async-a~async-b) + > ./a [8] ./index.js 1:0-47 + > ./b [8] ./index.js 2:0-47 + [3] ./node_modules/y.js 20 bytes {3} {10} {11} [built] + chunk {4} default/async-g.js (async-g) 34 bytes <{0}> <{1}> <{10}> <{3}> <{5}> ={2}= [rendered] + > ./g [] 6:0-47 + > ./g [] 6:0-47 + [9] ./g.js 34 bytes {4} [built] + chunk {5} default/async-a.js (async-a) 156 bytes <{9}> ={0}= ={1}= ={3}= >{2}< >{4}< [rendered] + > ./a [8] ./index.js 1:0-47 + [7] ./a.js + 1 modules 156 bytes {5} {10} [built] + | ./a.js 121 bytes [built] + | ./e.js 20 bytes [built] + chunk {6} default/async-b.js (async-b) 72 bytes <{9}> ={0}= ={1}= ={2}= ={3}= [rendered] + > ./b [8] ./index.js 2:0-47 + [5] ./b.js 72 bytes {6} {11} [built] + chunk {7} default/async-c.js (async-c) 72 bytes <{9}> ={0}= ={1}= ={2}= ={8}= [rendered] + > ./c [8] ./index.js 3:0-47 + [6] ./c.js 72 bytes {7} {12} [built] + chunk {8} default/vendors~async-c.js (vendors~async-c) 20 bytes <{9}> ={0}= ={1}= ={2}= ={7}= [rendered] split chunk (cache group: vendors) (name: vendors~async-c) + > ./c [8] ./index.js 3:0-47 + [4] ./node_modules/z.js 20 bytes {8} {12} [built] + chunk {9} default/main.js (main) 147 bytes >{0}< >{1}< >{2}< >{3}< >{5}< >{6}< >{7}< >{8}< [entry] [rendered] + > ./ main + [8] ./index.js 147 bytes {9} [built] + chunk {10} default/a.js (a) 216 bytes >{2}< >{4}< [entry] [rendered] + > ./a a + [0] ./d.js 20 bytes {1} {10} {11} {12} [built] + [1] ./node_modules/x.js 20 bytes {0} {10} {11} {12} [built] + [3] ./node_modules/y.js 20 bytes {3} {10} {11} [built] + [7] ./a.js + 1 modules 156 bytes {5} {10} [built] + | ./a.js 121 bytes [built] + | ./e.js 20 bytes [built] + chunk {11} default/b.js (b) 152 bytes [entry] [rendered] + > ./b b + [0] ./d.js 20 bytes {1} {10} {11} {12} [built] + [1] ./node_modules/x.js 20 bytes {0} {10} {11} {12} [built] + [2] ./f.js 20 bytes {2} {11} {12} [built] + [3] ./node_modules/y.js 20 bytes {3} {10} {11} [built] + [5] ./b.js 72 bytes {6} {11} [built] + chunk {12} default/c.js (c) 152 bytes [entry] [rendered] + > ./c c + [0] ./d.js 20 bytes {1} {10} {11} {12} [built] + [1] ./node_modules/x.js 20 bytes {0} {10} {11} {12} [built] + [2] ./f.js 20 bytes {2} {11} {12} [built] + [4] ./node_modules/z.js 20 bytes {8} {12} [built] + [6] ./c.js 72 bytes {7} {12} [built] +Child vendors: + Entrypoint main = vendors/main.js + Entrypoint a = vendors/vendors.js vendors/a.js + Entrypoint b = vendors/vendors.js vendors/b.js + Entrypoint c = vendors/vendors.js vendors/c.js + chunk {0} vendors/async-g.js (async-g) 54 bytes <{1}> <{4}> <{6}> [rendered] + > ./g [] 6:0-47 + > ./g [] 6:0-47 + [2] ./f.js 20 bytes {0} {2} {3} {7} {8} [built] + [9] ./g.js 34 bytes {0} [built] + chunk {1} vendors/async-a.js (async-a) 216 bytes <{5}> >{0}< [rendered] + > ./a [8] ./index.js 1:0-47 + [0] ./d.js 20 bytes {1} {2} {3} {6} {7} {8} [built] + [1] ./node_modules/x.js 20 bytes {1} {2} {3} {4} [built] + [3] ./node_modules/y.js 20 bytes {1} {2} {4} [built] + [7] ./a.js + 1 modules 156 bytes {1} {6} [built] + | ./a.js 121 bytes [built] + | ./e.js 20 bytes [built] + chunk {2} vendors/async-b.js (async-b) 152 bytes <{5}> [rendered] + > ./b [8] ./index.js 2:0-47 + [0] ./d.js 20 bytes {1} {2} {3} {6} {7} {8} [built] + [1] ./node_modules/x.js 20 bytes {1} {2} {3} {4} [built] + [2] ./f.js 20 bytes {0} {2} {3} {7} {8} [built] + [3] ./node_modules/y.js 20 bytes {1} {2} {4} [built] + [5] ./b.js 72 bytes {2} {7} [built] + chunk {3} vendors/async-c.js (async-c) 152 bytes <{5}> [rendered] + > ./c [8] ./index.js 3:0-47 + [0] ./d.js 20 bytes {1} {2} {3} {6} {7} {8} [built] + [1] ./node_modules/x.js 20 bytes {1} {2} {3} {4} [built] + [2] ./f.js 20 bytes {0} {2} {3} {7} {8} [built] + [4] ./node_modules/z.js 20 bytes {3} {4} [built] + [6] ./c.js 72 bytes {3} {8} [built] + chunk {4} vendors/vendors.js (vendors) 60 bytes ={6}= ={7}= ={8}= >{0}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors) + > ./a a + > ./b b + > ./c c + [1] ./node_modules/x.js 20 bytes {1} {2} {3} {4} [built] + [3] ./node_modules/y.js 20 bytes {1} {2} {4} [built] + [4] ./node_modules/z.js 20 bytes {3} {4} [built] + chunk {5} vendors/main.js (main) 147 bytes >{1}< >{2}< >{3}< [entry] [rendered] + > ./ main + [8] ./index.js 147 bytes {5} [built] + chunk {6} vendors/a.js (a) 176 bytes ={4}= >{0}< [entry] [rendered] + > ./a a + [0] ./d.js 20 bytes {1} {2} {3} {6} {7} {8} [built] + [7] ./a.js + 1 modules 156 bytes {1} {6} [built] + | ./a.js 121 bytes [built] + | ./e.js 20 bytes [built] + chunk {7} vendors/b.js (b) 112 bytes ={4}= [entry] [rendered] + > ./b b + [0] ./d.js 20 bytes {1} {2} {3} {6} {7} {8} [built] + [2] ./f.js 20 bytes {0} {2} {3} {7} {8} [built] + [5] ./b.js 72 bytes {2} {7} [built] + chunk {8} vendors/c.js (c) 112 bytes ={4}= [entry] [rendered] + > ./c c + [0] ./d.js 20 bytes {1} {2} {3} {6} {7} {8} [built] + [2] ./f.js 20 bytes {0} {2} {3} {7} {8} [built] + [6] ./c.js 72 bytes {3} {8} [built] +Child multiple-vendors: + Entrypoint main = multiple-vendors/main.js + Entrypoint a = multiple-vendors/libs-x.js multiple-vendors/vendors~a~async-a~async-b~b.js multiple-vendors/a.js + Entrypoint b = multiple-vendors/libs-x.js multiple-vendors/vendors~a~async-a~async-b~b.js multiple-vendors/b.js + Entrypoint c = multiple-vendors/libs-x.js multiple-vendors/vendors~async-c~c.js multiple-vendors/c.js + chunk {0} multiple-vendors/libs-x.js (libs-x) 20 bytes <{9}> ={1}= ={10}= ={11}= ={12}= ={2}= ={3}= ={4}= ={6}= ={7}= ={8}= >{2}< >{5}< [initial] [rendered] split chunk (cache group: libs) (name: libs-x) + > ./a a + > ./b b + > ./c c + > ./a [8] ./index.js 1:0-47 + > ./b [8] ./index.js 2:0-47 + > ./c [8] ./index.js 3:0-47 + [2] ./node_modules/x.js 20 bytes {0} [built] + chunk {1} multiple-vendors/async-a~async-b~async-c.js (async-a~async-b~async-c) 20 bytes <{9}> ={0}= ={2}= ={3}= ={4}= ={6}= ={7}= ={8}= >{2}< >{5}< [rendered] split chunk (cache group: default) (name: async-a~async-b~async-c) + > ./a [8] ./index.js 1:0-47 + > ./b [8] ./index.js 2:0-47 + > ./c [8] ./index.js 3:0-47 + [0] ./d.js 20 bytes {1} {10} {11} {12} [built] + chunk {2} multiple-vendors/async-b~async-c~async-g.js (async-b~async-c~async-g) 20 bytes <{0}> <{1}> <{10}> <{3}> <{6}> <{9}> ={0}= ={1}= ={3}= ={4}= ={5}= ={7}= ={8}= [rendered] split chunk (cache group: default) (name: async-b~async-c~async-g) + > ./g [] 6:0-47 + > ./g [] 6:0-47 + > ./b [8] ./index.js 2:0-47 + > ./c [8] ./index.js 3:0-47 + [1] ./f.js 20 bytes {2} {11} {12} [built] + chunk {3} multiple-vendors/vendors~a~async-a~async-b~b.js (vendors~a~async-a~async-b~b) 20 bytes <{9}> ={0}= ={1}= ={10}= ={11}= ={2}= ={6}= ={7}= >{2}< >{5}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~a~async-a~async-b~b) + > ./a a + > ./b b + > ./a [8] ./index.js 1:0-47 + > ./b [8] ./index.js 2:0-47 + [3] ./node_modules/y.js 20 bytes {3} [built] + chunk {4} multiple-vendors/vendors~async-c~c.js (vendors~async-c~c) 20 bytes <{9}> ={0}= ={1}= ={12}= ={2}= ={8}= [initial] [rendered] split chunk (cache group: vendors) (name: vendors~async-c~c) + > ./c c + > ./c [8] ./index.js 3:0-47 + [7] ./node_modules/z.js 20 bytes {4} [built] + chunk {5} multiple-vendors/async-g.js (async-g) 34 bytes <{0}> <{1}> <{10}> <{3}> <{6}> ={2}= [rendered] + > ./g [] 6:0-47 + > ./g [] 6:0-47 + [9] ./g.js 34 bytes {5} [built] + chunk {6} multiple-vendors/async-a.js (async-a) 156 bytes <{9}> ={0}= ={1}= ={3}= >{2}< >{5}< [rendered] + > ./a [8] ./index.js 1:0-47 + [6] ./a.js + 1 modules 156 bytes {6} {10} [built] + | ./a.js 121 bytes [built] + | ./e.js 20 bytes [built] + chunk {7} multiple-vendors/async-b.js (async-b) 72 bytes <{9}> ={0}= ={1}= ={2}= ={3}= [rendered] + > ./b [8] ./index.js 2:0-47 + [4] ./b.js 72 bytes {7} {11} [built] + chunk {8} multiple-vendors/async-c.js (async-c) 72 bytes <{9}> ={0}= ={1}= ={2}= ={4}= [rendered] + > ./c [8] ./index.js 3:0-47 + [5] ./c.js 72 bytes {8} {12} [built] + chunk {9} multiple-vendors/main.js (main) 147 bytes >{0}< >{1}< >{2}< >{3}< >{4}< >{6}< >{7}< >{8}< [entry] [rendered] + > ./ main + [8] ./index.js 147 bytes {9} [built] + chunk {10} multiple-vendors/a.js (a) 176 bytes ={0}= ={3}= >{2}< >{5}< [entry] [rendered] + > ./a a + [0] ./d.js 20 bytes {1} {10} {11} {12} [built] + [6] ./a.js + 1 modules 156 bytes {6} {10} [built] + | ./a.js 121 bytes [built] + | ./e.js 20 bytes [built] + chunk {11} multiple-vendors/b.js (b) 112 bytes ={0}= ={3}= [entry] [rendered] + > ./b b + [0] ./d.js 20 bytes {1} {10} {11} {12} [built] + [1] ./f.js 20 bytes {2} {11} {12} [built] + [4] ./b.js 72 bytes {7} {11} [built] + chunk {12} multiple-vendors/c.js (c) 112 bytes ={0}= ={4}= [entry] [rendered] + > ./c c + [0] ./d.js 20 bytes {1} {10} {11} {12} [built] + [1] ./f.js 20 bytes {2} {11} {12} [built] + [5] ./c.js 72 bytes {8} {12} [built] +Child all: + Entrypoint main = all/main.js + Entrypoint a = all/vendors~a~async-a~async-b~async-c~b~c.js all/vendors~a~async-a~async-b~b.js all/a.js + Entrypoint b = all/vendors~a~async-a~async-b~async-c~b~c.js all/vendors~a~async-a~async-b~b.js all/b.js + Entrypoint c = all/vendors~a~async-a~async-b~async-c~b~c.js all/vendors~async-c~c.js all/c.js + chunk {0} all/vendors~a~async-a~async-b~async-c~b~c.js (vendors~a~async-a~async-b~async-c~b~c) 20 bytes <{9}> ={1}= ={10}= ={11}= ={12}= ={2}= ={3}= ={4}= ={6}= ={7}= ={8}= >{2}< >{5}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~a~async-a~async-b~async-c~b~c) + > ./a a + > ./b b + > ./c c + > ./a [8] ./index.js 1:0-47 + > ./b [8] ./index.js 2:0-47 + > ./c [8] ./index.js 3:0-47 + [2] ./node_modules/x.js 20 bytes {0} [built] + chunk {1} all/async-a~async-b~async-c.js (async-a~async-b~async-c) 20 bytes <{9}> ={0}= ={2}= ={3}= ={4}= ={6}= ={7}= ={8}= >{2}< >{5}< [rendered] split chunk (cache group: default) (name: async-a~async-b~async-c) + > ./a [8] ./index.js 1:0-47 + > ./b [8] ./index.js 2:0-47 + > ./c [8] ./index.js 3:0-47 + [0] ./d.js 20 bytes {1} {10} {11} {12} [built] + chunk {2} all/async-b~async-c~async-g.js (async-b~async-c~async-g) 20 bytes <{0}> <{1}> <{10}> <{3}> <{6}> <{9}> ={0}= ={1}= ={3}= ={4}= ={5}= ={7}= ={8}= [rendered] split chunk (cache group: default) (name: async-b~async-c~async-g) + > ./g [] 6:0-47 + > ./g [] 6:0-47 + > ./b [8] ./index.js 2:0-47 + > ./c [8] ./index.js 3:0-47 + [1] ./f.js 20 bytes {2} {11} {12} [built] + chunk {3} all/vendors~a~async-a~async-b~b.js (vendors~a~async-a~async-b~b) 20 bytes <{9}> ={0}= ={1}= ={10}= ={11}= ={2}= ={6}= ={7}= >{2}< >{5}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~a~async-a~async-b~b) + > ./a a + > ./b b + > ./a [8] ./index.js 1:0-47 + > ./b [8] ./index.js 2:0-47 + [3] ./node_modules/y.js 20 bytes {3} [built] + chunk {4} all/vendors~async-c~c.js (vendors~async-c~c) 20 bytes <{9}> ={0}= ={1}= ={12}= ={2}= ={8}= [initial] [rendered] split chunk (cache group: vendors) (name: vendors~async-c~c) + > ./c c + > ./c [8] ./index.js 3:0-47 + [7] ./node_modules/z.js 20 bytes {4} [built] + chunk {5} all/async-g.js (async-g) 34 bytes <{0}> <{1}> <{10}> <{3}> <{6}> ={2}= [rendered] + > ./g [] 6:0-47 + > ./g [] 6:0-47 + [9] ./g.js 34 bytes {5} [built] + chunk {6} all/async-a.js (async-a) 156 bytes <{9}> ={0}= ={1}= ={3}= >{2}< >{5}< [rendered] + > ./a [8] ./index.js 1:0-47 + [6] ./a.js + 1 modules 156 bytes {6} {10} [built] + | ./a.js 121 bytes [built] + | ./e.js 20 bytes [built] + chunk {7} all/async-b.js (async-b) 72 bytes <{9}> ={0}= ={1}= ={2}= ={3}= [rendered] + > ./b [8] ./index.js 2:0-47 + [4] ./b.js 72 bytes {7} {11} [built] + chunk {8} all/async-c.js (async-c) 72 bytes <{9}> ={0}= ={1}= ={2}= ={4}= [rendered] + > ./c [8] ./index.js 3:0-47 + [5] ./c.js 72 bytes {8} {12} [built] + chunk {9} all/main.js (main) 147 bytes >{0}< >{1}< >{2}< >{3}< >{4}< >{6}< >{7}< >{8}< [entry] [rendered] + > ./ main + [8] ./index.js 147 bytes {9} [built] + chunk {10} all/a.js (a) 176 bytes ={0}= ={3}= >{2}< >{5}< [entry] [rendered] + > ./a a + [0] ./d.js 20 bytes {1} {10} {11} {12} [built] + [6] ./a.js + 1 modules 156 bytes {6} {10} [built] + | ./a.js 121 bytes [built] + | ./e.js 20 bytes [built] + chunk {11} all/b.js (b) 112 bytes ={0}= ={3}= [entry] [rendered] + > ./b b + [0] ./d.js 20 bytes {1} {10} {11} {12} [built] + [1] ./f.js 20 bytes {2} {11} {12} [built] + [4] ./b.js 72 bytes {7} {11} [built] + chunk {12} all/c.js (c) 112 bytes ={0}= ={4}= [entry] [rendered] + > ./c c + [0] ./d.js 20 bytes {1} {10} {11} {12} [built] + [1] ./f.js 20 bytes {2} {11} {12} [built] + [5] ./c.js 72 bytes {8} {12} [built]" +`; + +exports[`StatsTestCases should print correct stats for chunk-module-id-range 1`] = ` +"Hash: 7d8eb8b4418c6ae6a262 +Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names +main2.js 4.85 KiB 0 [emitted] main2 +main1.js 4.86 KiB 1 [emitted] main1 +Entrypoint main1 = main1.js +Entrypoint main2 = main2.js +chunk {0} main2.js (main2) 136 bytes [entry] [rendered] + > ./main2 main2 + [0] ./e.js 20 bytes {0} [built] + [1] ./f.js 20 bytes {0} [built] + [2] ./main2.js 56 bytes {0} [built] + [100] ./d.js 20 bytes {0} {1} [built] + [101] ./a.js 20 bytes {0} {1} [built] +chunk {1} main1.js (main1) 136 bytes [entry] [rendered] + > ./main1 main1 + [3] ./b.js 20 bytes {1} [built] + [4] ./main1.js 56 bytes {1} [built] + [100] ./d.js 20 bytes {0} {1} [built] + [101] ./a.js 20 bytes {0} {1} [built] + [102] ./c.js 20 bytes {1} [built]" +`; + +exports[`StatsTestCases should print correct stats for chunks 1`] = ` +"Hash: 7762656cf5adce7c4f04 +Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names +0.bundle.js 152 bytes 0 [emitted] +1.bundle.js 289 bytes 1 [emitted] + bundle.js 8.29 KiB 2 [emitted] main +3.bundle.js 227 bytes 3 [emitted] +Entrypoint main = bundle.js +chunk {0} 0.bundle.js 22 bytes <{2}> [rendered] + > ./b [4] ./index.js 2:0-16 + [2] ./b.js 22 bytes {0} [built] + amd require ./b [4] ./index.js 2:0-16 + [4] Xms -> factory:Xms building:Xms = Xms +chunk {1} 1.bundle.js 54 bytes <{2}> >{3}< [rendered] + > ./c [4] ./index.js 3:0-16 + [3] ./c.js 54 bytes {1} [built] + amd require ./c [4] ./index.js 3:0-16 + [4] Xms -> factory:Xms building:Xms = Xms +chunk {2} bundle.js (main) 73 bytes >{0}< >{1}< [entry] [rendered] + > ./index main + [4] ./index.js 51 bytes {2} [built] + single entry ./index main + factory:Xms building:Xms = Xms + [5] ./a.js 22 bytes {2} [built] + cjs require ./a [4] ./index.js 1:0-14 + [4] Xms -> factory:Xms building:Xms = Xms +chunk {3} 3.bundle.js 44 bytes <{1}> [rendered] + > [3] ./c.js 1:0-52 + [0] ./d.js 22 bytes {3} [built] + require.ensure item ./d [3] ./c.js 1:0-52 + [4] Xms -> [3] Xms -> factory:Xms building:Xms = Xms + [1] ./e.js 22 bytes {3} [built] + require.ensure item ./e [3] ./c.js 1:0-52 + [4] Xms -> [3] Xms -> factory:Xms building:Xms = Xms" +`; + +exports[`StatsTestCases should print correct stats for chunks-development 1`] = ` +"Hash: e9e5a35c80318dd22050 +Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names +0.bundle.js 433 bytes 0 [emitted] +1.bundle.js 297 bytes 1 [emitted] +2.bundle.js 588 bytes 2 [emitted] + bundle.js 8.67 KiB main [emitted] main +Entrypoint main = bundle.js +chunk {main} bundle.js (main) 73 bytes >{0}< >{1}< [entry] [rendered] + > ./index main + [./a.js] 22 bytes {main} [built] + cjs require ./a [./index.js] 1:0-14 + cjs require ./a [./e.js] 1:0-14 + [./index.js] Xms -> factory:Xms building:Xms = Xms + [./index.js] 51 bytes {main} [built] + single entry ./index main + factory:Xms building:Xms = Xms +chunk {0} 0.bundle.js 54 bytes <{main}> >{2}< [rendered] + > ./c [./index.js] ./index.js 3:0-16 + [./c.js] 54 bytes {0} [built] + amd require ./c [./index.js] 3:0-16 + [./index.js] Xms -> factory:Xms building:Xms = Xms +chunk {1} 1.bundle.js 22 bytes <{main}> [rendered] + > ./b [./index.js] ./index.js 2:0-16 + [./b.js] 22 bytes {1} [built] + amd require ./b [./index.js] 2:0-16 + [./index.js] Xms -> factory:Xms building:Xms = Xms +chunk {2} 2.bundle.js 60 bytes <{0}> [rendered] + > [./c.js] ./c.js 1:0-52 + [./d.js] 22 bytes {2} [built] + require.ensure item ./d [./c.js] 1:0-52 + [./index.js] Xms -> [./c.js] Xms -> factory:Xms building:Xms = Xms + [./e.js] 38 bytes {2} [built] + require.ensure item ./e [./c.js] 1:0-52 + [./index.js] Xms -> [./c.js] Xms -> factory:Xms building:Xms = Xms" +`; + +exports[`StatsTestCases should print correct stats for circular-correctness 1`] = ` +"Entrypoint main = bundle.js +chunk {0} 0.bundle.js (a) 49 bytes <{2}> <{3}> >{3}< [rendered] + [1] ./module-a.js 49 bytes {0} [built] +chunk {1} 1.bundle.js (b) 49 bytes <{2}> <{3}> >{3}< [rendered] + [2] ./module-b.js 49 bytes {1} [built] +chunk {2} bundle.js (main) 98 bytes >{0}< >{1}< [entry] [rendered] + [3] ./index.js 98 bytes {2} [built] +chunk {3} 3.bundle.js (c) 98 bytes <{0}> <{1}> >{0}< >{1}< [rendered] + [0] ./module-c.js 98 bytes {3} [built]" +`; + +exports[`StatsTestCases should print correct stats for color-disabled 1`] = ` +"Hash: c5ad40363e9aee54c089 +Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names +main.js 3.57 KiB 0 [emitted] main +Entrypoint main = main.js +[0] ./index.js 0 bytes {0} [built]" +`; + +exports[`StatsTestCases should print correct stats for color-enabled 1`] = ` +"Hash: c5ad40363e9aee54c089 +Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names +main.js 3.57 KiB 0 [emitted] main +Entrypoint main = main.js +[0] ./index.js 0 bytes {0} [built]" +`; + +exports[`StatsTestCases should print correct stats for color-enabled-custom 1`] = ` +"Hash: c5ad40363e9aee54c089 +Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names +main.js 3.57 KiB 0 [emitted] main +Entrypoint main = main.js +[0] ./index.js 0 bytes {0} [built]" +`; + +exports[`StatsTestCases should print correct stats for commons-chunk-min-size-0 1`] = ` +"Hash: bace8077f1ed02050b2f +Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + entry-1.js 6.6 KiB 0 [emitted] entry-1 +vendor-1~entry-1.js 314 bytes 1 [emitted] vendor-1~entry-1 +Entrypoint entry-1 = vendor-1~entry-1.js entry-1.js +[0] ./entry-1.js 145 bytes {0} [built] +[1] ./modules/a.js 22 bytes {1} [built] +[2] ./modules/b.js 22 bytes {1} [built] +[3] ./modules/c.js 22 bytes {1} [built] +[4] ./modules/d.js 22 bytes {0} [built] +[5] ./modules/e.js 22 bytes {0} [built] +[6] ./modules/f.js 22 bytes {0} [built]" +`; + +exports[`StatsTestCases should print correct stats for commons-chunk-min-size-Infinity 1`] = ` +"Hash: cb8c4bb6c365b0a67d67 +Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + entry-1.js 6.6 KiB 0 [emitted] entry-1 +vendor-1.js 314 bytes 1 [emitted] vendor-1 +Entrypoint entry-1 = vendor-1.js entry-1.js +[0] ./entry-1.js 145 bytes {0} [built] +[1] ./modules/a.js 22 bytes {1} [built] +[2] ./modules/b.js 22 bytes {1} [built] +[3] ./modules/c.js 22 bytes {1} [built] +[4] ./modules/d.js 22 bytes {0} [built] +[5] ./modules/e.js 22 bytes {0} [built] +[6] ./modules/f.js 22 bytes {0} [built]" +`; + +exports[`StatsTestCases should print correct stats for commons-plugin-issue-4980 1`] = ` +"Hash: 707868320b2a03412b3fe3b00ef4ecd794b284d6 +Child + Hash: 707868320b2a03412b3f + Time: Xms + Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + app.js 6.69 KiB 0 [emitted] app + vendor.6a3bdffda9f0de672978.js 619 bytes 1 [emitted] vendor + Entrypoint app = vendor.6a3bdffda9f0de672978.js app.js + [./constants.js] 87 bytes {1} [built] + [./entry-1.js] ./entry-1.js + 2 modules 190 bytes {0} [built] + | ./entry-1.js 67 bytes [built] + | ./submodule-a.js 59 bytes [built] + | ./submodule-b.js 59 bytes [built] +Child + Hash: e3b00ef4ecd794b284d6 + Time: Xms + Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + app.js 6.7 KiB 0 [emitted] app + vendor.6a3bdffda9f0de672978.js 619 bytes 1 [emitted] vendor + Entrypoint app = vendor.6a3bdffda9f0de672978.js app.js + [./constants.js] 87 bytes {1} [built] + [./entry-2.js] ./entry-2.js + 2 modules 197 bytes {0} [built] + | ./entry-2.js 67 bytes [built] + | ./submodule-a.js 59 bytes [built] + | ./submodule-c.js 66 bytes [built]" +`; + +exports[`StatsTestCases should print correct stats for concat-and-sideeffects 1`] = ` +"[0] ./index.js + 2 modules 119 bytes {0} [built] + | ./index.js 46 bytes [built] + | ModuleConcatenation bailout: Module is an entry point + | ./node_modules/pmodule/a.js 49 bytes [built] + | ./node_modules/pmodule/aa.js 24 bytes [built] +[1] ./node_modules/pmodule/index.js 63 bytes [built] + ModuleConcatenation bailout: Module is not in any chunk +[2] ./node_modules/pmodule/b.js 49 bytes [built] + ModuleConcatenation bailout: Module is not in any chunk +[3] ./node_modules/pmodule/bb.js 24 bytes [built] + ModuleConcatenation bailout: Module is not in any chunk +[4] ./node_modules/pmodule/c.js 49 bytes [built] + ModuleConcatenation bailout: Module is not in any chunk +[5] ./node_modules/pmodule/cc.js 24 bytes [built] + ModuleConcatenation bailout: Module is not in any chunk" +`; + +exports[`StatsTestCases should print correct stats for define-plugin 1`] = ` +"Hash: cfe08d4450db77f81610f4228fcb997ec81e2aa6 +Child + Hash: cfe08d4450db77f81610 + Time: Xms + Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + main.js 3.6 KiB 0 [emitted] main + Entrypoint main = main.js + [0] ./index.js 24 bytes {0} [built] +Child + Hash: f4228fcb997ec81e2aa6 + Time: Xms + Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + main.js 3.6 KiB 0 [emitted] main + Entrypoint main = main.js + [0] ./index.js 24 bytes {0} [built]" +`; + +exports[`StatsTestCases should print correct stats for exclude-with-loader 1`] = ` +"Hash: 52eadc5de721f000106b +Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names +bundle.js 4.01 KiB 0 [emitted] main + + 1 hidden asset +Entrypoint main = bundle.js +[0] ./index.js 77 bytes {0} [built] +[1] ./a.txt 43 bytes {0} [built] + + 2 hidden modules" +`; + +exports[`StatsTestCases should print correct stats for external 1`] = ` +"Hash: 7a4bb5500ee0eddeee44 +Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names +main.js 3.71 KiB 0 [emitted] main +Entrypoint main = main.js +[0] ./index.js 17 bytes {0} [built] +[1] external \\"test\\" 42 bytes {0} [built]" +`; + +exports[`StatsTestCases should print correct stats for filter-warnings 1`] = ` +"Hash: 4269d427a8c1110386b44269d427a8c1110386b44269d427a8c1110386b44269d427a8c1110386b44269d427a8c1110386b44269d427a8c1110386b44269d427a8c1110386b44269d427a8c1110386b44269d427a8c1110386b44269d427a8c1110386b44269d427a8c1110386b44269d427a8c1110386b44269d427a8c1110386b4 +Child + Hash: 4269d427a8c1110386b4 + Time: Xms + Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + bundle.js 2.89 KiB 0 [emitted] main + Entrypoint main = bundle.js + + WARNING in bundle.js from UglifyJs + Dropping side-effect-free statement [./index.js:6,0] + Dropping unused function someUnUsedFunction1 [./index.js:8,0] + Dropping unused function someUnUsedFunction2 [./index.js:9,0] + Dropping unused function someUnUsedFunction3 [./index.js:10,0] + Dropping unused function someUnUsedFunction4 [./index.js:11,0] + Dropping unused function someUnUsedFunction5 [./index.js:12,0] + Dropping unused function someRemoteUnUsedFunction1 [./a.js:3,0] + Dropping unused function someRemoteUnUsedFunction2 [./a.js:4,0] + Dropping unused function someRemoteUnUsedFunction3 [./a.js:5,0] + Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] + Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] +Child + Hash: 4269d427a8c1110386b4 + Time: Xms + Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + bundle.js 2.89 KiB 0 [emitted] main + Entrypoint main = bundle.js +Child + Hash: 4269d427a8c1110386b4 + Time: Xms + Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + bundle.js 2.89 KiB 0 [emitted] main + Entrypoint main = bundle.js +Child + Hash: 4269d427a8c1110386b4 + Time: Xms + Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + bundle.js 2.89 KiB 0 [emitted] main + Entrypoint main = bundle.js +Child + Hash: 4269d427a8c1110386b4 + Time: Xms + Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + bundle.js 2.89 KiB 0 [emitted] main + Entrypoint main = bundle.js +Child + Hash: 4269d427a8c1110386b4 + Time: Xms + Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + bundle.js 2.89 KiB 0 [emitted] main + Entrypoint main = bundle.js +Child + Hash: 4269d427a8c1110386b4 + Time: Xms + Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + bundle.js 2.89 KiB 0 [emitted] main + Entrypoint main = bundle.js +Child + Hash: 4269d427a8c1110386b4 + Time: Xms + Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + bundle.js 2.89 KiB 0 [emitted] main + Entrypoint main = bundle.js + + WARNING in bundle.js from UglifyJs + Dropping side-effect-free statement [./index.js:6,0] + Dropping unused function someUnUsedFunction1 [./index.js:8,0] + Dropping unused function someUnUsedFunction2 [./index.js:9,0] + Dropping unused function someUnUsedFunction3 [./index.js:10,0] + Dropping unused function someUnUsedFunction4 [./index.js:11,0] + Dropping unused function someUnUsedFunction5 [./index.js:12,0] + Dropping unused function someRemoteUnUsedFunction1 [./a.js:3,0] + Dropping unused function someRemoteUnUsedFunction2 [./a.js:4,0] + Dropping unused function someRemoteUnUsedFunction3 [./a.js:5,0] + Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] + Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] +Child + Hash: 4269d427a8c1110386b4 + Time: Xms + Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + bundle.js 2.89 KiB 0 [emitted] main + Entrypoint main = bundle.js + + WARNING in bundle.js from UglifyJs + Dropping side-effect-free statement [./index.js:6,0] + Dropping unused function someUnUsedFunction1 [./index.js:8,0] + Dropping unused function someUnUsedFunction2 [./index.js:9,0] + Dropping unused function someUnUsedFunction3 [./index.js:10,0] + Dropping unused function someUnUsedFunction4 [./index.js:11,0] + Dropping unused function someUnUsedFunction5 [./index.js:12,0] + Dropping unused function someRemoteUnUsedFunction1 [./a.js:3,0] + Dropping unused function someRemoteUnUsedFunction2 [./a.js:4,0] + Dropping unused function someRemoteUnUsedFunction3 [./a.js:5,0] + Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] + Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] +Child + Hash: 4269d427a8c1110386b4 + Time: Xms + Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + bundle.js 2.89 KiB 0 [emitted] main + Entrypoint main = bundle.js + + WARNING in bundle.js from UglifyJs + Dropping side-effect-free statement [./index.js:6,0] + Dropping unused function someUnUsedFunction1 [./index.js:8,0] + Dropping unused function someUnUsedFunction2 [./index.js:9,0] + Dropping unused function someUnUsedFunction3 [./index.js:10,0] + Dropping unused function someUnUsedFunction4 [./index.js:11,0] + Dropping unused function someUnUsedFunction5 [./index.js:12,0] + Dropping unused function someRemoteUnUsedFunction1 [./a.js:3,0] + Dropping unused function someRemoteUnUsedFunction2 [./a.js:4,0] + Dropping unused function someRemoteUnUsedFunction3 [./a.js:5,0] + Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] + Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] +Child + Hash: 4269d427a8c1110386b4 + Time: Xms + Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + bundle.js 2.89 KiB 0 [emitted] main + Entrypoint main = bundle.js + + WARNING in bundle.js from UglifyJs + Dropping side-effect-free statement [./index.js:6,0] + Dropping unused function someUnUsedFunction1 [./index.js:8,0] + Dropping unused function someUnUsedFunction2 [./index.js:9,0] + Dropping unused function someUnUsedFunction3 [./index.js:10,0] + Dropping unused function someUnUsedFunction4 [./index.js:11,0] + Dropping unused function someUnUsedFunction5 [./index.js:12,0] + Dropping unused function someRemoteUnUsedFunction1 [./a.js:3,0] + Dropping unused function someRemoteUnUsedFunction2 [./a.js:4,0] + Dropping unused function someRemoteUnUsedFunction3 [./a.js:5,0] + Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] + Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] +Child + Hash: 4269d427a8c1110386b4 + Time: Xms + Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + bundle.js 2.89 KiB 0 [emitted] main + Entrypoint main = bundle.js + + WARNING in bundle.js from UglifyJs + Dropping side-effect-free statement [./index.js:6,0] + Dropping unused function someUnUsedFunction1 [./index.js:8,0] + Dropping unused function someUnUsedFunction2 [./index.js:9,0] + Dropping unused function someUnUsedFunction3 [./index.js:10,0] + Dropping unused function someUnUsedFunction4 [./index.js:11,0] + Dropping unused function someUnUsedFunction5 [./index.js:12,0] + Dropping unused function someRemoteUnUsedFunction1 [./a.js:3,0] + Dropping unused function someRemoteUnUsedFunction2 [./a.js:4,0] + Dropping unused function someRemoteUnUsedFunction3 [./a.js:5,0] + Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] + Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] +Child + Hash: 4269d427a8c1110386b4 + Time: Xms + Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + bundle.js 2.89 KiB 0 [emitted] main + Entrypoint main = bundle.js + + WARNING in bundle.js from UglifyJs + Dropping side-effect-free statement [./index.js:6,0] + Dropping unused function someUnUsedFunction1 [./index.js:8,0] + Dropping unused function someUnUsedFunction2 [./index.js:9,0] + Dropping unused function someUnUsedFunction3 [./index.js:10,0] + Dropping unused function someUnUsedFunction4 [./index.js:11,0] + Dropping unused function someUnUsedFunction5 [./index.js:12,0] + Dropping unused function someRemoteUnUsedFunction1 [./a.js:3,0] + Dropping unused function someRemoteUnUsedFunction2 [./a.js:4,0] + Dropping unused function someRemoteUnUsedFunction3 [./a.js:5,0] + Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] + Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0]" +`; + +exports[`StatsTestCases should print correct stats for graph-correctness-entries 1`] = ` +"Entrypoint e1 = e1.js +Entrypoint e2 = e2.js +chunk {0} c.js (c) 49 bytes <{3}> <{4}> >{1}< [rendered] + [1] ./module-c.js 49 bytes {0} [built] + import() ./module-c [2] ./module-b.js 1:0-47 + import() ./module-c [4] ./e2.js 1:0-47 +chunk {1} a.js (a) 49 bytes <{0}> <{2}> >{4}< [rendered] + [0] ./module-a.js 49 bytes {1} [built] + import() ./module-a [1] ./module-c.js 1:0-47 + import() ./module-a [3] ./e1.js 1:0-47 +chunk {2} e1.js (e1) 49 bytes >{1}< [entry] [rendered] + [3] ./e1.js 49 bytes {2} [built] + single entry ./e1 e1 +chunk {3} e2.js (e2) 49 bytes >{0}< [entry] [rendered] + [4] ./e2.js 49 bytes {3} [built] + single entry ./e2 e2 +chunk {4} b.js (b) 49 bytes <{1}> >{0}< [rendered] + [2] ./module-b.js 49 bytes {4} [built] + import() ./module-b [0] ./module-a.js 1:0-47" +`; + +exports[`StatsTestCases should print correct stats for graph-correctness-modules 1`] = ` +"Entrypoint e1 = e1.js +Entrypoint e2 = e2.js +chunk {0} y.js (y) 0 bytes <{3}> <{4}> [rendered] + [3] ./module-y.js 0 bytes {0} [built] + import() ./module-y [0] ./module-x.js 1:0-47 +chunk {1} c.js (c) 49 bytes <{4}> <{5}> >{2}< [rendered] + [2] ./module-c.js 49 bytes {1} [built] + import() ./module-c [4] ./module-b.js 1:0-47 + import() ./module-c [6] ./e2.js 2:0-47 +chunk {2} a.js (a) 49 bytes <{1}> <{3}> >{5}< [rendered] + [1] ./module-a.js 49 bytes {2} [built] + import() ./module-a [2] ./module-c.js 1:0-47 + import() ./module-a [5] ./e1.js 2:0-47 +chunk {3} e1.js (e1) 119 bytes >{0}< >{2}< [entry] [rendered] + [0] ./module-x.js 49 bytes {3} {4} [built] + import() ./module-x [4] ./module-b.js 2:0-20 + harmony side effect evaluation ./module-x [5] ./e1.js 1:0-20 + harmony side effect evaluation ./module-x [6] ./e2.js 1:0-20 + [5] ./e1.js 70 bytes {3} [built] + single entry ./e1 e1 +chunk {4} e2.js (e2) 119 bytes >{0}< >{1}< [entry] [rendered] + [0] ./module-x.js 49 bytes {3} {4} [built] + import() ./module-x [4] ./module-b.js 2:0-20 + harmony side effect evaluation ./module-x [5] ./e1.js 1:0-20 + harmony side effect evaluation ./module-x [6] ./e2.js 1:0-20 + [6] ./e2.js 70 bytes {4} [built] + single entry ./e2 e2 +chunk {5} b.js (b) 179 bytes <{2}> >{1}< [rendered] + [4] ./module-b.js 179 bytes {5} [built] + import() ./module-b [1] ./module-a.js 1:0-47" +`; + +exports[`StatsTestCases should print correct stats for import-context-filter 1`] = ` +"Hash: 2a0d654db3e185182232 +Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + 0.js 305 bytes 0 [emitted] + 1.js 314 bytes 1 [emitted] + 2.js 308 bytes 2 [emitted] +entry.js 9.08 KiB 3 [emitted] entry +Entrypoint entry = entry.js +[0] ./templates/bar.js 38 bytes {0} [optional] [built] +[1] ./templates/baz.js 38 bytes {1} [optional] [built] +[2] ./templates/foo.js 38 bytes {2} [optional] [built] +[3] ./entry.js 450 bytes {3} [built] +[4] ./templates lazy ^\\\\.\\\\/.*$ include: \\\\.js$ exclude: \\\\.noimport\\\\.js$ namespace object 160 bytes {3} [optional] [built]" +`; + +exports[`StatsTestCases should print correct stats for import-weak 1`] = ` +"Hash: 34cdd6c85db0facc427a +Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + 0.js 149 bytes 0 [emitted] +entry.js 8.53 KiB 1 [emitted] entry +Entrypoint entry = entry.js +[0] ./modules/b.js 22 bytes {0} [built] +[1] ./entry.js 120 bytes {1} [built] +[2] ./modules/a.js 37 bytes [built]" +`; + +exports[`StatsTestCases should print correct stats for import-with-invalid-options-comments 1`] = ` +"Built at: Thu Jan 01 1970 00:00:00 GMT +[0] ./chunk-a.js 27 bytes {2} [built] +[1] ./chunk-b.js 27 bytes {3} [built] +[2] ./chunk-c.js 27 bytes {4} [built] +[3] ./chunk-d.js 27 bytes {5} [built] +[4] ./chunk.js 401 bytes {0} [built] [3 warnings] +[5] ./index.js 50 bytes {1} [built] + +WARNING in ./chunk.js 4:11-77 +Compilation error while processing magic comment(-s): /* webpack Prefetch: 0, webpackChunkName: \\"notGoingToCompile-c\\" */: Unexpected identifier + @ ./index.js 1:0-49 + +WARNING in ./chunk.js 5:11-38 +Compilation error while processing magic comment(-s): /* webpackPrefetch: nope */: nope is not defined + @ ./index.js 1:0-49 + +WARNING in ./chunk.js 2:11-84 +Compilation error while processing magic comment(-s): /* webpackPrefetch: true, webpackChunkName: notGoingToCompileChunkName */: notGoingToCompileChunkName is not defined + @ ./index.js 1:0-49" +`; + +exports[`StatsTestCases should print correct stats for limit-chunk-count-plugin 1`] = ` +"Hash: 3f682d19df3a78cc355b84831557db9bd7a90e1a059dbb5576e98cee97e4f44eff82b7d35dbb5021 +Child 1 chunks: + Hash: 3f682d19df3a78cc355b + Time: Xms + Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + bundle.js 6.39 KiB 0 [emitted] main + Entrypoint main = bundle.js + chunk {0} bundle.js (main) 191 bytes <{0}> >{0}< [entry] [rendered] + [0] ./index.js 73 bytes {0} [built] + [1] ./a.js 22 bytes {0} [built] + [2] ./b.js 22 bytes {0} [built] + [3] ./c.js 30 bytes {0} [built] + [4] ./d.js 22 bytes {0} [built] + [5] ./e.js 22 bytes {0} [built] +Child 2 chunks: + Hash: 84831557db9bd7a90e1a + Time: Xms + Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + 0.bundle.js 632 bytes 0 [emitted] + bundle.js 8.28 KiB 1 [emitted] main + Entrypoint main = bundle.js + chunk {0} 0.bundle.js 118 bytes <{0}> <{1}> >{0}< [rendered] + [0] ./d.js 22 bytes {0} [built] + [1] ./e.js 22 bytes {0} [built] + [2] ./a.js 22 bytes {0} [built] + [3] ./b.js 22 bytes {0} [built] + [4] ./c.js 30 bytes {0} [built] + chunk {1} bundle.js (main) 73 bytes >{0}< [entry] [rendered] + [5] ./index.js 73 bytes {1} [built] +Child 3 chunks: + Hash: 059dbb5576e98cee97e4 + Time: Xms + Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + 0.bundle.js 494 bytes 0 [emitted] + 1.bundle.js 245 bytes 1 [emitted] + bundle.js 8.28 KiB 2 [emitted] main + Entrypoint main = bundle.js + chunk {0} 0.bundle.js 74 bytes <{0}> <{2}> >{0}< >{1}< [rendered] + [0] ./d.js 22 bytes {0} [built] + [2] ./a.js 22 bytes {0} [built] + [4] ./c.js 30 bytes {0} [built] + chunk {1} 1.bundle.js 44 bytes <{0}> <{2}> [rendered] + [1] ./e.js 22 bytes {1} [built] + [3] ./b.js 22 bytes {1} [built] + chunk {2} bundle.js (main) 73 bytes >{0}< >{1}< [entry] [rendered] + [5] ./index.js 73 bytes {2} [built] +Child 4 chunks: + Hash: f44eff82b7d35dbb5021 + Time: Xms + Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + 0.bundle.js 236 bytes 0 [emitted] + 1.bundle.js 245 bytes 1 [emitted] + 2.bundle.js 323 bytes 2 [emitted] + bundle.js 8.28 KiB 3 [emitted] main + Entrypoint main = bundle.js + chunk {0} 0.bundle.js 44 bytes <{2}> <{3}> [rendered] + [0] ./d.js 22 bytes {0} [built] + [2] ./a.js 22 bytes {0} [built] + chunk {1} 1.bundle.js 44 bytes <{2}> <{3}> [rendered] + [1] ./e.js 22 bytes {1} [built] + [3] ./b.js 22 bytes {1} [built] + chunk {2} 2.bundle.js 30 bytes <{3}> >{0}< >{1}< [rendered] + [4] ./c.js 30 bytes {2} [built] + chunk {3} bundle.js (main) 73 bytes >{0}< >{1}< >{2}< [entry] [rendered] + [5] ./index.js 73 bytes {3} [built]" +`; + +exports[`StatsTestCases should print correct stats for max-modules 1`] = ` +"Hash: 8e1f6d7b7886c5f4617d +Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names +main.js 6.81 KiB 0 [emitted] main +Entrypoint main = main.js + [0] ./a.js?1 33 bytes {0} [built] + [1] ./a.js?2 33 bytes {0} [built] + [2] ./a.js?3 33 bytes {0} [built] + [3] ./a.js?4 33 bytes {0} [built] + [4] ./a.js?5 33 bytes {0} [built] + [5] ./a.js?6 33 bytes {0} [built] + [6] ./a.js?7 33 bytes {0} [built] + [7] ./a.js?8 33 bytes {0} [built] + [8] ./a.js?9 33 bytes {0} [built] + [9] ./a.js?10 33 bytes {0} [built] +[10] ./index.js 181 bytes {0} [built] +[11] ./c.js?1 33 bytes {0} [built] +[13] ./c.js?2 33 bytes {0} [built] +[15] ./c.js?3 33 bytes {0} [built] +[17] ./c.js?4 33 bytes {0} [built] +[19] ./c.js?5 33 bytes {0} [built] +[23] ./c.js?7 33 bytes {0} [built] +[25] ./c.js?8 33 bytes {0} [built] +[27] ./c.js?9 33 bytes {0} [built] +[29] ./c.js?10 33 bytes {0} [built] + + 11 hidden modules" +`; + +exports[`StatsTestCases should print correct stats for max-modules-default 1`] = ` +"Hash: 8e1f6d7b7886c5f4617d +Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names +main.js 6.81 KiB 0 [emitted] main +Entrypoint main = main.js + [0] ./a.js?1 33 bytes {0} [built] + [1] ./a.js?2 33 bytes {0} [built] + [2] ./a.js?3 33 bytes {0} [built] + [3] ./a.js?4 33 bytes {0} [built] + [4] ./a.js?5 33 bytes {0} [built] + [5] ./a.js?6 33 bytes {0} [built] + [6] ./a.js?7 33 bytes {0} [built] + [7] ./a.js?8 33 bytes {0} [built] + [8] ./a.js?9 33 bytes {0} [built] + [9] ./a.js?10 33 bytes {0} [built] +[10] ./index.js 181 bytes {0} [built] +[11] ./c.js?1 33 bytes {0} [built] +[13] ./c.js?2 33 bytes {0} [built] +[27] ./c.js?9 33 bytes {0} [built] +[29] ./c.js?10 33 bytes {0} [built] + + 16 hidden modules" +`; + +exports[`StatsTestCases should print correct stats for module-assets 1`] = ` +"Hash: e1ecf80df7148b69327b +Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT +Entrypoint main = main.js +chunk {0} 0.js 68 bytes <{1}> [rendered] + [0] ./node_modules/a/1.png 51 bytes {0} [built] [1 asset] + [1] ./node_modules/a/index.js 17 bytes {0} [built] +chunk {1} main.js (main) 12 bytes >{0}< [entry] [rendered] + [2] ./index.js 12 bytes {1} [built] +[0] ./node_modules/a/1.png 51 bytes {0} [built] [1 asset] +[1] ./node_modules/a/index.js 17 bytes {0} [built] +[2] ./index.js 12 bytes {1} [built]" +`; + +exports[`StatsTestCases should print correct stats for module-deduplication 1`] = ` +"Asset Size Chunks Chunk Names + 0.js 730 bytes 0, 5 [emitted] + 1.js 730 bytes 1, 4 [emitted] + 2.js 730 bytes 2, 3 [emitted] + 3.js 661 bytes 3 [emitted] + 4.js 661 bytes 4 [emitted] + 5.js 661 bytes 5 [emitted] +e1.js 9.42 KiB 6 [emitted] e1 +e2.js 9.44 KiB 7 [emitted] e2 +e3.js 9.46 KiB 8 [emitted] e3 +Entrypoint e1 = e1.js +Entrypoint e2 = e2.js +Entrypoint e3 = e3.js +chunk {0} 0.js 37 bytes <{7}> <{8}> [rendered] + [2] ./d.js 9 bytes {0} {6} [built] + [5] ./async1.js 28 bytes {0} {5} [built] +chunk {1} 1.js 37 bytes <{6}> <{8}> [rendered] + [3] ./f.js 9 bytes {1} {7} [built] + [6] ./async2.js 28 bytes {1} {4} [built] +chunk {2} 2.js 37 bytes <{6}> <{7}> [rendered] + [4] ./h.js 9 bytes {2} {8} [built] + [7] ./async3.js 28 bytes {2} {3} [built] +chunk {3} 3.js 28 bytes <{8}> [rendered] + [7] ./async3.js 28 bytes {2} {3} [built] +chunk {4} 4.js 28 bytes <{7}> [rendered] + [6] ./async2.js 28 bytes {1} {4} [built] +chunk {5} 5.js 28 bytes <{6}> [rendered] + [5] ./async1.js 28 bytes {0} {5} [built] +chunk {6} e1.js (e1) 152 bytes >{1}< >{2}< >{5}< [entry] [rendered] + [0] ./b.js 9 bytes {6} {7} {8} [built] + [1] ./a.js 9 bytes {6} {7} {8} [built] + [2] ./d.js 9 bytes {0} {6} [built] + [8] ./e1.js 116 bytes {6} [built] + [9] ./c.js 9 bytes {6} [built] +chunk {7} e2.js (e2) 152 bytes >{0}< >{2}< >{4}< [entry] [rendered] + [0] ./b.js 9 bytes {6} {7} {8} [built] + [1] ./a.js 9 bytes {6} {7} {8} [built] + [3] ./f.js 9 bytes {1} {7} [built] + [10] ./e2.js 116 bytes {7} [built] + [11] ./e.js 9 bytes {7} [built] +chunk {8} e3.js (e3) 152 bytes >{0}< >{1}< >{3}< [entry] [rendered] + [0] ./b.js 9 bytes {6} {7} {8} [built] + [1] ./a.js 9 bytes {6} {7} {8} [built] + [4] ./h.js 9 bytes {2} {8} [built] + [12] ./e3.js 116 bytes {8} [built] + [13] ./g.js 9 bytes {8} [built]" +`; + +exports[`StatsTestCases should print correct stats for module-deduplication-named 1`] = ` +" Asset Size Chunks Chunk Names +async3.js 818 bytes 0 [emitted] async3 +async1.js 818 bytes 1 [emitted] async1 +async2.js 818 bytes 2 [emitted] async2 + e1.js 9.31 KiB 3 [emitted] e1 + e2.js 9.33 KiB 4 [emitted] e2 + e3.js 9.35 KiB 5 [emitted] e3 +Entrypoint e1 = e1.js +Entrypoint e2 = e2.js +Entrypoint e3 = e3.js +chunk {0} async3.js (async3) 89 bytes <{2}> <{5}> >{1}< [rendered] + [4] ./h.js 9 bytes {0} {5} [built] + [7] ./async3.js 80 bytes {0} [built] +chunk {1} async1.js (async1) 89 bytes <{0}> <{3}> >{2}< [rendered] + [2] ./d.js 9 bytes {1} {3} [built] + [5] ./async1.js 80 bytes {1} [built] +chunk {2} async2.js (async2) 89 bytes <{1}> <{4}> >{0}< [rendered] + [3] ./f.js 9 bytes {2} {4} [built] + [6] ./async2.js 80 bytes {2} [built] +chunk {3} e1.js (e1) 144 bytes >{1}< [entry] [rendered] + [0] ./b.js 9 bytes {3} {4} {5} [built] + [1] ./a.js 9 bytes {3} {4} {5} [built] + [2] ./d.js 9 bytes {1} {3} [built] + [8] ./e1.js 108 bytes {3} [built] + [9] ./c.js 9 bytes {3} [built] +chunk {4} e2.js (e2) 144 bytes >{2}< [entry] [rendered] + [0] ./b.js 9 bytes {3} {4} {5} [built] + [1] ./a.js 9 bytes {3} {4} {5} [built] + [3] ./f.js 9 bytes {2} {4} [built] + [10] ./e2.js 108 bytes {4} [built] + [11] ./e.js 9 bytes {4} [built] +chunk {5} e3.js (e3) 144 bytes >{0}< [entry] [rendered] + [0] ./b.js 9 bytes {3} {4} {5} [built] + [1] ./a.js 9 bytes {3} {4} {5} [built] + [4] ./h.js 9 bytes {0} {5} [built] + [12] ./e3.js 108 bytes {5} [built] + [13] ./g.js 9 bytes {5} [built]" +`; + +exports[`StatsTestCases should print correct stats for module-trace-disabled-in-error 1`] = ` +"Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names +main.js 3.75 KiB 0 main +Entrypoint main = main.js +[0] ./index.js 25 bytes {0} [built] + +ERROR in ./index.js +Module not found: Error: Can't resolve 'does-not-exist' in 'Xdir/module-trace-disabled-in-error'" +`; + +exports[`StatsTestCases should print correct stats for module-trace-enabled-in-error 1`] = ` +"Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names +main.js 3.75 KiB 0 main +Entrypoint main = main.js +[0] ./index.js 25 bytes {0} [built] + +ERROR in ./index.js +Module not found: Error: Can't resolve 'does-not-exist' in 'Xdir/module-trace-enabled-in-error' + @ ./index.js 1:0-25" +`; + +exports[`StatsTestCases should print correct stats for named-chunk-groups 1`] = ` +"Child + Chunk Group main = main.js + Chunk Group async-a = async-a~async-b.js async-a.js + Chunk Group async-b = async-a~async-b.js async-b.js + Chunk Group async-c = vendors.js async-c.js + chunk {0} async-a~async-b.js (async-a~async-b) 133 bytes <{5}> ={1}= ={2}= [rendered] split chunk (cache group: default) (name: async-a~async-b) + > ./a [6] ./index.js 1:0-47 + > ./b [6] ./index.js 2:0-47 + [0] ./shared.js 133 bytes {0} [built] + chunk {1} async-a.js (async-a) 40 bytes <{5}> ={0}= [rendered] + > ./a [6] ./index.js 1:0-47 + [3] ./a.js 40 bytes {1} [built] + chunk {2} async-b.js (async-b) 40 bytes <{5}> ={0}= [rendered] + > ./b [6] ./index.js 2:0-47 + [4] ./b.js 40 bytes {2} [built] + chunk {3} async-c.js (async-c) 45 bytes <{5}> ={4}= [rendered] + > ./c [6] ./index.js 3:0-47 + [5] ./c.js 45 bytes {3} [built] + chunk {4} vendors.js (vendors) 40 bytes <{5}> ={3}= [rendered] split chunk (cache group: vendors) (name: vendors) + > ./c [6] ./index.js 3:0-47 + [1] ./node_modules/x.js 20 bytes {4} [built] + [2] ./node_modules/y.js 20 bytes {4} [built] + chunk {5} main.js (main) 146 bytes >{0}< >{1}< >{2}< >{3}< >{4}< [entry] [rendered] + > ./ main + [6] ./index.js 146 bytes {5} [built] +Child + Entrypoint main = main.js + Chunk Group async-a = async-a~async-b.js async-a.js + Chunk Group async-b = async-a~async-b.js async-b.js + Chunk Group async-c = vendors.js async-c.js + chunk {0} async-a~async-b.js (async-a~async-b) 133 bytes <{5}> ={1}= ={2}= [rendered] split chunk (cache group: default) (name: async-a~async-b) + > ./a [6] ./index.js 1:0-47 + > ./b [6] ./index.js 2:0-47 + [0] ./shared.js 133 bytes {0} [built] + chunk {1} async-a.js (async-a) 40 bytes <{5}> ={0}= [rendered] + > ./a [6] ./index.js 1:0-47 + [3] ./a.js 40 bytes {1} [built] + chunk {2} async-b.js (async-b) 40 bytes <{5}> ={0}= [rendered] + > ./b [6] ./index.js 2:0-47 + [4] ./b.js 40 bytes {2} [built] + chunk {3} async-c.js (async-c) 45 bytes <{5}> ={4}= [rendered] + > ./c [6] ./index.js 3:0-47 + [5] ./c.js 45 bytes {3} [built] + chunk {4} vendors.js (vendors) 40 bytes <{5}> ={3}= [rendered] split chunk (cache group: vendors) (name: vendors) + > ./c [6] ./index.js 3:0-47 + [1] ./node_modules/x.js 20 bytes {4} [built] + [2] ./node_modules/y.js 20 bytes {4} [built] + chunk {5} main.js (main) 146 bytes >{0}< >{1}< >{2}< >{3}< >{4}< [entry] [rendered] + > ./ main + [6] ./index.js 146 bytes {5} [built]" +`; + +exports[`StatsTestCases should print correct stats for named-chunks-plugin 1`] = ` +"Hash: ae58e4539a3d3b521cc7 +Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + entry.js 6.45 KiB entry [emitted] entry +vendor.js 269 bytes vendor [emitted] vendor +Entrypoint entry = vendor.js entry.js +[./entry.js] 72 bytes {entry} [built] +[./modules/a.js] 22 bytes {vendor} [built] +[./modules/b.js] 22 bytes {vendor} [built] +[./modules/c.js] 22 bytes {entry} [built]" +`; + +exports[`StatsTestCases should print correct stats for named-chunks-plugin-async 1`] = ` +"Hash: b6aa15eeabc33e889828 +Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names +chunk-containing-__a_js.js 313 bytes chunk-containing-__a_js [emitted] +chunk-containing-__b_js.js 173 bytes chunk-containing-__b_js [emitted] + entry.js 8.18 KiB entry [emitted] entry +Entrypoint entry = entry.js +[0] ./modules/b.js 22 bytes {chunk-containing-__b_js} [built] +[1] ./modules/a.js 37 bytes {chunk-containing-__a_js} [built] +[2] ./entry.js 47 bytes {entry} [built]" +`; + +exports[`StatsTestCases should print correct stats for no-emit-on-errors-plugin-with-child-error 1`] = ` +"Hash: 6a246e5dec75240f30bf +Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + child.js 3.57 KiB +bundle.js 3.57 KiB 0 main +Entrypoint main = bundle.js +[0] ./index.js 0 bytes {0} [built] + +WARNING in configuration +The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment. +You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/concepts/mode/ +Child child: + Asset Size Chunks Chunk Names + child.js 3.57 KiB 0 child + Entrypoint child = child.js + [0] ./index.js 0 bytes {0} [built] + + ERROR in forced error" +`; + +exports[`StatsTestCases should print correct stats for optimize-chunks 1`] = ` +"Hash: c52867ded6f77bcf50cc +Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + cir1.js 299 bytes 0 [emitted] cir1 + ab.js 183 bytes 1 [emitted] ab + abd.js 277 bytes 2, 1 [emitted] abd + cir2.js 299 bytes 3 [emitted] cir2 + main.js 9.09 KiB 4 [emitted] main +cir2 from cir1.js 359 bytes 5, 3 [emitted] cir2 from cir1 + chunk.js 190 bytes 6, 7 [emitted] chunk + ac in ab.js 130 bytes 7 [emitted] ac in ab +Entrypoint main = main.js +chunk {0} cir1.js (cir1) 81 bytes <{3}> <{4}> >{5}< [rendered] + > [3] ./circular2.js 1:0-79 + > [3] ./circular2.js 1:0-79 + > [8] ./index.js 13:0-54 + [2] ./circular1.js 81 bytes {0} [built] +chunk {1} ab.js (ab) 0 bytes <{4}> >{7}< [rendered] + > [8] ./index.js 1:0-6:8 + [0] ./modules/a.js 0 bytes {1} {2} [built] + [1] ./modules/b.js 0 bytes {1} {2} [built] +chunk {2} abd.js (abd) 0 bytes <{4}> >{6}< [rendered] + > [8] ./index.js 8:0-11:9 + [0] ./modules/a.js 0 bytes {1} {2} [built] + [1] ./modules/b.js 0 bytes {1} {2} [built] + [6] ./modules/d.js 0 bytes {2} {6} [built] +chunk {3} cir2.js (cir2) 81 bytes <{4}> >{0}< [rendered] + > [8] ./index.js 14:0-54 + [3] ./circular2.js 81 bytes {3} {5} [built] +chunk {4} main.js (main) 523 bytes >{0}< >{1}< >{2}< >{3}< [entry] [rendered] + > ./index main + [4] ./modules/f.js 0 bytes {4} [built] + [8] ./index.js 523 bytes {4} [built] +chunk {5} cir2 from cir1.js (cir2 from cir1) 81 bytes <{0}> [rendered] + > [2] ./circular1.js 1:0-79 + > [2] ./circular1.js 1:0-79 + [3] ./circular2.js 81 bytes {3} {5} [built] + [7] ./modules/e.js 0 bytes {5} [built] +chunk {6} chunk.js (chunk) 0 bytes <{2}> <{7}> [rendered] + > [8] ./index.js 3:2-4:13 + > [8] ./index.js 9:1-10:12 + [5] ./modules/c.js 0 bytes {6} {7} [built] + [6] ./modules/d.js 0 bytes {2} {6} [built] +chunk {7} ac in ab.js (ac in ab) 0 bytes <{1}> >{6}< [rendered] + > [8] ./index.js 2:1-5:15 + [5] ./modules/c.js 0 bytes {6} {7} [built]" +`; + +exports[`StatsTestCases should print correct stats for parse-error 1`] = ` +" Asset Size Chunks Chunk Names +main.js 4.01 KiB 0 main +Entrypoint main = main.js +[0] ./b.js 169 bytes {0} [built] [failed] [1 error] +[1] ./index.js + 1 modules 35 bytes {0} [built] + | ./index.js 15 bytes [built] + | ./a.js 15 bytes [built] + +ERROR in ./b.js 6:7 +Module parse failed: Unexpected token (6:7) +You may need an appropriate loader to handle this file type. +| includes +| a +> parser ) +| error +| in + @ ./a.js 2:0-13 + @ ./index.js" +`; + +exports[`StatsTestCases should print correct stats for performance-different-mode-and-target 1`] = ` +"Hash: b27a7019f90a13ead012bb84b396eb1e98365d94fb930f6aa3329ab03a278deb0030bfebe86abb37a1cddcae25eb52f3112b62c8b61bc84829d26b13ae06efe5f0099a11af36 +Child + Hash: b27a7019f90a13ead012 + Time: Xms + Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + warning.pro-web.js 297 KiB 0 [emitted] [big] main + Entrypoint main [big] = warning.pro-web.js + [0] ./index.js 293 KiB {0} [built] + + WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB). + This can impact web performance. + Assets: + warning.pro-web.js (297 KiB) + + WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance. + Entrypoints: + main (297 KiB) + warning.pro-web.js + + + WARNING in webpack performance recommendations: + You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application. + For more info visit https://webpack.js.org/guides/code-splitting/ +Child + Hash: bb84b396eb1e98365d94 + Time: Xms + Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + warning.pro-webworker.js 297 KiB 0 [emitted] [big] main + Entrypoint main [big] = warning.pro-webworker.js + [0] ./index.js 293 KiB {0} [built] + + WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB). + This can impact web performance. + Assets: + warning.pro-webworker.js (297 KiB) + + WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance. + Entrypoints: + main (297 KiB) + warning.pro-webworker.js + + + WARNING in webpack performance recommendations: + You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application. + For more info visit https://webpack.js.org/guides/code-splitting/ +Child + Hash: fb930f6aa3329ab03a27 + Time: Xms + Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + no-warning.pro-node.js 297 KiB 0 [emitted] main + Entrypoint main = no-warning.pro-node.js + [0] ./index.js 293 KiB {0} [built] +Child + Hash: 8deb0030bfebe86abb37 + Time: Xms + Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + no-warning.dev-web.js 1.72 MiB main [emitted] main + Entrypoint main = no-warning.dev-web.js + [./index.js] 293 KiB {main} [built] +Child + Hash: a1cddcae25eb52f3112b + Time: Xms + Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + no-warning.dev-node.js 1.72 MiB main [emitted] main + Entrypoint main = no-warning.dev-node.js + [./index.js] 293 KiB {main} [built] +Child + Hash: 62c8b61bc84829d26b13 + Time: Xms + Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + no-warning.dev-web-with-limit-set.js 1.72 MiB main [emitted] [big] main + Entrypoint main [big] = no-warning.dev-web-with-limit-set.js + [./index.js] 293 KiB {main} [built] +Child + Hash: ae06efe5f0099a11af36 + Time: Xms + Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + warning.pro-node-with-hints-set.js 297 KiB 0 [emitted] [big] main + Entrypoint main [big] = warning.pro-node-with-hints-set.js + [0] ./index.js 293 KiB {0} [built] + + WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB). + This can impact web performance. + Assets: + warning.pro-node-with-hints-set.js (297 KiB) + + WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance. + Entrypoints: + main (297 KiB) + warning.pro-node-with-hints-set.js + + + WARNING in webpack performance recommendations: + You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application. + For more info visit https://webpack.js.org/guides/code-splitting/" +`; + +exports[`StatsTestCases should print correct stats for performance-disabled 1`] = ` +"Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + 0.js 152 bytes 0 [emitted] + 1.js 289 bytes 1 [emitted] +main.js 301 KiB 2 [emitted] main + 3.js 227 bytes 3 [emitted] +Entrypoint main = main.js +[0] ./d.js 22 bytes {3} [built] +[1] ./e.js 22 bytes {3} [built] +[2] ./b.js 22 bytes {0} [built] +[3] ./c.js 54 bytes {1} [built] +[4] ./index.js 52 bytes {2} [built] +[5] ./a.js 293 KiB {2} [built]" +`; + +exports[`StatsTestCases should print correct stats for performance-error 1`] = ` +"Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + 0.js 152 bytes 0 [emitted] + 1.js 289 bytes 1 [emitted] +main.js 301 KiB 2 [emitted] [big] main + 3.js 227 bytes 3 [emitted] +Entrypoint main [big] = main.js +[0] ./d.js 22 bytes {3} [built] +[1] ./e.js 22 bytes {3} [built] +[2] ./b.js 22 bytes {0} [built] +[3] ./c.js 54 bytes {1} [built] +[4] ./index.js 52 bytes {2} [built] +[5] ./a.js 293 KiB {2} [built] + +ERROR in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB). +This can impact web performance. +Assets: + main.js (301 KiB) + +ERROR in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance. +Entrypoints: + main (301 KiB) + main.js +" +`; + +exports[`StatsTestCases should print correct stats for performance-no-async-chunks-shown 1`] = ` +"Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names +main.js 297 KiB 0 [emitted] [big] main + sec.js 3.91 KiB 1 [emitted] sec +Entrypoint main [big] = main.js +Entrypoint sec = sec.js +[0] ./b.js 22 bytes {0} {1} [built] +[1] ./index.js 32 bytes {0} [built] +[2] ./a.js 293 KiB {0} [built] +[3] ./index2.js 48 bytes {1} [built] +[4] ./c.js 22 bytes {1} [built] +[5] ./d.js 22 bytes {1} [built] + +WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB). +This can impact web performance. +Assets: + main.js (297 KiB) + +WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance. +Entrypoints: + main (297 KiB) + main.js + + +WARNING in webpack performance recommendations: +You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application. +For more info visit https://webpack.js.org/guides/code-splitting/" +`; + +exports[`StatsTestCases should print correct stats for performance-no-hints 1`] = ` +"Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + 0.js 152 bytes 0 [emitted] + 1.js 289 bytes 1 [emitted] +main.js 301 KiB 2 [emitted] [big] main + 3.js 227 bytes 3 [emitted] +Entrypoint main [big] = main.js +[0] ./d.js 22 bytes {3} [built] +[1] ./e.js 22 bytes {3} [built] +[2] ./b.js 22 bytes {0} [built] +[3] ./c.js 54 bytes {1} [built] +[4] ./index.js 52 bytes {2} [built] +[5] ./a.js 293 KiB {2} [built]" +`; + +exports[`StatsTestCases should print correct stats for performance-oversize-limit-error 1`] = ` +"Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names +main.js 297 KiB 0 [emitted] [big] main + sec.js 297 KiB 1 [emitted] [big] sec +Entrypoint main [big] = main.js +Entrypoint sec [big] = sec.js +[0] ./a.js 293 KiB {0} {1} [built] +[1] ./index.js 16 bytes {0} [built] +[2] ./index2.js 16 bytes {1} [built] + +ERROR in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB). +This can impact web performance. +Assets: + main.js (297 KiB) + sec.js (297 KiB) + +ERROR in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance. +Entrypoints: + main (297 KiB) + main.js + sec (297 KiB) + sec.js + + +ERROR in webpack performance recommendations: +You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application. +For more info visit https://webpack.js.org/guides/code-splitting/" +`; + +exports[`StatsTestCases should print correct stats for prefetch 1`] = ` +" Asset Size Chunks Chunk Names + prefetched.js 475 bytes 0 [emitted] prefetched + normal.js 130 bytes 1 [emitted] normal +prefetched2.js 127 bytes 2 [emitted] prefetched2 +prefetched3.js 130 bytes 3 [emitted] prefetched3 + main.js 9.66 KiB 4 [emitted] main + inner.js 136 bytes 5 [emitted] inner + inner2.js 201 bytes 6 [emitted] inner2 +Entrypoint main = main.js (prefetch: prefetched2.js prefetched.js prefetched3.js) +chunk {0} prefetched.js (prefetched) 228 bytes <{4}> >{5}< >{6}< (prefetch: {6} {5}) [rendered] +chunk {1} normal.js (normal) 0 bytes <{4}> [rendered] +chunk {2} prefetched2.js (prefetched2) 0 bytes <{4}> [rendered] +chunk {3} prefetched3.js (prefetched3) 0 bytes <{4}> [rendered] +chunk {4} main.js (main) 436 bytes >{0}< >{1}< >{2}< >{3}< (prefetch: {2} {0} {3}) [entry] [rendered] +chunk {5} inner.js (inner) 0 bytes <{0}> [rendered] +chunk {6} inner2.js (inner2) 0 bytes <{0}> [rendered]" +`; + +exports[`StatsTestCases should print correct stats for prefetch-preload-mixed 1`] = ` +"chunk {0} a.js (a) 136 bytes <{3}> >{10}< >{9}< (prefetch: {9} {10}) [rendered] +chunk {1} b.js (b) 203 bytes <{3}> >{6}< >{7}< >{8}< (prefetch: {6} {8}) (preload: {7}) [rendered] +chunk {2} c.js (c) 134 bytes <{3}> >{4}< >{5}< (preload: {4} {5}) [rendered] +chunk {3} main.js (main) 195 bytes >{0}< >{1}< >{2}< (prefetch: {0} {1} {2}) [entry] [rendered] +chunk {4} c1.js (c1) 0 bytes <{2}> [rendered] +chunk {5} c2.js (c2) 0 bytes <{2}> [rendered] +chunk {6} b1.js (b1) 0 bytes <{1}> [rendered] +chunk {7} b2.js (b2) 0 bytes <{1}> [rendered] +chunk {8} b3.js (b3) 0 bytes <{1}> [rendered] +chunk {9} a1.js (a1) 0 bytes <{0}> [rendered] +chunk {10} a2.js (a2) 0 bytes <{0}> [rendered]" +`; + +exports[`StatsTestCases should print correct stats for preload 1`] = ` +" Asset Size Chunks Chunk Names + preloaded.js 467 bytes 0 [emitted] preloaded + normal.js 130 bytes 1 [emitted] normal +preloaded2.js 127 bytes 2 [emitted] preloaded2 +preloaded3.js 130 bytes 3 [emitted] preloaded3 + main.js 9.87 KiB 4 [emitted] main + inner.js 136 bytes 5 [emitted] inner + inner2.js 201 bytes 6 [emitted] inner2 +Entrypoint main = main.js (preload: preloaded2.js preloaded.js preloaded3.js) +chunk {0} preloaded.js (preloaded) 226 bytes <{4}> >{5}< >{6}< (preload: {6} {5}) [rendered] +chunk {1} normal.js (normal) 0 bytes <{4}> [rendered] +chunk {2} preloaded2.js (preloaded2) 0 bytes <{4}> [rendered] +chunk {3} preloaded3.js (preloaded3) 0 bytes <{4}> [rendered] +chunk {4} main.js (main) 424 bytes >{0}< >{1}< >{2}< >{3}< (preload: {2} {0} {3}) [entry] [rendered] +chunk {5} inner.js (inner) 0 bytes <{0}> [rendered] +chunk {6} inner2.js (inner2) 0 bytes <{0}> [rendered]" +`; + +exports[`StatsTestCases should print correct stats for preset-detailed 1`] = ` +"Hash: 2eb3274d0272da6a7a14 +Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + 0.js 152 bytes 0 [emitted] + 1.js 289 bytes 1 [emitted] +main.js 8.29 KiB 2 [emitted] main + 3.js 227 bytes 3 [emitted] +Entrypoint main = main.js +chunk {0} 0.js 22 bytes <{2}> [rendered] + > ./b [4] ./index.js 2:0-16 +chunk {1} 1.js 54 bytes <{2}> >{3}< [rendered] + > ./c [4] ./index.js 3:0-16 +chunk {2} main.js (main) 73 bytes >{0}< >{1}< [entry] [rendered] + > ./index main +chunk {3} 3.js 44 bytes <{1}> [rendered] + > [3] ./c.js 1:0-52 +[0] ./d.js 22 bytes {3} [depth 2] [built] + ModuleConcatenation bailout: Module is not an ECMAScript module +[1] ./e.js 22 bytes {3} [depth 2] [built] + ModuleConcatenation bailout: Module is not an ECMAScript module +[2] ./b.js 22 bytes {0} [depth 1] [built] + ModuleConcatenation bailout: Module is not an ECMAScript module +[3] ./c.js 54 bytes {1} [depth 1] [built] + ModuleConcatenation bailout: Module is not an ECMAScript module +[4] ./index.js 51 bytes {2} [depth 0] [built] + ModuleConcatenation bailout: Module is not an ECMAScript module +[5] ./a.js 22 bytes {2} [depth 1] [built] + ModuleConcatenation bailout: Module is not an ECMAScript module" +`; + +exports[`StatsTestCases should print correct stats for preset-errors-only 1`] = `""`; + +exports[`StatsTestCases should print correct stats for preset-errors-only-error 1`] = ` +" +ERROR in ./index.js +Module not found: Error: Can't resolve 'does-not-exist' in 'Xdir/preset-errors-only-error' + @ ./index.js 1:0-25" +`; + +exports[`StatsTestCases should print correct stats for preset-minimal 1`] = `" 6 modules"`; + +exports[`StatsTestCases should print correct stats for preset-minimal-simple 1`] = `" 1 module"`; + +exports[`StatsTestCases should print correct stats for preset-mixed-array 1`] = ` +"Child minimal: + 1 module +Child verbose: + Entrypoint main = main.js + [0] ./index.js 8 bytes {0} [built]" +`; + +exports[`StatsTestCases should print correct stats for preset-none 1`] = `""`; + +exports[`StatsTestCases should print correct stats for preset-none-array 1`] = `""`; + +exports[`StatsTestCases should print correct stats for preset-none-error 1`] = `""`; + +exports[`StatsTestCases should print correct stats for preset-normal 1`] = ` +"Hash: 2eb3274d0272da6a7a14 +Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + 0.js 152 bytes 0 [emitted] + 1.js 289 bytes 1 [emitted] +main.js 8.29 KiB 2 [emitted] main + 3.js 227 bytes 3 [emitted] +Entrypoint main = main.js +[0] ./d.js 22 bytes {3} [built] +[1] ./e.js 22 bytes {3} [built] +[2] ./b.js 22 bytes {0} [built] +[3] ./c.js 54 bytes {1} [built] +[4] ./index.js 51 bytes {2} [built] +[5] ./a.js 22 bytes {2} [built]" +`; + +exports[`StatsTestCases should print correct stats for preset-normal-performance 1`] = ` +"Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + 0.js 152 bytes 0 [emitted] + 1.js 289 bytes 1 [emitted] +main.js 301 KiB 2 [emitted] [big] main + 3.js 227 bytes 3 [emitted] +Entrypoint main [big] = main.js +[0] ./d.js 22 bytes {3} [built] +[1] ./e.js 22 bytes {3} [built] +[2] ./b.js 22 bytes {0} [built] +[3] ./c.js 54 bytes {1} [built] +[4] ./index.js 52 bytes {2} [built] +[5] ./a.js 293 KiB {2} [built] + +WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB). +This can impact web performance. +Assets: + main.js (301 KiB) + +WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance. +Entrypoints: + main (301 KiB) + main.js +" +`; + +exports[`StatsTestCases should print correct stats for preset-normal-performance-ensure-filter-sourcemaps 1`] = ` +"Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + 0.js 182 bytes 0 [emitted] + 1.js 319 bytes 1 [emitted] + main.js 301 KiB 2 [emitted] [big] main + 3.js 257 bytes 3 [emitted] + 0.js.map 156 bytes 0 [emitted] + 1.js.map 197 bytes 1 [emitted] +main.js.map 1.72 MiB 2 [emitted] main + 3.js.map 214 bytes 3 [emitted] +Entrypoint main [big] = main.js main.js.map +[0] ./d.js 22 bytes {3} [built] +[1] ./e.js 22 bytes {3} [built] +[2] ./b.js 22 bytes {0} [built] +[3] ./c.js 54 bytes {1} [built] +[4] ./index.js 52 bytes {2} [built] +[5] ./a.js 293 KiB {2} [built] + +WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB). +This can impact web performance. +Assets: + main.js (301 KiB) + +WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance. +Entrypoints: + main (301 KiB) + main.js +" +`; + +exports[`StatsTestCases should print correct stats for preset-verbose 1`] = ` +"Hash: 2eb3274d0272da6a7a14 +Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + 0.js 152 bytes 0 [emitted] + 1.js 289 bytes 1 [emitted] +main.js 8.29 KiB 2 [emitted] main + 3.js 227 bytes 3 [emitted] +Entrypoint main = main.js +chunk {0} 0.js 22 bytes <{2}> [rendered] + > ./b [4] ./index.js 2:0-16 + [2] ./b.js 22 bytes {0} [depth 1] [built] + ModuleConcatenation bailout: Module is not an ECMAScript module + amd require ./b [4] ./index.js 2:0-16 + [4] Xms -> factory:Xms building:Xms = Xms +chunk {1} 1.js 54 bytes <{2}> >{3}< [rendered] + > ./c [4] ./index.js 3:0-16 + [3] ./c.js 54 bytes {1} [depth 1] [built] + ModuleConcatenation bailout: Module is not an ECMAScript module + amd require ./c [4] ./index.js 3:0-16 + [4] Xms -> factory:Xms building:Xms = Xms +chunk {2} main.js (main) 73 bytes >{0}< >{1}< [entry] [rendered] + > ./index main + [4] ./index.js 51 bytes {2} [depth 0] [built] + ModuleConcatenation bailout: Module is not an ECMAScript module + single entry ./index main + factory:Xms building:Xms = Xms + [5] ./a.js 22 bytes {2} [depth 1] [built] + ModuleConcatenation bailout: Module is not an ECMAScript module + cjs require ./a [4] ./index.js 1:0-14 + [4] Xms -> factory:Xms building:Xms = Xms +chunk {3} 3.js 44 bytes <{1}> [rendered] + > [3] ./c.js 1:0-52 + [0] ./d.js 22 bytes {3} [depth 2] [built] + ModuleConcatenation bailout: Module is not an ECMAScript module + require.ensure item ./d [3] ./c.js 1:0-52 + [4] Xms -> [3] Xms -> factory:Xms building:Xms = Xms + [1] ./e.js 22 bytes {3} [depth 2] [built] + ModuleConcatenation bailout: Module is not an ECMAScript module + require.ensure item ./e [3] ./c.js 1:0-52 + [4] Xms -> [3] Xms -> factory:Xms building:Xms = Xms" +`; + +exports[`StatsTestCases should print correct stats for resolve-plugin-context 1`] = ` +"Hash: f866085f4874b382c7c6 +Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names +bundle.js 3.97 KiB 0 [emitted] main +Entrypoint main = bundle.js +[0] ./node_modules/xyz/index.js 0 bytes {0} [built] +[1] ./index.js 48 bytes {0} [built] +[2] ./node_modules/abc/index.js 16 bytes {0} [built] +[3] ./node_modules/def/index.js 16 bytes {0} [built] +[4] ./node_modules/def/node_modules/xyz/index.js 0 bytes {0} [built]" +`; + +exports[`StatsTestCases should print correct stats for reverse-sort-modules 1`] = ` +"Hash: 8e1f6d7b7886c5f4617d +Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names +main.js 6.81 KiB 0 [emitted] main +Entrypoint main = main.js +[29] ./c.js?10 33 bytes {0} [built] +[27] ./c.js?9 33 bytes {0} [built] +[25] ./c.js?8 33 bytes {0} [built] +[23] ./c.js?7 33 bytes {0} [built] +[19] ./c.js?5 33 bytes {0} [built] +[17] ./c.js?4 33 bytes {0} [built] +[15] ./c.js?3 33 bytes {0} [built] +[13] ./c.js?2 33 bytes {0} [built] +[11] ./c.js?1 33 bytes {0} [built] +[10] ./index.js 181 bytes {0} [built] + [9] ./a.js?10 33 bytes {0} [built] + [8] ./a.js?9 33 bytes {0} [built] + [7] ./a.js?8 33 bytes {0} [built] + [6] ./a.js?7 33 bytes {0} [built] + [5] ./a.js?6 33 bytes {0} [built] + [4] ./a.js?5 33 bytes {0} [built] + [3] ./a.js?4 33 bytes {0} [built] + [2] ./a.js?3 33 bytes {0} [built] + [1] ./a.js?2 33 bytes {0} [built] + [0] ./a.js?1 33 bytes {0} [built] + + 11 hidden modules" +`; + +exports[`StatsTestCases should print correct stats for runtime-chunk 1`] = ` +"Entrypoint e1 = runtime~e1.js e1.js +Entrypoint e2 = runtime~e2.js e2.js" +`; + +exports[`StatsTestCases should print correct stats for runtime-chunk-integration 1`] = ` +"Child base: + Asset Size Chunks Chunk Names + 0.js 719 bytes 0 [emitted] + main1.js 542 bytes 1 [emitted] main1 + runtime.js 8.75 KiB 2 [emitted] runtime + Entrypoint main1 = runtime.js main1.js + [0] ./b.js 20 bytes {0} [built] + [1] ./c.js 20 bytes {0} [built] + [2] ./d.js 20 bytes {0} [built] + [3] ./main1.js 66 bytes {1} [built] +Child manifest is named entry: + Asset Size Chunks Chunk Names + 0.js 719 bytes 0 [emitted] + manifest.js 9.06 KiB 1 [emitted] manifest + main1.js 542 bytes 2 [emitted] main1 + Entrypoint main1 = manifest.js main1.js + Entrypoint manifest = manifest.js + [0] ./b.js 20 bytes {0} [built] + [1] ./c.js 20 bytes {0} [built] + [2] ./d.js 20 bytes {0} [built] + [3] ./main1.js 66 bytes {2} [built] + [4] ./f.js 20 bytes {1} [built]" +`; + +exports[`StatsTestCases should print correct stats for runtime-chunk-issue-7382 1`] = ` +"Entrypoint e1 = runtime.js all.js e1.js +Entrypoint e2 = runtime.js all.js e2.js" +`; + +exports[`StatsTestCases should print correct stats for runtime-chunk-single 1`] = ` +"Entrypoint e1 = runtime.js e1.js +Entrypoint e2 = runtime.js e2.js" +`; + +exports[`StatsTestCases should print correct stats for scope-hoisting-bailouts 1`] = ` +"Hash: df49e15bdf57c432360e +Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT +Entrypoint index = index.js +Entrypoint entry = entry.js +[0] ./entry.js 32 bytes {1} {2} [built] + ModuleConcatenation bailout: Module is an entry point +[1] ./ref-from-cjs.js 45 bytes {1} [built] + ModuleConcatenation bailout: Module is referenced from these modules with unsupported syntax: ./cjs.js (referenced with cjs require) +[2] external \\"external\\" 42 bytes {1} [built] + ModuleConcatenation bailout: Module is not an ECMAScript module +[3] ./concatenated.js + 2 modules 116 bytes {0} [built] + ModuleConcatenation bailout: Cannot concat with external \\"external\\" (<- Module is not an ECMAScript module) + | ./concatenated.js 26 bytes [built] + | ModuleConcatenation bailout: Module is referenced from these modules with unsupported syntax: ./index.js (referenced with import()) + | ./concatenated1.js 37 bytes [built] + | ./concatenated2.js 48 bytes [built] +[4] ./index.js 176 bytes {1} [built] + ModuleConcatenation bailout: Module is an entry point +[5] ./cjs.js 59 bytes {1} [built] + ModuleConcatenation bailout: Module is not an ECMAScript module +[6] ./eval.js 35 bytes {1} [built] + ModuleConcatenation bailout: Module uses eval() +[7] ./injected-vars.js 40 bytes {1} [built] + ModuleConcatenation bailout: Module uses injected variables (__dirname, __filename) +[8] ./module-id.js 26 bytes {1} [built] + ModuleConcatenation bailout: Module uses module.id +[9] ./module-loaded.js 30 bytes {1} [built] + ModuleConcatenation bailout: Module uses module.loaded" +`; + +exports[`StatsTestCases should print correct stats for scope-hoisting-multi 1`] = ` +"Hash: f47bea8ea571296b32b82a4cd6b69820dd6e8c36 +Child + Hash: f47bea8ea571296b32b8 + Time: Xms + Built at: Thu Jan 01 1970 00:00:00 GMT + Entrypoint first = vendor.js first.js + Entrypoint second = vendor.js second.js + [0] ./common_lazy_shared.js 25 bytes {0} {1} {2} [built] + [1] ./common2.js 25 bytes {4} {5} [built] + [2] ./common_lazy.js 25 bytes {1} {2} [built] + [3] ./common.js 37 bytes {4} {5} [built] + [4] ./lazy_shared.js 31 bytes {0} [built] + [5] ./vendor.js 25 bytes {3} [built] + [6] ./lazy_first.js 55 bytes {2} [built] + [7] ./lazy_second.js 55 bytes {1} [built] + [8] ./first.js 207 bytes {4} [built] + [9] ./module_first.js 31 bytes {4} [built] + [10] ./second.js 177 bytes {5} [built] +Child + Hash: 2a4cd6b69820dd6e8c36 + Time: Xms + Built at: Thu Jan 01 1970 00:00:00 GMT + Entrypoint first = vendor.js first.js + Entrypoint second = vendor.js second.js + [0] ./common_lazy_shared.js 25 bytes {0} {1} {2} [built] + [1] ./common_lazy.js 25 bytes {1} {2} [built] + [2] ./common.js + 1 modules 62 bytes {4} {5} [built] + | ./common.js 37 bytes [built] + | ./common2.js 25 bytes [built] + [3] ./vendor.js 25 bytes {3} [built] + [4] ./lazy_shared.js 31 bytes {0} [built] + ModuleConcatenation bailout: Module is referenced from these modules with unsupported syntax: ./first.js (referenced with import()), ./second.js (referenced with import()) + [5] ./lazy_second.js 55 bytes {1} [built] + ModuleConcatenation bailout: Module is referenced from these modules with unsupported syntax: ./second.js (referenced with import()) + [6] ./second.js 177 bytes {5} [built] + ModuleConcatenation bailout: Module is an entry point + [7] ./first.js + 1 modules 248 bytes {4} [built] + ModuleConcatenation bailout: Cannot concat with ./common.js + ModuleConcatenation bailout: Cannot concat with ./vendor.js + | ./first.js 207 bytes [built] + | ModuleConcatenation bailout: Module is an entry point + | ./module_first.js 31 bytes [built] + [8] ./lazy_first.js 55 bytes {2} [built] + ModuleConcatenation bailout: Module is referenced from these modules with unsupported syntax: ./first.js (referenced with import())" +`; + +exports[`StatsTestCases should print correct stats for side-effects-issue-7428 1`] = ` +"Hash: b1ef68bcfacb3ad18417 +Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names + 0.js 481 bytes 0 [emitted] +main.js 9.32 KiB 1 [emitted] main +Entrypoint main = main.js +[0] ./components/src/CompAB/utils.js 97 bytes {1} [built] + harmony side effect evaluation ./utils [1] ./main.js + 1 modules 1:0-30 + harmony import specifier ./utils [1] ./main.js + 1 modules 5:2-5 + harmony side effect evaluation ./utils [4] ./components/src/CompAB/CompA.js 1:0-35 + harmony import specifier ./utils [4] ./components/src/CompAB/CompA.js 5:5-12 +[1] ./main.js + 1 modules 231 bytes {1} [built] + single entry ./main.js main + | ./main.js 144 bytes [built] + | single entry ./main.js main + | ./components/src/CompAB/CompB.js 77 bytes [built] + | [only some exports used: default] + | harmony import specifier ./components ./main.js 4:15-20 (skipped side-effect-free modules) + | harmony side effect evaluation ./CompB [7] ./components/src/CompAB/index.js 2:0-43 + | harmony export imported specifier ./CompB [7] ./components/src/CompAB/index.js 2:0-43 +[2] ./components/src/index.js 84 bytes [built] + [no exports used] + harmony side effect evaluation ./components [1] ./main.js + 1 modules 1:0-44 + harmony side effect evaluation ./components [3] ./foo.js 1:0-37 +[3] ./foo.js 101 bytes {0} [built] + import() ./foo ./main.js 6:0-15 +[4] ./components/src/CompAB/CompA.js 89 bytes {1} [built] + [only some exports used: default] + harmony import specifier ./components ./main.js 3:15-20 (skipped side-effect-free modules) + harmony import specifier ./components [3] ./foo.js 3:20-25 (skipped side-effect-free modules) + harmony side effect evaluation ./CompA [7] ./components/src/CompAB/index.js 1:0-43 + harmony export imported specifier ./CompA [7] ./components/src/CompAB/index.js 1:0-43 +[5] ./components/src/CompC/CompC.js 33 bytes [built] + [no exports used] + harmony side effect evaluation ./CompC [6] ./components/src/CompC/index.js 1:0-34 + harmony export imported specifier ./CompC [6] ./components/src/CompC/index.js 1:0-34 +[6] ./components/src/CompC/index.js 34 bytes [built] + [no exports used] + harmony side effect evaluation ./CompC [2] ./components/src/index.js 2:0-43 + harmony export imported specifier ./CompC [2] ./components/src/index.js 2:0-43 +[7] ./components/src/CompAB/index.js 87 bytes [built] + [no exports used] + harmony side effect evaluation ./CompAB [2] ./components/src/index.js 1:0-40 + harmony export imported specifier ./CompAB [2] ./components/src/index.js 1:0-40 + harmony export imported specifier ./CompAB [2] ./components/src/index.js 1:0-40" +`; + +exports[`StatsTestCases should print correct stats for side-effects-simple-unused 1`] = ` +"Hash: 98f9f698f299e2fa69de +Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names +main.js 3.9 KiB 0 [emitted] main +Entrypoint main = main.js +[0] ./node_modules/pmodule/b.js 69 bytes [built] + [no exports used] +[1] ./node_modules/pmodule/a.js 60 bytes [built] + [no exports used] +[2] ./index.js + 2 modules 158 bytes {0} [built] + | ./index.js 55 bytes [built] + | ./node_modules/pmodule/index.js 75 bytes [built] + | [only some exports used: default] + | ./node_modules/pmodule/c.js 28 bytes [built] + | [only some exports used: z]" +`; + +exports[`StatsTestCases should print correct stats for simple 1`] = ` +"Hash: 06cc914b885215f96c5a +Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names +bundle.js 3.75 KiB main [emitted] main +Entrypoint main = bundle.js +[./index.js] 0 bytes {main} [built]" +`; + +exports[`StatsTestCases should print correct stats for simple-more-info 1`] = ` +"Hash: c8c226a954f967e61630 +Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names +bundle.js 3.57 KiB 0 [emitted] main +Entrypoint main = bundle.js +[0] ./index.js 0 bytes {0} [built] + single entry ./index main + factory:Xms building:Xms = Xms" +`; + +exports[`StatsTestCases should print correct stats for split-chunks 1`] = ` +"Child default: + Entrypoint main = default/main.js + Entrypoint a = default/a.js + Entrypoint b = default/b.js + Entrypoint c = default/c.js + chunk {0} default/vendors~async-a~async-b~async-c.js (vendors~async-a~async-b~async-c) 20 bytes <{9}> ={1}= ={2}= ={3}= ={5}= ={6}= ={7}= ={8}= >{2}< >{4}< [rendered] split chunk (cache group: vendors) (name: vendors~async-a~async-b~async-c) + > ./a [8] ./index.js 1:0-47 + > ./b [8] ./index.js 2:0-47 + > ./c [8] ./index.js 3:0-47 + [1] ./node_modules/x.js 20 bytes {0} {10} {11} {12} [built] + chunk {1} default/async-a~async-b~async-c.js (async-a~async-b~async-c) 20 bytes <{9}> ={0}= ={2}= ={3}= ={5}= ={6}= ={7}= ={8}= >{2}< >{4}< [rendered] split chunk (cache group: default) (name: async-a~async-b~async-c) + > ./a [8] ./index.js 1:0-47 + > ./b [8] ./index.js 2:0-47 + > ./c [8] ./index.js 3:0-47 + [0] ./d.js 20 bytes {1} {10} {11} {12} [built] + chunk {2} default/async-b~async-c~async-g.js (async-b~async-c~async-g) 20 bytes <{0}> <{1}> <{10}> <{3}> <{5}> <{9}> ={0}= ={1}= ={3}= ={4}= ={6}= ={7}= ={8}= [rendered] split chunk (cache group: default) (name: async-b~async-c~async-g) + > ./g [] 6:0-47 + > ./g [] 6:0-47 + > ./b [8] ./index.js 2:0-47 + > ./c [8] ./index.js 3:0-47 + [2] ./f.js 20 bytes {2} {11} {12} [built] + chunk {3} default/vendors~async-a~async-b.js (vendors~async-a~async-b) 20 bytes <{9}> ={0}= ={1}= ={2}= ={5}= ={6}= >{2}< >{4}< [rendered] split chunk (cache group: vendors) (name: vendors~async-a~async-b) + > ./a [8] ./index.js 1:0-47 + > ./b [8] ./index.js 2:0-47 + [3] ./node_modules/y.js 20 bytes {3} {10} {11} [built] + chunk {4} default/async-g.js (async-g) 34 bytes <{0}> <{1}> <{10}> <{3}> <{5}> ={2}= [rendered] + > ./g [] 6:0-47 + > ./g [] 6:0-47 + [9] ./g.js 34 bytes {4} [built] + chunk {5} default/async-a.js (async-a) 156 bytes <{9}> ={0}= ={1}= ={3}= >{2}< >{4}< [rendered] + > ./a [8] ./index.js 1:0-47 + [7] ./a.js + 1 modules 156 bytes {5} {10} [built] + | ./a.js 121 bytes [built] + | ./e.js 20 bytes [built] + chunk {6} default/async-b.js (async-b) 72 bytes <{9}> ={0}= ={1}= ={2}= ={3}= [rendered] + > ./b [8] ./index.js 2:0-47 + [5] ./b.js 72 bytes {6} {11} [built] + chunk {7} default/async-c.js (async-c) 72 bytes <{9}> ={0}= ={1}= ={2}= ={8}= [rendered] + > ./c [8] ./index.js 3:0-47 + [6] ./c.js 72 bytes {7} {12} [built] + chunk {8} default/vendors~async-c.js (vendors~async-c) 20 bytes <{9}> ={0}= ={1}= ={2}= ={7}= [rendered] split chunk (cache group: vendors) (name: vendors~async-c) + > ./c [8] ./index.js 3:0-47 + [4] ./node_modules/z.js 20 bytes {8} {12} [built] + chunk {9} default/main.js (main) 147 bytes >{0}< >{1}< >{2}< >{3}< >{5}< >{6}< >{7}< >{8}< [entry] [rendered] + > ./ main + [8] ./index.js 147 bytes {9} [built] + chunk {10} default/a.js (a) 216 bytes >{2}< >{4}< [entry] [rendered] + > ./a a + [0] ./d.js 20 bytes {1} {10} {11} {12} [built] + [1] ./node_modules/x.js 20 bytes {0} {10} {11} {12} [built] + [3] ./node_modules/y.js 20 bytes {3} {10} {11} [built] + [7] ./a.js + 1 modules 156 bytes {5} {10} [built] + | ./a.js 121 bytes [built] + | ./e.js 20 bytes [built] + chunk {11} default/b.js (b) 152 bytes [entry] [rendered] + > ./b b + [0] ./d.js 20 bytes {1} {10} {11} {12} [built] + [1] ./node_modules/x.js 20 bytes {0} {10} {11} {12} [built] + [2] ./f.js 20 bytes {2} {11} {12} [built] + [3] ./node_modules/y.js 20 bytes {3} {10} {11} [built] + [5] ./b.js 72 bytes {6} {11} [built] + chunk {12} default/c.js (c) 152 bytes [entry] [rendered] + > ./c c + [0] ./d.js 20 bytes {1} {10} {11} {12} [built] + [1] ./node_modules/x.js 20 bytes {0} {10} {11} {12} [built] + [2] ./f.js 20 bytes {2} {11} {12} [built] + [4] ./node_modules/z.js 20 bytes {8} {12} [built] + [6] ./c.js 72 bytes {7} {12} [built] +Child all-chunks: + Entrypoint main = default/main.js + Entrypoint a = default/vendors~a~async-a~async-b~async-c~b~c.js default/vendors~a~async-a~async-b~b.js default/a.js + Entrypoint b = default/vendors~a~async-a~async-b~async-c~b~c.js default/vendors~a~async-a~async-b~b.js default/b.js + Entrypoint c = default/vendors~a~async-a~async-b~async-c~b~c.js default/vendors~async-c~c.js default/c.js + chunk {0} default/vendors~a~async-a~async-b~async-c~b~c.js (vendors~a~async-a~async-b~async-c~b~c) 20 bytes <{9}> ={1}= ={10}= ={11}= ={12}= ={2}= ={3}= ={4}= ={6}= ={7}= ={8}= >{2}< >{5}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~a~async-a~async-b~async-c~b~c) + > ./a a + > ./b b + > ./c c + > ./a [8] ./index.js 1:0-47 + > ./b [8] ./index.js 2:0-47 + > ./c [8] ./index.js 3:0-47 + [2] ./node_modules/x.js 20 bytes {0} [built] + chunk {1} default/async-a~async-b~async-c.js (async-a~async-b~async-c) 20 bytes <{9}> ={0}= ={2}= ={3}= ={4}= ={6}= ={7}= ={8}= >{2}< >{5}< [rendered] split chunk (cache group: default) (name: async-a~async-b~async-c) + > ./a [8] ./index.js 1:0-47 + > ./b [8] ./index.js 2:0-47 + > ./c [8] ./index.js 3:0-47 + [0] ./d.js 20 bytes {1} {10} {11} {12} [built] + chunk {2} default/async-b~async-c~async-g.js (async-b~async-c~async-g) 20 bytes <{0}> <{1}> <{10}> <{3}> <{6}> <{9}> ={0}= ={1}= ={3}= ={4}= ={5}= ={7}= ={8}= [rendered] split chunk (cache group: default) (name: async-b~async-c~async-g) + > ./g [] 6:0-47 + > ./g [] 6:0-47 + > ./b [8] ./index.js 2:0-47 + > ./c [8] ./index.js 3:0-47 + [1] ./f.js 20 bytes {2} {11} {12} [built] + chunk {3} default/vendors~a~async-a~async-b~b.js (vendors~a~async-a~async-b~b) 20 bytes <{9}> ={0}= ={1}= ={10}= ={11}= ={2}= ={6}= ={7}= >{2}< >{5}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~a~async-a~async-b~b) + > ./a a + > ./b b + > ./a [8] ./index.js 1:0-47 + > ./b [8] ./index.js 2:0-47 + [3] ./node_modules/y.js 20 bytes {3} [built] + chunk {4} default/vendors~async-c~c.js (vendors~async-c~c) 20 bytes <{9}> ={0}= ={1}= ={12}= ={2}= ={8}= [initial] [rendered] split chunk (cache group: vendors) (name: vendors~async-c~c) + > ./c c + > ./c [8] ./index.js 3:0-47 + [7] ./node_modules/z.js 20 bytes {4} [built] + chunk {5} default/async-g.js (async-g) 34 bytes <{0}> <{1}> <{10}> <{3}> <{6}> ={2}= [rendered] + > ./g [] 6:0-47 + > ./g [] 6:0-47 + [9] ./g.js 34 bytes {5} [built] + chunk {6} default/async-a.js (async-a) 156 bytes <{9}> ={0}= ={1}= ={3}= >{2}< >{5}< [rendered] + > ./a [8] ./index.js 1:0-47 + [6] ./a.js + 1 modules 156 bytes {6} {10} [built] + | ./a.js 121 bytes [built] + | ./e.js 20 bytes [built] + chunk {7} default/async-b.js (async-b) 72 bytes <{9}> ={0}= ={1}= ={2}= ={3}= [rendered] + > ./b [8] ./index.js 2:0-47 + [4] ./b.js 72 bytes {7} {11} [built] + chunk {8} default/async-c.js (async-c) 72 bytes <{9}> ={0}= ={1}= ={2}= ={4}= [rendered] + > ./c [8] ./index.js 3:0-47 + [5] ./c.js 72 bytes {8} {12} [built] + chunk {9} default/main.js (main) 147 bytes >{0}< >{1}< >{2}< >{3}< >{4}< >{6}< >{7}< >{8}< [entry] [rendered] + > ./ main + [8] ./index.js 147 bytes {9} [built] + chunk {10} default/a.js (a) 176 bytes ={0}= ={3}= >{2}< >{5}< [entry] [rendered] + > ./a a + [0] ./d.js 20 bytes {1} {10} {11} {12} [built] + [6] ./a.js + 1 modules 156 bytes {6} {10} [built] + | ./a.js 121 bytes [built] + | ./e.js 20 bytes [built] + chunk {11} default/b.js (b) 112 bytes ={0}= ={3}= [entry] [rendered] + > ./b b + [0] ./d.js 20 bytes {1} {10} {11} {12} [built] + [1] ./f.js 20 bytes {2} {11} {12} [built] + [4] ./b.js 72 bytes {7} {11} [built] + chunk {12} default/c.js (c) 112 bytes ={0}= ={4}= [entry] [rendered] + > ./c c + [0] ./d.js 20 bytes {1} {10} {11} {12} [built] + [1] ./f.js 20 bytes {2} {11} {12} [built] + [5] ./c.js 72 bytes {8} {12} [built] +Child manual: + Entrypoint main = default/main.js + Entrypoint a = default/vendors.js default/a.js + Entrypoint b = default/vendors.js default/b.js + Entrypoint c = default/vendors.js default/c.js + chunk {0} default/vendors.js (vendors) 112 bytes <{5}> ={2}= ={3}= ={4}= ={6}= ={7}= ={8}= >{1}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors) + > ./a a + > ./b b + > ./c c + > ./a [8] ./index.js 1:0-47 + > ./b [8] ./index.js 2:0-47 + > ./c [8] ./index.js 3:0-47 + [2] ./node_modules/x.js 20 bytes {0} [built] + [3] ./node_modules/y.js 20 bytes {0} [built] + [6] ./node_modules/z.js 20 bytes {0} [built] + [10] multi x y z 52 bytes {0} [built] + chunk {1} default/async-g.js (async-g) 54 bytes <{0}> <{2}> <{6}> [rendered] + > ./g [] 6:0-47 + > ./g [] 6:0-47 + [1] ./f.js 20 bytes {1} {3} {4} {7} {8} [built] + [9] ./g.js 34 bytes {1} [built] + chunk {2} default/async-a.js (async-a) 176 bytes <{5}> ={0}= >{1}< [rendered] + > ./a [8] ./index.js 1:0-47 + [0] ./d.js 20 bytes {2} {3} {4} {6} {7} {8} [built] + [7] ./a.js + 1 modules 156 bytes {2} {6} [built] + | ./a.js 121 bytes [built] + | ./e.js 20 bytes [built] + chunk {3} default/async-b.js (async-b) 112 bytes <{5}> ={0}= [rendered] + > ./b [8] ./index.js 2:0-47 + [0] ./d.js 20 bytes {2} {3} {4} {6} {7} {8} [built] + [1] ./f.js 20 bytes {1} {3} {4} {7} {8} [built] + [4] ./b.js 72 bytes {3} {7} [built] + chunk {4} default/async-c.js (async-c) 112 bytes <{5}> ={0}= [rendered] + > ./c [8] ./index.js 3:0-47 + [0] ./d.js 20 bytes {2} {3} {4} {6} {7} {8} [built] + [1] ./f.js 20 bytes {1} {3} {4} {7} {8} [built] + [5] ./c.js 72 bytes {4} {8} [built] + chunk {5} default/main.js (main) 147 bytes >{0}< >{2}< >{3}< >{4}< [entry] [rendered] + > ./ main + [8] ./index.js 147 bytes {5} [built] + chunk {6} default/a.js (a) 176 bytes ={0}= >{1}< [entry] [rendered] + > ./a a + [0] ./d.js 20 bytes {2} {3} {4} {6} {7} {8} [built] + [7] ./a.js + 1 modules 156 bytes {2} {6} [built] + | ./a.js 121 bytes [built] + | ./e.js 20 bytes [built] + chunk {7} default/b.js (b) 112 bytes ={0}= [entry] [rendered] + > ./b b + [0] ./d.js 20 bytes {2} {3} {4} {6} {7} {8} [built] + [1] ./f.js 20 bytes {1} {3} {4} {7} {8} [built] + [4] ./b.js 72 bytes {3} {7} [built] + chunk {8} default/c.js (c) 112 bytes ={0}= [entry] [rendered] + > ./c c + [0] ./d.js 20 bytes {2} {3} {4} {6} {7} {8} [built] + [1] ./f.js 20 bytes {1} {3} {4} {7} {8} [built] + [5] ./c.js 72 bytes {4} {8} [built] +Child name-too-long: + Entrypoint main = main.js + Entrypoint aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccc~50ebc41f.js vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.js aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccccccccccc~18066793.js async-a.js aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.js + Entrypoint bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb = vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccc~50ebc41f.js vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.js aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccccccccccc~18066793.js async-b~async-c~async-g~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccccccccccccccccccccccccccc.js async-b.js bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.js + Entrypoint cccccccccccccccccccccccccccccc = vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccc~50ebc41f.js vendors~async-c~cccccccccccccccccccccccccccccc.js aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccccccccccc~18066793.js async-b~async-c~async-g~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccccccccccccccccccccccccccc.js async-c.js cccccccccccccccccccccccccccccc.js + chunk {0} vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccc~50ebc41f.js (vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccc~50ebc41f) 20 bytes <{9}> ={1}= ={10}= ={11}= ={12}= ={2}= ={3}= ={4}= ={5}= ={6}= ={7}= >{2}< >{8}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccc~50ebc41f) + > ./a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + > ./b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb + > ./c cccccccccccccccccccccccccccccc + > ./a [4] ./index.js 1:0-47 + > ./b [4] ./index.js 2:0-47 + > ./c [4] ./index.js 3:0-47 + [2] ./node_modules/x.js 20 bytes {0} [built] + chunk {1} aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccccccccccc~18066793.js (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccccccccccc~18066793) 20 bytes <{9}> ={0}= ={10}= ={11}= ={12}= ={2}= ={3}= ={4}= ={5}= ={6}= ={7}= >{2}< >{8}< [initial] [rendered] split chunk (cache group: default) (name: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccccccccccc~18066793) + > ./a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + > ./b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb + > ./c cccccccccccccccccccccccccccccc + > ./a [4] ./index.js 1:0-47 + > ./b [4] ./index.js 2:0-47 + > ./c [4] ./index.js 3:0-47 + [1] ./d.js 20 bytes {1} [built] + chunk {2} async-b~async-c~async-g~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccccccccccccccccccccccccccc.js (async-b~async-c~async-g~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccccccccccccccccccccccccccc) 20 bytes <{0}> <{1}> <{10}> <{3}> <{4}> <{9}> ={0}= ={1}= ={11}= ={12}= ={3}= ={5}= ={6}= ={7}= ={8}= [initial] [rendered] split chunk (cache group: default) (name: async-b~async-c~async-g~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccccccccccccccccccccccccccc) + > ./g [] 6:0-47 + > ./g [] 6:0-47 + > ./b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb + > ./c cccccccccccccccccccccccccccccc + > ./b [4] ./index.js 2:0-47 + > ./c [4] ./index.js 3:0-47 + [0] ./f.js 20 bytes {2} [built] + chunk {3} vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.js (vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb) 20 bytes <{9}> ={0}= ={1}= ={10}= ={11}= ={2}= ={4}= ={5}= >{2}< >{8}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb) + > ./a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + > ./b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb + > ./a [4] ./index.js 1:0-47 + > ./b [4] ./index.js 2:0-47 + [3] ./node_modules/y.js 20 bytes {3} [built] + chunk {4} async-a.js (async-a) 156 bytes <{9}> ={0}= ={1}= ={10}= ={3}= >{2}< >{8}< [initial] [rendered] reused as split chunk (cache group: default) + > ./a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + > ./a [4] ./index.js 1:0-47 + [8] ./a.js + 1 modules 156 bytes {4} [built] + | ./a.js 121 bytes [built] + | ./e.js 20 bytes [built] + chunk {5} async-b.js (async-b) 72 bytes <{9}> ={0}= ={1}= ={11}= ={2}= ={3}= [initial] [rendered] reused as split chunk (cache group: default) + > ./b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb + > ./b [4] ./index.js 2:0-47 + [5] ./b.js 72 bytes {5} [built] + chunk {6} async-c.js (async-c) 72 bytes <{9}> ={0}= ={1}= ={12}= ={2}= ={7}= [initial] [rendered] reused as split chunk (cache group: default) + > ./c cccccccccccccccccccccccccccccc + > ./c [4] ./index.js 3:0-47 + [6] ./c.js 72 bytes {6} [built] + chunk {7} vendors~async-c~cccccccccccccccccccccccccccccc.js (vendors~async-c~cccccccccccccccccccccccccccccc) 20 bytes <{9}> ={0}= ={1}= ={12}= ={2}= ={6}= [initial] [rendered] split chunk (cache group: vendors) (name: vendors~async-c~cccccccccccccccccccccccccccccc) + > ./c cccccccccccccccccccccccccccccc + > ./c [4] ./index.js 3:0-47 + [7] ./node_modules/z.js 20 bytes {7} [built] + chunk {8} async-g.js (async-g) 34 bytes <{0}> <{1}> <{10}> <{3}> <{4}> ={2}= [rendered] + > ./g [] 6:0-47 + > ./g [] 6:0-47 + [9] ./g.js 34 bytes {8} [built] + chunk {9} main.js (main) 147 bytes >{0}< >{1}< >{2}< >{3}< >{4}< >{5}< >{6}< >{7}< [entry] [rendered] + > ./ main + [4] ./index.js 147 bytes {9} [built] + chunk {10} aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.js (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) 0 bytes ={0}= ={1}= ={3}= ={4}= >{2}< >{8}< [entry] [rendered] + > ./a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + chunk {11} bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.js (bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb) 0 bytes ={0}= ={1}= ={2}= ={3}= ={5}= [entry] [rendered] + > ./b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb + chunk {12} cccccccccccccccccccccccccccccc.js (cccccccccccccccccccccccccccccc) 0 bytes ={0}= ={1}= ={2}= ={6}= ={7}= [entry] [rendered] + > ./c cccccccccccccccccccccccccccccc +Child custom-chunks-filter: + Entrypoint main = default/main.js + Entrypoint a = default/a.js + Entrypoint b = default/vendors~async-a~async-b~async-c~b~c.js default/vendors~async-a~async-b~b.js default/b.js + Entrypoint c = default/vendors~async-a~async-b~async-c~b~c.js default/vendors~async-c~c.js default/c.js + chunk {0} default/vendors~async-a~async-b~async-c~b~c.js (vendors~async-a~async-b~async-c~b~c) 20 bytes <{9}> ={1}= ={11}= ={12}= ={2}= ={3}= ={4}= ={6}= ={7}= ={8}= >{2}< >{5}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~async-a~async-b~async-c~b~c) + > ./b b + > ./c c + > ./a [8] ./index.js 1:0-47 + > ./b [8] ./index.js 2:0-47 + > ./c [8] ./index.js 3:0-47 + [2] ./node_modules/x.js 20 bytes {0} {10} [built] + chunk {1} default/async-a~async-b~async-c.js (async-a~async-b~async-c) 20 bytes <{9}> ={0}= ={2}= ={3}= ={4}= ={6}= ={7}= ={8}= >{2}< >{5}< [rendered] split chunk (cache group: default) (name: async-a~async-b~async-c) + > ./a [8] ./index.js 1:0-47 + > ./b [8] ./index.js 2:0-47 + > ./c [8] ./index.js 3:0-47 + [0] ./d.js 20 bytes {1} {10} {11} {12} [built] + chunk {2} default/async-b~async-c~async-g.js (async-b~async-c~async-g) 20 bytes <{0}> <{1}> <{10}> <{3}> <{6}> <{9}> ={0}= ={1}= ={3}= ={4}= ={5}= ={7}= ={8}= [rendered] split chunk (cache group: default) (name: async-b~async-c~async-g) + > ./g [] 6:0-47 + > ./g [] 6:0-47 + > ./b [8] ./index.js 2:0-47 + > ./c [8] ./index.js 3:0-47 + [1] ./f.js 20 bytes {2} {11} {12} [built] + chunk {3} default/vendors~async-a~async-b~b.js (vendors~async-a~async-b~b) 20 bytes <{9}> ={0}= ={1}= ={11}= ={2}= ={6}= ={7}= >{2}< >{5}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~async-a~async-b~b) + > ./b b + > ./a [8] ./index.js 1:0-47 + > ./b [8] ./index.js 2:0-47 + [3] ./node_modules/y.js 20 bytes {3} {10} [built] + chunk {4} default/vendors~async-c~c.js (vendors~async-c~c) 20 bytes <{9}> ={0}= ={1}= ={12}= ={2}= ={8}= [initial] [rendered] split chunk (cache group: vendors) (name: vendors~async-c~c) + > ./c c + > ./c [8] ./index.js 3:0-47 + [7] ./node_modules/z.js 20 bytes {4} [built] + chunk {5} default/async-g.js (async-g) 34 bytes <{0}> <{1}> <{10}> <{3}> <{6}> ={2}= [rendered] + > ./g [] 6:0-47 + > ./g [] 6:0-47 + [9] ./g.js 34 bytes {5} [built] + chunk {6} default/async-a.js (async-a) 156 bytes <{9}> ={0}= ={1}= ={3}= >{2}< >{5}< [rendered] + > ./a [8] ./index.js 1:0-47 + [6] ./a.js + 1 modules 156 bytes {6} {10} [built] + | ./a.js 121 bytes [built] + | ./e.js 20 bytes [built] + chunk {7} default/async-b.js (async-b) 72 bytes <{9}> ={0}= ={1}= ={2}= ={3}= [rendered] + > ./b [8] ./index.js 2:0-47 + [4] ./b.js 72 bytes {7} {11} [built] + chunk {8} default/async-c.js (async-c) 72 bytes <{9}> ={0}= ={1}= ={2}= ={4}= [rendered] + > ./c [8] ./index.js 3:0-47 + [5] ./c.js 72 bytes {8} {12} [built] + chunk {9} default/main.js (main) 147 bytes >{0}< >{1}< >{2}< >{3}< >{4}< >{6}< >{7}< >{8}< [entry] [rendered] + > ./ main + [8] ./index.js 147 bytes {9} [built] + chunk {10} default/a.js (a) 216 bytes >{2}< >{5}< [entry] [rendered] + > ./a a + [0] ./d.js 20 bytes {1} {10} {11} {12} [built] + [2] ./node_modules/x.js 20 bytes {0} {10} [built] + [3] ./node_modules/y.js 20 bytes {3} {10} [built] + [6] ./a.js + 1 modules 156 bytes {6} {10} [built] + | ./a.js 121 bytes [built] + | ./e.js 20 bytes [built] + chunk {11} default/b.js (b) 112 bytes ={0}= ={3}= [entry] [rendered] + > ./b b + [0] ./d.js 20 bytes {1} {10} {11} {12} [built] + [1] ./f.js 20 bytes {2} {11} {12} [built] + [4] ./b.js 72 bytes {7} {11} [built] + chunk {12} default/c.js (c) 112 bytes ={0}= ={4}= [entry] [rendered] + > ./c c + [0] ./d.js 20 bytes {1} {10} {11} {12} [built] + [1] ./f.js 20 bytes {2} {11} {12} [built] + [5] ./c.js 72 bytes {8} {12} [built] +Child custom-chunks-filter-in-cache-groups: + Entrypoint main = default/main.js + Entrypoint a = default/a.js + Entrypoint b = default/vendors.js default/b.js + Entrypoint c = default/vendors.js default/c.js + chunk {0} default/vendors.js (vendors) 112 bytes <{5}> ={2}= ={3}= ={4}= ={7}= ={8}= >{1}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors) + > ./b b + > ./c c + > ./a [8] ./index.js 1:0-47 + > ./b [8] ./index.js 2:0-47 + > ./c [8] ./index.js 3:0-47 + [2] ./node_modules/x.js 20 bytes {0} {6} [built] + [3] ./node_modules/y.js 20 bytes {0} {6} [built] + [6] ./node_modules/z.js 20 bytes {0} [built] + [10] multi x y z 52 bytes {0} [built] + chunk {1} default/async-g.js (async-g) 54 bytes <{0}> <{2}> <{6}> [rendered] + > ./g [] 6:0-47 + > ./g [] 6:0-47 + [1] ./f.js 20 bytes {1} {3} {4} {7} {8} [built] + [9] ./g.js 34 bytes {1} [built] + chunk {2} default/async-a.js (async-a) 176 bytes <{5}> ={0}= >{1}< [rendered] + > ./a [8] ./index.js 1:0-47 + [0] ./d.js 20 bytes {2} {3} {4} {6} {7} {8} [built] + [7] ./a.js + 1 modules 156 bytes {2} {6} [built] + | ./a.js 121 bytes [built] + | ./e.js 20 bytes [built] + chunk {3} default/async-b.js (async-b) 112 bytes <{5}> ={0}= [rendered] + > ./b [8] ./index.js 2:0-47 + [0] ./d.js 20 bytes {2} {3} {4} {6} {7} {8} [built] + [1] ./f.js 20 bytes {1} {3} {4} {7} {8} [built] + [4] ./b.js 72 bytes {3} {7} [built] + chunk {4} default/async-c.js (async-c) 112 bytes <{5}> ={0}= [rendered] + > ./c [8] ./index.js 3:0-47 + [0] ./d.js 20 bytes {2} {3} {4} {6} {7} {8} [built] + [1] ./f.js 20 bytes {1} {3} {4} {7} {8} [built] + [5] ./c.js 72 bytes {4} {8} [built] + chunk {5} default/main.js (main) 147 bytes >{0}< >{2}< >{3}< >{4}< [entry] [rendered] + > ./ main + [8] ./index.js 147 bytes {5} [built] + chunk {6} default/a.js (a) 216 bytes >{1}< [entry] [rendered] + > ./a a + [0] ./d.js 20 bytes {2} {3} {4} {6} {7} {8} [built] + [2] ./node_modules/x.js 20 bytes {0} {6} [built] + [3] ./node_modules/y.js 20 bytes {0} {6} [built] + [7] ./a.js + 1 modules 156 bytes {2} {6} [built] + | ./a.js 121 bytes [built] + | ./e.js 20 bytes [built] + chunk {7} default/b.js (b) 112 bytes ={0}= [entry] [rendered] + > ./b b + [0] ./d.js 20 bytes {2} {3} {4} {6} {7} {8} [built] + [1] ./f.js 20 bytes {1} {3} {4} {7} {8} [built] + [4] ./b.js 72 bytes {3} {7} [built] + chunk {8} default/c.js (c) 112 bytes ={0}= [entry] [rendered] + > ./c c + [0] ./d.js 20 bytes {2} {3} {4} {6} {7} {8} [built] + [1] ./f.js 20 bytes {1} {3} {4} {7} {8} [built] + [5] ./c.js 72 bytes {4} {8} [built]" +`; + +exports[`StatsTestCases should print correct stats for split-chunks-combinations 1`] = ` +"Entrypoint main = main.js +chunk {0} async-a~async-b.js (async-a~async-b) 134 bytes <{8}> ={1}= ={2}= [rendered] split chunk (cache group: default) (name: async-a~async-b) + > ./a [9] ./index.js 1:0-47 + > ./b [9] ./index.js 2:0-47 + [0] ./x.js 67 bytes {0} {3} {4} {5} {6} {7} [built] + [1] ./y.js 67 bytes {0} [built] +chunk {1} async-a.js (async-a) 48 bytes <{8}> ={0}= [rendered] + > ./a [9] ./index.js 1:0-47 + [2] ./a.js 48 bytes {1} [built] +chunk {2} async-b.js (async-b) 48 bytes <{8}> ={0}= [rendered] + > ./b [9] ./index.js 2:0-47 + [3] ./b.js 48 bytes {2} [built] +chunk {3} async-c.js (async-c) 101 bytes <{8}> [rendered] + > ./c [9] ./index.js 3:0-47 + [0] ./x.js 67 bytes {0} {3} {4} {5} {6} {7} [built] + [4] ./c.js 34 bytes {3} [built] +chunk {4} async-d.js (async-d) 101 bytes <{8}> [rendered] + > ./d [9] ./index.js 4:0-47 + [0] ./x.js 67 bytes {0} {3} {4} {5} {6} {7} [built] + [5] ./d.js 34 bytes {4} [built] +chunk {5} async-e.js (async-e) 101 bytes <{8}> [rendered] + > ./e [9] ./index.js 5:0-47 + [0] ./x.js 67 bytes {0} {3} {4} {5} {6} {7} [built] + [6] ./e.js 34 bytes {5} [built] +chunk {6} async-f.js (async-f) 101 bytes <{8}> [rendered] + > ./f [9] ./index.js 6:0-47 + [0] ./x.js 67 bytes {0} {3} {4} {5} {6} {7} [built] + [7] ./f.js 34 bytes {6} [built] +chunk {7} async-g.js (async-g) 101 bytes <{8}> [rendered] + > ./g [9] ./index.js 7:0-47 + [0] ./x.js 67 bytes {0} {3} {4} {5} {6} {7} [built] + [8] ./g.js 34 bytes {7} [built] +chunk {8} main.js (main) 343 bytes >{0}< >{1}< >{2}< >{3}< >{4}< >{5}< >{6}< >{7}< [entry] [rendered] + > ./ main + [9] ./index.js 343 bytes {8} [built]" +`; + +exports[`StatsTestCases should print correct stats for split-chunks-issue-6413 1`] = ` +"Entrypoint main = main.js +chunk {0} vendors~async-a~async-b~async-c.js (vendors~async-a~async-b~async-c) 20 bytes <{5}> ={1}= ={2}= ={3}= ={4}= [rendered] split chunk (cache group: vendors) (name: vendors~async-a~async-b~async-c) + > ./a [5] ./index.js 1:0-47 + > ./b [5] ./index.js 2:0-47 + > ./c [5] ./index.js 3:0-47 + [1] ./node_modules/x.js 20 bytes {0} [built] +chunk {1} async-a~async-b~async-c.js (async-a~async-b~async-c) 11 bytes <{5}> ={0}= ={2}= ={3}= ={4}= [rendered] split chunk (cache group: default) (name: async-a~async-b~async-c) + > ./a [5] ./index.js 1:0-47 + > ./b [5] ./index.js 2:0-47 + > ./c [5] ./index.js 3:0-47 + [0] ./common.js 11 bytes {1} [built] +chunk {2} async-a.js (async-a) 19 bytes <{5}> ={0}= ={1}= [rendered] + > ./a [5] ./index.js 1:0-47 + [2] ./a.js 19 bytes {2} [built] +chunk {3} async-b.js (async-b) 19 bytes <{5}> ={0}= ={1}= [rendered] + > ./b [5] ./index.js 2:0-47 + [3] ./b.js 19 bytes {3} [built] +chunk {4} async-c.js (async-c) 19 bytes <{5}> ={0}= ={1}= [rendered] + > ./c [5] ./index.js 3:0-47 + [4] ./c.js 19 bytes {4} [built] +chunk {5} main.js (main) 147 bytes >{0}< >{1}< >{2}< >{3}< >{4}< [entry] [rendered] + > ./ main + [5] ./index.js 147 bytes {5} [built]" +`; + +exports[`StatsTestCases should print correct stats for split-chunks-issue-6696 1`] = ` +"Entrypoint main = vendors.js main.js +chunk {0} async-a.js (async-a) 32 bytes <{2}> <{3}> [rendered] + > ./a [3] ./index.js 2:0-47 + [0] ./node_modules/x.js 20 bytes {0} {1} [built] + [1] ./a.js 12 bytes {0} [built] +chunk {1} async-b.js (async-b) 32 bytes <{2}> <{3}> [rendered] + > ./b [3] ./index.js 3:0-47 + [0] ./node_modules/x.js 20 bytes {0} {1} [built] + [2] ./b.js 12 bytes {1} [built] +chunk {2} main.js (main) 110 bytes ={3}= >{0}< >{1}< [entry] [rendered] + > ./ main + [3] ./index.js 110 bytes {2} [built] +chunk {3} vendors.js (vendors) 20 bytes ={2}= >{0}< >{1}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors) + > ./ main + [4] ./node_modules/y.js 20 bytes {3} [built]" +`; + +exports[`StatsTestCases should print correct stats for split-chunks-issue-7401 1`] = ` +"Entrypoint a = vendors~a~c.js a.js +Entrypoint b = b.js +Chunk Group c = vendors~a~c.js c.js +chunk {0} vendors~a~c.js (vendors~a~c) 20 bytes <{3}> ={1}= ={2}= [initial] [rendered] split chunk (cache group: vendors) (name: vendors~a~c) + > ./a a + > ./c [3] ./b.js 1:0-41 + [0] ./node_modules/x.js 20 bytes {0} [built] +chunk {1} c.js (c) 12 bytes <{3}> ={0}= [rendered] + > ./c [3] ./b.js 1:0-41 + [1] ./c.js 12 bytes {1} [built] +chunk {2} a.js (a) 12 bytes ={0}= [entry] [rendered] + > ./a a + [2] ./a.js 12 bytes {2} [built] +chunk {3} b.js (b) 43 bytes >{0}< >{1}< [entry] [rendered] + > ./b b + [3] ./b.js 43 bytes {3} [built]" +`; + +exports[`StatsTestCases should print correct stats for split-chunks-prefer-bigger-splits 1`] = ` +"Entrypoint main = default/main.js +chunk {0} default/async-b~async-c.js (async-b~async-c) 110 bytes <{4}> ={2}= ={3}= [rendered] split chunk (cache group: default) (name: async-b~async-c) + > ./b [6] ./index.js 2:0-47 + > ./c [6] ./index.js 3:0-47 + [0] ./d.js 43 bytes {0} {1} [built] + [2] ./f.js 67 bytes {0} [built] +chunk {1} default/async-a.js (async-a) 134 bytes <{4}> [rendered] + > ./a [6] ./index.js 1:0-47 + [0] ./d.js 43 bytes {0} {1} [built] + [1] ./e.js 43 bytes {1} {2} [built] + [3] ./a.js 48 bytes {1} [built] +chunk {2} default/async-b.js (async-b) 105 bytes <{4}> ={0}= [rendered] + > ./b [6] ./index.js 2:0-47 + [1] ./e.js 43 bytes {1} {2} [built] + [4] ./b.js 62 bytes {2} [built] +chunk {3} default/async-c.js (async-c) 48 bytes <{4}> ={0}= [rendered] + > ./c [6] ./index.js 3:0-47 + [5] ./c.js 48 bytes {3} [built] +chunk {4} default/main.js (main) 147 bytes >{0}< >{1}< >{2}< >{3}< [entry] [rendered] + > ./ main + [6] ./index.js 147 bytes {4} [built]" +`; + +exports[`StatsTestCases should print correct stats for tree-shaking 1`] = ` +"Hash: 7664ceef8f3f695c9688 +Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names +bundle.js 8.23 KiB 0 [emitted] main +Entrypoint main = bundle.js + [0] ./a.js 13 bytes {0} [built] + [exports: a] + [all exports used] + [1] ./b.js 13 bytes {0} [built] + [exports: b] + [no exports used] + [2] ./unknown.js 0 bytes {0} [built] + [only some exports used: c] + [3] ./unknown2.js 0 bytes {0} [built] + [only some exports used: y] + [4] ./index.js 315 bytes {0} [built] + [no exports] + [5] ./require.include.js 36 bytes {0} [built] + [exports: a, default] + [no exports used] + [6] ./reexport-known.js 49 bytes {0} [built] + [exports: a, b] + [only some exports used: a] + [7] ./reexport-star-known.js 41 bytes {0} [built] + [exports: a, b] + [only some exports used: a] + [8] ./edge.js 45 bytes {0} [built] + [only some exports used: y] + [9] ./reexport-unknown.js 83 bytes {0} [built] + [exports: a, b, c, d] + [only some exports used: a, c] +[10] ./reexport-star-unknown.js 68 bytes {0} [built] + [only some exports used: a, c]" +`; + +exports[`StatsTestCases should print correct stats for warnings-uglifyjs 1`] = ` +"Hash: 1325fb5a846745d7ae89 +Time: Xms +Built at: Thu Jan 01 1970 00:00:00 GMT + Asset Size Chunks Chunk Names +bundle.js 2.89 KiB 0 [emitted] main +Entrypoint main = bundle.js +[0] ./index.js 299 bytes {0} [built] +[1] ./a.js 249 bytes {0} [built] +[2] (webpack)/buildin/module.js 497 bytes {0} [built] + +WARNING in bundle.js from UglifyJs +Dropping unused function someUnRemoteUsedFunction1 [./a.js:3,0] +Dropping unused function someUnRemoteUsedFunction2 [./a.js:4,0] +Dropping unused function someUnRemoteUsedFunction3 [./a.js:5,0] +Dropping unused function someUnRemoteUsedFunction4 [./a.js:6,0] +Dropping unused function someUnRemoteUsedFunction5 [./a.js:7,0]" +`; diff --git a/test/browsertest/lib/index.web.js b/test/browsertest/lib/index.web.js index fe9a593acad..f8f83fe5a17 100644 --- a/test/browsertest/lib/index.web.js +++ b/test/browsertest/lib/index.web.js @@ -9,27 +9,24 @@ require("script-loader!../js/library1.js"); require("./stylesheet.css"); require("./stylesheet.less"); -var should = require("should"); -if(!should.exist) should.exist = function(x) { should.strictEqual(x === undefined, false); should.strictEqual(x === null, false); } - describe("main", function() { it("should load library1 with script-loader", function() { - should.exist(window.library1); - window.library1.should.be.eql(true); + expect(window.library1).toEqual(expect.anything()); + expect(window.library1).toBe(true); }); it("should load library2 exported as global", function() { - should.exist(window.library2common); - should.exist(window.library2common.ok2); - window.library2common.ok2.should.be.eql(true); - should.exist(window.library2); - should.exist(window.library2.ok); - window.library2.ok.should.be.eql(true); + expect(window.library2common).toEqual(expect.anything()); + expect(window.library2common.ok2).toEqual(expect.anything()); + expect(window.library2common.ok2).toBe(true); + expect(window.library2).toEqual(expect.anything()); + expect(window.library2.ok).toEqual(expect.anything()); + expect(window.library2.ok).toBe(true); }); describe("web resolving", function() { it("should load index.web.js instead of index.js", function() { - true.should.be.eql(true); + expect(true).toBe(true); }); it("should load correct replacements for files", function(done) { @@ -43,8 +40,8 @@ describe("main", function() { }); after(function() { - should.exist(exports.ok); - exports.ok.should.be.eql(true); + expect(exports.ok).toEqual(expect.anything()); + expect(exports.ok).toBe(true); }); }); @@ -52,8 +49,8 @@ describe("main", function() { it("should have support for require.main", function() { var value = require.main === module; var otherModuleValue = require("./testRequireMain"); - value.should.be.eql(true); - otherModuleValue.should.be.eql(false); + expect(value).toBe(true); + expect(otherModuleValue).toBe(false); }); }); @@ -65,12 +62,12 @@ describe("main", function() { }); it("should polyfill process and module", function(done) { - module.id.should.have.type("number"); + expect(typeof module.id).toBe("number"); require.ensure([], function(require) { test(Array.isArray(process.argv), "process.argv should be an array"); process.nextTick(function() { sum2++; - sum2.should.be.eql(2); + expect(sum2).toBe(2); done(); }); sum2++; @@ -81,7 +78,7 @@ describe("main", function() { describe("web loaders", function() { it("should handle the file loader correctly", function() { - require("!file-loader!../img/image.png").should.match(/js\/.+\.png$/); + expect(require("!file-loader!../img/image.png")).toMatch(/js\/.+\.png$/); document.getElementById("image").src = require("file-loader?prefix=img/!../img/image.png"); }); }); @@ -93,10 +90,10 @@ describe("main", function() { import("./three").then(function() { done(new Error("Chunk shouldn't be loaded")); }).catch(function(err) { - err.should.be.instanceOf(Error); + expect(err).toBeInstanceOf(Error); __webpack_public_path__ = old; import("./three").then(function(three) { - three.should.be.eql(3); + expect(three).toBe(3); done(); }).catch(function(err) { done(new Error("Shouldn't result in an chunk loading error")); diff --git a/test/browsertest/library2config.coffee b/test/browsertest/library2config.coffee index 8e946bc3605..254425bb6c1 100644 --- a/test/browsertest/library2config.coffee +++ b/test/browsertest/library2config.coffee @@ -12,11 +12,6 @@ exports.default = new Promise (resolve, reject) -> ] amd: fromOptions: true - resolve: - # cannot resolve should outside the outermost node_modules - # so it is injected here - alias: - should: require.resolve "should" plugins: [ new webpack.optimize.LimitChunkCountPlugin maxChunks: 3 diff --git a/test/browsertest/node_modules/library1/index.js b/test/browsertest/node_modules/library1/index.js index 9b10f4d5beb..4292aaf556a 100644 --- a/test/browsertest/node_modules/library1/index.js +++ b/test/browsertest/node_modules/library1/index.js @@ -2,22 +2,22 @@ var loadTimelibrary1 = typeof window.library1 === "undefined" describe("library1", function() { it("should load library1 only once", function() { - loadTimelibrary1.should.be.ok; + expect(loadTimelibrary1).toBe(true); }); it("should load a component", function() { - require("./lib/component").should.be.eql("lib1 component"); + expect(require("./lib/component")).toBe("lib1 component"); }); it("should load async submodules with require.ensure even if single == true", function(done) { var sameTick = true; require.ensure(["submodule1", "submodule2"], function(require) { - sameTick.should.be.eql(true); - require("submodule1").should.be.eql("submodule1"); - require("submodule2").should.be.eql("submodule2"); - require("submodule3")().should.be.eql("submodule3"); + expect(sameTick).toBe(true); + expect(require("submodule1")).toBe("submodule1"); + expect(require("submodule2")).toBe("submodule2"); + expect(require("submodule3")()).toBe("submodule3"); require.ensure([], function(require) { - sameTick.should.be.eql(true); + expect(sameTick).toBe(true); done(); }); }); @@ -26,4 +26,4 @@ describe("library1", function() { }); }); }); -module.exports = true; \ No newline at end of file +module.exports = true; diff --git a/test/browsertest/node_modules/library2/lib/common.js b/test/browsertest/node_modules/library2/lib/common.js index 0544ae974b5..fc5d837715a 100644 --- a/test/browsertest/node_modules/library2/lib/common.js +++ b/test/browsertest/node_modules/library2/lib/common.js @@ -1,10 +1,8 @@ -var should = require("should"); - var typeofLibrary2 = typeof library2; describe("library2", function() { it("should run before main", function() { - typeofLibrary2.should.be.eql("undefined"); + expect(typeofLibrary2).toBe("undefined"); }); }); -exports.library2common = { ok2: true }; \ No newline at end of file +exports.library2common = { ok2: true }; diff --git a/test/browsertest/node_modules/library2/lib/main.js b/test/browsertest/node_modules/library2/lib/main.js index 0fee7cfe78d..d026078f43e 100644 --- a/test/browsertest/node_modules/library2/lib/main.js +++ b/test/browsertest/node_modules/library2/lib/main.js @@ -1,13 +1,11 @@ // Chunked File library -var should = require("should"); - var library2commonValue = library2common; describe("library2", function() { var tickExtra, tickEmpty, tickMerged; var extraValue, testValue; - before(function(done) { + beforeAll(function(done) { var asnycOk = false, asnycOk2 = false; var sameTick1 = true; require.ensure(["./extra"], function(require) { @@ -35,25 +33,25 @@ describe("library2", function() { it("should run after common", function() { - library2commonValue.should.be.eql({ok2: true}); + expect(library2commonValue).toEqual({ok2: true}); }); it("should load stuff with require.ensure asynchron", function() { - should.strictEqual(tickExtra, false); + expect(tickExtra).toBe(false); }); it("should load not include stuff from parent, remove empty chunks and apply a post loader", function() { - should.strictEqual(tickEmpty, true); - extraValue.should.be.eql("Lib2 extra2 with post loader"); + expect(tickEmpty).toBe(true); + expect(extraValue).toBe("Lib2 extra2 with post loader"); }); it("should merge chunks if maxChunks specified", function() { - should.strictEqual(tickEmpty, true); - testValue.should.be.eql("test module"); + expect(tickEmpty).toBe(true); + expect(testValue).toBe("test module"); }); it("should load require.amd from options", function() { - require.amd.should.have.property("fromOptions").be.eql(true); + expect(require.amd.fromOptions).toBe(true); }); it("should run empty AMD require", function(done) { @@ -62,36 +60,36 @@ describe("library2", function() { emptyRequire = true; }); Promise.resolve().then(function() {}).then(function() {}).then(function() { - emptyRequire.should.be.eql(true); + expect(emptyRequire).toBe(true); done(); }); }); it("should provide free variables", function() { - s3().should.be.eql("submodule3"); + expect(s3()).toBe("submodule3"); }); it("should define values", function() { - (CONST_UNDEFINED === undefined).should.be.eql(true); - (CONST_NULL === null).should.be.eql(true); - CONST_TRUE.should.be.eql(true); - CONST_FALSE.should.be.eql(false); - (CONST_FUNCTION()).should.be.eql("ok"); - (CONST_NUMBER).should.be.eql(123); - CONST_NUMBER_EXPR.should.be.eql(123); - (typeof CONST_TYPEOF).should.be.eql("typeof"); + expect(CONST_UNDEFINED === undefined).toBe(true); + expect(CONST_NULL === null).toBe(true); + expect(CONST_TRUE).toBe(true); + expect(CONST_FALSE).toBe(false); + expect(CONST_FUNCTION()).toBe("ok"); + expect(CONST_NUMBER).toBe(123); + expect(CONST_NUMBER_EXPR).toBe(123); + expect(typeof CONST_TYPEOF).toBe("typeof"); var o = CONST_OBJECT; - (CONST_OBJECT.A).should.be.eql(1); - CONST_OBJECT.B.should.be.eql("B"); - CONST_OBJECT.C().should.be.eql("C"); - o.A.should.be.eql(1); - o.B.should.be.eql("B"); - o.C().should.be.eql("C"); + expect(CONST_OBJECT.A).toBe(1); + expect(CONST_OBJECT.B).toBe("B"); + expect(CONST_OBJECT.C()).toBe("C"); + expect(o.A).toBe(1); + expect(o.B).toBe("B"); + expect(o.C()).toBe("C"); (function(o) { - o.A.should.be.eql(1); - o.B.should.be.eql("B"); - o.C().should.be.eql("C"); + expect(o.A).toBe(1); + expect(o.B).toBe("B"); + expect(o.C()).toBe("C"); }(CONST_OBJECT)); if(CONST_FALSE) require("fail"); @@ -108,4 +106,4 @@ describe("library2", function() { }); exports.library2 = {ok: true}; -// it should not fail if comment in last line \ No newline at end of file +// it should not fail if comment in last line diff --git a/test/browsertest/node_modules/library2b.js b/test/browsertest/node_modules/library2b.js index 56f80044757..64d1a8eacd7 100644 --- a/test/browsertest/node_modules/library2b.js +++ b/test/browsertest/node_modules/library2b.js @@ -1,5 +1,5 @@ describe("library2b", function() { it("should load this library", function() { - true.should.be.ok; + expect(true).toBe(true); }); }); diff --git a/test/cases/amd/namedModules/index.js b/test/cases/amd/namedModules/index.js index 51313a514fe..0084e7348e8 100644 --- a/test/cases/amd/namedModules/index.js +++ b/test/cases/amd/namedModules/index.js @@ -16,14 +16,14 @@ define("named4", [], function() { define(["named1", "named2"], function(named1, named2) { it("should load the named modules in defined dependencies", function() { - named1.should.be.eql("named1"); - named2.should.be.eql("named2"); + expect(named1).toBe("named1"); + expect(named2).toBe("named2"); }); it("should load the named modules in require dependencies", function(done) { require(["named3", "named4"], function (named3, named4) { - named3.should.be.eql("named3"); - named4.should.be.eql("named4"); + expect(named3).toBe("named3"); + expect(named4).toBe("named4"); done(); }); }); diff --git a/test/cases/amd/namedModulesConstArrayDep/index.js b/test/cases/amd/namedModulesConstArrayDep/index.js index e6dc0eb1036..e8b0995cdc1 100644 --- a/test/cases/amd/namedModulesConstArrayDep/index.js +++ b/test/cases/amd/namedModulesConstArrayDep/index.js @@ -16,14 +16,14 @@ define("named4", [], function() { define("named1,named2".split(","), function(named1, named2) { it("should load the named modules in const array defined dependencies", function() { - named1.should.be.eql("named1"); - named2.should.be.eql("named2"); + expect(named1).toBe("named1"); + expect(named2).toBe("named2"); }); it("should load the named modules in const array require dependencies", function(done) { require("named3,named4".split(","), function (named3, named4) { - named3.should.be.eql("named3"); - named4.should.be.eql("named4"); + expect(named3).toBe("named3"); + expect(named4).toBe("named4"); done(); }); }); diff --git a/test/cases/chunks/circular-correctness/index.js b/test/cases/chunks/circular-correctness/index.js index 5db11228d9f..e9878a8d5f4 100644 --- a/test/cases/chunks/circular-correctness/index.js +++ b/test/cases/chunks/circular-correctness/index.js @@ -2,7 +2,7 @@ it("should handle circular chunks correctly", function(done) { import(/* webpackChunkName: "a" */"./module-a").then(function(result) { return result.default(); }).then(function(result2) { - result2.default().should.be.eql("x"); + expect(result2.default()).toBe("x"); done(); }).catch(function(e) { done(e); diff --git a/test/cases/chunks/context-weak/index.js b/test/cases/chunks/context-weak/index.js index dbcdef64c00..65aa0c58c1d 100644 --- a/test/cases/chunks/context-weak/index.js +++ b/test/cases/chunks/context-weak/index.js @@ -1,18 +1,18 @@ it("should not bundle context requires with asyncMode === 'weak'", function() { var contextRequire = require.context(".", false, /two/, "weak"); - (function() { + expect(function() { contextRequire("./two") - }).should.throw(/not available/); + }).toThrowError(/not available/); }); it("should find module with asyncMode === 'weak' when required elsewhere", function() { var contextRequire = require.context(".", false, /.+/, "weak"); - contextRequire("./three").should.be.eql(3); + expect(contextRequire("./three")).toBe(3); require("./three"); // in a real app would be served as a separate chunk }); it("should find module with asyncMode === 'weak' when required elsewhere (recursive)", function() { var contextRequire = require.context(".", true, /.+/, "weak"); - contextRequire("./dir/four").should.be.eql(4); + expect(contextRequire("./dir/four")).toBe(4); require("./dir/four"); // in a real app would be served as a separate chunk }); diff --git a/test/cases/chunks/context/index.js b/test/cases/chunks/context/index.js index 37a6e7ac1f9..7658b1a0ebc 100644 --- a/test/cases/chunks/context/index.js +++ b/test/cases/chunks/context/index.js @@ -1,9 +1,9 @@ it("should also work in a chunk", function(done) { require.ensure([], function(require) { var contextRequire = require.context(".", false, /two/); - contextRequire("./two").should.be.eql(2); + expect(contextRequire("./two")).toBe(2); var tw = "tw"; - require("." + "/" + tw + "o").should.be.eql(2); + expect(require("." + "/" + tw + "o")).toBe(2); done(); }); }); diff --git a/test/cases/chunks/import-circle/index.js b/test/cases/chunks/import-circle/index.js new file mode 100644 index 00000000000..feb7bc8b726 --- /dev/null +++ b/test/cases/chunks/import-circle/index.js @@ -0,0 +1,15 @@ +import leftHelix from './leftHelix'; +import rightHelix from './rightHelix'; + +it("should import generate ensure function for this", () => +{ + return Promise.all([ + leftHelix.run(), + rightHelix.run() + ]); +}); + +export default { + leftHelix, + rightHelix, +}; diff --git a/test/cases/chunks/import-circle/leftHelix.js b/test/cases/chunks/import-circle/leftHelix.js new file mode 100644 index 00000000000..455e0daebf8 --- /dev/null +++ b/test/cases/chunks/import-circle/leftHelix.js @@ -0,0 +1,6 @@ +import leftHelixPrime, { run } from './leftHelixPrime'; + +export default { + leftHelixPrime, + run +}; diff --git a/test/cases/chunks/import-circle/leftHelixPrime.js b/test/cases/chunks/import-circle/leftHelixPrime.js new file mode 100644 index 00000000000..9b720f2d1fe --- /dev/null +++ b/test/cases/chunks/import-circle/leftHelixPrime.js @@ -0,0 +1,9 @@ +import rightHelixPrime from './rightHelixPrime'; + +export function run() { + return import(/* webpackChunkName: "left" */ './leftHelix'); +} + +export default { + rightHelixPrime, +}; diff --git a/test/cases/chunks/import-circle/rightHelix.js b/test/cases/chunks/import-circle/rightHelix.js new file mode 100644 index 00000000000..2fe50e79171 --- /dev/null +++ b/test/cases/chunks/import-circle/rightHelix.js @@ -0,0 +1,6 @@ +import rightHelixPrime, { run } from './rightHelixPrime'; + +export default { + rightHelixPrime, + run +} diff --git a/test/cases/chunks/import-circle/rightHelixPrime.js b/test/cases/chunks/import-circle/rightHelixPrime.js new file mode 100644 index 00000000000..5657a7127e5 --- /dev/null +++ b/test/cases/chunks/import-circle/rightHelixPrime.js @@ -0,0 +1,9 @@ +import leftHelixPrime from './leftHelixPrime'; + +export function run() { + return import(/* webpackChunkName: "right" */ './rightHelix'); +} + +export default { + leftHelixPrime +}; diff --git a/test/cases/chunks/import-context/index.js b/test/cases/chunks/import-context/index.js index ae1da48a9f7..9392c88775f 100644 --- a/test/cases/chunks/import-context/index.js +++ b/test/cases/chunks/import-context/index.js @@ -2,11 +2,11 @@ function testCase(load, done) { load("two", 2, function() { var sync = true; load("one", 1, function() { - sync.should.be.eql(false); + expect(sync).toBe(false); load("three", 3, function() { var sync = true; load("two", 2, function() { - sync.should.be.eql(true); + expect(sync).toBe(true); done(); }); Promise.resolve().then(function() {}).then(function() {}).then(function() { @@ -23,7 +23,10 @@ function testCase(load, done) { it("should be able to use expressions in import", function(done) { function load(name, expected, callback) { import("./dir/" + name).then(function(result) { - result.should.be.eql({ default: expected }); + expect(result).toEqual({ + default: expected, + [Symbol.toStringTag]: "Module" + }); callback(); }).catch(function(err) { done(err); diff --git a/test/cases/chunks/import/index.js b/test/cases/chunks/import/index.js index 8dd0f33bad2..e9bbf35d5df 100644 --- a/test/cases/chunks/import/index.js +++ b/test/cases/chunks/import/index.js @@ -1,6 +1,9 @@ it("should be able to use import", function(done) { import("./two").then(function(two) { - two.should.be.eql({ default: 2 }); + expect(two).toEqual({ + default: 2, + [Symbol.toStringTag]: "Module" + }); done(); }).catch(function(err) { done(err); diff --git a/test/cases/chunks/inline-options/index.js b/test/cases/chunks/inline-options/index.js index f5249e659cc..23c60da711a 100644 --- a/test/cases/chunks/inline-options/index.js +++ b/test/cases/chunks/inline-options/index.js @@ -91,31 +91,37 @@ it("should not find module when mode is weak and chunk not served elsewhere", fu var name = "a"; return import(/* webpackMode: "weak" */ "./dir10/" + name) .catch(function(e) { - e.should.match({ message: /not available/, code: /MODULE_NOT_FOUND/ }); - }) + expect(e).toMatchObject({ message: /not available/, code: /MODULE_NOT_FOUND/ }); + }); }); it("should not find module when mode is weak and chunk not served elsewhere (without context)", function() { return import(/* webpackMode: "weak" */ "./dir11/a") .catch(function(e) { - e.should.match({ message: /not available/, code: /MODULE_NOT_FOUND/ }); - }) + expect(e).toMatchObject({ message: /not available/, code: /MODULE_NOT_FOUND/ }); + }); }); function testChunkLoading(load, expectedSyncInitial, expectedSyncRequested) { var sync = false; var syncInitial = true; var p = Promise.all([load("a"), load("b")]).then(function() { - syncInitial.should.be.eql(expectedSyncInitial); + expect(syncInitial).toBe(expectedSyncInitial); sync = true; var p = Promise.all([ load("a").then(function(a) { - a.should.be.eql({ default: "a" }); - sync.should.be.eql(true); + expect(a).toEqual({ + default: "a", + [Symbol.toStringTag]: "Module" + }); + expect(sync).toBe(true); }), load("c").then(function(c) { - c.should.be.eql({ default: "c" }); - sync.should.be.eql(expectedSyncRequested); + expect(c).toEqual({ + default: "c", + [Symbol.toStringTag]: "Module" + }); + expect(sync).toBe(expectedSyncRequested); }) ]); Promise.resolve().then(function(){}).then(function(){}).then(function(){}).then(function(){ diff --git a/test/cases/chunks/issue-2443/index.js b/test/cases/chunks/issue-2443/index.js index 299e99d7fa3..76388fef631 100644 --- a/test/cases/chunks/issue-2443/index.js +++ b/test/cases/chunks/issue-2443/index.js @@ -1,7 +1,10 @@ it("should be able to use expressions in import (directory)", function(done) { function load(name, expected, callback) { import("./dir/" + name + "/file.js").then(function(result) { - result.should.be.eql({ default: expected }); + expect(result).toEqual({ + default: expected, + [Symbol.toStringTag]: "Module" + }); callback(); }).catch(function(err) { done(err); diff --git a/test/cases/chunks/issue-5153/index.js b/test/cases/chunks/issue-5153/index.js new file mode 100644 index 00000000000..70c5dbd9620 --- /dev/null +++ b/test/cases/chunks/issue-5153/index.js @@ -0,0 +1,7 @@ +import x from "./module"; + +it("should export the same binding", () => { + return import("./module").then(ns => { + expect(x).toBe(ns.default); + }); +}); diff --git a/test/cases/chunks/issue-5153/module.js b/test/cases/chunks/issue-5153/module.js new file mode 100644 index 00000000000..ff8b4c56321 --- /dev/null +++ b/test/cases/chunks/issue-5153/module.js @@ -0,0 +1 @@ +export default {}; diff --git a/test/cases/chunks/named-chunks/index.js b/test/cases/chunks/named-chunks/index.js index f3a81461927..1897b9a0b6b 100644 --- a/test/cases/chunks/named-chunks/index.js +++ b/test/cases/chunks/named-chunks/index.js @@ -13,7 +13,7 @@ it("should handle named chunks", function(done) { require.ensure([], function(require) { require("./empty?c"); require("./empty?d"); - sync.should.be.ok(); + expect(sync).toBeTruthy(); done(); }, "named-chunk"); } @@ -22,10 +22,10 @@ it("should handle named chunks", function(done) { it("should handle empty named chunks", function(done) { var sync = false; require.ensure([], function(require) { - sync.should.be.ok(); + expect(sync).toBeTruthy(); }, "empty-named-chunk"); require.ensure([], function(require) { - sync.should.be.ok(); + expect(sync).toBeTruthy(); done(); }, "empty-named-chunk"); sync = true; @@ -49,7 +49,7 @@ it("should handle named chunks when there is an error callback", function(done) require.ensure([], function(require) { require("./empty?g"); require("./empty?h"); - sync.should.be.ok(); + expect(sync).toBeTruthy(); done(); }, function(error) {}, "named-chunk-for-error-callback"); } @@ -58,10 +58,10 @@ it("should handle named chunks when there is an error callback", function(done) it("should handle empty named chunks when there is an error callback", function(done) { var sync = false; require.ensure([], function(require) { - sync.should.be.ok(); + expect(sync).toBeTruthy(); }, function(error) {}, "empty-named-chunk-for-error-callback"); require.ensure([], function(require) { - sync.should.be.ok(); + expect(sync).toBeTruthy(); done(); }, function(error) {}, "empty-named-chunk-for-error-callback"); sync = true; @@ -75,13 +75,13 @@ it("should be able to use named chunks in import()", function(done) { import("./empty?import1-in-chunk1" /* webpackChunkName: "import-named-chunk-1" */).then(function(result){ var i = 0; import("./empty?import2-in-chunk1" /* webpackChunkName: "import-named-chunk-1" */).then(function(result){ - sync.should.be.ok(); + expect(sync).toBeTruthy(); if(i++ > 0) done(); }).catch(function(err){ done(err); }); import("./empty?import3-in-chunk2" /* webpackChunkName: "import-named-chunk-2" */).then(function(result){ - sync.should.not.be.ok(); + expect(sync).toBeFalsy(); if(i++ > 0) done(); }).catch(function(err){ done(err); @@ -99,13 +99,13 @@ it("should be able to use named chunk in context import()", function(done) { import("./e" + mpty + "2" /* webpackChunkName: "context-named-chunk" */).then(function(result) { var i = 0; import("./e" + mpty + "3" /* webpackChunkName: "context-named-chunk" */).then(function(result){ - sync.should.be.ok(); + expect(sync).toBeTruthy(); if(i++ > 0) done(); }).catch(function(err){ done(err); }); import("./e" + mpty + "4" /* webpackChunkName: "context-named-chunk-2" */).then(function(result){ - sync.should.not.be.ok(); + expect(sync).toBeFalsy(); if(i++ > 0) done(); }).catch(function(err){ done(err); diff --git a/test/cases/chunks/parsing/index.js b/test/cases/chunks/parsing/index.js index edefaf29653..f3a376a5b27 100644 --- a/test/cases/chunks/parsing/index.js +++ b/test/cases/chunks/parsing/index.js @@ -1,12 +1,10 @@ -var should = require("should"); - it("should handle bound function expressions", function(done) { require.ensure([], function(require) { - this.should.be.eql({ test: true }); + expect(this).toEqual({ test: true }); require("./empty?test"); - process.nextTick.should.have.type("function"); // check if injection still works + expect(process.nextTick).toBeTypeOf("function"); // check if injection still works require.ensure([], function(require) { - this.should.be.eql({ test: true }); + expect(this).toEqual({ test: true }); done(); }.bind(this)); }.bind({test: true})); @@ -21,7 +19,7 @@ it("should handle require.ensure without function expression", function(done) { it("should parse expression in require.ensure, which isn't a function expression", function(done) { require.ensure([], (function() { - require("./empty?require.ensure:test").should.be.eql({}); + expect(require("./empty?require.ensure:test")).toEqual({}); return function f() { done(); }; @@ -35,8 +33,8 @@ it("should accept a require.include call", function(done) { value = require("./require.include"); }); setImmediate(function() { - should.strictEqual(value, "require.include"); - value.should.be.eql("require.include"); + expect(value).toBe("require.include"); + expect(value).toBe("require.include"); done(); }); }); diff --git a/test/cases/chunks/runtime/duplicate.js b/test/cases/chunks/runtime/duplicate.js index 9867c81061c..35482931895 100644 --- a/test/cases/chunks/runtime/duplicate.js +++ b/test/cases/chunks/runtime/duplicate.js @@ -1,3 +1,3 @@ require.ensure(["./a"], function(require) { - require("./a").should.be.eql("a"); -}) \ No newline at end of file + expect(require("./a")).toBe("a"); +}) diff --git a/test/cases/chunks/runtime/duplicate2.js b/test/cases/chunks/runtime/duplicate2.js index e6ab3c76865..37b0f6b4d27 100644 --- a/test/cases/chunks/runtime/duplicate2.js +++ b/test/cases/chunks/runtime/duplicate2.js @@ -1,3 +1,3 @@ require.ensure(["./b"], function(require) { - require("./b").should.be.eql("a"); -}) \ No newline at end of file + expect(require("./b")).toBe("a"); +}) diff --git a/test/cases/chunks/runtime/index.js b/test/cases/chunks/runtime/index.js index 30b8e1dfa3a..a070316530f 100644 --- a/test/cases/chunks/runtime/index.js +++ b/test/cases/chunks/runtime/index.js @@ -21,7 +21,7 @@ it("should not load a chunk which is included in a already loaded one", function var asyncFlag = false; require.ensure(["./empty?x", "./empty?y", "./empty?z"], function(require) { try { - asyncFlag.should.be.eql(true); + expect(asyncFlag).toBe(true); loadChunk(); } catch(e) { done(e); @@ -34,7 +34,7 @@ it("should not load a chunk which is included in a already loaded one", function var sync = true; require.ensure(["./empty?x", "./empty?y"], function(require) { try { - sync.should.be.eql(true); + expect(sync).toBe(true); done(); } catch(e) { done(e); diff --git a/test/cases/chunks/runtime/test.filter.js b/test/cases/chunks/runtime/test.filter.js new file mode 100644 index 00000000000..3ed2e8ae961 --- /dev/null +++ b/test/cases/chunks/runtime/test.filter.js @@ -0,0 +1,4 @@ +module.exports = function(config) { + // This test can't run in development mode as it depends on the flagIncludedChunks optimization + return config.mode !== "development"; +}; diff --git a/test/cases/chunks/weak-dependencies-context/index.js b/test/cases/chunks/weak-dependencies-context/index.js index 96477ab2fce..c6290bd7ec1 100644 --- a/test/cases/chunks/weak-dependencies-context/index.js +++ b/test/cases/chunks/weak-dependencies-context/index.js @@ -14,11 +14,11 @@ it("should not include a module with a weak dependency using context", function( require(["./b"]); require("./c"); - resolveWeakA.should.exist; - resolveWeakB.should.exist; - resolveWeakC.should.exist; + expect(resolveWeakA).toBeDefined(); + expect(resolveWeakB).toBeDefined(); + expect(resolveWeakC).toBeDefined(); - a.should.be.eql(false); - b.should.be.eql(false); - c.should.be.eql(true); + expect(a).toBe(false); + expect(b).toBe(false); + expect(c).toBe(true); }); diff --git a/test/cases/chunks/weak-dependencies/index.js b/test/cases/chunks/weak-dependencies/index.js index bde0c7db0c6..d293d17f5c8 100644 --- a/test/cases/chunks/weak-dependencies/index.js +++ b/test/cases/chunks/weak-dependencies/index.js @@ -5,9 +5,9 @@ it("should not include a module with a weak dependency", function() { var d = !!__webpack_modules__[require.resolveWeak("./d")]; require(["./c"]); require("./d"); - - a.should.be.eql(false); - b.should.be.eql(true); - c.should.be.eql(false); - d.should.be.eql(true); -}); \ No newline at end of file + + expect(a).toBe(false); + expect(b).toBe(true); + expect(c).toBe(false); + expect(d).toBe(true); +}); diff --git a/test/cases/chunks/weird-reference-to-entry/index.js b/test/cases/chunks/weird-reference-to-entry/index.js index ea307b7e9a1..d22953e46c9 100644 --- a/test/cases/chunks/weird-reference-to-entry/index.js +++ b/test/cases/chunks/weird-reference-to-entry/index.js @@ -1,6 +1,6 @@ it("should handle reference to entry chunk correctly", function(done) { import(/* webpackChunkName: "main" */"./module-a").then(function(result) { - result.default.should.be.eql("ok"); + expect(result.default).toBe("ok"); done(); }).catch(function(e) { done(e); diff --git a/test/cases/compile/deduplication-bundle-loader/index.js b/test/cases/compile/deduplication-bundle-loader/index.js index e713c6063c2..7b5adeae0be 100644 --- a/test/cases/compile/deduplication-bundle-loader/index.js +++ b/test/cases/compile/deduplication-bundle-loader/index.js @@ -1,12 +1,12 @@ it("should load a duplicate module with different dependencies correctly", function(done) { var a = require("bundle-loader!./a/file"); var b = require("bundle-loader!./b/file"); - (typeof a).should.be.eql("function"); - (typeof b).should.be.eql("function"); + expect((typeof a)).toBe("function"); + expect((typeof b)).toBe("function"); a(function(ra) { - ra.should.be.eql("a"); + expect(ra).toBe("a"); b(function(rb) { - rb.should.be.eql("b"); + expect(rb).toBe("b"); done(); }) }); diff --git a/test/cases/compile/deduplication/index.js b/test/cases/compile/deduplication/index.js index dfe4dba1cb0..df4bdbee755 100644 --- a/test/cases/compile/deduplication/index.js +++ b/test/cases/compile/deduplication/index.js @@ -1,6 +1,6 @@ it("should load a duplicate module with different dependencies correctly", function() { var dedupe1 = require("./dedupe1"); var dedupe2 = require("./dedupe2"); - dedupe1.should.be.eql("dedupe1"); - dedupe2.should.be.eql("dedupe2"); + expect(dedupe1).toBe("dedupe1"); + expect(dedupe2).toBe("dedupe2"); }); diff --git a/test/cases/compile/error-hide-stack/errors.js b/test/cases/compile/error-hide-stack/errors.js index 26dde3d9681..709dd36e710 100644 --- a/test/cases/compile/error-hide-stack/errors.js +++ b/test/cases/compile/error-hide-stack/errors.js @@ -1,3 +1,3 @@ module.exports = [ - [/Module build failed: Message\nStack/] -]; \ No newline at end of file + [/Module build failed( \(from [^)]+\))?:\nMessage\nStack/] +]; diff --git a/test/cases/compile/error-hide-stack/index.js b/test/cases/compile/error-hide-stack/index.js index 89bae46adf7..e73a65df4ee 100644 --- a/test/cases/compile/error-hide-stack/index.js +++ b/test/cases/compile/error-hide-stack/index.js @@ -1,5 +1,5 @@ it("should hide stack in details", function() { - (function f() { + expect(function f() { require("./loader!"); - }).should.throw(); + }).toThrowError(); }); diff --git a/test/cases/concord/inner-modules-and-extensions/index.js b/test/cases/concord/inner-modules-and-extensions/index.js index b35fdaacb71..4a2f7000fd6 100644 --- a/test/cases/concord/inner-modules-and-extensions/index.js +++ b/test/cases/concord/inner-modules-and-extensions/index.js @@ -1,12 +1,12 @@ it("should resolve the alias in package.json", function() { - require("app/file").default.should.be.eql("file"); + expect(require("app/file").default).toBe("file"); }); it("should resolve the alias and extensions in package.json", function() { - require("app/file2").default.should.be.eql("correct file2"); + expect(require("app/file2").default).toBe("correct file2"); }); it("should resolve the alias in package.json", function() { - require("thing").default.should.be.eql("the thing"); + expect(require("thing").default).toBe("the thing"); }); diff --git a/test/cases/context/ignore-hidden-files/index.js b/test/cases/context/ignore-hidden-files/index.js index 4f13adedbab..83313cd16e2 100644 --- a/test/cases/context/ignore-hidden-files/index.js +++ b/test/cases/context/ignore-hidden-files/index.js @@ -1,6 +1,6 @@ it("should ignore hidden files", function() { - (function() { + expect(function() { var name = "./file.js"; require("./folder/" + name); - }).should.throw(); + }).toThrowError(); }); \ No newline at end of file diff --git a/test/cases/context/issue-1769/index.js b/test/cases/context/issue-1769/index.js index 76305733c90..504862c3730 100644 --- a/test/cases/context/issue-1769/index.js +++ b/test/cases/context/issue-1769/index.js @@ -3,7 +3,7 @@ it("should be able the catch a incorrect import", function(done) { import("./folder/" + expr).then(function() { done(new Error("should not be called")); }).catch(function(err) { - err.should.be.instanceof(Error); + expect(err).toBeInstanceOf(Error); done(); }); }); diff --git a/test/cases/context/issue-3873/index.js b/test/cases/context/issue-3873/index.js index 8135a5a737d..01f49fbd70f 100644 --- a/test/cases/context/issue-3873/index.js +++ b/test/cases/context/issue-3873/index.js @@ -3,5 +3,5 @@ function get(name) { } it("should automatically infer the index.js file", function() { - get("module").should.be.eql("module"); + expect(get("module")).toBe("module"); }); diff --git a/test/cases/context/issue-524/index.js b/test/cases/context/issue-524/index.js index 8c42102a7c2..4c0c7721c43 100644 --- a/test/cases/context/issue-524/index.js +++ b/test/cases/context/issue-524/index.js @@ -1,25 +1,11 @@ it("should support an empty context", function() { var c = require.context(".", true, /^nothing$/); - (typeof c.id).should.be.oneOf(["number", "string"]); - (function() { + expect(typeof c.id === "number" || typeof c.id === "string").toBeTruthy(); + expect(function() { c.resolve(""); - }).should.throw(); - (function() { + }).toThrowError(); + expect(function() { c(""); - }).should.throw(); - c.keys().should.be.eql([]); + }).toThrowError(); + expect(c.keys()).toEqual([]); }); - -// This would be a useful testcase, but it requires an (really) empty directory. -// **but** you cannot commit empty directories into git -/*it("should support an empty context (empty dir)", function() { - var c = require.context("./empty", true, /^nothing$/); - c.id.should.be.type("number"); - (function() { - c.resolve(""); - }).should.throw(); - (function() { - c(""); - }).should.throw(); - c.keys().should.be.eql([]); -});*/ diff --git a/test/cases/context/issue-5750/index.js b/test/cases/context/issue-5750/index.js index 09b525ab07a..92b55ac8407 100644 --- a/test/cases/context/issue-5750/index.js +++ b/test/cases/context/issue-5750/index.js @@ -1,4 +1,4 @@ it("should not use regexps with the g flag", function() { - require.context("./folder", true, /a/).keys().length.should.be.eql(1); - require.context("./folder", true, /a/g).keys().length.should.be.eql(0); + expect(require.context("./folder", true, /a/).keys().length).toBe(1); + expect(require.context("./folder", true, /a/g).keys().length).toBe(0); }); diff --git a/test/cases/context/issue-801/index.js b/test/cases/context/issue-801/index.js index bacd8cc43c0..c96532006ef 100644 --- a/test/cases/context/issue-801/index.js +++ b/test/cases/context/issue-801/index.js @@ -1,7 +1,7 @@ it("should emit valid code for dynamic require string with expr", function() { var test = require("./folder/file"); - test("file").should.be.eql({ a: false, b: false, c: true, d: true }); - test("file.js").should.be.eql({ a: false, b: false, c: false, d: true }); - test("./file").should.be.eql({ a: true, b: true, c: false, d: false }); - test("./file.js").should.be.eql({ a: false, b: false, c: false, d: false }); -}); \ No newline at end of file + expect(test("file")).toEqual({ a: false, b: false, c: true, d: true }); + expect(test("file.js")).toEqual({ a: false, b: false, c: false, d: true }); + expect(test("./file")).toEqual({ a: true, b: true, c: false, d: false }); + expect(test("./file.js")).toEqual({ a: false, b: false, c: false, d: false }); +}); diff --git a/test/cases/errors/case-sensitive/index.js b/test/cases/errors/case-sensitive/index.js index f107f0160d8..c42f65350d6 100644 --- a/test/cases/errors/case-sensitive/index.js +++ b/test/cases/errors/case-sensitive/index.js @@ -3,6 +3,6 @@ it("should return different modules with different casing", function() { var A = require("./A"); var b = require("./b/file.js"); var B = require("./B/file.js"); - a.should.not.be.equal(A); - b.should.not.be.equal(B); + expect(a).not.toBe(A); + expect(b).not.toBe(B); }); diff --git a/test/cases/errors/harmony-import-missing/index.js b/test/cases/errors/harmony-import-missing/index.js index 2ee1bcc332a..14db1676922 100644 --- a/test/cases/errors/harmony-import-missing/index.js +++ b/test/cases/errors/harmony-import-missing/index.js @@ -1,5 +1,5 @@ it("should not crash on importing missing modules", function() { - (function() { + expect(function() { require("./module"); - }).should.throw(); + }).toThrowError(); }); diff --git a/test/cases/json/data/index.js b/test/cases/json/data/index.js index b4e30016bf8..eb3a9a73049 100644 --- a/test/cases/json/data/index.js +++ b/test/cases/json/data/index.js @@ -1,8 +1,8 @@ it("should require json via require", function() { - ({ data: require("./a.json") }).should.be.eql({ data: null }); - ({ data: require("./b.json") }).should.be.eql({ data: 123 }); - ({ data: require("./c.json") }).should.be.eql({ data: [1, 2, 3, 4] }); - ({ data: require("./e.json") }).should.be.eql({ data: { + expect({ data: require("./a.json") }).toEqual({ data: null }); + expect({ data: require("./b.json") }).toEqual({ data: 123 }); + expect({ data: require("./c.json") }).toEqual({ data: [1, 2, 3, 4] }); + expect({ data: require("./e.json") }).toEqual({ data: { "aa": 1, "bb": 2, "1": "x" diff --git a/test/cases/json/import-by-name/index.js b/test/cases/json/import-by-name/index.js index 58917005710..20993afb537 100644 --- a/test/cases/json/import-by-name/index.js +++ b/test/cases/json/import-by-name/index.js @@ -5,17 +5,17 @@ import f, { named } from "../data/f.json"; import g, { named as gnamed } from "../data/g.json"; it("should be possible to import json data", function() { - c[2].should.be.eql(3); - Object.keys(d).should.be.eql(["default"]); - aa.should.be.eql(1); - bb.should.be.eql(2); - named.should.be.eql("named"); - ({ f }).should.be.eql({ + expect(c[2]).toBe(3); + expect(Object.keys(d)).toEqual(["default"]); + expect(aa).toBe(1); + expect(bb).toBe(2); + expect(named).toBe("named"); + (expect({ f })).toEqual({ f: { __esModule: true, default: "default", named: "named" } }); - g.named.should.be.equal(gnamed); + expect(g.named).toBe(gnamed); }); diff --git a/test/cases/json/import-lazy/index.js b/test/cases/json/import-lazy/index.js new file mode 100644 index 00000000000..2f01d1b61fa --- /dev/null +++ b/test/cases/json/import-lazy/index.js @@ -0,0 +1,61 @@ + +it("should be possible to import json data async", function() { + return Promise.all([ + import("../data/a.json"), + import("../data/b.json"), + import("../data/c.json"), + import("../data/d.json"), + import("../data/e.json"), + import("../data/f.json"), + import("../data/g.json") + ]).then(([a, b, c, d, e, f, g]) => { + expect(a).toEqual({ + default: null, + [Symbol.toStringTag]: "Module" + }); + expect(b).toEqual({ + default: 123, + [Symbol.toStringTag]: "Module" + }); + expect(c).toEqual({ + 0: 1, + 1: 2, + 2: 3, + 3: 4, + default: [1, 2, 3, 4], + [Symbol.toStringTag]: "Module" + }); + expect(d).toEqual({ + default: {}, + [Symbol.toStringTag]: "Module" + }); + expect(e).toEqual({ + aa: 1, + bb: 2, + 1: "x", + default: { + aa: 1, + bb: 2, + "1": "x" + }, + [Symbol.toStringTag]: "Module" + }); + expect(f).toEqual({ + named: "named", + default: { + named: "named", + "default": "default", + __esModule: true + }, + [Symbol.toStringTag]: "Module" + }); + expect(g).toEqual({ + named: {}, + default: { + named: {} + }, + [Symbol.toStringTag]: "Module" + }); + expect(g.named).toBe(g.default.named); + }); +}); diff --git a/test/cases/json/import-with-default/index.js b/test/cases/json/import-with-default/index.js index e138d294e99..80fde51faea 100644 --- a/test/cases/json/import-with-default/index.js +++ b/test/cases/json/import-with-default/index.js @@ -6,16 +6,16 @@ import e from "../data/e.json"; import f from "../data/f.json"; it("should be possible to import json data", function() { - ({a}).should.be.eql({a: null}); - b.should.be.eql(123); - c.should.be.eql([1, 2, 3, 4]); - d.should.be.eql({}); - e.should.be.eql({ + expect({a}).toEqual({a: null}); + expect(b).toBe(123); + expect(c).toEqual([1, 2, 3, 4]); + expect(d).toEqual({}); + expect(e).toEqual({ aa: 1, bb: 2, "1": "x" }); - f.should.be.eql({ + expect(f).toEqual({ named: "named", "default": "default", __esModule: true diff --git a/test/cases/loaders/_resources/included.jade b/test/cases/loaders/_resources/included.pug similarity index 100% rename from test/cases/loaders/_resources/included.jade rename to test/cases/loaders/_resources/included.pug diff --git a/test/cases/loaders/_resources/parent.jade b/test/cases/loaders/_resources/parent.pug similarity index 100% rename from test/cases/loaders/_resources/parent.jade rename to test/cases/loaders/_resources/parent.pug diff --git a/test/cases/loaders/_resources/template.jade b/test/cases/loaders/_resources/template.pug similarity index 100% rename from test/cases/loaders/_resources/template.jade rename to test/cases/loaders/_resources/template.pug diff --git a/test/cases/loaders/async/index.js b/test/cases/loaders/async/index.js index 0c3a7cb0f0c..8d7a8628ba9 100644 --- a/test/cases/loaders/async/index.js +++ b/test/cases/loaders/async/index.js @@ -1,14 +1,14 @@ it("should allow combinations of async and sync loaders", function() { - require("./loaders/syncloader!./a").should.be.eql("a"); - require("./loaders/asyncloader!./a").should.be.eql("a"); + expect(require("./loaders/syncloader!./a")).toBe("a"); + expect(require("./loaders/asyncloader!./a")).toBe("a"); - require("./loaders/syncloader!./loaders/syncloader!./a").should.be.eql("a"); - require("./loaders/syncloader!./loaders/asyncloader!./a").should.be.eql("a"); - require("./loaders/asyncloader!./loaders/syncloader!./a").should.be.eql("a"); - require("./loaders/asyncloader!./loaders/asyncloader!./a").should.be.eql("a"); + expect(require("./loaders/syncloader!./loaders/syncloader!./a")).toBe("a"); + expect(require("./loaders/syncloader!./loaders/asyncloader!./a")).toBe("a"); + expect(require("./loaders/asyncloader!./loaders/syncloader!./a")).toBe("a"); + expect(require("./loaders/asyncloader!./loaders/asyncloader!./a")).toBe("a"); - require("./loaders/asyncloader!./loaders/asyncloader!./loaders/asyncloader!./a").should.be.eql("a"); - require("./loaders/asyncloader!./loaders/syncloader!./loaders/asyncloader!./a").should.be.eql("a"); - require("./loaders/syncloader!./loaders/asyncloader!./loaders/syncloader!./a").should.be.eql("a"); - require("./loaders/syncloader!./loaders/syncloader!./loaders/syncloader!./a").should.be.eql("a"); + expect(require("./loaders/asyncloader!./loaders/asyncloader!./loaders/asyncloader!./a")).toBe("a"); + expect(require("./loaders/asyncloader!./loaders/syncloader!./loaders/asyncloader!./a")).toBe("a"); + expect(require("./loaders/syncloader!./loaders/asyncloader!./loaders/syncloader!./a")).toBe("a"); + expect(require("./loaders/syncloader!./loaders/syncloader!./loaders/syncloader!./a")).toBe("a"); }); diff --git a/test/cases/loaders/coffee-loader/index.js b/test/cases/loaders/coffee-loader/index.js index 2e0012214ee..be3924f1e3f 100644 --- a/test/cases/loaders/coffee-loader/index.js +++ b/test/cases/loaders/coffee-loader/index.js @@ -1,10 +1,10 @@ it("should handle the coffee loader correctly", function() { - require("!coffee-loader!../_resources/script.coffee").should.be.eql("coffee test"); - require("../_resources/script.coffee").should.be.eql("coffee test"); + expect(require("!coffee-loader!../_resources/script.coffee")).toBe("coffee test"); + expect(require("../_resources/script.coffee")).toBe("coffee test"); }); it("should handle literate coffee script correctly", function() { - require("!coffee-loader?literate!./script.coffee.md").should.be.eql("literate coffee test"); + expect(require("!coffee-loader?literate!./script.coffee.md")).toBe("literate coffee test"); }); it("should generate valid code with cheap-source-map", function() { diff --git a/test/cases/loaders/context/index.js b/test/cases/loaders/context/index.js index 833bebb1051..9105d7d6f32 100644 --- a/test/cases/loaders/context/index.js +++ b/test/cases/loaders/context/index.js @@ -1,5 +1,5 @@ it("should be able to use a context with a loader", function() { var abc = "abc", scr = "script.coffee"; - require("../_resources/" + scr).should.be.eql("coffee test"); - require("raw-loader!../_resources/" + abc + ".txt").should.be.eql("abc"); + expect(require("../_resources/" + scr)).toBe("coffee test"); + expect(require("raw-loader!../_resources/" + abc + ".txt")).toBe("abc"); }); diff --git a/test/cases/loaders/css-loader/index.js b/test/cases/loaders/css-loader/index.js index 2ecc753956c..b6484574fb4 100644 --- a/test/cases/loaders/css-loader/index.js +++ b/test/cases/loaders/css-loader/index.js @@ -1,5 +1,11 @@ it("should handle the css loader correctly", function() { - (require("!css-loader!../_css/stylesheet.css") + "").indexOf(".rule-direct").should.not.be.eql(-1); - (require("!css-loader!../_css/stylesheet.css") + "").indexOf(".rule-import1").should.not.be.eql(-1); - (require("!css-loader!../_css/stylesheet.css") + "").indexOf(".rule-import2").should.not.be.eql(-1); + expect( + (require("!css-loader!../_css/stylesheet.css") + "").indexOf(".rule-direct") + ).not.toEqual(-1); + expect( + (require("!css-loader!../_css/stylesheet.css") + "").indexOf(".rule-import1") + ).not.toEqual(-1); + expect( + (require("!css-loader!../_css/stylesheet.css") + "").indexOf(".rule-import2") + ).not.toEqual(-1); }); diff --git a/test/cases/loaders/issue-2299/index.js b/test/cases/loaders/issue-2299/index.js index 29e632e6262..0a97e0c920f 100644 --- a/test/cases/loaders/issue-2299/index.js +++ b/test/cases/loaders/issue-2299/index.js @@ -1,3 +1,6 @@ it("should be able to use loadModule multiple times within a loader, on files in different directories", function() { - require('!./loader/index.js!./a.data').should.have.properties(['a', 'b', 'c']); + const data = require("!./loader/index.js!./a.data"); + expect(data).toHaveProperty("a"); + expect(data).toHaveProperty("b"); + expect(data).toHaveProperty("c"); }); diff --git a/test/cases/loaders/issue-4959/a.js b/test/cases/loaders/issue-4959/a.js new file mode 100644 index 00000000000..6cd1d0075d4 --- /dev/null +++ b/test/cases/loaders/issue-4959/a.js @@ -0,0 +1 @@ +module.exports = "a"; diff --git a/test/cases/loaders/issue-4959/b.js b/test/cases/loaders/issue-4959/b.js new file mode 100644 index 00000000000..554e527d5dc --- /dev/null +++ b/test/cases/loaders/issue-4959/b.js @@ -0,0 +1 @@ +module.exports = require("c"); diff --git a/test/cases/loaders/issue-4959/c.js b/test/cases/loaders/issue-4959/c.js new file mode 100644 index 00000000000..f55ffed587c --- /dev/null +++ b/test/cases/loaders/issue-4959/c.js @@ -0,0 +1 @@ +module.exports = "c"; diff --git a/test/cases/loaders/issue-4959/index.js b/test/cases/loaders/issue-4959/index.js new file mode 100644 index 00000000000..8f360d4b8dc --- /dev/null +++ b/test/cases/loaders/issue-4959/index.js @@ -0,0 +1,3 @@ +it("should resolve module dependencies recursively", function() { + expect(require("!./loaders/index!a")).toBe("c"); +}); diff --git a/test/cases/loaders/issue-4959/loaders/index.js b/test/cases/loaders/issue-4959/loaders/index.js new file mode 100644 index 00000000000..a9877df5e40 --- /dev/null +++ b/test/cases/loaders/issue-4959/loaders/index.js @@ -0,0 +1,9 @@ +module.exports = function() { + var callback = this.async(); + this.loadModule("b", function(error) { + if (error) { + return callback(error); + } + callback(null, "module.exports = require('b');"); + }); +}; diff --git a/test/cases/loaders/issue-4959/package.json b/test/cases/loaders/issue-4959/package.json new file mode 100644 index 00000000000..240a86856fb --- /dev/null +++ b/test/cases/loaders/issue-4959/package.json @@ -0,0 +1,7 @@ +{ + "browser": { + "a": "./a.js", + "b": "./b.js", + "c": "./c.js" + } +} diff --git a/test/cases/loaders/jade-loader/index.js b/test/cases/loaders/jade-loader/index.js deleted file mode 100644 index a30c1f92eec..00000000000 --- a/test/cases/loaders/jade-loader/index.js +++ /dev/null @@ -1,4 +0,0 @@ -it("should handle the jade loader correctly", function() { - require("!jade-loader?self!../_resources/template.jade")({abc: "abc"}).should.be.eql("

selfabc

included

"); - require("../_resources/template.jade")({abc: "abc"}).should.be.eql("

abc

included

"); -}); diff --git a/test/cases/loaders/json-loader/index.js b/test/cases/loaders/json-loader/index.js index e2e75edf4ab..97de4550607 100644 --- a/test/cases/loaders/json-loader/index.js +++ b/test/cases/loaders/json-loader/index.js @@ -1,13 +1,11 @@ -var should = require("should"); - it("should be able to load JSON files without loader", function() { var someJson = require("./some.json"); - someJson.should.have.property("it", "works"); - someJson.should.have.property("number", 42); + expect(someJson).toHaveProperty("it", "works"); + expect(someJson).toHaveProperty("number", 42); }); it("should also work when the json extension is omitted", function() { var someJson = require("./some"); - someJson.should.have.property("it", "works"); - someJson.should.have.property("number", 42); + expect(someJson).toHaveProperty("it", "works"); + expect(someJson).toHaveProperty("number", 42); }); diff --git a/test/cases/loaders/less-loader/index.js b/test/cases/loaders/less-loader/index.js index 936d89c6197..fc94245fbd6 100644 --- a/test/cases/loaders/less-loader/index.js +++ b/test/cases/loaders/less-loader/index.js @@ -1,5 +1,11 @@ it("should handle the less loader (piped with raw loader) correctly", function() { - require("!raw-loader!less-loader!./less/stylesheet.less").indexOf(".less-rule-direct").should.not.be.eql(-1); - require("!raw-loader!less-loader!./less/stylesheet.less").indexOf(".less-rule-import1").should.not.be.eql(-1); - require("!raw-loader!less-loader!./less/stylesheet.less").indexOf(".less-rule-import2").should.not.be.eql(-1); + expect( + require("!raw-loader!less-loader!./less/stylesheet.less").indexOf(".less-rule-direct") + ).not.toEqual(-1); + expect( + require("!raw-loader!less-loader!./less/stylesheet.less").indexOf(".less-rule-import1") + ).not.toEqual(-1); + expect( + require("!raw-loader!less-loader!./less/stylesheet.less").indexOf(".less-rule-import2") + ).not.toEqual(-1); }); diff --git a/test/cases/loaders/module-description-file/index.js b/test/cases/loaders/module-description-file/index.js index 385187584be..ce5b36996b6 100644 --- a/test/cases/loaders/module-description-file/index.js +++ b/test/cases/loaders/module-description-file/index.js @@ -1,12 +1,12 @@ it("should run a loader from package.json", function() { - require("testloader!../_resources/abc.txt").should.be.eql("abcwebpack"); - require("testloader/lib/loader2!../_resources/abc.txt").should.be.eql("abcweb"); - require("testloader/lib/loader3!../_resources/abc.txt").should.be.eql("abcloader"); - require("testloader/lib/loader-indirect!../_resources/abc.txt").should.be.eql("abcwebpack"); + expect(require("testloader!../_resources/abc.txt")).toBe("abcwebpack"); + expect(require("testloader/lib/loader2!../_resources/abc.txt")).toBe("abcweb"); + expect(require("testloader/lib/loader3!../_resources/abc.txt")).toBe("abcloader"); + expect(require("testloader/lib/loader-indirect!../_resources/abc.txt")).toBe("abcwebpack"); }); it("should run a loader from .webpack-loader.js extension", function() { - require("testloader/lib/loader!../_resources/abc.txt").should.be.eql("abcwebpack"); + expect(require("testloader/lib/loader!../_resources/abc.txt")).toBe("abcwebpack"); }); it("should be able to pipe loaders", function() { - require("testloader!./reverseloader!../_resources/abc.txt").should.be.eql("cbawebpack"); + expect(require("testloader!./reverseloader!../_resources/abc.txt")).toBe("cbawebpack"); }); diff --git a/test/cases/loaders/no-string/errors.js b/test/cases/loaders/no-string/errors.js new file mode 100644 index 00000000000..c3bb27deb83 --- /dev/null +++ b/test/cases/loaders/no-string/errors.js @@ -0,0 +1,10 @@ +module.exports = [ + [ + /\.\/loaders\/no-string\/file\.js \(\.\/loaders\/no-string\/loader\.js!\.\/loaders\/no-string\/file\.js\)/, + /Module build failed: Error: Final loader \(\.\/loaders\/no-string\/loader\.js\) didn't return a Buffer or String/ + ], + [ + /\.\/loaders\/no-string\/file\.js \(\.\/loaders\/no-string\/loader\.js!\.\/loaders\/no-string\/pitch-loader\.js!\.\/loaders\/no-string\/file\.js\)/, + /Module build failed: Error: Final loader \(\.\/loaders\/no-string\/loader\.js\) didn't return a Buffer or String/ + ] +]; diff --git a/test/cases/loaders/no-string/file.js b/test/cases/loaders/no-string/file.js new file mode 100644 index 00000000000..190a18037c6 --- /dev/null +++ b/test/cases/loaders/no-string/file.js @@ -0,0 +1 @@ +123 diff --git a/test/cases/loaders/no-string/index.js b/test/cases/loaders/no-string/index.js new file mode 100644 index 00000000000..a7205631c24 --- /dev/null +++ b/test/cases/loaders/no-string/index.js @@ -0,0 +1,8 @@ +it("should emit the correct error for loaders not returning buffer or string", function() { + expect(() => require("./loader.js!./file.js")).toThrowError( + /Module build failed/ + ); + expect(() => require("./loader.js!./pitch-loader.js!./file.js")).toThrowError( + /Module build failed/ + ); +}); diff --git a/test/cases/loaders/no-string/loader.js b/test/cases/loaders/no-string/loader.js new file mode 100644 index 00000000000..6f8c80e598e --- /dev/null +++ b/test/cases/loaders/no-string/loader.js @@ -0,0 +1,3 @@ +module.exports = () => { + return 123; +}; diff --git a/test/cases/loaders/no-string/pitch-loader.js b/test/cases/loaders/no-string/pitch-loader.js new file mode 100644 index 00000000000..6f8c80e598e --- /dev/null +++ b/test/cases/loaders/no-string/pitch-loader.js @@ -0,0 +1,3 @@ +module.exports = () => { + return 123; +}; diff --git a/test/cases/loaders/pug-loader/index.js b/test/cases/loaders/pug-loader/index.js new file mode 100644 index 00000000000..7348ae7df16 --- /dev/null +++ b/test/cases/loaders/pug-loader/index.js @@ -0,0 +1,4 @@ +it("should handle the pug loader correctly", function() { + expect(require("!pug-loader?self!../_resources/template.pug")({ abc: "abc" })).toBe("

selfabc

included

"); + expect(require("../_resources/template.pug")({ abc: "abc" })).toBe("

abc

included

"); +}); diff --git a/test/cases/loaders/query/index.js b/test/cases/loaders/query/index.js index 5ce94909a7e..260f9287c29 100644 --- a/test/cases/loaders/query/index.js +++ b/test/cases/loaders/query/index.js @@ -1,6 +1,6 @@ it("should pass query to loader", function() { var result = require("./loaders/queryloader?query!./a?resourcequery"); - result.should.be.eql({ + expect(result).toEqual({ resourceQuery: "?resourcequery", query: "?query", prev: "module.exports = \"a\";" @@ -9,7 +9,7 @@ it("should pass query to loader", function() { it("should pass query to loader without resource with resource query", function() { var result = require("./loaders/queryloader?query!?resourcequery"); - result.should.be.eql({ + expect(result).toEqual({ resourceQuery: "?resourcequery", query: "?query", prev: null @@ -18,7 +18,7 @@ it("should pass query to loader without resource with resource query", function( it("should pass query to loader without resource", function() { var result = require("./loaders/queryloader?query!"); - result.should.be.eql({ + expect(result).toEqual({ query: "?query", prev: null }); @@ -26,10 +26,10 @@ it("should pass query to loader without resource", function() { it("should pass query to multiple loaders", function() { var result = require("./loaders/queryloader?query1!./loaders/queryloader?query2!./a?resourcequery"); - result.should.have.type("object"); - result.should.have.property("resourceQuery").be.eql("?resourcequery"); - result.should.have.property("query").be.eql("?query1"); - result.should.have.property("prev").be.eql("module.exports = " + JSON.stringify({ + expect(result).toBeTypeOf("object"); + expect(result).toHaveProperty("resourceQuery", "?resourcequery"); + expect(result).toHaveProperty("query", "?query1"); + expect(result).toHaveProperty("prev", "module.exports = " + JSON.stringify({ resourceQuery: "?resourcequery", query: "?query2", prev: "module.exports = \"a\";" @@ -39,7 +39,7 @@ it("should pass query to multiple loaders", function() { it("should pass query to loader over context", function() { var test = "test"; var result = require("./loaders/queryloader?query!./context-query-test/" + test); - result.should.be.eql({ + expect(result).toEqual({ resourceQuery: "", query: "?query", prev: "test content" diff --git a/test/cases/loaders/raw-loader/index.js b/test/cases/loaders/raw-loader/index.js index eb82ae080be..5367de4e8d3 100644 --- a/test/cases/loaders/raw-loader/index.js +++ b/test/cases/loaders/raw-loader/index.js @@ -1,3 +1,3 @@ it("should handle the raw loader correctly", function() { - require("raw-loader!../_resources/abc.txt").should.be.eql("abc"); + expect(require("raw-loader!../_resources/abc.txt")).toBe("abc"); }); diff --git a/test/cases/loaders/val-loader/index.js b/test/cases/loaders/val-loader/index.js index 34d6c914e39..29a56b6aa38 100644 --- a/test/cases/loaders/val-loader/index.js +++ b/test/cases/loaders/val-loader/index.js @@ -1,5 +1,11 @@ it("should handle the val loader (piped with css loader) correctly", function() { - (require("!css-loader!val-loader!../_css/generateCss") + "").indexOf("generated").should.not.be.eql(-1); - (require("!css-loader!val-loader!../_css/generateCss") + "").indexOf(".rule-import2").should.not.be.eql(-1); - (require("!raw-loader!val-loader!../_css/generateCss") + "").indexOf("generated").should.not.be.eql(-1); + expect( + (require("!css-loader!val-loader!../_css/generateCss") + "").indexOf("generated") + ).not.toEqual(-1); + expect( + (require("!css-loader!val-loader!../_css/generateCss") + "").indexOf(".rule-import2") + ).not.toEqual(-1); + expect( + (require("!raw-loader!val-loader!../_css/generateCss") + "").indexOf("generated") + ).not.toEqual(-1); }); diff --git a/test/cases/mjs/cjs-import-default/index.mjs b/test/cases/mjs/cjs-import-default/index.mjs index 2e95cbb3a5b..2094d704219 100644 --- a/test/cases/mjs/cjs-import-default/index.mjs +++ b/test/cases/mjs/cjs-import-default/index.mjs @@ -5,58 +5,61 @@ import { ns, default as def1, def as def2, data as data2 } from "./reexport.mjs" import * as reexport from "./reexport.mjs"; it("should get correct values when importing named exports from a CommonJs module from mjs", function() { - (typeof data).should.be.eql("undefined"); - ({ data }).should.be.eql({ data: undefined }); - def.should.be.eql({ + expect(typeof data).toBe("undefined"); + expect({ data }).toEqual({ data: undefined }); + expect(def).toEqual({ data: "ok", default: "default" }); - ({ def }).should.be.eql({ + expect({ def }).toEqual({ def: { data: "ok", default: "default" } }); - const valueOf = "valueOf"; - star[valueOf]().should.be.eql({ + expect(star).toEqual({ default: { data: "ok", default: "default" - } + }, + [Symbol.toStringTag]: "Module" }); - ({ star }).should.be.eql({ + expect({ star }).toEqual({ star: { default: { data: "ok", default: "default" - } + }, + [Symbol.toStringTag]: "Module" } }); - star.default.should.be.eql({ + expect(star.default).toEqual({ data: "ok", default: "default" }); - ns.should.be.eql({ + expect(ns).toEqual({ default: { data: "ok", default: "default" - } + }, + [Symbol.toStringTag]: "Module" }); - def1.should.be.eql({ + expect(def1).toEqual({ data: "ok", default: "default" }); - def2.should.be.eql({ + expect(def2).toEqual({ data: "ok", default: "default" }); - (typeof data2).should.be.eql("undefined"); - reexport[valueOf]().should.be.eql({ + expect((typeof data2)).toBe("undefined"); + expect(reexport).toEqual({ ns: { default: { data: "ok", default: "default" - } + }, + [Symbol.toStringTag]: "Module" }, default: { data: "ok", @@ -66,6 +69,7 @@ it("should get correct values when importing named exports from a CommonJs modul data: "ok", default: "default" }, - data: undefined + data: undefined, + [Symbol.toStringTag]: "Module" }); }); diff --git a/test/cases/mjs/esm-by-default/index.mjs b/test/cases/mjs/esm-by-default/index.mjs index 839b81030e1..701d602ab77 100644 --- a/test/cases/mjs/esm-by-default/index.mjs +++ b/test/cases/mjs/esm-by-default/index.mjs @@ -1,8 +1,8 @@ it("should not have commonjs stuff available", function() { if(typeof module !== "undefined") { // If module is available - module.should.have.property("webpackTestSuiteModule"); // it must be the node.js module + expect(module).toHaveProperty("webpackTestSuiteModule"); // it must be the node.js module } if(typeof require !== "undefined") { // If require is available - require.should.have.property("webpackTestSuiteRequire"); // it must be the node.js require + expect(require).toHaveProperty("webpackTestSuiteRequire"); // it must be the node.js require } }); diff --git a/test/cases/mjs/namespace-object-lazy/dir-mixed/json.json b/test/cases/mjs/namespace-object-lazy/dir-mixed/json.json new file mode 100644 index 00000000000..9c8ca3f82ff --- /dev/null +++ b/test/cases/mjs/namespace-object-lazy/dir-mixed/json.json @@ -0,0 +1,4 @@ +{ + "default": "default", + "named": "named" +} \ No newline at end of file diff --git a/test/cases/mjs/namespace-object-lazy/index.mjs b/test/cases/mjs/namespace-object-lazy/index.mjs index eafa159390f..539e66910d8 100644 --- a/test/cases/mjs/namespace-object-lazy/index.mjs +++ b/test/cases/mjs/namespace-object-lazy/index.mjs @@ -1,13 +1,13 @@ it("should receive a namespace object when importing commonjs", function(done) { import("./cjs.js").then(function(result) { - result.should.be.eql({ default: { named: "named", default: "default" } }); + expect(result).toEqual({ default: { named: "named", default: "default" }, [Symbol.toStringTag]: "Module" }); done(); }).catch(done); }); it("should receive a namespace object when importing commonjs with __esModule", function(done) { import("./cjs-esmodule.js").then(function(result) { - result.should.be.eql({ default: { __esModule: true, named: "named", default: "default" } }); + expect(result).toEqual({ default: { __esModule: true, named: "named", default: "default" }, [Symbol.toStringTag]: "Module" }); done(); }).catch(done); }); @@ -40,11 +40,11 @@ function contextHarmony(name) { function contextMixed(name) { return Promise.all([ - import(`./dir-mixed/${name}.js`), - import(/* webpackMode: "lazy-once" */`./dir-mixed?1/${name}.js`), - import(/* webpackMode: "eager" */`./dir-mixed?2/${name}.js`) + import(`./dir-mixed/${name}`), + import(/* webpackMode: "lazy-once" */`./dir-mixed?1/${name}`), + import(/* webpackMode: "eager" */`./dir-mixed?2/${name}`) ]).then(function(results) { - return import(/* webpackMode: "weak" */`./dir-mixed/${name}.js`).then(function(r) { + return import(/* webpackMode: "weak" */`./dir-mixed/${name}`).then(function(r) { results.push(r); return results; }); @@ -54,32 +54,33 @@ function contextMixed(name) { function promiseTest(promise, equalsTo) { return promise.then(function(results) { for(const result of results) - result.should.be.eql(equalsTo); + expect(result).toEqual(equalsTo); }); } it("should receive a namespace object when importing commonjs via context", function() { return Promise.all([ - promiseTest(contextCJS("one"), { default: { named: "named", default: "default" } }), - promiseTest(contextCJS("two"), { default: { __esModule: true, named: "named", default: "default" } }), - promiseTest(contextCJS("three"), { default: { named: "named", default: "default" } }), - promiseTest(contextCJS("null"), { default: null }) + promiseTest(contextCJS("one"), { default: { named: "named", default: "default" }, [Symbol.toStringTag]: "Module" }), + promiseTest(contextCJS("two"), { default: { __esModule: true, named: "named", default: "default" }, [Symbol.toStringTag]: "Module" }), + promiseTest(contextCJS("three"), { default: { named: "named", default: "default" }, [Symbol.toStringTag]: "Module" }), + promiseTest(contextCJS("null"), { default: null, [Symbol.toStringTag]: "Module" }) ]); }); it("should receive a namespace object when importing harmony via context", function() { return Promise.all([ - promiseTest(contextHarmony("one"), { named: "named", default: "default" }), - promiseTest(contextHarmony("two"), { named: "named", default: "default" }), - promiseTest(contextHarmony("three"), { named: "named", default: "default" }) + promiseTest(contextHarmony("one"), { named: "named", default: "default", [Symbol.toStringTag]: "Module" }), + promiseTest(contextHarmony("two"), { named: "named", default: "default", [Symbol.toStringTag]: "Module" }), + promiseTest(contextHarmony("three"), { named: "named", default: "default", [Symbol.toStringTag]: "Module" }) ]); }); it("should receive a namespace object when importing mixed content via context", function() { return Promise.all([ - promiseTest(contextMixed("one"), { default: { named: "named", default: "default" } }), - promiseTest(contextMixed("two"), { default: { __esModule: true, named: "named", default: "default" } }), - promiseTest(contextMixed("three"), { named: "named", default: "default" }), - promiseTest(contextMixed("null"), { default: null }) + promiseTest(contextMixed("one"), { default: { named: "named", default: "default" }, [Symbol.toStringTag]: "Module" }), + promiseTest(contextMixed("two"), { default: { __esModule: true, named: "named", default: "default" }, [Symbol.toStringTag]: "Module" }), + promiseTest(contextMixed("three"), { named: "named", default: "default", [Symbol.toStringTag]: "Module" }), + promiseTest(contextMixed("null"), { default: null, [Symbol.toStringTag]: "Module" }), + promiseTest(contextMixed("json.json"), { named: "named", default: { named: "named", default: "default" }, [Symbol.toStringTag]: "Module" }) ]); }); diff --git a/test/cases/mjs/no-module-main-field/index.mjs b/test/cases/mjs/no-module-main-field/index.mjs index 0870957cceb..323db4cee0e 100644 --- a/test/cases/mjs/no-module-main-field/index.mjs +++ b/test/cases/mjs/no-module-main-field/index.mjs @@ -1,5 +1,5 @@ import result from "m"; it("should use the correct entry point", function() { - result.should.be.eql("yep"); + expect(result).toBe("yep"); }); diff --git a/test/cases/mjs/non-mjs-namespace-object-lazy/dir-mixed/json.json b/test/cases/mjs/non-mjs-namespace-object-lazy/dir-mixed/json.json new file mode 100644 index 00000000000..9c8ca3f82ff --- /dev/null +++ b/test/cases/mjs/non-mjs-namespace-object-lazy/dir-mixed/json.json @@ -0,0 +1,4 @@ +{ + "default": "default", + "named": "named" +} \ No newline at end of file diff --git a/test/cases/mjs/non-mjs-namespace-object-lazy/index.js b/test/cases/mjs/non-mjs-namespace-object-lazy/index.js index c9c6d829c9e..936032eb9b6 100644 --- a/test/cases/mjs/non-mjs-namespace-object-lazy/index.js +++ b/test/cases/mjs/non-mjs-namespace-object-lazy/index.js @@ -1,13 +1,13 @@ it("should receive a namespace object when importing commonjs", function(done) { import("./cjs").then(function(result) { - result.should.be.eql({ named: "named", default: { named: "named", default: "default" } }); + expect(result).toEqual({ named: "named", default: { named: "named", default: "default" }, [Symbol.toStringTag]: "Module" }); done(); }).catch(done); }); it("should receive a namespace object when importing commonjs with __esModule", function(done) { import("./cjs-esmodule").then(function(result) { - result.should.be.eql({ __esModule: true, named: "named", default: "default" }); + expect(result).toEqual({ __esModule: true, named: "named", default: "default" }); done(); }).catch(done); }); @@ -54,32 +54,33 @@ function contextMixed(name) { function promiseTest(promise, equalsTo) { return promise.then(function(results) { for(const result of results) - result.should.be.eql(equalsTo); + expect(result).toEqual(equalsTo); }); } it("should receive a namespace object when importing commonjs via context", function() { return Promise.all([ - promiseTest(contextCJS("one"), { named: "named", default: { named: "named", default: "default" } }), + promiseTest(contextCJS("one"), { named: "named", default: { named: "named", default: "default" }, [Symbol.toStringTag]: "Module" }), promiseTest(contextCJS("two"), { __esModule: true, named: "named", default: "default" }), - promiseTest(contextCJS("three"), { named: "named", default: { named: "named", default: "default" } }), - promiseTest(contextCJS("null"), { default: null }) + promiseTest(contextCJS("three"), { named: "named", default: { named: "named", default: "default" }, [Symbol.toStringTag]: "Module" }), + promiseTest(contextCJS("null"), { default: null, [Symbol.toStringTag]: "Module" }) ]); }); it("should receive a namespace object when importing harmony via context", function() { return Promise.all([ - promiseTest(contextHarmony("one"), { named: "named", default: "default" }), - promiseTest(contextHarmony("two"), { named: "named", default: "default" }), - promiseTest(contextHarmony("three"), { named: "named", default: "default" }) + promiseTest(contextHarmony("one"), { named: "named", default: "default", [Symbol.toStringTag]: "Module" }), + promiseTest(contextHarmony("two"), { named: "named", default: "default", [Symbol.toStringTag]: "Module" }), + promiseTest(contextHarmony("three"), { named: "named", default: "default", [Symbol.toStringTag]: "Module" }) ]); }); it("should receive a namespace object when importing mixed content via context", function() { return Promise.all([ - promiseTest(contextMixed("one"), { named: "named", default: { named: "named", default: "default" } }), + promiseTest(contextMixed("one"), { named: "named", default: { named: "named", default: "default" }, [Symbol.toStringTag]: "Module" }), promiseTest(contextMixed("two"), { __esModule: true, named: "named", default: "default" }), - promiseTest(contextMixed("three"), { named: "named", default: "default" }), - promiseTest(contextMixed("null"), { default: null }) + promiseTest(contextMixed("three"), { named: "named", default: "default", [Symbol.toStringTag]: "Module" }), + promiseTest(contextMixed("null"), { default: null, [Symbol.toStringTag]: "Module" }), + promiseTest(contextMixed("json.json"), { named: "named", default: { named: "named", default: "default" }, [Symbol.toStringTag]: "Module" }) ]); }); diff --git a/test/cases/nonce/set-nonce/index.js b/test/cases/nonce/set-nonce/index.js index 5d742671f70..9607ec97b86 100644 --- a/test/cases/nonce/set-nonce/index.js +++ b/test/cases/nonce/set-nonce/index.js @@ -7,7 +7,7 @@ it("should load script with nonce 'nonce1234'", function(done) { // if in browser context, test that nonce was added. if (typeof document !== 'undefined') { var script = document.querySelector('script[src="js/chunk-with-nonce.web.js"]'); - script.getAttribute('nonce').should.be.eql('nonce1234'); + expect(script.getAttribute('nonce')).toBe('nonce1234'); } __webpack_nonce__ = undefined; done(); @@ -21,8 +21,8 @@ it("should load script without nonce", function(done) { // if in browser context, test that nonce was added. if (typeof document !== 'undefined') { var script = document.querySelector('script[src="js/chunk-without-nonce.web.js"]'); - script.hasAttribute('nonce').should.be.eql(false); + expect(script.hasAttribute('nonce')).toBe(false); } __webpack_nonce__ = undefined; done(); -}); \ No newline at end of file +}); diff --git a/test/cases/optimize/side-effects-all-chain-unused/index.js b/test/cases/optimize/side-effects-all-chain-unused/index.js index f4132b00696..38a67a0eb87 100644 --- a/test/cases/optimize/side-effects-all-chain-unused/index.js +++ b/test/cases/optimize/side-effects-all-chain-unused/index.js @@ -2,6 +2,6 @@ import { log } from "pmodule/tracker"; import { a } from "pmodule"; it("should not evaluate a chain of modules", function() { - a.should.be.eql("a"); - log.should.be.eql(["a.js"]); + expect(a).toBe("a"); + expect(log).toEqual(["a.js"]); }); diff --git a/test/cases/optimize/side-effects-all-used/index.js b/test/cases/optimize/side-effects-all-used/index.js index c5f6c2ffc9c..8838b99487b 100644 --- a/test/cases/optimize/side-effects-all-used/index.js +++ b/test/cases/optimize/side-effects-all-used/index.js @@ -3,9 +3,9 @@ import { a, x, z } from "pmodule"; import def from "pmodule"; it("should evaluate all modules", function() { - def.should.be.eql("def"); - a.should.be.eql("a"); - x.should.be.eql("x"); - z.should.be.eql("z"); - log.should.be.eql(["a.js", "b.js", "c.js", "index.js"]); + expect(def).toBe("def"); + expect(a).toBe("a"); + expect(x).toBe("x"); + expect(z).toBe("z"); + expect(log).toEqual(["a.js", "b.js", "c.js", "index.js"]); }); diff --git a/test/cases/optimize/side-effects-immediate-unused/index.js b/test/cases/optimize/side-effects-immediate-unused/index.js index 65b5c767a44..4a9b783c92e 100644 --- a/test/cases/optimize/side-effects-immediate-unused/index.js +++ b/test/cases/optimize/side-effects-immediate-unused/index.js @@ -2,7 +2,7 @@ import { log } from "pmodule/tracker"; import { a, z } from "pmodule"; it("should not evaluate an immediate module", function() { - a.should.be.eql("a"); - z.should.be.eql("z"); - log.should.be.eql(["a.js", "c.js"]); + expect(a).toBe("a"); + expect(z).toBe("z"); + expect(log).toEqual(["a.js", "c.js"]); }); diff --git a/test/cases/optimize/side-effects-reexport-start-unknown/index.js b/test/cases/optimize/side-effects-reexport-start-unknown/index.js index e23690e9117..4c1a54309e3 100644 --- a/test/cases/optimize/side-effects-reexport-start-unknown/index.js +++ b/test/cases/optimize/side-effects-reexport-start-unknown/index.js @@ -2,5 +2,5 @@ import * as m from "m"; it("should handle unknown exports fine", function() { var x = m; - x.should.be.eql({ foo: "foo" }); + expect(x).toEqual({ foo: "foo", [Symbol.toStringTag]: "Module" }); }); diff --git a/test/cases/optimize/side-effects-root-unused/index.js b/test/cases/optimize/side-effects-root-unused/index.js index 36980ebab8c..22e4427cba1 100644 --- a/test/cases/optimize/side-effects-root-unused/index.js +++ b/test/cases/optimize/side-effects-root-unused/index.js @@ -2,8 +2,8 @@ import { log } from "pmodule/tracker"; import { a, x, z } from "pmodule"; it("should evaluate all modules", function() { - a.should.be.eql("a"); - x.should.be.eql("x"); - z.should.be.eql("z"); - log.should.be.eql(["a.js", "b.js", "c.js"]); + expect(a).toBe("a"); + expect(x).toBe("x"); + expect(z).toBe("z"); + expect(log).toEqual(["a.js", "b.js", "c.js"]); }); diff --git a/test/cases/optimize/side-effects-scope-hoisting/index.js b/test/cases/optimize/side-effects-scope-hoisting/index.js new file mode 100644 index 00000000000..100d58775b3 --- /dev/null +++ b/test/cases/optimize/side-effects-scope-hoisting/index.js @@ -0,0 +1,8 @@ +import { a } from "pmodule"; + +it("should not crash with null id", function() { + expect(a).toBe("a"); +}); + +if(Math === undefined) + console.log(module); // prevent scope hoisting of this module diff --git a/test/cases/optimize/side-effects-simple-unused/index.js b/test/cases/optimize/side-effects-simple-unused/index.js index 70de1742615..6e14a2b1a31 100644 --- a/test/cases/optimize/side-effects-simple-unused/index.js +++ b/test/cases/optimize/side-effects-simple-unused/index.js @@ -3,8 +3,8 @@ import { x, z } from "pmodule"; import def from "pmodule"; it("should not evaluate a simple unused module", function() { - def.should.be.eql("def"); - x.should.be.eql("x"); - z.should.be.eql("z"); - log.should.be.eql(["b.js", "c.js", "index.js"]); + expect(def).toBe("def"); + expect(x).toBe("x"); + expect(z).toBe("z"); + expect(log).toEqual(["b.js", "c.js", "index.js"]); }); diff --git a/test/cases/optimize/side-effects-transitive-unused/index.js b/test/cases/optimize/side-effects-transitive-unused/index.js index 5da932f05e3..007064fbf2c 100644 --- a/test/cases/optimize/side-effects-transitive-unused/index.js +++ b/test/cases/optimize/side-effects-transitive-unused/index.js @@ -2,7 +2,7 @@ import { log } from "pmodule/tracker"; import { a, y } from "pmodule"; it("should not evaluate a reexporting transitive module", function() { - a.should.be.eql("a"); - y.should.be.eql("y"); - log.should.be.eql(["a.js", "b.js"]); + expect(a).toBe("a"); + expect(y).toBe("y"); + expect(log).toEqual(["a.js", "b.js"]); }); diff --git a/test/cases/optimize/tree-shaking-commonjs/index.js b/test/cases/optimize/tree-shaking-commonjs/index.js index e7cee8bee91..0340d09aa19 100644 --- a/test/cases/optimize/tree-shaking-commonjs/index.js +++ b/test/cases/optimize/tree-shaking-commonjs/index.js @@ -1,5 +1,5 @@ import { test } from "./a"; it("should correctly tree shake star exports", function() { - test.should.be.eql(123); + expect(test).toBe(123); }); diff --git a/test/cases/optimize/tree-shaking-star/index.js b/test/cases/optimize/tree-shaking-star/index.js index 231747efb8c..479be136349 100644 --- a/test/cases/optimize/tree-shaking-star/index.js +++ b/test/cases/optimize/tree-shaking-star/index.js @@ -2,7 +2,7 @@ import { test } from "./a"; import { func1, func3 } from "./x"; it("should correctly tree shake star exports", function() { - test.should.be.eql(123); - func1().should.be.eql("func1"); - func3().should.be.eql("func3"); + expect(test).toBe(123); + expect(func1()).toBe("func1"); + expect(func3()).toBe("func3"); }); diff --git a/test/cases/optimize/tree-shaking-star2/index.js b/test/cases/optimize/tree-shaking-star2/index.js index b8bb5764b64..676392638a8 100644 --- a/test/cases/optimize/tree-shaking-star2/index.js +++ b/test/cases/optimize/tree-shaking-star2/index.js @@ -3,11 +3,12 @@ import { aa as aa2, d } from "./root3"; var root6 = require("./root6"); it("should correctly tree shake star exports", function() { - aa.should.be.eql("aa"); - aa2.should.be.eql("aa"); - d.should.be.eql("d"); - root6.should.be.eql({ + expect(aa).toBe("aa"); + expect(aa2).toBe("aa"); + expect(d).toBe("d"); + expect(root6).toEqual({ aa: "aa", - c: "c" + c: "c", + [Symbol.toStringTag]: "Module" }); }); diff --git a/test/cases/parsing/amd-rename/index.js b/test/cases/parsing/amd-rename/index.js index 42658e5be7a..be0d7347a13 100644 --- a/test/cases/parsing/amd-rename/index.js +++ b/test/cases/parsing/amd-rename/index.js @@ -1,5 +1,5 @@ it("should name require in define correctly", function() { define(["require"], function(require) { - (typeof require).should.be.eql("function"); + expect((typeof require)).toBe("function"); }); }); diff --git a/test/cases/parsing/bom/bomfile.json b/test/cases/parsing/bom/bomfile.json new file mode 100644 index 00000000000..20de8bbdddd --- /dev/null +++ b/test/cases/parsing/bom/bomfile.json @@ -0,0 +1 @@ +{ "message": "ok" } \ No newline at end of file diff --git a/test/cases/parsing/bom/index.js b/test/cases/parsing/bom/index.js index f1016163487..f7d590e9d54 100644 --- a/test/cases/parsing/bom/index.js +++ b/test/cases/parsing/bom/index.js @@ -1,9 +1,14 @@ it("should load a utf-8 file with BOM", function() { var result = require("./bomfile"); - result.should.be.eql("ok"); + expect(result).toEqual("ok"); }); it("should load a css file with BOM", function() { var css = require("!css-loader!./bomfile.css") + ""; - css.should.be.eql("body{color:#abc}"); + expect(css).toBe("body{color:#abc}"); +}); + +it("should load a json file with BOM", function() { + var result = require("./bomfile.json"); + expect(result.message).toEqual("ok"); }); diff --git a/test/cases/parsing/browserify/index.js b/test/cases/parsing/browserify/index.js index a1c656ae4c5..83555856960 100644 --- a/test/cases/parsing/browserify/index.js +++ b/test/cases/parsing/browserify/index.js @@ -10,5 +10,5 @@ it("should be able to parse browserified modules (UMD)", function() { },{}]},{},[1]) (1) }); - module.exports.should.be.eql(1234); -}); \ No newline at end of file + expect(module.exports).toBe(1234); +}); diff --git a/test/cases/parsing/chunks/index.js b/test/cases/parsing/chunks/index.js index 8a1afd3ac5c..641660b861d 100644 --- a/test/cases/parsing/chunks/index.js +++ b/test/cases/parsing/chunks/index.js @@ -1,7 +1,7 @@ it("should parse a Coffeescript style function expression in require.ensure", function(done) { require.ensure([], (function(_this) { return function(require) { - require("./file").should.be.eql("ok"); + expect(require("./file")).toBe("ok"); done(); }; }(this))); @@ -9,28 +9,28 @@ it("should parse a Coffeescript style function expression in require.ensure", fu it("should parse a bound function expression in require.ensure", function(done) { require.ensure([], function(require) { - require("./file").should.be.eql("ok"); + expect(require("./file")).toBe("ok"); done(); }.bind(this)); }); it("should parse a string in require.ensure", function(done) { require.ensure("./file", function(require) { - require("./file").should.be.eql("ok"); + expect(require("./file")).toBe("ok"); done(); }); }); it("should parse a string in require.ensure with arrow function expression", function(done) { require.ensure("./file", require => { - require("./file").should.be.eql("ok"); + expect(require("./file")).toBe("ok"); done(); }); }); it("should parse a string in require.ensure with arrow function array expression", function(done) { - require.ensure("./file", require => (require("./file").should.be.eql("ok"), done())); + require.ensure("./file", require => (expect(require("./file")).toBe("ok"), done())); }); diff --git a/test/cases/parsing/class/index.js b/test/cases/parsing/class/index.js index 74e55e418e0..c58c505fc13 100644 --- a/test/cases/parsing/class/index.js +++ b/test/cases/parsing/class/index.js @@ -1,12 +1,12 @@ import X, { A, B } from "./module"; it("should parse classes", function() { - new X().a.should.be.eql("ok"); - new A().a.should.be.eql("ok"); - new B().a.should.be.eql("ok"); + expect(new X().a).toBe("ok"); + expect(new A().a).toBe("ok"); + expect(new B().a).toBe("ok"); }); it("should parse methods", function() { - new X().b().should.be.eql("ok"); - X.c().should.be.eql("ok"); + expect(new X().b()).toBe("ok"); + expect(X.c()).toBe("ok"); }); diff --git a/test/cases/parsing/comment-in-import/index.js b/test/cases/parsing/comment-in-import/index.js new file mode 100644 index 00000000000..ee20771a8d3 --- /dev/null +++ b/test/cases/parsing/comment-in-import/index.js @@ -0,0 +1,8 @@ +it("should allow random comments in import()", () => { + return Promise.all([ + import(/* hello world */ "./module"), + import(/* }); */ "./module"), + import(/* test */ "./module"), + import(/* 1234 */ "./module") + ]); +}); diff --git a/test/statsCases/preset-errors-only/expected.txt b/test/cases/parsing/comment-in-import/module.js similarity index 100% rename from test/statsCases/preset-errors-only/expected.txt rename to test/cases/parsing/comment-in-import/module.js diff --git a/test/cases/parsing/complex-require/amd.js b/test/cases/parsing/complex-require/amd.js index 0207171425e..9972aba665c 100644 --- a/test/cases/parsing/complex-require/amd.js +++ b/test/cases/parsing/complex-require/amd.js @@ -12,7 +12,7 @@ it("should parse template strings in amd requires", function(done) { ].length; function test (result) { - result.default.should.eql("ok") + expect(result.default).toEqual("ok") if (--pending <= 0) { done() } @@ -31,7 +31,7 @@ it("should parse .concat strings in amd requires", function(done) { ].length; function test (result) { - result.default.should.eql("ok") + expect(result.default).toEqual("ok") if (--pending <= 0) { done() } diff --git a/test/cases/parsing/complex-require/cjs.js b/test/cases/parsing/complex-require/cjs.js index b33adad3817..71113b97620 100644 --- a/test/cases/parsing/complex-require/cjs.js +++ b/test/cases/parsing/complex-require/cjs.js @@ -12,7 +12,7 @@ it("should parse template strings in require.ensure requires", function(done) { ]; for (var i = 0; i < imports.length; i++) { - imports[i].default.should.eql("ok"); + expect(imports[i].default).toEqual("ok"); } done() }) @@ -31,7 +31,7 @@ it("should parse template strings in sync requires", function() { ]; for (var i = 0; i < imports.length; i++) { - imports[i].default.should.eql("sync"); + expect(imports[i].default).toEqual("sync"); } }) @@ -40,7 +40,7 @@ it("should parse template strings in require.resolve", function() { // Arbitrary assertion; can't use .ok() as it could be 0, // can't use typeof as that depends on webpack config. - require.resolve(`./sync/${name}Test`).should.not.be.undefined(); + expect(require.resolve(`./sync/${name}Test`)).toBeDefined(); }) it("should parse .concat strings in require.ensure requires", function(done) { @@ -55,7 +55,7 @@ it("should parse .concat strings in require.ensure requires", function(done) { ]; for (var i = 0; i < imports.length; i++) { - imports[i].default.should.eql("ok"); + expect(imports[i].default).toEqual("ok"); } done() }) @@ -72,7 +72,7 @@ it("should parse .concat strings in sync requires", function() { ]; for (var i = 0; i < imports.length; i++) { - imports[i].default.should.eql("sync"); + expect(imports[i].default).toEqual("sync"); } }) @@ -81,5 +81,5 @@ it("should parse .concat strings in require.resolve", function() { // Arbitrary assertion; can't use .ok() as it could be 0, // can't use typeof as that depends on webpack config. - require.resolve("./sync/".concat(name, "Test")).should.not.be.undefined(); + expect(require.resolve("./sync/".concat(name, "Test"))).toBeDefined(); }) diff --git a/test/cases/parsing/complex-require/index.js b/test/cases/parsing/complex-require/index.js index c2cb97e485b..b93a4e4c1e5 100644 --- a/test/cases/parsing/complex-require/index.js +++ b/test/cases/parsing/complex-require/index.js @@ -1,5 +1,3 @@ -var should = require('should') - it("should parse template strings in import", function(done) { var name = "abc".split(""); var suffix = "Test"; @@ -10,7 +8,7 @@ it("should parse template strings in import", function(done) { ]) .then(function (imports) { for (var i = 0; i < imports.length; i++) { - imports[i].default.should.eql("ok"); + expect(imports[i].default).toEqual("ok"); } }) .then(function () { done(); }, done) @@ -21,7 +19,7 @@ it("should parse .concat strings in import", function(done) { var suffix = "Test"; import("./abc/".concat(name[0]).concat(name[1]).concat(name[2], "Test")) .then(function (imported) { - imported.default.should.eql("ok"); + expect(imported.default).toEqual("ok"); }) .then(function () { done(); }, done) }); diff --git a/test/cases/parsing/context/index.js b/test/cases/parsing/context/index.js index 6c6c3bf6e0f..59d7ff9669d 100644 --- a/test/cases/parsing/context/index.js +++ b/test/cases/parsing/context/index.js @@ -1,28 +1,28 @@ it("should be able to load a file with the require.context method", function() { - require.context("./templates")("./tmpl").should.be.eql("test template"); - (require.context("./././templates"))("./tmpl").should.be.eql("test template"); - (require.context("././templates/.")("./tmpl")).should.be.eql("test template"); - require.context("./loaders/queryloader?dog=bark!./templates?cat=meow")("./tmpl").should.be.eql({ + expect(require.context("./templates")("./tmpl")).toBe("test template"); + expect((require.context("./././templates"))("./tmpl")).toBe("test template"); + expect((require.context("././templates/.")("./tmpl"))).toBe("test template"); + expect(require.context("./loaders/queryloader?dog=bark!./templates?cat=meow")("./tmpl")).toEqual({ resourceQuery: "?cat=meow", query: "?dog=bark", prev: "module.exports = \"test template\";" }); - require . context ( "." + "/." + "/" + "templ" + "ates" ) ( "./subdir/tmpl.js" ).should.be.eql("subdir test template"); - require.context("./templates", true, /./)("xyz").should.be.eql("xyz"); + expect(require . context ( "." + "/." + "/" + "templ" + "ates" ) ( "./subdir/tmpl.js" )).toBe("subdir test template"); + expect(require.context("./templates", true, /./)("xyz")).toBe("xyz"); }); it("should automatically create contexts", function() { var template = "tmpl", templateFull = "./tmpl.js"; var mp = "mp", tmp = "tmp", mpl = "mpl"; - require("./templates/" + template).should.be.eql("test template"); - require("./templates/" + tmp + "l").should.be.eql("test template"); - require("./templates/t" + mpl).should.be.eql("test template"); - require("./templates/t" + mp + "l").should.be.eql("test template"); + expect(require("./templates/" + template)).toBe("test template"); + expect(require("./templates/" + tmp + "l")).toBe("test template"); + expect(require("./templates/t" + mpl)).toBe("test template"); + expect(require("./templates/t" + mp + "l")).toBe("test template"); }); it("should be able to require.resolve with automatical context", function() { var template = "tmpl"; - require.resolve("./templates/" + template).should.be.eql(require.resolve("./templates/tmpl")); + expect(require.resolve("./templates/" + template)).toBe(require.resolve("./templates/tmpl")); }); it("should be able to use renaming combined with a context", function() { @@ -30,22 +30,22 @@ it("should be able to use renaming combined with a context", function() { require = function () {}; require("fail"); var template = "tmpl"; - renamedRequire("./templates/" + template).should.be.eql("test template"); + expect(renamedRequire("./templates/" + template)).toBe("test template"); }); it("should compile an empty context", function() { var x = "xxx"; - (function() { + expect(function() { require("./templates/notExisting" + x); - }).should.throw(/xxx/); + }).toThrowError(/xxx/); }); it("should execute an empty context", function() { var context; - (function() { + expect(function() { context = require.context("./templates/", true, /^\.\/notExisting/); - }).should.not.throw(); - (function() { + }).not.toThrowError(); + expect(function() { context(""); - }).should.throw(); + }).toThrowError(); }); diff --git a/test/cases/parsing/es6.nominimize/index.js b/test/cases/parsing/es6.nominimize/index.js index 8d77c7059d3..70031b4cad6 100644 --- a/test/cases/parsing/es6.nominimize/index.js +++ b/test/cases/parsing/es6.nominimize/index.js @@ -19,21 +19,21 @@ it("should parse classes", function() { var x = new MyClass(); - x.a.should.be.eql("a"); - x.func().should.be.eql("b"); - x.c().should.be.eql("c"); + expect(x.a).toBe("a"); + expect(x.func()).toBe("b"); + expect(x.c()).toBe("c"); }); it("should parse spread operator"/*, function() { - [0, ...require("./array")].should.be.eql([0, 1, 2, 3]); - ({z: 0, ...require("./object")}).should.be.eql({z: 0, a: 1, b: 2, c: 3}); + expect([0, ...require("./array")]).toEqual([0, 1, 2, 3]); + expect(({z: 0, ...require("./object")})).toEqual({z: 0, a: 1, b: 2, c: 3}); }*/); it("should parse arrow function", function() { - (() => require("./a"))().should.be.eql("a"); - (() => { + expect((() => require("./a"))()).toBe("a"); + expect((() => { return require("./a"); - })().should.be.eql("a"); + })()).toBe("a"); require.ensure([], () => { require("./a"); }); @@ -53,8 +53,8 @@ it("should parse template literals", function() { } var x = `a${require("./b")}c`; var y = tag`a${require("./b")}c`; - x.should.be.eql("abc"); - y.should.be.eql("b"); + expect(x).toBe("abc"); + expect(y).toBe("b"); }) it("should parse generators and yield", function() { @@ -63,7 +63,7 @@ it("should parse generators and yield", function() { yield require("./b"); } var x = gen(); - x.next().value.should.be.eql("a"); - x.next().value.should.be.eql("b"); - x.next().done.should.be.eql(true); + expect(x.next().value).toBe("a"); + expect(x.next().value).toBe("b"); + expect(x.next().done).toBe(true); }) diff --git a/test/cases/parsing/evaluate/index.js b/test/cases/parsing/evaluate/index.js index 5f8cc691264..e2762e5c59e 100644 --- a/test/cases/parsing/evaluate/index.js +++ b/test/cases/parsing/evaluate/index.js @@ -7,7 +7,7 @@ it("should evaluate null", function() { if("shouldn't evaluate expression", function() { var value = ""; var x = (value + "") ? "fail" : "ok"; - x.should.be.eql("ok"); + expect(x).toBe("ok"); }); it("should short-circuit evaluating", function() { @@ -18,5 +18,5 @@ it("should short-circuit evaluating", function() { it("should evaluate __dirname and __resourceQuery with replace and substr", function() { var result = require("./resourceQuery/index?" + __dirname); - result.should.be.eql("?resourceQuery"); + expect(result).toEqual("?resourceQuery"); }); diff --git a/test/cases/parsing/extract-amd.nominimize/index.js b/test/cases/parsing/extract-amd.nominimize/index.js index a29bd757841..a79383e0026 100644 --- a/test/cases/parsing/extract-amd.nominimize/index.js +++ b/test/cases/parsing/extract-amd.nominimize/index.js @@ -1,5 +1,3 @@ -var should = require("should"); - it("should parse fancy function calls with arrow functions", function() { ("function"==typeof define && define.amd ? define : @@ -7,70 +5,70 @@ it("should parse fancy function calls with arrow functions", function() { )(["./constructor"], (c) => { return new c(1324); }); - module.exports.should.have.property("value").be.eql(1324); + expect(module.exports).toHaveProperty("value", 1324); (("function"==typeof define && define.amd ? define : (e,t) => {return t()} )(["./constructor"], (c) => { return new c(4231); })); - module.exports.should.have.property("value").be.eql(4231); + expect(module.exports).toHaveProperty("value", 4231); }); it("should parse fancy AMD calls with arrow functions", function() { require("./constructor ./a".split(" ")); require("-> module module exports *constructor *a".replace("module", "require").substr(3).replace(/\*/g, "./").split(" "), (require, module, exports, constructor, a) => { - (typeof require).should.be.eql("function"); - (typeof module).should.be.eql("object"); - (typeof exports).should.be.eql("object"); - (typeof require("./constructor")).should.be.eql("function"); - (typeof constructor).should.be.eql("function"); - a.should.be.eql("a"); + expect((typeof require)).toBe("function"); + expect((typeof module)).toBe("object"); + expect((typeof exports)).toBe("object"); + expect((typeof require("./constructor"))).toBe("function"); + expect((typeof constructor)).toBe("function"); + expect(a).toBe("a"); }); define("-> module module exports *constructor *a".replace("module", "require").substr(3).replace(/\*/g, "./").split(" "), (require, module, exports, constructor, a) => { - (typeof require).should.be.eql("function"); - (typeof module).should.be.eql("object"); - (typeof exports).should.be.eql("object"); - (typeof require("./constructor")).should.be.eql("function"); - (typeof constructor).should.be.eql("function"); - a.should.be.eql("a"); + expect((typeof require)).toBe("function"); + expect((typeof module)).toBe("object"); + expect((typeof exports)).toBe("object"); + expect((typeof require("./constructor"))).toBe("function"); + expect((typeof constructor)).toBe("function"); + expect(a).toBe("a"); }); }); it("should be able to use AMD-style require with arrow functions", function(done) { var template = "b"; require(["./circular", "./templates/" + template, true ? "./circular" : "fail"], (circular, testTemplate, circular2) => { - circular.should.be.eql(1); - circular2.should.be.eql(1); - testTemplate.should.be.eql("b"); + expect(circular).toBe(1); + expect(circular2).toBe(1); + expect(testTemplate).toBe("b"); done(); }); }); it("should be able to use require.js-style define with arrow functions", function(done) { define("name", ["./circular"], (circular) => { - circular.should.be.eql(1); + expect(circular).toBe(1); done(); }); }); it("should be able to use require.js-style define, optional dependencies, not exist, with arrow function", function(done) { define("name", ["./optional"], (optional) => { - should(optional.b).not.exist; + expect(optional.b).toBeFalsy(); done(); }); }); it("should be able to use require.js-style define, special string, with arrow function", function(done) { define(["require"], (require) => { - require("./circular").should.be.eql(1); + expect(require("./circular")).toBe(1); done(); }); }); it("should be able to use require.js-style define, without name, with arrow function", function(done) { true && define(["./circular"], (circular) => { - circular.should.be.eql(1); + expect(circular).toBe(1); done(); }); }); @@ -91,17 +89,17 @@ it("should offer AMD-style define for CommonJs with arrow function", function(do var _test_exports = exports; var _test_module = module; define((require, exports, module) => { - (typeof require).should.be.eql("function"); - exports.should.be.equal(_test_exports); - module.should.be.equal(_test_module); - require("./circular").should.be.eql(1); + expect((typeof require)).toBe("function"); + expect(exports).toBe(_test_exports); + expect(module).toBe(_test_module); + expect(require("./circular")).toBe(1); done(); }); }); it("should pull in all dependencies of an AMD module with arrow function", function(done) { define((require) => { - require("./amdmodule").should.be.eql("a"); + expect(require("./amdmodule")).toBe("a"); done(); }); }); @@ -109,9 +107,9 @@ it("should pull in all dependencies of an AMD module with arrow function", funct it("should create a chunk for require.js require, with arrow function", function(done) { var sameTick = true; require(["./c"], (c) => { - sameTick.should.be.eql(false); - c.should.be.eql("c"); - require("./d").should.be.eql("d"); + expect(sameTick).toBe(false); + expect(c).toBe("c"); + expect(require("./d")).toBe("d"); done(); }); sameTick = false; diff --git a/test/cases/parsing/extract-amd/index.js b/test/cases/parsing/extract-amd/index.js index 4299ede63e2..13cc0d3f047 100644 --- a/test/cases/parsing/extract-amd/index.js +++ b/test/cases/parsing/extract-amd/index.js @@ -1,5 +1,3 @@ -var should = require("should"); - it("should parse fancy function calls", function() { ("function"==typeof define && define.amd ? define : @@ -7,70 +5,70 @@ it("should parse fancy function calls", function() { )(["./constructor"], function(c) { return new c(1324); }); - module.exports.should.have.property("value").be.eql(1324); + expect(module.exports).toHaveProperty("value", 1324); (("function"==typeof define && define.amd ? define : function(e,t){return t()} )(["./constructor"], function(c) { return new c(4231); })); - module.exports.should.have.property("value").be.eql(4231); + expect(module.exports).toHaveProperty("value", 4231); }); it("should parse fancy AMD calls", function() { require("./constructor ./a".split(" ")); require("-> module module exports *constructor *a".replace("module", "require").substr(3).replace(/\*/g, "./").split(" "), function(require, module, exports, constructor, a) { - (typeof require).should.be.eql("function"); - (typeof module).should.be.eql("object"); - (typeof exports).should.be.eql("object"); - (typeof require("./constructor")).should.be.eql("function"); - (typeof constructor).should.be.eql("function"); - a.should.be.eql("a"); + expect((typeof require)).toBe("function"); + expect((typeof module)).toBe("object"); + expect((typeof exports)).toBe("object"); + expect((typeof require("./constructor"))).toBe("function"); + expect((typeof constructor)).toBe("function"); + expect(a).toBe("a"); }); define("-> module module exports *constructor *a".replace("module", "require").substr(3).replace(/\*/g, "./").split(" "), function(require, module, exports, constructor, a) { - (typeof require).should.be.eql("function"); - (typeof module).should.be.eql("object"); - (typeof exports).should.be.eql("object"); - (typeof require("./constructor")).should.be.eql("function"); - (typeof constructor).should.be.eql("function"); - a.should.be.eql("a"); + expect((typeof require)).toBe("function"); + expect((typeof module)).toBe("object"); + expect((typeof exports)).toBe("object"); + expect((typeof require("./constructor"))).toBe("function"); + expect((typeof constructor)).toBe("function"); + expect(a).toBe("a"); }); }); it("should be able to use AMD-style require", function(done) { var template = "b"; require(["./circular", "./templates/" + template, true ? "./circular" : "fail"], function(circular, testTemplate, circular2) { - circular.should.be.eql(1); - circular2.should.be.eql(1); - testTemplate.should.be.eql("b"); + expect(circular).toBe(1); + expect(circular2).toBe(1); + expect(testTemplate).toBe("b"); done(); }); }); it("should be able to use require.js-style define", function(done) { define("name", ["./circular"], function(circular) { - circular.should.be.eql(1); + expect(circular).toBe(1); done(); }); }); it("should be able to use require.js-style define, optional dependencies, not exist", function(done) { define("name", ["./optional"], function(optional) { - should(optional.b).not.exist; + expect(optional.b).toBeFalsy(); done(); }); }); it("should be able to use require.js-style define, special string", function(done) { define(["require"], function(require) { - require("./circular").should.be.eql(1); + expect(require("./circular")).toBe(1); done(); }); }); it("should be able to use require.js-style define, without name", function(done) { true && define(["./circular"], function(circular) { - circular.should.be.eql(1); + expect(circular).toBe(1); done(); }); }); @@ -107,12 +105,12 @@ it("should be able to use require.js-style define, with an object", function() { true && define("blaaa", obj); - module.exports.should.be.equal(obj); + expect(module.exports).toBe(obj); module.exports = null; define("blaaa", obj); - module.exports.should.be.equal(obj); + expect(module.exports).toBe(obj); module.exports = null; }); @@ -120,10 +118,10 @@ it("should offer AMD-style define for CommonJs", function(done) { var _test_exports = exports; var _test_module = module; define(function(require, exports, module) { - (typeof require).should.be.eql("function"); - exports.should.be.equal(_test_exports); - module.should.be.equal(_test_module); - require("./circular").should.be.eql(1); + expect((typeof require)).toBe("function"); + expect(exports).toBe(_test_exports); + expect(module).toBe(_test_module); + expect(require("./circular")).toBe(1); done(); }); }); @@ -140,7 +138,7 @@ it("should be able to use AMD require without function expression (empty array)" it("should be able to use AMD require without function expression", function(done) { require(["./circular"], fn); function fn(c) { - c.should.be.eql(1); + expect(c).toBe(1); done(); } }); @@ -148,9 +146,9 @@ it("should be able to use AMD require without function expression", function(don it("should create a chunk for require.js require", function(done) { var sameTick = true; require(["./c"], function(c) { - sameTick.should.be.eql(false); - c.should.be.eql("c"); - require("./d").should.be.eql("d"); + expect(sameTick).toBe(false); + expect(c).toBe("c"); + expect(require("./d")).toBe("d"); done(); }); sameTick = false; @@ -170,34 +168,34 @@ it("should not fail #138", function(done) { it("should parse a bound function expression 1", function(done) { define(function(a, require, exports, module) { - a.should.be.eql(123); - (typeof require).should.be.eql("function"); - require("./a").should.be.eql("a"); + expect(a).toBe(123); + expect((typeof require)).toBe("function"); + expect(require("./a")).toBe("a"); done(); }.bind(null, 123)); }); it("should parse a bound function expression 2", function(done) { define("name", function(a, require, exports, module) { - a.should.be.eql(123); - (typeof require).should.be.eql("function"); - require("./a").should.be.eql("a"); + expect(a).toBe(123); + expect((typeof require)).toBe("function"); + expect(require("./a")).toBe("a"); done(); }.bind(null, 123)); }); it("should parse a bound function expression 3", function(done) { define(["./a"], function(number, a) { - number.should.be.eql(123); - a.should.be.eql("a"); + expect(number).toBe(123); + expect(a).toBe("a"); done(); }.bind(null, 123)); }); it("should parse a bound function expression 4", function(done) { define("name", ["./a"], function(number, a) { - number.should.be.eql(123); - a.should.be.eql("a"); + expect(number).toBe(123); + expect(a).toBe("a"); done(); }.bind(null, 123)); }); @@ -205,21 +203,21 @@ it("should parse a bound function expression 4", function(done) { it("should not fail issue #138 second", function() { (function(define, global) { 'use strict'; define(function (require) { - (typeof require).should.be.eql("function"); - require("./a").should.be.eql("a"); + expect((typeof require)).toBe("function"); + expect(require("./a")).toBe("a"); return "#138 2."; }); })(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); }, this); - module.exports.should.be.eql("#138 2."); + expect(module.exports).toBe("#138 2."); }); it("should parse an define with empty array and object", function() { var obj = {ok: 95476}; define([], obj); - module.exports.should.be.eql(obj); + expect(module.exports).toBe(obj); }); it("should parse an define with object", function() { var obj = {ok: 76243}; define(obj); - module.exports.should.be.eql(obj); + expect(module.exports).toBe(obj); }); diff --git a/test/cases/parsing/extract-require/index.js b/test/cases/parsing/extract-require/index.js index b3167f22943..7550c443ba7 100644 --- a/test/cases/parsing/extract-require/index.js +++ b/test/cases/parsing/extract-require/index.js @@ -1,39 +1,39 @@ -var should = require("should"); - function testCase(number) { - require(number === 1 ? "./folder/file1" : number === 2 ? "./folder/file2" : number === 3 ? "./folder/file3" : "./missingModule").should.be.eql("file" + number); - require( + expect(require(number === 1 ? "./folder/file1" : number === 2 ? "./folder/file2" : number === 3 ? "./folder/file3" : "./missingModule")).toBe("file" + number); + expect(require( number === 1 ? "./folder/file1" : number === 2 ? "./folder/file2" : number === 3 ? "./folder/file3" : "./missingModule" - ).should.be.eql("file" + number); + )).toBe("file" + number); } it("should parse complex require calls", function() { - should.strictEqual(new(require("./constructor"))(1234).value, 1234, "Parse require in new(…) should work"); - should.strictEqual(new ( require ( "./constructor" ) ) ( 1234 ) .value, 1234, "Parse require in new(…) should work, with spaces"); + // "Parse require in new(...) should work" + expect(new(require("./constructor"))(1234).value).toBe(1234); + // "Parse require in new(...) should work, with spaces" + expect(new ( require ( "./constructor" ) ) ( 1234 ) .value).toBe(1234); }); it("should let the user hide the require function", function() { - (function(require) { return require; }(1234)).should.be.eql(1234); + expect((function(require) { return require; })(1234)).toBe(1234); function testFunc(abc, require) { return require; } - testFunc(333, 678).should.be.eql(678); + expect(testFunc(333, 678)).toBe(678); (function() { var require = 123; - require.should.be.eql(123); + expect(require).toBe(123); }()); (function() { function require() { return 123; }; - require("error").should.be.eql(123); + expect(require("error")).toBe(123); }()); (function() { var module = 1233; - module.should.be.eql(1233); + expect(module).toBe(1233); }()); }); @@ -42,3 +42,4 @@ it("should not create a context for the ?: operator", function() { testCase(2); testCase(3); }); + diff --git a/test/cases/parsing/filename/index.js b/test/cases/parsing/filename/index.js index 71357682d53..525244fe998 100644 --- a/test/cases/parsing/filename/index.js +++ b/test/cases/parsing/filename/index.js @@ -1,11 +1,11 @@ it("should be a string (__filename)", function() { - __filename.should.be.type("string"); + expect(__filename).toBeTypeOf("string"); var f = __filename; - f.should.be.type("string"); + expect(f).toBeTypeOf("string"); }); it("should be a string (__dirname)", function() { - __dirname.should.be.type("string"); + expect(__dirname).toBeTypeOf("string"); var d = __dirname; - d.should.be.type("string"); -}); \ No newline at end of file + expect(d).toBeTypeOf("string"); +}); diff --git a/test/cases/parsing/harmony-commonjs-mix/index.js b/test/cases/parsing/harmony-commonjs-mix/index.js index 6383d861f97..7947bbf08a2 100644 --- a/test/cases/parsing/harmony-commonjs-mix/index.js +++ b/test/cases/parsing/harmony-commonjs-mix/index.js @@ -1,4 +1,7 @@ it("should result in a warning when using module.exports in harmony module", function() { var x = require("./module1"); - x.should.be.eql({default: 1234}); + expect(x).toEqual({ + default: 1234, + [Symbol.toStringTag]: "Module" + }); }); diff --git a/test/cases/parsing/harmony-commonjs-mix/module1.js b/test/cases/parsing/harmony-commonjs-mix/module1.js index ab456ad0a6f..aa3681a495c 100644 --- a/test/cases/parsing/harmony-commonjs-mix/module1.js +++ b/test/cases/parsing/harmony-commonjs-mix/module1.js @@ -1,19 +1,19 @@ import "./module"; -(function() { +expect(function() { module.exports = 1; -}).should.throw(); +}).toThrowError(); -(typeof module.exports).should.be.eql("undefined"); +expect((typeof module.exports)).toBe("undefined"); -(typeof define).should.be.eql("undefined"); -(function() { +expect((typeof define)).toBe("undefined"); +expect(function() { define(function() {}) -}).should.throw(/define is not defined/); +}).toThrowError(/define is not defined/); export default 1234; if(eval("typeof exports !== \"undefined\"")) { // exports is node.js exports and not webpacks - Object.keys(exports).should.be.eql([]); + expect(Object.keys(exports)).toEqual([]); } diff --git a/test/cases/parsing/harmony-commonjs/index.js b/test/cases/parsing/harmony-commonjs/index.js index 187eefc12cb..fc9dbe295e3 100644 --- a/test/cases/parsing/harmony-commonjs/index.js +++ b/test/cases/parsing/harmony-commonjs/index.js @@ -2,7 +2,7 @@ import { x, y } from "./b"; it("should pass when required by CommonJS module", function () { var test1 = require('./a').default; - test1().should.be.eql("OK"); + expect(test1()).toBe("OK"); }); it("should pass when use babeljs transpiler", function() { @@ -13,18 +13,18 @@ it("should pass when use babeljs transpiler", function() { var _test2 = _interopRequireDefault(_test); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var test2 = (0, _test2.default)(); - test2.should.be.eql("OK"); + expect(test2).toBe("OK"); }); it("should double reexport from non-harmony modules correctly", function() { - y.should.be.eql("y"); - x.should.be.eql("x"); + expect(y).toBe("y"); + expect(x).toBe("x"); }); import { a, b } from "./reexport" it("should be possible to reexport a module with unknown exports", function() { - a.should.be.eql("a"); - b.should.be.eql("b"); + expect(a).toBe("a"); + expect(b).toBe("b"); }); diff --git a/test/cases/parsing/harmony-duplicate-export/index.js b/test/cases/parsing/harmony-duplicate-export/index.js index 54bbf91dba3..b9be967f819 100644 --- a/test/cases/parsing/harmony-duplicate-export/index.js +++ b/test/cases/parsing/harmony-duplicate-export/index.js @@ -15,21 +15,21 @@ var y6 = require("./6?b").x; var y7 = require("./7?b").x; it("should not overwrite when using star export (known exports)", function() { - x1.should.be.eql("1"); - x2.should.be.eql("1"); - x3.should.be.eql("a"); - x4.should.be.eql("b"); - x5.should.be.eql("c"); - x6.should.be.eql("a"); - x7.should.be.eql("d"); + expect(x1).toBe("1"); + expect(x2).toBe("1"); + expect(x3).toBe("a"); + expect(x4).toBe("b"); + expect(x5).toBe("c"); + expect(x6).toBe("a"); + expect(x7).toBe("d"); }); it("should not overwrite when using star export (unknown exports)", function() { - y1.should.be.eql("1"); - y2.should.be.eql("1"); - y3.should.be.eql("a"); - y4.should.be.eql("b"); - y5.should.be.eql("c"); - y6.should.be.eql("a"); - y7.should.be.eql("d"); + expect(y1).toBe("1"); + expect(y2).toBe("1"); + expect(y3).toBe("a"); + expect(y4).toBe("b"); + expect(y5).toBe("c"); + expect(y6).toBe("a"); + expect(y7).toBe("d"); }); diff --git a/test/cases/parsing/harmony-edge-cases/index.js b/test/cases/parsing/harmony-edge-cases/index.js index ff252435b7f..965fb31505c 100644 --- a/test/cases/parsing/harmony-edge-cases/index.js +++ b/test/cases/parsing/harmony-edge-cases/index.js @@ -3,9 +3,9 @@ import x, { b } from "./b"; import { c, d } from "./fake-reexport"; it("should be able to use exported function", function() { - a.should.be.eql("ok"); - b.should.be.eql("ok"); - x().should.be.eql("ok"); - c.should.be.eql("ok"); - d.should.be.eql("ok"); + expect(a).toBe("ok"); + expect(b).toBe("ok"); + expect(x()).toBe("ok"); + expect(c).toBe("ok"); + expect(d).toBe("ok"); }); diff --git a/test/cases/parsing/harmony-export-hoist/index.js b/test/cases/parsing/harmony-export-hoist/index.js index 8ae8ff1e912..fd5748c9df1 100644 --- a/test/cases/parsing/harmony-export-hoist/index.js +++ b/test/cases/parsing/harmony-export-hoist/index.js @@ -2,8 +2,8 @@ it("should hoist exports", function() { var result = require("./foo").default; - (typeof result.foo).should.have.eql("function"); - (typeof result.foo2).should.have.eql("function"); - result.foo().should.be.eql("ok"); - result.foo2().should.be.eql("ok"); + expect(typeof result.foo).toEqual("function"); + expect(typeof result.foo2).toEqual("function"); + expect(result.foo()).toBe("ok"); + expect(result.foo2()).toBe("ok"); }); diff --git a/test/cases/parsing/harmony-export-import-specifier/index.js b/test/cases/parsing/harmony-export-import-specifier/index.js index b8d8e509423..e0a4d16b1af 100644 --- a/test/cases/parsing/harmony-export-import-specifier/index.js +++ b/test/cases/parsing/harmony-export-import-specifier/index.js @@ -1,8 +1,8 @@ "use strict"; -import {x, y} from "./a"; +import { x, y } from "./a"; it("namespace export as from commonjs should override named export", function() { - x.should.be.eql(1); - y.should.be.eql(3); + expect(x).toBe(1); + expect(y).toBe(3); }); diff --git a/test/cases/parsing/harmony-export-precedence/index.js b/test/cases/parsing/harmony-export-precedence/index.js index 83a1181a887..dfdaf66838e 100644 --- a/test/cases/parsing/harmony-export-precedence/index.js +++ b/test/cases/parsing/harmony-export-precedence/index.js @@ -3,19 +3,19 @@ import { a, b, c, d, e } from "./a"; import defaultImport from "./a"; it("should prefer local exports", function() { - a().should.be.eql("a1"); - e.should.be.eql("e1"); + expect(a()).toBe("a1"); + expect(e).toBe("e1"); }); it("should prefer indirect exports over star exports", function() { - b.should.be.eql("b2"); - d.should.be.eql("d2"); + expect(b).toBe("b2"); + expect(d).toBe("d2"); }); it("should use star exports", function() { - c.should.be.eql("c3"); + expect(c).toBe("c3"); }); it("should not export default via star export", function() { - (typeof defaultImport).should.be.eql("undefined"); + expect((typeof defaultImport)).toBe("undefined"); }); diff --git a/test/cases/parsing/harmony-import-export-order/index.js b/test/cases/parsing/harmony-import-export-order/index.js index 3c0e34d8544..4ba8b05c8e7 100644 --- a/test/cases/parsing/harmony-import-export-order/index.js +++ b/test/cases/parsing/harmony-import-export-order/index.js @@ -3,8 +3,8 @@ it("should process imports of star exports in the correct order", function() { tracker.list.length = 0; delete require.cache[require.resolve("./c")]; var c = require("./c"); - tracker.list.should.be.eql(["a", "b", "c"]); - c.ax.should.be.eql("ax"); - c.bx.should.be.eql("ax"); - c.cx.should.be.eql("ax"); + expect(tracker.list).toEqual(["a", "b", "c"]); + expect(c.ax).toBe("ax"); + expect(c.bx).toBe("ax"); + expect(c.cx).toBe("ax"); }); diff --git a/test/cases/parsing/harmony-import-targets/index.js b/test/cases/parsing/harmony-import-targets/index.js index 66b1a645f9e..c87e1952f92 100644 --- a/test/cases/parsing/harmony-import-targets/index.js +++ b/test/cases/parsing/harmony-import-targets/index.js @@ -1,9 +1,9 @@ import {x, f} from "./x"; it("should import into object literal", function() { - ({ x: x }).should.be.eql({x: 1}); + (expect({ x: x })).toEqual({x: 1}); var obj = { x: x }; - obj.should.be.eql({x: 1}); + expect(obj).toEqual({x: 1}); }); function func(z) { @@ -11,21 +11,21 @@ function func(z) { } it("should import into function argument", function() { - func(x).should.be.eql(1); - f(x).should.be.eql(1); - func({x:x}).should.be.eql({x:1}); - f({x:x}).should.be.eql({x:1}); + expect(func(x)).toBe(1); + expect(f(x)).toBe(1); + expect(func({x:x})).toEqual({x:1}); + expect(f({x:x})).toEqual({x:1}); var y = f(x); - y.should.be.eql(1); + expect(y).toBe(1); y = function() { return x; }; - y().should.be.eql(1); + expect(y()).toBe(1); }); it("should import into array literal", function() { - ([x, f(2)]).should.be.eql([1, 2]); - ([{ + expect([x, f(2)]).toEqual([1, 2]); + expect([{ value: x - }]).should.be.eql([{ value: x }]); + }]).toEqual([{ value: x }]); }); diff --git a/test/cases/parsing/harmony-injecting-order/index.js b/test/cases/parsing/harmony-injecting-order/index.js index 88d344b6940..e61841e8c93 100644 --- a/test/cases/parsing/harmony-injecting-order/index.js +++ b/test/cases/parsing/harmony-injecting-order/index.js @@ -1,3 +1,3 @@ it("should inject variables before exporting", function() { - require("./file").f().should.be.eql({}); + expect(require("./file").f()).toEqual({}); }); diff --git a/test/cases/parsing/harmony-spec/index.js b/test/cases/parsing/harmony-spec/index.js index d4e12cddc67..59a1517ab81 100644 --- a/test/cases/parsing/harmony-spec/index.js +++ b/test/cases/parsing/harmony-spec/index.js @@ -6,33 +6,33 @@ import cycleValue from "./export-cycle-a"; import { data } from "./self-cycle"; it("should establish live binding of values", function() { - value.should.be.eql(0); + expect(value).toBe(0); add(2); - value.should.be.eql(2); + expect(value).toBe(2); }); it("should establish live binding of values with transpiled es5 module", function() { - value2.should.be.eql(0); + expect(value2).toBe(0); add2(5); - value2.should.be.eql(5); + expect(value2).toBe(5); }); it("should allow to use eval with exports", function() { - valueEval.should.be.eql(0); + expect(valueEval).toBe(0); evalInModule("value = 5"); - valueEval.should.be.eql(5); + expect(valueEval).toBe(5); }); it("should execute modules in the correct order", function() { - getLog().should.be.eql(["a", "b", "c"]); + expect(getLog()).toEqual(["a", "b", "c"]); }); it("should bind exports before the module executes", function() { - cycleValue.should.be.eql(true); + expect(cycleValue).toBe(true); }); it("should allow to import live variables from itself", function() { - data.should.be.eql([undefined, 1, 2]); + expect(data).toEqual([undefined, 1, 2]); }); import { value as valueEval, evalInModule } from "./eval"; diff --git a/test/cases/parsing/harmony-tdz/index.js b/test/cases/parsing/harmony-tdz/index.js index a033014f067..0f2ef06aa98 100644 --- a/test/cases/parsing/harmony-tdz/index.js +++ b/test/cases/parsing/harmony-tdz/index.js @@ -1,8 +1,8 @@ import value, { exception } from "./module"; it("should have a TDZ for exported const values", function() { - (typeof exception).should.be.eql("object"); - exception.should.be.instanceof(Error); - exception.message.should.match(/ is not defined$/); - value.should.be.eql("value"); + expect((typeof exception)).toBe("object"); + expect(exception).toBeInstanceOf(Error); + expect(exception.message).toMatch(/ is not defined$/); + expect(value).toBe("value"); }); diff --git a/test/cases/parsing/harmony-this/index.js b/test/cases/parsing/harmony-this/index.js index 9a142de00e5..0f350bd05db 100644 --- a/test/cases/parsing/harmony-this/index.js +++ b/test/cases/parsing/harmony-this/index.js @@ -7,11 +7,11 @@ import * as abc from "./abc"; function x() { throw new Error("should not be executed"); } it("should have this = undefined on imported non-strict functions", function() { x - d().should.be.eql("undefined"); + expect(d()).toBe("undefined"); x - a().should.be.eql("undefined"); + expect(a()).toBe("undefined"); x - B().should.be.eql("undefined"); + expect(B()).toBe("undefined"); }); import C2, { C } from "./new"; @@ -20,9 +20,9 @@ import * as New from "./new"; it("should be possible to use new correctly", function() { x - new C().should.match({ok: true}); + expect(new C()).toEqual({ok: true}); x - new C2().should.match({ok: true}); + expect(new C2()).toEqual({ok: true}); x - new New.C().should.match({ok: true}); + expect(new New.C()).toEqual({ok: true}); }); diff --git a/test/cases/parsing/harmony/index.js b/test/cases/parsing/harmony/index.js index 32117f23d4c..2989113bc91 100644 --- a/test/cases/parsing/harmony/index.js +++ b/test/cases/parsing/harmony/index.js @@ -26,89 +26,90 @@ import "unused"; it("should import a default export from a module", function() { - defaultExport.should.be.eql("def"); + expect(defaultExport).toBe("def"); }); it("should import an identifier from a module", function() { - a.should.be.eql("a"); - B.should.be.eql("b"); + expect(a).toBe("a"); + expect(B).toBe("b"); }); it("should import a whole module", function() { - abc.a.should.be.eql("a"); - abc.b.should.be.eql("b"); - abc.c.should.be.eql("c"); - abc.d.c.should.be.eql("c"); - abc.e.should.be.eql("c"); + expect(abc.a).toBe("a"); + expect(abc.b).toBe("b"); + expect(abc.c).toBe("c"); + expect(abc.d.c).toBe("c"); + expect(abc.e).toBe("c"); var copy = (function(a) { return a; }(abc)); - copy.a.should.be.eql("a"); - copy.b.should.be.eql("b"); - copy.c.should.be.eql("c"); - copy.d.c.should.be.eql("c"); - copy.e.should.be.eql("c"); - (typeof abc).should.be.eql("object"); + expect(copy.a).toBe("a"); + expect(copy.b).toBe("b"); + expect(copy.c).toBe("c"); + expect(copy.d.c).toBe("c"); + expect(copy.e).toBe("c"); + expect((typeof abc)).toBe("object"); + expect("" + abc).toBe("[object Module]"); }); it("should export functions", function() { - fn.should.have.type("function"); - fn().should.be.eql("fn"); - (fn === fn).should.be.eql(true); + expect(fn).toBeTypeOf("function"); + expect(fn()).toBe("fn"); + expect((fn === fn)).toBe(true); }); it("should multiple variables with one statement", function() { - one.should.be.eql("one"); - two.should.be.eql("two"); + expect(one).toBe("one"); + expect(two).toBe("two"); }); it("should still be able to use exported stuff", function() { - test1.should.be.eql("fn"); - test2.should.be.eql("two"); + expect(test1).toBe("fn"); + expect(test2).toBe("two"); }); it("should reexport a module", function() { - rea.should.be.eql("a"); - reb.should.be.eql("b"); - rec.should.be.eql("c"); - reo.should.be.eql("one"); - retwo.should.be.eql("two"); - rea2.should.be.eql("a"); + expect(rea).toBe("a"); + expect(reb).toBe("b"); + expect(rec).toBe("c"); + expect(reo).toBe("one"); + expect(retwo).toBe("two"); + expect(rea2).toBe("a"); }); it("should support circular dependencies", function() { - threeIsOdd.should.be.eql(true); - even(4).should.be.eql(true); + expect(threeIsOdd).toBe(true); + expect(even(4)).toBe(true); }); it("should support export specifier", function() { - specA.should.be.eql(1); - specB.should.be.eql(2); + expect(specA).toBe(1); + expect(specB).toBe(2); }); it("should be able to import commonjs", function() { function x() { throw new Error("should not be executed"); } // next line doesn't end with semicolon x - Thing.should.have.type("function"); + expect(Thing).toBeTypeOf("function"); x - Thing().should.be.eql("thing"); + expect(Thing()).toBe("thing"); x - Other.should.be.eql("other"); + expect(Other).toBe("other"); - Thing2.should.have.type("function"); - new Thing2().value.should.be.eql("thing"); - Other2.should.be.eql("other"); - Thing3().should.be.eql("thing"); + expect(Thing2).toBeTypeOf("function"); + expect(new Thing2().value).toBe("thing"); + expect(Other2).toBe("other"); + expect(Thing3()).toBe("thing"); }); it("should be able to import commonjs with star import", function() { var copyOfCommonjs = commonjs; - commonjs().should.be.eql("thing"); - commonjs.Other.should.be.eql("other"); - copyOfCommonjs().should.be.eql("thing"); - copyOfCommonjs.Other.should.be.eql("other"); + expect(commonjs()).toBe("thing"); + expect(commonjs.Other).toBe("other"); + expect(copyOfCommonjs()).toBe("thing"); + expect(copyOfCommonjs.Other).toBe("other"); var copyOfCommonjsTrans = commonjsTrans; - new commonjsTrans.default().value.should.be.eql("thing"); - commonjsTrans.Other.should.be.eql("other"); - new copyOfCommonjsTrans.default().value.should.be.eql("thing"); - copyOfCommonjsTrans.Other.should.be.eql("other"); + expect(new commonjsTrans.default().value).toBe("thing"); + expect(commonjsTrans.Other).toBe("other"); + expect(new copyOfCommonjsTrans.default().value).toBe("thing"); + expect(copyOfCommonjsTrans.Other).toBe("other"); }); diff --git a/test/cases/parsing/hot-hash/index.js b/test/cases/parsing/hot-hash/index.js index ab17273e778..c15a7483e67 100644 --- a/test/cases/parsing/hot-hash/index.js +++ b/test/cases/parsing/hot-hash/index.js @@ -1,7 +1,7 @@ if(module.hot) { it("should have __webpack_hash__", function() { - (typeof __webpack_hash__).should.be.type("string"); - __webpack_hash__.should.match(/^[0-9a-f]{20}$/); + expect(typeof __webpack_hash__).toBeTypeOf("string"); + expect(__webpack_hash__).toMatch(/^[0-9a-f]{20}$/); }); } else { it("should have __webpack_hash__ (disabled)", function() { diff --git a/test/cases/parsing/inject-free-vars/index.js b/test/cases/parsing/inject-free-vars/index.js index 235dbb50f51..043b3e4f38d 100644 --- a/test/cases/parsing/inject-free-vars/index.js +++ b/test/cases/parsing/inject-free-vars/index.js @@ -1,18 +1,18 @@ it("should inject the module object into a chunk (AMD1)", function(done) { require([], function() { - module.webpackPolyfill.should.be.eql(1); + expect(module.webpackPolyfill).toBe(1); done(); }); }); it("should inject the module object into a chunk (AMD2)", function() { require([module.webpackPolyfill ? "./x1" : "./fail"]); - module.webpackPolyfill.should.be.eql(1); + expect(module.webpackPolyfill).toBe(1); }); it("should inject the module object into a chunk (ensure)", function(done) { require.ensure([], function(require) { - module.webpackPolyfill.should.be.eql(1); + expect(module.webpackPolyfill).toBe(1); done(); }); }); diff --git a/test/cases/parsing/issue-1600/index.js b/test/cases/parsing/issue-1600/index.js index 42d58a49c8c..bebd6523877 100644 --- a/test/cases/parsing/issue-1600/index.js +++ b/test/cases/parsing/issue-1600/index.js @@ -1,5 +1,5 @@ import fn from './file'; it("should compile correctly", function() { - fn().should.be.eql(1); + expect(fn()).toBe(1); }); diff --git a/test/cases/parsing/issue-2019/index.js b/test/cases/parsing/issue-2019/index.js index 04c1ffaa72e..186534811fc 100644 --- a/test/cases/parsing/issue-2019/index.js +++ b/test/cases/parsing/issue-2019/index.js @@ -1,4 +1,4 @@ it("should not fail on default export before export", function() { - require("./file").default.should.be.eql("default"); - require("./file").CONSTANT.should.be.eql("const"); -}); \ No newline at end of file + expect(require("./file").default).toBe("default"); + expect(require("./file").CONSTANT).toBe("const"); +}); diff --git a/test/cases/parsing/issue-2050/index.js b/test/cases/parsing/issue-2050/index.js index 85754b23bf0..4c28c4bac3e 100644 --- a/test/cases/parsing/issue-2050/index.js +++ b/test/cases/parsing/issue-2050/index.js @@ -1,8 +1,9 @@ it("should support multiple reexports", function() { - require("./x").should.be.eql({ + expect(require("./x")).toEqual({ xa: "a", xb: "b", xc: "c", - xd: "d" + xd: "d", + [Symbol.toStringTag]: "Module" }); }); diff --git a/test/cases/parsing/issue-2084/index.js b/test/cases/parsing/issue-2084/index.js index a9bc27f1387..04383d5d6ac 100644 --- a/test/cases/parsing/issue-2084/index.js +++ b/test/cases/parsing/issue-2084/index.js @@ -7,8 +7,8 @@ it("should bind this context on require callback", function(done) { runWithThis({ok: true}, function() { require([], function() { try { - require("./file").should.be.eql("file"); - this.should.be.eql({ok: true}); + expect(require("./file")).toBe("file"); + expect(this).toEqual({ok: true}); done(); } catch(e) { done(e); } }.bind(this)); @@ -19,9 +19,9 @@ it("should bind this context on require callback (loaded)", function(done) { runWithThis({ok: true}, function() { require(["./load.js"], function(load) { try { - require("./file").should.be.eql("file"); - load.should.be.eql("load"); - this.should.be.eql({ok: true}); + expect(require("./file")).toBe("file"); + expect(load).toBe("load"); + expect(this).toEqual({ok: true}); done(); } catch(e) { done(e); } }.bind(this)); @@ -32,8 +32,8 @@ it("should bind this context on require callback (foo)", function(done) { var foo = {ok: true}; require([], function(load) { try { - require("./file").should.be.eql("file"); - this.should.be.eql({ok: true}); + expect(require("./file")).toBe("file"); + expect(this).toEqual({ok: true}); done(); } catch(e) { done(e); } }.bind(foo)); @@ -43,9 +43,9 @@ it("should bind this context on require callback (foo, loaded)", function(done) var foo = {ok: true}; require(["./load.js"], function(load) { try { - require("./file").should.be.eql("file"); - load.should.be.eql("load"); - this.should.be.eql({ok: true}); + expect(require("./file")).toBe("file"); + expect(load).toBe("load"); + expect(this).toEqual({ok: true}); done(); } catch(e) { done(e); } }.bind(foo)); @@ -55,8 +55,8 @@ it("should bind this context on require callback (foo)", function(done) { runWithThis({ok: true}, function() { require([], function(load) { try { - require("./file").should.be.eql("file"); - this.should.be.eql({ok: {ok: true}}); + expect(require("./file")).toBe("file"); + expect(this).toEqual({ok: {ok: true}}); done(); } catch(e) { done(e); } }.bind({ok: this})); @@ -67,8 +67,8 @@ it("should bind this context on require.ensure callback", function(done) { runWithThis({ok: true}, function() { require.ensure([], function(require) { try { - require("./file").should.be.eql("file"); - this.should.be.eql({ok: true}); + expect(require("./file")).toBe("file"); + expect(this).toEqual({ok: true}); done(); } catch(e) { done(e); } }.bind(this)); @@ -79,8 +79,8 @@ it("should bind this context on require.ensure callback (loaded)", function(done runWithThis({ok: true}, function() { require.ensure(["./load.js"], function(require) { try { - require("./file").should.be.eql("file"); - this.should.be.eql({ok: true}); + expect(require("./file")).toBe("file"); + expect(this).toEqual({ok: true}); done(); } catch(e) { done(e); } }.bind(this)); diff --git a/test/cases/parsing/issue-2349/index.js b/test/cases/parsing/issue-2349/index.js index 277cee408ea..065ececb521 100644 --- a/test/cases/parsing/issue-2349/index.js +++ b/test/cases/parsing/issue-2349/index.js @@ -1,5 +1,5 @@ import {x} from './a' // named imported cases an errors it("should be able to import a named export", function() { - x.should.be.eql(1); + expect(x).toBe(1); }); diff --git a/test/cases/parsing/issue-2522/index.js b/test/cases/parsing/issue-2522/index.js index 86cb81e38a4..a727d989f25 100644 --- a/test/cases/parsing/issue-2522/index.js +++ b/test/cases/parsing/issue-2522/index.js @@ -9,13 +9,14 @@ it("should import into object shorthand", function() { b, c }; - o.should.be.eql({ + expect(o).toEqual({ a: 123, aa: 123, b: 456, c: { a: 123, - default: 456 + default: 456, + [Symbol.toStringTag]: "Module" } }); -}) \ No newline at end of file +}) diff --git a/test/cases/parsing/issue-2523/index.js b/test/cases/parsing/issue-2523/index.js index 8adb8a17a97..53c08cc144d 100644 --- a/test/cases/parsing/issue-2523/index.js +++ b/test/cases/parsing/issue-2523/index.js @@ -3,7 +3,7 @@ import { B } from "./module"; import { c } from "./module"; it("should allow to export a class", function() { - (typeof A).should.be.eql("function"); - (typeof B).should.be.eql("function"); - c.should.be.eql("c"); -}) \ No newline at end of file + expect((typeof A)).toBe("function"); + expect((typeof B)).toBe("function"); + expect(c).toBe("c"); +}) diff --git a/test/cases/parsing/issue-2528/index.js b/test/cases/parsing/issue-2528/index.js index 8fa0cde7690..a9a6562b88c 100644 --- a/test/cases/parsing/issue-2528/index.js +++ b/test/cases/parsing/issue-2528/index.js @@ -51,7 +51,7 @@ import { count } from "./module"; it("should run async functions", function() { var org = count; notExportedAsync(); - count.should.be.eql(org + 1); + expect(count).toBe(org + 1); exportedAsync(); - count.should.be.eql(org + 2); + expect(count).toBe(org + 2); }); diff --git a/test/cases/parsing/issue-2570/index.js b/test/cases/parsing/issue-2570/index.js index 700e4eaa172..3339350df17 100644 --- a/test/cases/parsing/issue-2570/index.js +++ b/test/cases/parsing/issue-2570/index.js @@ -6,8 +6,8 @@ it("should generate valid code when calling a harmony import function with brack var c = fn((3), (4)); var d = fn(5, (6)); - a.should.be.eql([1]); - b.should.be.eql([2]); - c.should.be.eql([3, 4]); - d.should.be.eql([5, 6]); + expect(a).toEqual([1]); + expect(b).toEqual([2]); + expect(c).toEqual([3, 4]); + expect(d).toEqual([5, 6]); }); diff --git a/test/cases/parsing/issue-2618/index.js b/test/cases/parsing/issue-2618/index.js index 1220384df7a..a8716a2f8c1 100644 --- a/test/cases/parsing/issue-2618/index.js +++ b/test/cases/parsing/issue-2618/index.js @@ -1,9 +1,9 @@ import defaultValue, { value, value2, value3, value4 } from "./module"; it("should be possible to redefine Object in a module", function() { - value.should.be.eql(123); - value2.should.be.eql(123); - value3.should.be.eql(123); - value4.should.be.eql(123); - defaultValue.should.be.eql(123); + expect(value).toBe(123); + expect(value2).toBe(123); + expect(value3).toBe(123); + expect(value4).toBe(123); + expect(defaultValue).toBe(123); }); diff --git a/test/cases/parsing/issue-2622/index.js b/test/cases/parsing/issue-2622/index.js index 262d5332e12..696ecad76a0 100644 --- a/test/cases/parsing/issue-2622/index.js +++ b/test/cases/parsing/issue-2622/index.js @@ -9,8 +9,8 @@ var func2 = function(x = a, y = b) { } it("should import into default parameters", function() { - func().should.be.eql(["a", "b"]); - func2().should.be.eql(["a", "b"]); - func(1).should.be.eql([1, "b"]); - func2(2).should.be.eql([2, "b"]); + expect(func()).toEqual(["a", "b"]); + expect(func2()).toEqual(["a", "b"]); + expect(func(1)).toEqual([1, "b"]); + expect(func2(2)).toEqual([2, "b"]); }); diff --git a/test/cases/parsing/issue-2641/index.js b/test/cases/parsing/issue-2641/index.js index d2155f6d480..4626a3d9cda 100644 --- a/test/cases/parsing/issue-2641/index.js +++ b/test/cases/parsing/issue-2641/index.js @@ -1,7 +1,7 @@ it("should require existing module with supplied error callback", function(done) { require(['./file'], function(file){ try { - file.should.be.eql("file"); + expect(file).toBe("file"); done(); } catch(e) { done(e); } }, function(error) { done(error); }); @@ -10,8 +10,8 @@ it("should require existing module with supplied error callback", function(done) it("should call error callback on missing module", function(done) { require(['./file', './missingModule'], function(file){}, function(error) { try { - error.should.be.instanceOf(Error); - error.message.should.be.eql('Cannot find module "./missingModule"'); + expect(error).toBeInstanceOf(Error); + expect(error.message).toBe("Cannot find module './missingModule'"); done(); } catch(e) { done(e); @@ -23,8 +23,8 @@ it("should call error callback on missing module in context", function(done) { (function(module) { require(['./' + module], function(file){}, function(error) { try { - error.should.be.instanceOf(Error); - error.message.should.be.eql("Cannot find module \"./missingModule\"."); + expect(error).toBeInstanceOf(Error); + expect(error.message).toBe("Cannot find module './missingModule'"); done(); } catch(e) { done(e); } }); @@ -34,8 +34,8 @@ it("should call error callback on missing module in context", function(done) { it("should call error callback on exception thrown in loading module", function(done) { require(['./throwing'], function(){}, function(error) { try { - error.should.be.instanceOf(Error); - error.message.should.be.eql('message'); + expect(error).toBeInstanceOf(Error); + expect(error.message).toBe('message'); done(); } catch(e) { done(e); } }); @@ -46,8 +46,8 @@ it("should not call error callback on exception thrown in require callback", fun throw new Error('message'); }, function(error) { try { - error.should.be.instanceOf(Error); - error.message.should.be.eql('message'); + expect(error).toBeInstanceOf(Error); + expect(error.message).toBe('message'); done(); } catch(e) { done(e); } }); diff --git a/test/cases/parsing/issue-2895/index.js b/test/cases/parsing/issue-2895/index.js index 26fba727954..83b1aae9750 100644 --- a/test/cases/parsing/issue-2895/index.js +++ b/test/cases/parsing/issue-2895/index.js @@ -1,6 +1,6 @@ import { a, b } from "./a"; it("should export a const value without semicolon", function() { - a.should.be.eql({x: 1}); - b.should.be.eql({x: 2}); + expect(a).toEqual({x: 1}); + expect(b).toEqual({x: 2}); }); diff --git a/test/cases/parsing/issue-2942/index.js b/test/cases/parsing/issue-2942/index.js index f30332b6f3f..dfc72823a72 100644 --- a/test/cases/parsing/issue-2942/index.js +++ b/test/cases/parsing/issue-2942/index.js @@ -2,11 +2,11 @@ it("should polyfill System", function() { if (typeof System === "object" && typeof System.register === "function") { require("fail"); } - (typeof System).should.be.eql("object"); - (typeof System.register).should.be.eql("undefined"); - (typeof System.get).should.be.eql("undefined"); - (typeof System.set).should.be.eql("undefined"); - (typeof System.anyNewItem).should.be.eql("undefined"); + expect((typeof System)).toBe("object"); + expect((typeof System.register)).toBe("undefined"); + expect((typeof System.get)).toBe("undefined"); + expect((typeof System.set)).toBe("undefined"); + expect((typeof System.anyNewItem)).toBe("undefined"); var x = System.anyNewItem; - (typeof x).should.be.eql("undefined"); + expect((typeof x)).toBe("undefined"); }) diff --git a/test/cases/parsing/issue-2942/warnings.js b/test/cases/parsing/issue-2942/warnings.js index f831b6a05b1..217c81ed03a 100644 --- a/test/cases/parsing/issue-2942/warnings.js +++ b/test/cases/parsing/issue-2942/warnings.js @@ -1,5 +1,5 @@ module.exports = [ - [/System.get is not supported by webpack/], [/System.register is not supported by webpack/], + [/System.get is not supported by webpack/], [/System.set is not supported by webpack/], ]; diff --git a/test/cases/parsing/issue-3116/index.js b/test/cases/parsing/issue-3116/index.js index c06f808242e..5d7eb70d8ba 100644 --- a/test/cases/parsing/issue-3116/index.js +++ b/test/cases/parsing/issue-3116/index.js @@ -2,12 +2,12 @@ import * as file from "./file"; import * as file2 from "./file2"; it("should translate indexed access to harmony import correctly", function() { - file["default"].should.be.eql("default"); - file["abc"].should.be.eql("abc"); + expect(file["default"]).toBe("default"); + expect(file["abc"]).toBe("abc"); }); it("should translate dynamic indexed access to harmony import correctly", function() { var fault = "fault"; - file2["de" + fault].should.be.eql("default"); - file2["abc"].should.be.eql("abc"); + expect(file2["de" + fault]).toBe("default"); + expect(file2["abc"]).toBe("abc"); }); diff --git a/test/cases/parsing/issue-3238/index.js b/test/cases/parsing/issue-3238/index.js index de1e9161beb..66321abae44 100644 --- a/test/cases/parsing/issue-3238/index.js +++ b/test/cases/parsing/issue-3238/index.js @@ -1,4 +1,4 @@ it("supports empty element in destructuring", function() { const second = ([, x]) => x; - second([1, 2]).should.eql(2); + expect(second([1, 2])).toEqual(2); }); diff --git a/test/cases/parsing/issue-3252/index.js b/test/cases/parsing/issue-3252/index.js index 29e9859e5f4..60c74513600 100644 --- a/test/cases/parsing/issue-3252/index.js +++ b/test/cases/parsing/issue-3252/index.js @@ -6,5 +6,5 @@ function fooBar({some, bar = E.V6Engine}) { } it("supports default argument assignment in import", function () { - fooBar({some:"test"}).should.eql('V6'); + expect(fooBar({some:"test"})).toEqual('V6'); }); diff --git a/test/cases/parsing/issue-3273/index.js b/test/cases/parsing/issue-3273/index.js index 9922239649f..294ce89a956 100644 --- a/test/cases/parsing/issue-3273/index.js +++ b/test/cases/parsing/issue-3273/index.js @@ -2,37 +2,37 @@ import { test } from "./file"; it("should hide import by local var", function() { var test = "ok"; - test.should.be.eql("ok"); + expect(test).toBe("ok"); }); it("should hide import by object pattern", function() { var { test } = { test: "ok" }; - test.should.be.eql("ok"); + expect(test).toBe("ok"); }); it("should hide import by array pattern", function() { var [test] = ["ok"]; - test.should.be.eql("ok"); + expect(test).toBe("ok"); }); it("should hide import by array pattern (nested)", function() { var [[test]] = [["ok"]]; - test.should.be.eql("ok"); + expect(test).toBe("ok"); }); it("should hide import by pattern in function", function() { (function({test}) { - test.should.be.eql("ok"); + expect(test).toBe("ok"); }({ test: "ok" })); }); it("should allow import in default (incorrect)", function() { var { other = test, test } = { test: "ok" }; - test.should.be.eql("ok"); - (typeof other).should.be.eql("undefined"); + expect(test).toBe("ok"); + expect((typeof other)).toBe("undefined"); }); it("should allow import in default", function() { var { other = test } = { test: "ok" }; - other.should.be.eql("test"); + expect(other).toBe("test"); }); diff --git a/test/cases/parsing/issue-345/index.js b/test/cases/parsing/issue-345/index.js index 9dc72a8a6aa..00f1b5fc6f1 100644 --- a/test/cases/parsing/issue-345/index.js +++ b/test/cases/parsing/issue-345/index.js @@ -1,7 +1,7 @@ it("should parse multiple expressions in a require", function(done) { var name = "abc"; require(["./" + name + "/" + name + "Test"], function(x) { - x.should.be.eql("ok"); + expect(x).toBe("ok"); done(); }); -}); \ No newline at end of file +}); diff --git a/test/cases/parsing/issue-3769/index.js b/test/cases/parsing/issue-3769/index.js index 85d022ca5e6..393ea08ae3c 100644 --- a/test/cases/parsing/issue-3769/index.js +++ b/test/cases/parsing/issue-3769/index.js @@ -1,3 +1,3 @@ it("should generate valid code", function() { - require("./module").myTest.should.be.eql("test"); + expect(require("./module").myTest).toBe("test"); }); diff --git a/test/cases/parsing/issue-387/index.js b/test/cases/parsing/issue-387/index.js index 535bbcee4d1..06c08883f27 100644 --- a/test/cases/parsing/issue-387/index.js +++ b/test/cases/parsing/issue-387/index.js @@ -10,7 +10,7 @@ it("should parse cujojs UMD modules", function() { ? define : function (factory) { module.exports = factory(require); } )); - module.exports.should.be.eql(123); + expect(module.exports).toBe(123); }); it("should parse cujojs UMD modules with deps", function() { @@ -30,7 +30,7 @@ it("should parse cujojs UMD modules with deps", function() { module.exports = factory.apply(null, deps); } )); - module.exports.should.be.eql(1234); + expect(module.exports).toBe(1234); }); it("should parse cujojs UMD modules with inlined deps", function() { @@ -45,5 +45,5 @@ it("should parse cujojs UMD modules with inlined deps", function() { ? define : function (factory) { module.exports = factory(require); } )); - module.exports.should.be.eql(4321); -}); \ No newline at end of file + expect(module.exports).toBe(4321); +}); diff --git a/test/cases/parsing/issue-3917/index.js b/test/cases/parsing/issue-3917/index.js index 119e28bed12..914aca7ffce 100644 --- a/test/cases/parsing/issue-3917/index.js +++ b/test/cases/parsing/issue-3917/index.js @@ -1,14 +1,14 @@ it("should be able to compile a module with UMD", function() { var x = require("./module"); - x.default.should.be.equal(global); + expect(x.default).toBe(global); }); it("should not find a free exports", function() { var x = require("./module2"); if(typeof exports !== "undefined") - (x.default).should.be.equal(exports); + expect(x.default).toBe(exports); else - (x.default).should.be.eql(false); + expect((x.default)).toBe(false); }); export {} diff --git a/test/cases/parsing/issue-3964/index.js b/test/cases/parsing/issue-3964/index.js index f290a7fa90c..9671c573578 100644 --- a/test/cases/parsing/issue-3964/index.js +++ b/test/cases/parsing/issue-3964/index.js @@ -1,4 +1,4 @@ it("should be possible to export default an imported name", function() { var x = require("./module"); - x.should.be.eql({ default: 1234 }); + expect(x).toEqual({ default: 1234, [Symbol.toStringTag]: "Module" }); }); diff --git a/test/cases/parsing/issue-4179/index.js b/test/cases/parsing/issue-4179/index.js index 9a769bf3d80..475b9e1ee1e 100644 --- a/test/cases/parsing/issue-4179/index.js +++ b/test/cases/parsing/issue-4179/index.js @@ -2,7 +2,7 @@ import def from "./module?harmony"; import * as mod from "./module?harmony-start" it("should export a sequence expression correctly", function() { - require("./module?cjs").should.be.eql({ default: 2 }); - def.should.be.eql(2); - mod.default.should.be.eql(2); + expect(require("./module?cjs")).toEqual({ default: 2, [Symbol.toStringTag]: "Module" }); + expect(def).toBe(2); + expect(mod.default).toBe(2); }); diff --git a/test/cases/parsing/issue-4357/index.js b/test/cases/parsing/issue-4357/index.js index 2b3f1da86ab..bef054d113e 100644 --- a/test/cases/parsing/issue-4357/index.js +++ b/test/cases/parsing/issue-4357/index.js @@ -5,7 +5,7 @@ it("should parse dynamic property names", function() { [require("./a")]: "a", [b]: "b" }; - o.should.be.eql({ + expect(o).toEqual({ a: "a", b: "b" }); @@ -21,7 +21,7 @@ it("should match dynamic property names", function() { [b]: cc } }]] = [0, 1, {b: {b: "c"}}]; - aa.should.be.eql("a"); - bb.should.be.eql("b"); - cc.should.be.eql("c"); + expect(aa).toBe("a"); + expect(bb).toBe("b"); + expect(cc).toBe("c"); }); diff --git a/test/cases/parsing/issue-4596/index.js b/test/cases/parsing/issue-4596/index.js index a8f957c22cd..bb772a0411e 100644 --- a/test/cases/parsing/issue-4596/index.js +++ b/test/cases/parsing/issue-4596/index.js @@ -3,11 +3,11 @@ it("should evaluate require.resolve as truthy value", function() { if(require.resolve) id = require.resolve("./module.js"); - (typeof id).should.be.oneOf("number", "string"); + expect(typeof id === "number" || typeof id === "string").toBeTruthy(); }); it("should evaluate require.resolve in ?: expression", function() { var id = require.resolve ? require.resolve("./module.js") : null; - (typeof id).should.be.oneOf("number", "string"); + expect(typeof id === "number" || typeof id === "string").toBeTruthy(); }); diff --git a/test/cases/parsing/issue-4608-1/index.js b/test/cases/parsing/issue-4608-1/index.js index 5ac3cf4b6d8..760ccdba7ce 100644 --- a/test/cases/parsing/issue-4608-1/index.js +++ b/test/cases/parsing/issue-4608-1/index.js @@ -1,5 +1,5 @@ it("should find var declaration later in code", function() { - (typeof require).should.be.eql("undefined"); + expect((typeof require)).toBe("undefined"); var require; }); @@ -10,7 +10,7 @@ it("should find var declaration in same statement", function() { }), require; require = (function(x) { - x.should.be.eql("fail"); + expect(x).toBe("fail"); }); fn(); }); @@ -18,7 +18,7 @@ it("should find var declaration in same statement", function() { it("should find a catch block declaration", function() { try { var f = (function(x) { - x.should.be.eql("fail"); + expect(x).toBe("fail"); }); throw f; } catch(require) { @@ -28,7 +28,7 @@ it("should find a catch block declaration", function() { it("should find var declaration in control statements", function() { var f = (function(x) { - x.should.be.eql("fail"); + expect(x).toBe("fail"); }); (function() { @@ -83,7 +83,7 @@ it("should find var declaration in control statements", function() { it("should find var declaration in control statements after usage", function() { var f = (function(x) { - x.should.be.eql("fail"); + expect(x).toBe("fail"); }); (function() { diff --git a/test/cases/parsing/issue-4608-2/index.js b/test/cases/parsing/issue-4608-2/index.js index 4aea99e059b..f2e777a5d87 100644 --- a/test/cases/parsing/issue-4608-2/index.js +++ b/test/cases/parsing/issue-4608-2/index.js @@ -2,7 +2,7 @@ it("should find var declaration in control statements", function() { var f = (function(x) { - x.should.be.eql("fail"); + expect(x).toBe("fail"); }); (function() { @@ -16,7 +16,7 @@ it("should find var declaration in control statements", function() { it("should find var declaration in control statements after usage", function() { var f = (function(x) { - x.should.be.eql("fail"); + expect(x).toBe("fail"); }); (function() { diff --git a/test/cases/parsing/issue-4870/index.js b/test/cases/parsing/issue-4870/index.js index 81774bc885b..2e1700560a2 100644 --- a/test/cases/parsing/issue-4870/index.js +++ b/test/cases/parsing/issue-4870/index.js @@ -3,11 +3,11 @@ import { test } from "./file"; it("should allow import in array destructing", function() { var other; [other = test] = []; - other.should.be.eql("test"); + expect(other).toBe("test"); }); it("should allow import in object destructing", function() { var other; ({other = test} = {}); - other.should.be.eql("test"); + expect(other).toBe("test"); }); diff --git a/test/cases/parsing/issue-494/index.js b/test/cases/parsing/issue-494/index.js index 1013d2b8a5a..f50a3046921 100644 --- a/test/cases/parsing/issue-494/index.js +++ b/test/cases/parsing/issue-494/index.js @@ -1,5 +1,5 @@ it("should replace a free var in a IIFE", function() { (function(md) { - md.should.be.type("function"); + expect(md).toBeTypeOf("function"); }(module.deprecate)); -}); \ No newline at end of file +}); diff --git a/test/cases/parsing/issue-4940/index.js b/test/cases/parsing/issue-4940/index.js index 927531b5d72..9785bf3c26c 100644 --- a/test/cases/parsing/issue-4940/index.js +++ b/test/cases/parsing/issue-4940/index.js @@ -1,58 +1,58 @@ -define("local-module-object", function () { +define("local-module-object", function() { return { foo: "bar" }; }); -define("local-side-effect", function () { +define("local-side-effect", function() { return { foo: null }; }); -define("local-module-non-object", ["local-side-effect"], function (sideEffect) { - sideEffect.foo = "bar" +define("local-module-non-object", ["local-side-effect"], function(sideEffect) { + sideEffect.foo = "bar"; return 1; }); it("should create dependency when require is called with 'new' (object export)", function() { const result = new require("./object-export"); - result.foo.should.equal("bar"); - result.should.equal(require("./object-export")); + expect(result.foo).toBe("bar"); + expect(result).toEqual(require("./object-export")); }); it("should create dependency when require is called with 'new' (non-object export)", function() { const sideEffect = require("./sideEffect"); const result = new require("./non-object-export"); - result.should.instanceof(__webpack_require__); - sideEffect.foo.should.equal("bar"); - result.should.not.equal(require("./non-object-export")); + expect(result instanceof __webpack_require__).toBe(true); + expect(sideEffect.foo).toBe("bar"); + expect(result).not.toEqual(require("./non-object-export")); }); it("should create dependency with 'new' on a local dependency (object export)", function() { const result = new require("local-module-object"); - result.foo.should.equal("bar"); - result.should.equal(require("local-module-object")); + expect(result.foo).toBe("bar"); + expect(result).toEqual(require("local-module-object")); }); it("shouldn't fail with a local dependency (non-object export)", function() { const sideEffect = require("local-side-effect"); const result = new require("local-module-non-object"); - result.should.not.equal(1); - sideEffect.foo.should.equal("bar"); - result.should.not.equal(require("local-module-non-object")); + expect(result).not.toBe(1); + expect(sideEffect.foo).toBe("bar"); + expect(result).not.toEqual(require("local-module-non-object")); }); -it("should work with 'require' in parentheses", function () { - const result = new (require)("./object-export"); - result.foo.should.equal("bar"); +it("should work with 'require' in parentheses", function() { + const result = new require("./object-export"); + expect(result.foo).toBe("bar"); }); -it("should work with local module 'require' in parentheses", function () { - const result = new (require)("local-module-object"); - result.foo.should.equal("bar"); +it("should work with local module 'require' in parentheses", function() { + const result = new require("local-module-object"); + expect(result.foo).toBe("bar"); }); -it("shouldn't fail with non-object local module 'require' in parentheses", function () { - new (require)("local-module-non-object"); +it("shouldn't fail with non-object local module 'require' in parentheses", function() { + new require("local-module-non-object"); }); diff --git a/test/cases/parsing/issue-551/index.js b/test/cases/parsing/issue-551/index.js index 6f3a39a0fe8..16d3208d280 100644 --- a/test/cases/parsing/issue-551/index.js +++ b/test/cases/parsing/issue-551/index.js @@ -5,20 +5,20 @@ it("should be able to set the public path", function() { global.xyz = "xyz"; __webpack_public_path__ = global.xyz; - __webpack_require__.p.should.be.eql("xyz"); + expect(__webpack_require__.p).toBe("xyz"); delete global.xyz; window.something = "something"; __webpack_public_path__ = window.something; - __webpack_require__.p.should.be.eql("something"); + expect(__webpack_require__.p).toBe("something"); delete window.something; __webpack_public_path__ = "abc"; - __webpack_require__.p.should.be.eql("abc"); + expect(__webpack_require__.p).toBe("abc"); __webpack_public_path__ = func(); - __webpack_require__.p.should.be.eql("func"); - + expect(__webpack_require__.p).toBe("func"); + __webpack_public_path__ = originalValue; function func() { diff --git a/test/cases/parsing/issue-5624/index.js b/test/cases/parsing/issue-5624/index.js index affa367d810..b230381ffda 100644 --- a/test/cases/parsing/issue-5624/index.js +++ b/test/cases/parsing/issue-5624/index.js @@ -2,5 +2,5 @@ import { fn } from "./module"; it("should allow conditionals as callee", function() { var x = (true ? fn : fn)(); - x.should.be.eql("ok"); + expect(x).toBe("ok"); }); diff --git a/test/cases/parsing/issue-5889/index.js b/test/cases/parsing/issue-5889/index.js new file mode 100644 index 00000000000..fdeb2378921 --- /dev/null +++ b/test/cases/parsing/issue-5889/index.js @@ -0,0 +1,5 @@ +const result = require("./module"); + +it("should correctly replace 'require' bindings", () => { + expect(result).toBe(true); +}); diff --git a/test/cases/parsing/issue-5889/module.js b/test/cases/parsing/issue-5889/module.js new file mode 100644 index 00000000000..6287013fb83 --- /dev/null +++ b/test/cases/parsing/issue-5889/module.js @@ -0,0 +1,6 @@ +let result = false; +if (require) { + result = true; +} + +module.exports = result; diff --git a/test/cases/parsing/issue-627/dir/test.js b/test/cases/parsing/issue-627/dir/test.js index a71df353647..71bf065207c 100644 --- a/test/cases/parsing/issue-627/dir/test.js +++ b/test/cases/parsing/issue-627/dir/test.js @@ -1,4 +1,4 @@ -(function() { +expect(function() { var expr1 = "a", expr2 = "b"; require(Math.random() < 0.5 ? expr1 : expr2); -}).should.throw(); +}).toThrowError(); diff --git a/test/cases/parsing/issue-7318/index.js b/test/cases/parsing/issue-7318/index.js new file mode 100644 index 00000000000..b99c6946803 --- /dev/null +++ b/test/cases/parsing/issue-7318/index.js @@ -0,0 +1,5 @@ +const type = require("./typeof"); + +it("should not output invalid code", () => { + expect(type).toBe("number"); +}); diff --git a/test/cases/parsing/issue-7318/typeof.js b/test/cases/parsing/issue-7318/typeof.js new file mode 100644 index 00000000000..e48d9ea1cd1 --- /dev/null +++ b/test/cases/parsing/issue-7318/typeof.js @@ -0,0 +1,2 @@ +typeof 1 +module.exports = "number" diff --git a/test/cases/parsing/issue-7335/a.js b/test/cases/parsing/issue-7335/a.js new file mode 100644 index 00000000000..2cf44cad69a --- /dev/null +++ b/test/cases/parsing/issue-7335/a.js @@ -0,0 +1 @@ +export default 9; diff --git a/test/cases/parsing/issue-7335/index.js b/test/cases/parsing/issue-7335/index.js new file mode 100644 index 00000000000..93f603c860b --- /dev/null +++ b/test/cases/parsing/issue-7335/index.js @@ -0,0 +1,27 @@ +import x from "./a"; + +const sum1 = (x, y, total = x + y) => total; +const id1 = (a = x) => a; + +function sum2(x, y, total = x + y) { return total; } +function id2(a = x) { return a; } + +const sum3 = function(x, y, total = x + y) { return total; } +const id3 = function(a = x) { return a; } + +it("should shadow imported bindings", () => { + // Arrow functions + expect(sum1(2, 3)).toBe(5); + expect(id1(1)).toBe(1); + expect(id1()).toBe(9); + + // Function declarations + expect(sum2(2, 3)).toBe(5); + expect(id2(1)).toBe(1); + expect(id2()).toBe(9); + + // Function expressions + expect(sum3(2, 3)).toBe(5); + expect(id3(1)).toBe(1); + expect(id3()).toBe(9); +}); diff --git a/test/cases/parsing/issue-758/index.js b/test/cases/parsing/issue-758/index.js index bcae179ba67..01ac1344e2d 100644 --- a/test/cases/parsing/issue-758/index.js +++ b/test/cases/parsing/issue-758/index.js @@ -2,7 +2,7 @@ it("should require existing module with supplied error callback", function(done) require.ensure(['./file'], function(){ try { var file = require('./file'); - file.should.be.eql("file"); + expect(file).toBe("file"); done(); } catch(e) { done(e); } }, function(error) {}); @@ -12,8 +12,8 @@ it("should call error callback on missing module", function(done) { require.ensure(['./missingModule'], function(){ require('./missingModule'); }, function(error) { - error.should.be.instanceOf(Error); - error.message.should.be.eql('Cannot find module "./missingModule"'); + expect(error).toBeInstanceOf(Error); + expect(error.message).toBe("Cannot find module './missingModule'"); done(); }); }); @@ -23,8 +23,8 @@ it("should call error callback on missing module in context", function(done) { require.ensure([], function(){ require('./' + module); }, function(error) { - error.should.be.instanceOf(Error); - error.message.should.be.eql("Cannot find module \"./missingModule\"."); + expect(error).toBeInstanceOf(Error); + expect(error.message).toBe("Cannot find module './missingModule'"); done(); }); })('missingModule'); @@ -34,8 +34,8 @@ it("should call error callback on exception thrown in loading module", function( require.ensure(['./throwing'], function(){ require('./throwing'); }, function(error) { - error.should.be.instanceOf(Error); - error.message.should.be.eql('message'); + expect(error).toBeInstanceOf(Error); + expect(error.message).toBe('message'); done(); }); }); @@ -44,8 +44,8 @@ it("should not call error callback on exception thrown in require callback", fun require.ensure(['./throwing'], function() { throw new Error('message'); }, function(error) { - error.should.be.instanceOf(Error); - error.message.should.be.eql('message'); + expect(error).toBeInstanceOf(Error); + expect(error.message).toBe('message'); done(); }); }); @@ -58,7 +58,7 @@ it("should call error callback when there is an error loading the chunk", functi var file = require('./file'); } catch(e) { done(e); } }, function(error) { - error.should.be.eql('fake chunk load error'); + expect(error).toBe('fake chunk load error'); done(); }); __webpack_require__.e = temp; diff --git a/test/cases/parsing/javascript/index.js b/test/cases/parsing/javascript/index.js index e9272a47b0b..7f59cf2ac37 100644 --- a/test/cases/parsing/javascript/index.js +++ b/test/cases/parsing/javascript/index.js @@ -1,4 +1,4 @@ it("should parse sparse arrays", function() { // issue #136 - [,null].should.have.length(2); - [0,,,0].should.have.length(4); + expect([,null]).toHaveLength(2); + expect([0,,,0]).toHaveLength(4); }); diff --git a/test/cases/parsing/local-modules/index.js b/test/cases/parsing/local-modules/index.js index 1d558cc8580..8eae3c39664 100644 --- a/test/cases/parsing/local-modules/index.js +++ b/test/cases/parsing/local-modules/index.js @@ -3,13 +3,13 @@ it("should define and require a local module", function() { define("my-module", function() { return 1234; }); - module.exports.should.be.eql("not set"); + expect(module.exports).toBe("not set"); define(["my-module"], function(myModule) { - myModule.should.be.eql(1234); + expect(myModule).toBe(1234); return 2345; }); - module.exports.should.be.eql(2345); - require("my-module").should.be.eql(1234); + expect(module.exports).toBe(2345); + expect(require("my-module")).toBe(1234); require(["my-module"]); }); @@ -19,11 +19,11 @@ it("should not create a chunk for a AMD require to a local module", function(don }); var sync = false; require(["my-module2"], function(myModule2) { - myModule2.should.be.eql(1235); + expect(myModule2).toBe(1235); sync = true; }); setImmediate(function() { - sync.should.be.eql(true); + expect(sync).toBe(true); done(); }); }); @@ -31,18 +31,18 @@ it("should not create a chunk for a AMD require to a local module", function(don it("should define and require a local module with deps", function() { module.exports = "not set"; define("my-module3", ["./dep"], function(dep) { - dep.should.be.eql("dep"); + expect(dep).toBe("dep"); return 1234; }); - module.exports.should.be.eql("not set"); + expect(module.exports).toBe("not set"); define("my-module4", ["my-module3", "./dep"], function(myModule, dep) { - dep.should.be.eql("dep"); - myModule.should.be.eql(1234); + expect(dep).toBe("dep"); + expect(myModule).toBe(1234); return 2345; }); - module.exports.should.be.eql("not set"); - require("my-module3").should.be.eql(1234); - require("my-module4").should.be.eql(2345); + expect(module.exports).toBe("not set"); + expect(require("my-module3")).toBe(1234); + expect(require("my-module4")).toBe(2345); }); it("should define and require a local module that is relative", function () { @@ -53,9 +53,9 @@ it("should define and require a local module that is relative", function () { return 2345; }); define("my-dir/my-other-dir/my-module5", ["./my-module4", "../my-module3"], function(myModule4, myModule3) { - myModule3.should.be.eql(1234); - myModule4.should.be.eql(2345); + expect(myModule3).toBe(1234); + expect(myModule4).toBe(2345); return 3456; }); - require("my-dir/my-other-dir/my-module5").should.be.eql(3456); + expect(require("my-dir/my-other-dir/my-module5")).toBe(3456); }) diff --git a/test/cases/parsing/optional-catch-binding/index.js b/test/cases/parsing/optional-catch-binding/index.js new file mode 100644 index 00000000000..e256ca2285e --- /dev/null +++ b/test/cases/parsing/optional-catch-binding/index.js @@ -0,0 +1,5 @@ +import f from "./module"; + +it("should support optional catch binding", () => { + expect(f()).toBe(true); +}); diff --git a/test/cases/parsing/optional-catch-binding/module.js b/test/cases/parsing/optional-catch-binding/module.js new file mode 100644 index 00000000000..f8060dc1fba --- /dev/null +++ b/test/cases/parsing/optional-catch-binding/module.js @@ -0,0 +1,7 @@ +export default function() { + try { + throw new Error(); + } catch { + return true; + } +}; diff --git a/test/cases/parsing/optional-catch-binding/test.filter.js b/test/cases/parsing/optional-catch-binding/test.filter.js new file mode 100644 index 00000000000..172fad5af93 --- /dev/null +++ b/test/cases/parsing/optional-catch-binding/test.filter.js @@ -0,0 +1,9 @@ +const supportsOptionalCatchBinding = require("../../../helpers/supportsOptionalCatchBinding"); + +module.exports = function(config) { + // XXX: Disable this test if UglifyJS is used because it does not support ES 2019 + if (config.mode === "production") { + return false; + } + return supportsOptionalCatchBinding(); +}; diff --git a/test/cases/parsing/pattern-in-for/index.js b/test/cases/parsing/pattern-in-for/index.js index 85786e65eae..499af551c3c 100644 --- a/test/cases/parsing/pattern-in-for/index.js +++ b/test/cases/parsing/pattern-in-for/index.js @@ -1,15 +1,15 @@ it("should parse patterns in for in/of statements", () => { var message; for({ message = require("./module")} of [{}]) { - message.should.be.eql("ok"); + expect(message).toBe("ok"); } for({ message = require("./module") } in { "string": "value" }) { - message.should.be.eql("ok"); + expect(message).toBe("ok"); } for(var { value = require("./module")} of [{}]) { - value.should.be.eql("ok"); + expect(value).toBe("ok"); } for(var { value = require("./module") } in { "string": "value" }) { - value.should.be.eql("ok"); + expect(value).toBe("ok"); } }); diff --git a/test/cases/parsing/precreated-ast/index.js b/test/cases/parsing/precreated-ast/index.js index dbcba88201b..a74dea11d5f 100644 --- a/test/cases/parsing/precreated-ast/index.js +++ b/test/cases/parsing/precreated-ast/index.js @@ -1,3 +1,3 @@ it("should be able to process AST from loader", function() { - require("./ast-loader!./module").should.be.eql("ok"); + expect(require("./ast-loader!./module")).toBe("ok"); }); diff --git a/test/cases/parsing/renaming/index.js b/test/cases/parsing/renaming/index.js index 22e0edde923..fea96df2523 100644 --- a/test/cases/parsing/renaming/index.js +++ b/test/cases/parsing/renaming/index.js @@ -1,8 +1,8 @@ it("should be able to rename require by var", function() { var cjsRequire; // just to make it difficult var cjsRequire = require, cjsRequire2 = typeof require !== "undefined" && require; - cjsRequire("./file").should.be.eql("ok"); - cjsRequire2("./file").should.be.eql("ok"); + expect(cjsRequire("./file")).toBe("ok"); + expect(cjsRequire2("./file")).toBe("ok"); }); it("should be able to rename require by assign", function() { @@ -10,39 +10,39 @@ it("should be able to rename require by assign", function() { (function() { cjsRequire = require; cjsRequire2 = typeof require === "function" && require; - cjsRequire("./file").should.be.eql("ok"); - cjsRequire2("./file").should.be.eql("ok"); + expect(cjsRequire("./file")).toBe("ok"); + expect(cjsRequire2("./file")).toBe("ok"); }()); }); it("should be able to rename require by IIFE", function() { (function(cjsRequire) { - cjsRequire("./file").should.be.eql("ok"); + expect(cjsRequire("./file")).toBe("ok"); }(require)); }); it("should be able to rename require by IIFE call", function() { (function(somethingElse, cjsRequire) { - cjsRequire("./file").should.be.eql("ok"); - somethingElse.should.be.eql(123); + expect(cjsRequire("./file")).toBe("ok"); + expect(somethingElse).toBe(123); }.call(this, 123, typeof require === "function" ? require : "error")); }); it("should be able to rename stuff by IIFE call", function() { (function(_exports, _exports2, _module, _module2, _define, _define2, _require, _require2) { _define(function(R, E, M) { - R("./file").should.be.eql("ok"); - _require("./file").should.be.eql("ok"); - _require2("./file").should.be.eql("ok"); - E.should.be.eql(exports); - _exports.should.be.eql(exports); - _exports2.should.be.eql(exports); - M.should.be.eql(module); - _module.should.be.eql(module); - _module2.should.be.eql(module); + expect(R("./file")).toBe("ok"); + expect(_require("./file")).toBe("ok"); + expect(_require2("./file")).toBe("ok"); + expect(E).toBe(exports); + expect(_exports).toBe(exports); + expect(_exports2).toBe(exports); + expect(M).toBe(module); + expect(_module).toBe(module); + expect(_module2).toBe(module); }); _define2(["./file"], function(file) { - file.should.be.eql("ok"); + expect(file).toBe("ok"); }); }).call(this, typeof exports !== 'undefined' ? exports : null, @@ -57,8 +57,8 @@ it("should be able to rename stuff by IIFE call", function() { it("should accept less parameters in a IIFE call", function() { (function(r, require) { - r("./file").should.be.eql("ok"); - (typeof require).should.be.eql("undefined"); + expect(r("./file")).toBe("ok"); + expect((typeof require)).toBe("undefined"); }(require)); }); @@ -70,12 +70,12 @@ it("should accept more parameters in a IIFE call", function() { it("should be able to rename stuff by IIFE call", function() { (function(_exports, _module, _define, _require) { _define(function(R, E, M) { - R("./file").should.be.eql("ok"); - _require("./file").should.be.eql("ok"); - E.should.be.eql(exports); - _exports.should.be.eql(exports); - M.should.be.eql(module); - _module.should.be.eql(module); + expect(R("./file")).toBe("ok"); + expect(_require("./file")).toBe("ok"); + expect(E).toBe(exports); + expect(_exports).toBe(exports); + expect(M).toBe(module); + expect(_module).toBe(module); }); }).call(this, typeof exports !== 'undefined' ? exports : null, diff --git a/test/cases/parsing/requirejs/index.js b/test/cases/parsing/requirejs/index.js index 37ea0ef2f65..93ee59899d7 100644 --- a/test/cases/parsing/requirejs/index.js +++ b/test/cases/parsing/requirejs/index.js @@ -7,14 +7,14 @@ it("should ignore require.config", function() { }); }); it("should have a require.version", function() { - require.version.should.be.type("string"); + expect(require.version).toBeTypeOf("string"); }); it("should have a requirejs.onError function", function() { function f(){} - requirejs.onError.should.be.type("function"); // has default handler + expect(requirejs.onError).toBeTypeOf("function"); // has default handler var org = requirejs.onError; requirejs.onError = f; - requirejs.onError.should.be.eql(f); + expect(requirejs.onError).toBe(f); requirejs.onError = org; require(["./file.js"], function() {}); }); diff --git a/test/cases/parsing/resolve-weak-context/index.js b/test/cases/parsing/resolve-weak-context/index.js index d166968e068..735c7fa49ca 100644 --- a/test/cases/parsing/resolve-weak-context/index.js +++ b/test/cases/parsing/resolve-weak-context/index.js @@ -1,6 +1,6 @@ it("should be able to use require.resolveWeak with expression", function() { var expr = "file"; var id = require.resolveWeak("./dir/" + expr); - id.should.be.eql(require("./dir/file.js")); + expect(id).toBe(require("./dir/file.js")); }); diff --git a/test/cases/parsing/spread/index.js b/test/cases/parsing/spread/index.js index 924a2c7e7e0..5a94cdea8bb 100644 --- a/test/cases/parsing/spread/index.js +++ b/test/cases/parsing/spread/index.js @@ -3,9 +3,9 @@ import * as M from "./module"; it("should support spread operator", function() { var o1 = { ...X }; - o1.should.be.eql({ A: "A", B: "B" }); + expect(o1).toEqual({ A: "A", B: "B" }); var o2 = { ...({ X }) }; - o2.should.be.eql({ X: { A: "A", B: "B" } }); + expect(o2).toEqual({ X: { A: "A", B: "B" } }); var o3 = { ...M }; - o3.should.be.eql({ default: { A: "A", B: "B" }, A: "A", B: "B" }); + expect(o3).toEqual({ default: { A: "A", B: "B" }, A: "A", B: "B" }); }); diff --git a/test/cases/parsing/strict-mode/index.js b/test/cases/parsing/strict-mode/index.js index 47aaab0da75..d3e026f57d6 100644 --- a/test/cases/parsing/strict-mode/index.js +++ b/test/cases/parsing/strict-mode/index.js @@ -9,11 +9,11 @@ define(["./abc"], function(abc) { var x = (function() { return this; })(); - (typeof x).should.be.eql("undefined"); + expect((typeof x)).toBe("undefined"); }); it("should import modules in strict mode", function() { - a().should.be.eql("undefined"); + expect(a()).toBe("undefined"); }); -}); \ No newline at end of file +}); diff --git a/test/cases/parsing/typeof/index.js b/test/cases/parsing/typeof/index.js index 0425079e7dd..93e366595ce 100644 --- a/test/cases/parsing/typeof/index.js +++ b/test/cases/parsing/typeof/index.js @@ -1,33 +1,33 @@ it("should not create a context for typeof require", function() { - require("./typeof").should.be.eql("function"); + expect(require("./typeof")).toBe("function"); }); it("should answer typeof require correctly", function() { - (typeof require).should.be.eql("function"); + expect((typeof require)).toBe("function"); }); it("should answer typeof define correctly", function() { - (typeof define).should.be.eql("function"); + expect((typeof define)).toBe("function"); }); it("should answer typeof require.amd correctly", function() { - (typeof require.amd).should.be.eql("object"); + expect((typeof require.amd)).toBe("object"); }); it("should answer typeof define.amd correctly", function() { - (typeof define.amd).should.be.eql("object"); + expect((typeof define.amd)).toBe("object"); }); it("should answer typeof module correctly", function() { - (typeof module).should.be.eql("object"); + expect((typeof module)).toBe("object"); }); it("should answer typeof exports correctly", function() { - (typeof exports).should.be.eql("object"); + expect((typeof exports)).toBe("object"); }); it("should answer typeof require.include correctly", function() { - (typeof require.include).should.be.eql("function"); + expect((typeof require.include)).toBe("function"); }); it("should answer typeof require.ensure correctly", function() { - (typeof require.ensure).should.be.eql("function"); + expect((typeof require.ensure)).toBe("function"); }); it("should answer typeof require.resolve correctly", function() { - (typeof require.resolve).should.be.eql("function"); + expect((typeof require.resolve)).toBe("function"); }); it("should not parse filtered stuff", function() { diff --git a/test/cases/parsing/unsupported-amd/index.js b/test/cases/parsing/unsupported-amd/index.js index 1ba36988d4c..db59455784f 100644 --- a/test/cases/parsing/unsupported-amd/index.js +++ b/test/cases/parsing/unsupported-amd/index.js @@ -1,14 +1,14 @@ it("should fail on unsupported use of AMD require 1", function() { - (function() { + expect(function() { var abc = ["./a", "./b"]; require(abc, function(a, b) {}); - }).should.throw(); + }).toThrowError(); }); it("should fail on unsupported use of AMD require 2", function() { - (function() { + expect(function() { var abc = ["./a", "./b"]; function f(a, b) {} require(abc, f); - }).should.throw(); + }).toThrowError(); }); diff --git a/test/cases/parsing/var-hiding/index.js b/test/cases/parsing/var-hiding/index.js index c339dee9e59..095807df090 100644 --- a/test/cases/parsing/var-hiding/index.js +++ b/test/cases/parsing/var-hiding/index.js @@ -2,9 +2,9 @@ var fn = function(module) { if (typeof module !== 'number') { throw new Error("module should be a number"); } - (typeof module).should.be.eql("number"); + expect((typeof module)).toBe("number"); }; it("should hide a free var by function argument", function() { fn(1); -}); \ No newline at end of file +}); diff --git a/test/cases/resolving/browser-field/index.js b/test/cases/resolving/browser-field/index.js index 342938206e5..fb3dba46390 100644 --- a/test/cases/resolving/browser-field/index.js +++ b/test/cases/resolving/browser-field/index.js @@ -1,37 +1,37 @@ it("should replace a module with a module", function() { - require("replacing-module1").should.be.eql("new-module"); + expect(require("replacing-module1")).toBe("new-module"); }); it("should replace a module with a file in a module", function() { - require("replacing-module2").should.be.eql("new-module/inner"); + expect(require("replacing-module2")).toBe("new-module/inner"); }); it("should replace a module with file in the same module", function() { - require("replacing-module3").should.be.eql("new-module/inner"); + expect(require("replacing-module3")).toBe("new-module/inner"); }); it("should replace a module with a file in the current module", function() { - require("replacing-module4").should.be.eql("replacing-module4/module"); + expect(require("replacing-module4")).toBe("replacing-module4/module"); }); it("should replace a file with another file", function() { - require("replacing-file1").should.be.eql("new-file"); + expect(require("replacing-file1")).toBe("new-file"); }); it("should replace a file with a module", function() { - require("replacing-file2").should.be.eql("new-module"); + expect(require("replacing-file2")).toBe("new-module"); }); it("should replace a file with a file in a module", function() { - require("replacing-file3").should.be.eql("new-module/inner"); + expect(require("replacing-file3")).toBe("new-module/inner"); }); it("should replace a file in a directory with another file", function() { - require("replacing-file4").should.be.eql("new-file"); + expect(require("replacing-file4")).toBe("new-file"); }); it("should ignore recursive module mappings", function() { - require("recursive-module").should.be.eql("new-module"); + expect(require("recursive-module")).toBe("new-module"); }); it("should use empty modules for ignored modules", function() { - require("ignoring-module").module.should.be.eql({}); - require("ignoring-module").file.should.be.eql({}); - require("ignoring-module").module.should.not.be.equal(require("ignoring-module").file); + expect(require("ignoring-module").module).toEqual({}); + expect(require("ignoring-module").file).toEqual({}); + expect(require("ignoring-module").module).not.toBe(require("ignoring-module").file); }); // Errors diff --git a/test/cases/resolving/commomjs-local-module/index.js b/test/cases/resolving/commomjs-local-module/index.js index f73c0597a9b..8abbf041723 100644 --- a/test/cases/resolving/commomjs-local-module/index.js +++ b/test/cases/resolving/commomjs-local-module/index.js @@ -1,5 +1,3 @@ -var should = require("should"); - define("regular", function(require, exports, module) { module.exports = "regular-module"; }); @@ -12,12 +10,11 @@ define("return-module", function(require, exports, module) { return "module is returned"; }); - it("should make different modules for query", function() { - should.strictEqual(require("regular"), "regular-module"); - should.strictEqual(require("return-module"), "module is returned"); + expect(require("regular")).toBe("regular-module"); + expect(require("return-module")).toBe("module is returned"); const overrideExports = require("override-exports"); - should(overrideExports).be.a.Object(); - should(Object.keys(overrideExports).length).be.exactly(0); + expect(typeof overrideExports).toBe("object"); + expect(Object.keys(overrideExports)).toHaveLength(0); }); diff --git a/test/cases/resolving/context/index.js b/test/cases/resolving/context/index.js index 0b4e1b9a616..20708273069 100644 --- a/test/cases/resolving/context/index.js +++ b/test/cases/resolving/context/index.js @@ -1,11 +1,11 @@ it("should resolve loaders relative to require", function() { var index = "index", test = "test"; - require("./loaders/queryloader?query!!!!./node_modules/subcontent/" + index + ".js").should.be.eql({ + expect(require("./loaders/queryloader?query!!!!./node_modules/subcontent/" + index + ".js")).toEqual({ resourceQuery: "", query: "?query", prev: "module.exports = \"error\";" }); - require("!./loaders/queryloader?query!./node_modules/subcontent/" + test + ".jade").should.be.eql({ + expect(require("!./loaders/queryloader?query!./node_modules/subcontent/" + test + ".pug")).toEqual({ resourceQuery: "", query: "?query", prev: "xyz: abc" diff --git a/test/cases/resolving/context/node_modules/subcontent/test.jade b/test/cases/resolving/context/node_modules/subcontent/test.pug similarity index 100% rename from test/cases/resolving/context/node_modules/subcontent/test.jade rename to test/cases/resolving/context/node_modules/subcontent/test.pug diff --git a/test/cases/resolving/query/index.js b/test/cases/resolving/query/index.js index 8b0f8c890fd..197f1ccf9c7 100644 --- a/test/cases/resolving/query/index.js +++ b/test/cases/resolving/query/index.js @@ -1,14 +1,12 @@ -var should = require("should"); - it("should make different modules for query", function() { var a = require("./empty"); var b = require("./empty?1"); var c = require("./empty?2"); - should.strictEqual(typeof a, "object"); - should.strictEqual(typeof b, "object"); - should.strictEqual(typeof c, "object"); - a.should.be.not.equal(b); - a.should.be.not.equal(c); - b.should.be.not.equal(c); + expect(typeof a).toBe("object"); + expect(typeof b).toBe("object"); + expect(typeof c).toBe("object"); + expect(a).not.toBe(b); + expect(a).not.toBe(c); + expect(b).not.toBe(c); }); diff --git a/test/cases/resolving/single-file-module/index.js b/test/cases/resolving/single-file-module/index.js index fed4edbdd17..62fffa34f9d 100644 --- a/test/cases/resolving/single-file-module/index.js +++ b/test/cases/resolving/single-file-module/index.js @@ -1,3 +1,3 @@ it("should load single file modules", function() { - require("subfilemodule").should.be.eql("subfilemodule"); + expect(require("subfilemodule")).toBe("subfilemodule"); }); diff --git a/test/cases/runtime/chunk-callback-order/duplicate.js b/test/cases/runtime/chunk-callback-order/duplicate.js index 9867c81061c..35482931895 100644 --- a/test/cases/runtime/chunk-callback-order/duplicate.js +++ b/test/cases/runtime/chunk-callback-order/duplicate.js @@ -1,3 +1,3 @@ require.ensure(["./a"], function(require) { - require("./a").should.be.eql("a"); -}) \ No newline at end of file + expect(require("./a")).toBe("a"); +}) diff --git a/test/cases/runtime/chunk-callback-order/duplicate2.js b/test/cases/runtime/chunk-callback-order/duplicate2.js index e6ab3c76865..37b0f6b4d27 100644 --- a/test/cases/runtime/chunk-callback-order/duplicate2.js +++ b/test/cases/runtime/chunk-callback-order/duplicate2.js @@ -1,3 +1,3 @@ require.ensure(["./b"], function(require) { - require("./b").should.be.eql("a"); -}) \ No newline at end of file + expect(require("./b")).toBe("a"); +}) diff --git a/test/cases/runtime/chunk-callback-order/index.js b/test/cases/runtime/chunk-callback-order/index.js index 3a3f2466a40..bed75d0dd4c 100644 --- a/test/cases/runtime/chunk-callback-order/index.js +++ b/test/cases/runtime/chunk-callback-order/index.js @@ -9,7 +9,7 @@ it("should fire multiple code load callbacks in the correct order", function(don require("./duplicate"); require("./duplicate2"); calls.push(2); - calls.should.be.eql([1,2]); + expect(calls).toEqual([1,2]); done(); }); }); diff --git a/test/cases/runtime/circular-dependencies/index.js b/test/cases/runtime/circular-dependencies/index.js index 5a7df2b4caf..fe666424597 100644 --- a/test/cases/runtime/circular-dependencies/index.js +++ b/test/cases/runtime/circular-dependencies/index.js @@ -1,3 +1,3 @@ it("should load circular dependencies correctly", function() { - require("./circular").should.be.eql(1); + expect(require("./circular")).toBe(1); }); diff --git a/test/cases/runtime/error-handling/index.js b/test/cases/runtime/error-handling/index.js index a8652210c8d..a471fbc0412 100644 --- a/test/cases/runtime/error-handling/index.js +++ b/test/cases/runtime/error-handling/index.js @@ -1,11 +1,11 @@ function testCase(number) { - require(number === 1 ? "./folder/file1" : number === 2 ? "./folder/file2" : number === 3 ? "./folder/file3" : "./missingModule").should.be.eql("file" + number); - require( + expect(require(number === 1 ? "./folder/file1" : number === 2 ? "./folder/file2" : number === 3 ? "./folder/file3" : "./missingModule")).toBe("file" + number); + expect(require( number === 1 ? "./folder/file1" : number === 2 ? "./folder/file2" : number === 3 ? "./folder/file3" : "./missingModule" - ).should.be.eql("file" + number); + )).toBe("file" + number); } @@ -16,7 +16,7 @@ it("should throw an error on missing module at runtime, but not at compile time } catch(e) { error = e; } - error.should.be.instanceOf(Error); + expect(error).toBeInstanceOf(Error); error = null; try { @@ -24,5 +24,5 @@ it("should throw an error on missing module at runtime, but not at compile time } catch(e) { error = e; } - error.should.be.instanceOf(Error); + expect(error).toBeInstanceOf(Error); }); diff --git a/test/cases/runtime/issue-1650/index.js b/test/cases/runtime/issue-1650/index.js index 307fc665d69..f14a6b66105 100644 --- a/test/cases/runtime/issue-1650/index.js +++ b/test/cases/runtime/issue-1650/index.js @@ -1,6 +1,6 @@ it("should be able to set the public path globally", function() { var org = __webpack_public_path__; require("./file"); - __webpack_public_path__.should.be.eql("ok"); + expect(__webpack_public_path__).toBe("ok"); __webpack_public_path__ = org; }); diff --git a/test/cases/runtime/issue-1788/a.js b/test/cases/runtime/issue-1788/a.js index a15f19f710e..f61f5ca9139 100644 --- a/test/cases/runtime/issue-1788/a.js +++ b/test/cases/runtime/issue-1788/a.js @@ -3,5 +3,5 @@ export default 'a-default'; export { btest } from "./b"; export function atest() { - b.should.be.eql("b-default"); + expect(b).toBe("b-default"); } diff --git a/test/cases/runtime/issue-1788/b.js b/test/cases/runtime/issue-1788/b.js index d79b5e30145..999009add7b 100644 --- a/test/cases/runtime/issue-1788/b.js +++ b/test/cases/runtime/issue-1788/b.js @@ -2,5 +2,5 @@ import a from './a'; export default 'b-default'; export function btest() { - a.should.be.eql("a-default"); + expect(a).toBe("a-default"); } diff --git a/test/cases/runtime/issue-2391-chunk/index.js b/test/cases/runtime/issue-2391-chunk/index.js index d11248e9ee9..7e38eadbdc5 100644 --- a/test/cases/runtime/issue-2391-chunk/index.js +++ b/test/cases/runtime/issue-2391-chunk/index.js @@ -1,4 +1,4 @@ it("should have a require.onError function by default", function() { - (typeof require.onError).should.be.eql("function"); + expect((typeof require.onError)).toBe("function"); require(["./file"]); -}); \ No newline at end of file +}); diff --git a/test/cases/runtime/issue-2391/index.js b/test/cases/runtime/issue-2391/index.js index c2ef272b650..c01b3c35a54 100644 --- a/test/cases/runtime/issue-2391/index.js +++ b/test/cases/runtime/issue-2391/index.js @@ -1,3 +1,3 @@ it("should not have a require.onError function by default", function() { - (typeof require.onError).should.be.eql("undefined"); // expected to fail in browsertests -}); \ No newline at end of file + expect((typeof require.onError)).toBe("undefined"); // expected to fail in browsertests +}); diff --git a/test/cases/runtime/missing-module-exception/index.js b/test/cases/runtime/missing-module-exception/index.js index fa2d10d63b3..3351fb7a5a4 100644 --- a/test/cases/runtime/missing-module-exception/index.js +++ b/test/cases/runtime/missing-module-exception/index.js @@ -2,6 +2,6 @@ it("should have correct error code", function() { try { require("./fail"); } catch(e) { - e.code.should.be.eql("MODULE_NOT_FOUND"); + expect(e.code).toBe("MODULE_NOT_FOUND"); } -}); \ No newline at end of file +}); diff --git a/test/cases/runtime/module-caching/index.js b/test/cases/runtime/module-caching/index.js index 34e70f3cd20..2618105a427 100644 --- a/test/cases/runtime/module-caching/index.js +++ b/test/cases/runtime/module-caching/index.js @@ -1,13 +1,11 @@ -var should = require("should"); - it("should cache modules correctly", function(done) { delete require.cache[require.resolve("./singular.js")]; - require("./singular.js").value.should.be.eql(1); - (require("./singular.js")).value.should.be.eql(1); + expect(require("./singular.js").value).toBe(1); + expect((require("./singular.js")).value).toBe(1); require("./sing" + "ular.js").value = 2; - require("./singular.js").value.should.be.eql(2); + expect(require("./singular.js").value).toBe(2); require.ensure(["./two.js"], function(require) { - require("./singular.js").value.should.be.eql(2); + expect(require("./singular.js").value).toBe(2); done(); }); }); @@ -18,9 +16,9 @@ it("should be able the remove modules from cache with require.cache and require. var singularIdInConditional = require.resolve(true ? "./singular2" : "./singular"); if(typeof singularId !== "number" && typeof singularId !== "string") throw new Error("require.resolve should return a number or string"); - singularIdInConditional.should.be.eql(singularId); - (require.cache).should.have.type("object"); - (require.cache[singularId]).should.have.type("object"); + expect(singularIdInConditional).toBe(singularId); + expect(require.cache).toBeTypeOf("object"); + expect(require.cache[singularId]).toBeTypeOf("object"); delete require.cache[singularId]; - require("./singular2").should.be.not.equal(singularObj); + expect(require("./singular2")).not.toBe(singularObj); }); diff --git a/test/cases/runtime/require-function/index.js b/test/cases/runtime/require-function/index.js index 12a202531ef..bd6a7caf019 100644 --- a/test/cases/runtime/require-function/index.js +++ b/test/cases/runtime/require-function/index.js @@ -1,5 +1,5 @@ it("should have correct properties on the require function", function() { - __webpack_require__.c.should.have.type("object"); - __webpack_require__.m.should.have.type("object"); - __webpack_require__.p.should.have.type("string"); -}); \ No newline at end of file + expect(__webpack_require__.c).toBeTypeOf("object"); + expect(__webpack_require__.m).toBeTypeOf("object"); + expect(__webpack_require__.p).toBeTypeOf("string"); +}); diff --git a/test/cases/scope-hoisting/async-keyword-5615/index.js b/test/cases/scope-hoisting/async-keyword-5615/index.js index b2e73311baa..845e64bd51f 100644 --- a/test/cases/scope-hoisting/async-keyword-5615/index.js +++ b/test/cases/scope-hoisting/async-keyword-5615/index.js @@ -1,5 +1,5 @@ import value from "./async"; it("should have the correct values", function() { - value.should.be.eql("default"); + expect(value).toBe("default"); }); diff --git a/test/cases/scope-hoisting/chained-reexport/index.js b/test/cases/scope-hoisting/chained-reexport/index.js index 5ac21327b52..bfc180c278c 100644 --- a/test/cases/scope-hoisting/chained-reexport/index.js +++ b/test/cases/scope-hoisting/chained-reexport/index.js @@ -1,5 +1,5 @@ import { named } from "./c"; it("should have the correct values", function() { - named.should.be.eql("named"); + expect(named).toBe("named"); }); diff --git a/test/cases/scope-hoisting/circular-namespace-object/index.js b/test/cases/scope-hoisting/circular-namespace-object/index.js index 34ccf6f6464..bec4005489f 100644 --- a/test/cases/scope-hoisting/circular-namespace-object/index.js +++ b/test/cases/scope-hoisting/circular-namespace-object/index.js @@ -1,5 +1,5 @@ import value from "./module"; it("should have access to namespace object before evaluation", function() { - value.should.be.eql("ok"); + expect(value).toBe("ok"); }); diff --git a/test/cases/scope-hoisting/export-namespace/index.js b/test/cases/scope-hoisting/export-namespace/index.js index 6c1b35d6f0a..f551d349e83 100644 --- a/test/cases/scope-hoisting/export-namespace/index.js +++ b/test/cases/scope-hoisting/export-namespace/index.js @@ -2,15 +2,17 @@ import { ns as ns1 } from "./module1"; const ns2 = require("./module2").ns; it("should allow to export a namespace object (concated)", function() { - ns1.should.be.eql({ + expect(ns1).toEqual({ a: "a", - b: "b" + b: "b", + [Symbol.toStringTag]: "Module" }); }); it("should allow to export a namespace object (exposed)", function() { - ns2.should.be.eql({ + expect(ns2).toEqual({ a: "a", - b: "b" + b: "b", + [Symbol.toStringTag]: "Module" }); }); diff --git a/test/cases/scope-hoisting/import-order/index.js b/test/cases/scope-hoisting/import-order/index.js index ce3eb167502..e4d2e75a596 100644 --- a/test/cases/scope-hoisting/import-order/index.js +++ b/test/cases/scope-hoisting/import-order/index.js @@ -3,5 +3,5 @@ import "./module"; import { log } from "./tracker"; it("should evaluate import in the correct order", function() { - log.should.be.eql(["commonjs", "module"]); + expect(log).toEqual(["commonjs", "module"]); }); diff --git a/test/cases/scope-hoisting/indirect-reexport/index.js b/test/cases/scope-hoisting/indirect-reexport/index.js index f9a31c159b4..44e195598fc 100644 --- a/test/cases/scope-hoisting/indirect-reexport/index.js +++ b/test/cases/scope-hoisting/indirect-reexport/index.js @@ -1,5 +1,5 @@ var c = require("./c"); it("should have the correct values", function() { - c.named.should.be.eql("named"); + expect(c.named).toBe("named"); }); diff --git a/test/cases/scope-hoisting/inside-class/index.js b/test/cases/scope-hoisting/inside-class/index.js index 63aa824b3a7..eba2d46a70b 100644 --- a/test/cases/scope-hoisting/inside-class/index.js +++ b/test/cases/scope-hoisting/inside-class/index.js @@ -4,8 +4,8 @@ import { Foo as SecondFoo, Bar } from "./second" it("should renamed class reference in inner scope", function() { var a = new Foo().test(); var b = new SecondFoo().test(); - a.should.be.eql(1); - b.should.be.eql(2); - new FirstBar().test().should.be.eql(1); - new Bar().test().should.be.eql(2); + expect(a).toBe(1); + expect(b).toBe(2); + expect(new FirstBar().test()).toBe(1); + expect(new Bar().test()).toBe(2); }); diff --git a/test/cases/scope-hoisting/intra-references/index.js b/test/cases/scope-hoisting/intra-references/index.js index 37184366789..b1169303c9f 100644 --- a/test/cases/scope-hoisting/intra-references/index.js +++ b/test/cases/scope-hoisting/intra-references/index.js @@ -1,7 +1,7 @@ import value from "./a"; it("should have the correct values", function() { - value.should.be.eql("ok"); + expect(value).toBe("ok"); }); diff --git a/test/cases/scope-hoisting/issue-5020-minimal/index.js b/test/cases/scope-hoisting/issue-5020-minimal/index.js index b992781ad9b..c664793105a 100644 --- a/test/cases/scope-hoisting/issue-5020-minimal/index.js +++ b/test/cases/scope-hoisting/issue-5020-minimal/index.js @@ -1,11 +1,14 @@ var testData = require("./src/index.js"); it("should export the correct values", function() { - testData.should.be.eql({ + expect(testData).toEqual({ icon: { svg: { - default: 1 - } - } + default: 1, + [Symbol.toStringTag]: "Module" + }, + [Symbol.toStringTag]: "Module" + }, + [Symbol.toStringTag]: "Module" }); -}) +}); diff --git a/test/cases/scope-hoisting/issue-5020/index.js b/test/cases/scope-hoisting/issue-5020/index.js index f2ab49e3950..df60a977d4e 100644 --- a/test/cases/scope-hoisting/issue-5020/index.js +++ b/test/cases/scope-hoisting/issue-5020/index.js @@ -1,7 +1,7 @@ var testData = require("./src/index.js"); it("should export the correct values", function() { - testData.should.be.eql({ + expect(testData).toEqual({ svg5: { svg: { clinical1: { @@ -9,8 +9,10 @@ it("should export the correct values", function() { }, clinical2: { svg2: 2 - } - } + }, + [Symbol.toStringTag]: "Module" + }, + [Symbol.toStringTag]: "Module" }, svg6: { svg: { @@ -19,8 +21,11 @@ it("should export the correct values", function() { }, clinical2: { svg2: 20 - } - } - } + }, + [Symbol.toStringTag]: "Module" + }, + [Symbol.toStringTag]: "Module" + }, + [Symbol.toStringTag]: "Module" }); }) diff --git a/test/cases/scope-hoisting/issue-5096/index.js b/test/cases/scope-hoisting/issue-5096/index.js index 0b7a38114b5..5da7dc00180 100644 --- a/test/cases/scope-hoisting/issue-5096/index.js +++ b/test/cases/scope-hoisting/issue-5096/index.js @@ -9,5 +9,5 @@ if(Math.random() < -1) console.log(module); it("should compile fine", function() { - b.should.be.eql("a"); + expect(b).toBe("a"); }); diff --git a/test/cases/scope-hoisting/issue-5314/index.js b/test/cases/scope-hoisting/issue-5314/index.js index 2697608c7de..d35a27e917f 100644 --- a/test/cases/scope-hoisting/issue-5314/index.js +++ b/test/cases/scope-hoisting/issue-5314/index.js @@ -3,7 +3,7 @@ import a from "./module"; var obj = {}; it("should allow access to the default export of the root module", function() { - a().should.be.eql(obj); + expect(a()).toBe(obj); }); export default obj; diff --git a/test/cases/scope-hoisting/issue-5443/index.js b/test/cases/scope-hoisting/issue-5443/index.js index 5ce5559b258..30c2bdb7de3 100644 --- a/test/cases/scope-hoisting/issue-5443/index.js +++ b/test/cases/scope-hoisting/issue-5443/index.js @@ -1,8 +1,9 @@ import { module } from "./reexport"; it("should have the correct values", function() { - module.should.be.eql({ + expect(module).toEqual({ default: "default", - named: "named" + named: "named", + [Symbol.toStringTag]: "Module" }); }); diff --git a/test/cases/scope-hoisting/issue-5481/index.js b/test/cases/scope-hoisting/issue-5481/index.js index b72050107f9..26fb8bd2512 100644 --- a/test/cases/scope-hoisting/issue-5481/index.js +++ b/test/cases/scope-hoisting/issue-5481/index.js @@ -1,5 +1,5 @@ import value from "./module"; it("should not cause name conflicts", function() { - (typeof value).should.be.eql("undefined"); + expect((typeof value)).toBe("undefined"); }); diff --git a/test/cases/scope-hoisting/issue-6407/index.js b/test/cases/scope-hoisting/issue-6407/index.js index 193213228fa..518972092e5 100644 --- a/test/cases/scope-hoisting/issue-6407/index.js +++ b/test/cases/scope-hoisting/issue-6407/index.js @@ -2,10 +2,10 @@ import importOne from './import-one'; import importTwo from './import-two'; it("should concatenate modules default exports and empty array values", function() { - importOne.length.should.be.eql(2); - (typeof importOne[0]).should.be.eql('undefined'); - (typeof importOne[1]).should.be.eql('function'); - importTwo.length.should.be.eql(2); - (typeof importTwo[0]).should.be.eql('undefined'); - (typeof importTwo[1]).should.be.eql('function'); + expect(importOne.length).toBe(2); + expect(typeof importOne[0]).toBe('undefined'); + expect(typeof importOne[1]).toBe('function'); + expect(importTwo.length).toBe(2); + expect(typeof importTwo[0]).toBe('undefined'); + expect(typeof importTwo[1]).toBe('function'); }); diff --git a/test/cases/scope-hoisting/json-reexport-6700/index.js b/test/cases/scope-hoisting/json-reexport-6700/index.js index 093e287fea2..8fee46d8381 100644 --- a/test/cases/scope-hoisting/json-reexport-6700/index.js +++ b/test/cases/scope-hoisting/json-reexport-6700/index.js @@ -1,9 +1,9 @@ import { a, b, aa, bb } from './json.js' it("should reexport json data correctly", () => { - aa.should.be.eql({ a: "A" }); - bb.should.be.eql({ b: "B" }); - a.should.be.eql("A"); - b.should.be.eql("B"); + expect(aa).toEqual({ a: "A" }); + expect(bb).toEqual({ b: "B" }); + expect(a).toBe("A"); + expect(b).toBe("B"); }); diff --git a/test/cases/scope-hoisting/name-conflicts/index.js b/test/cases/scope-hoisting/name-conflicts/index.js index 48677703336..351cbeac486 100644 --- a/test/cases/scope-hoisting/name-conflicts/index.js +++ b/test/cases/scope-hoisting/name-conflicts/index.js @@ -6,10 +6,10 @@ import value5 from "./module?{"; import value6 from "./module?}"; it("should not break on name conflicts", function() { - value1.should.be.eql("a"); - value2.should.be.eql("a"); - value3.should.be.eql("a"); - value4.should.be.eql("a"); - value5.should.be.eql("a"); - value6.should.be.eql("a"); + expect(value1).toBe("a"); + expect(value2).toBe("a"); + expect(value3).toBe("a"); + expect(value4).toBe("a"); + expect(value5).toBe("a"); + expect(value6).toBe("a"); }); diff --git a/test/cases/scope-hoisting/order-without-side-effects/a.js b/test/cases/scope-hoisting/order-without-side-effects/a.js new file mode 100644 index 00000000000..2d4a7c744e6 --- /dev/null +++ b/test/cases/scope-hoisting/order-without-side-effects/a.js @@ -0,0 +1,3 @@ +import { array } from "./tracker"; +array.push("a"); +export var a = 1; diff --git a/test/cases/scope-hoisting/order-without-side-effects/b.js b/test/cases/scope-hoisting/order-without-side-effects/b.js new file mode 100644 index 00000000000..ddfc0d103c6 --- /dev/null +++ b/test/cases/scope-hoisting/order-without-side-effects/b.js @@ -0,0 +1,3 @@ +import { array } from "./tracker"; +array.push("b"); +export var b = 2; diff --git a/test/cases/scope-hoisting/order-without-side-effects/index.js b/test/cases/scope-hoisting/order-without-side-effects/index.js new file mode 100644 index 00000000000..25ee45861ed --- /dev/null +++ b/test/cases/scope-hoisting/order-without-side-effects/index.js @@ -0,0 +1,9 @@ +import { array } from "./tracker"; +import { a } from "./a"; +import { b } from "./b"; + +it("should concatenate in correct order", function() { + expect(b).toBe(2); + expect(a).toBe(1); + expect(array).toEqual(["a", "b"]); +}); diff --git a/test/cases/scope-hoisting/order-without-side-effects/package.json b/test/cases/scope-hoisting/order-without-side-effects/package.json new file mode 100644 index 00000000000..a43829151e1 --- /dev/null +++ b/test/cases/scope-hoisting/order-without-side-effects/package.json @@ -0,0 +1,3 @@ +{ + "sideEffects": false +} diff --git a/test/cases/scope-hoisting/order-without-side-effects/tracker.js b/test/cases/scope-hoisting/order-without-side-effects/tracker.js new file mode 100644 index 00000000000..cbf7690afca --- /dev/null +++ b/test/cases/scope-hoisting/order-without-side-effects/tracker.js @@ -0,0 +1 @@ +export var array = []; diff --git a/test/cases/scope-hoisting/reexport-cjs/index.js b/test/cases/scope-hoisting/reexport-cjs/index.js index 5ac21327b52..bfc180c278c 100644 --- a/test/cases/scope-hoisting/reexport-cjs/index.js +++ b/test/cases/scope-hoisting/reexport-cjs/index.js @@ -1,5 +1,5 @@ import { named } from "./c"; it("should have the correct values", function() { - named.should.be.eql("named"); + expect(named).toBe("named"); }); diff --git a/test/cases/scope-hoisting/reexport-exposed-cjs/index.js b/test/cases/scope-hoisting/reexport-exposed-cjs/index.js index f9a31c159b4..44e195598fc 100644 --- a/test/cases/scope-hoisting/reexport-exposed-cjs/index.js +++ b/test/cases/scope-hoisting/reexport-exposed-cjs/index.js @@ -1,5 +1,5 @@ var c = require("./c"); it("should have the correct values", function() { - c.named.should.be.eql("named"); + expect(c.named).toBe("named"); }); diff --git a/test/cases/scope-hoisting/reexport-exposed-default-cjs/index.js b/test/cases/scope-hoisting/reexport-exposed-default-cjs/index.js index 80958b55389..1043ef8a55a 100644 --- a/test/cases/scope-hoisting/reexport-exposed-default-cjs/index.js +++ b/test/cases/scope-hoisting/reexport-exposed-default-cjs/index.js @@ -1,5 +1,5 @@ var c = require("./c"); it("should have the correct values", function() { - c.default.should.be.eql("default"); + expect(c.default).toBe("default"); }); diff --git a/test/cases/scope-hoisting/reexport-exposed-harmony/index.js b/test/cases/scope-hoisting/reexport-exposed-harmony/index.js index f9a31c159b4..44e195598fc 100644 --- a/test/cases/scope-hoisting/reexport-exposed-harmony/index.js +++ b/test/cases/scope-hoisting/reexport-exposed-harmony/index.js @@ -1,5 +1,5 @@ var c = require("./c"); it("should have the correct values", function() { - c.named.should.be.eql("named"); + expect(c.named).toBe("named"); }); diff --git a/test/cases/scope-hoisting/renaming-4967/index.js b/test/cases/scope-hoisting/renaming-4967/index.js index 445ebec053e..bcde84c0d6a 100644 --- a/test/cases/scope-hoisting/renaming-4967/index.js +++ b/test/cases/scope-hoisting/renaming-4967/index.js @@ -1,5 +1,5 @@ it("should check existing variables when renaming", function() { - require("./module").d.x().should.be.eql("ok"); - require("./module").c.a().should.be.eql("ok"); - require("./module").test().should.be.eql("ok"); + expect(require("./module").d.x()).toBe("ok"); + expect(require("./module").c.a()).toBe("ok"); + expect(require("./module").test()).toBe("ok"); }); diff --git a/test/cases/scope-hoisting/renaming-shorthand-5027/index.js b/test/cases/scope-hoisting/renaming-shorthand-5027/index.js index 7a7318ea721..5b58a840183 100644 --- a/test/cases/scope-hoisting/renaming-shorthand-5027/index.js +++ b/test/cases/scope-hoisting/renaming-shorthand-5027/index.js @@ -1,7 +1,7 @@ import m from "./module"; it("should apply shorthand properties correctly when renaming", function() { - m.should.be.eql({ + expect(m).toEqual({ obj: { test: "test1", test2: "test2", diff --git a/test/cases/scope-hoisting/require-root-5604/index.js b/test/cases/scope-hoisting/require-root-5604/index.js index 0aeb495bb6d..040925c6bc3 100644 --- a/test/cases/scope-hoisting/require-root-5604/index.js +++ b/test/cases/scope-hoisting/require-root-5604/index.js @@ -2,7 +2,7 @@ import value, { self as moduleSelf } from "./module"; export var self = require("./"); it("should have the correct values", function() { - value.should.be.eql("default"); - moduleSelf.should.be.eql(self); - self.self.should.be.eql(self); + expect(value).toBe("default"); + expect(moduleSelf).toBe(self); + expect(self.self).toBe(self); }); diff --git a/test/cases/scope-hoisting/simple/index.js b/test/cases/scope-hoisting/simple/index.js index b0ca24d53e6..2df9c1a853a 100644 --- a/test/cases/scope-hoisting/simple/index.js +++ b/test/cases/scope-hoisting/simple/index.js @@ -1,6 +1,6 @@ import value, { named } from "./module"; it("should have the correct values", function() { - value.should.be.eql("default"); - named.should.be.eql("named"); + expect(value).toBe("default"); + expect(named).toBe("named"); }); diff --git a/test/cases/wasm/decoding/index.js b/test/cases/wasm/decoding/index.js new file mode 100644 index 00000000000..5951edc435d --- /dev/null +++ b/test/cases/wasm/decoding/index.js @@ -0,0 +1,15 @@ +it("should support wasm compiled from c++", function() { + return import("./memory3.wasm").then(function(wasm) { + expect(wasm._Z3getv()).toBe(0); + wasm._Z3seti(42); + expect(wasm._Z3getv()).toBe(42); + }); +}); + +it("should raw memory export without data", function() { + return import("./memory2.wasm").then(function(wasm) { + expect(wasm.memory).toBeInstanceOf(WebAssembly.Memory); + expect(wasm.memory.buffer).toBeInstanceOf(ArrayBuffer); + expect(wasm.memory.buffer.byteLength).toBe(1 << 16); + }); +}); diff --git a/test/cases/wasm/decoding/memory2.wasm b/test/cases/wasm/decoding/memory2.wasm new file mode 100644 index 00000000000..654daf1d9b0 Binary files /dev/null and b/test/cases/wasm/decoding/memory2.wasm differ diff --git a/test/cases/wasm/decoding/memory3.wasm b/test/cases/wasm/decoding/memory3.wasm new file mode 100644 index 00000000000..0c2ca20c885 Binary files /dev/null and b/test/cases/wasm/decoding/memory3.wasm differ diff --git a/test/cases/wasm/decoding/test.filter.js b/test/cases/wasm/decoding/test.filter.js new file mode 100644 index 00000000000..23177349638 --- /dev/null +++ b/test/cases/wasm/decoding/test.filter.js @@ -0,0 +1,5 @@ +var supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); + +module.exports = function(config) { + return supportsWebAssembly(); +}; diff --git a/test/cases/wasm/export-imported-global/env.js b/test/cases/wasm/export-imported-global/env.js new file mode 100644 index 00000000000..baa33171481 --- /dev/null +++ b/test/cases/wasm/export-imported-global/env.js @@ -0,0 +1,2 @@ +export const n = 1; +export const m = 1.25 diff --git a/test/cases/wasm/export-imported-global/index.js b/test/cases/wasm/export-imported-global/index.js new file mode 100644 index 00000000000..3db7fee9e5d --- /dev/null +++ b/test/cases/wasm/export-imported-global/index.js @@ -0,0 +1,8 @@ +it("should export imported global", function() { + return import("./module").then(function({ v, w, x, test }) { + expect(v).toBe(1); + expect(w).toBe(1); + expect(x).toBe(1.25); + expect(test()).toBe(2); + }); +}); diff --git a/test/cases/wasm/export-imported-global/module.js b/test/cases/wasm/export-imported-global/module.js new file mode 100644 index 00000000000..bd82c8f8b1c --- /dev/null +++ b/test/cases/wasm/export-imported-global/module.js @@ -0,0 +1 @@ +export * from "./module.wat"; diff --git a/test/cases/wasm/export-imported-global/module.wat b/test/cases/wasm/export-imported-global/module.wat new file mode 100644 index 00000000000..c20daa39864 --- /dev/null +++ b/test/cases/wasm/export-imported-global/module.wat @@ -0,0 +1,17 @@ +(module + (import "./env.js" "n" (global i32)) + (import "./env.js" "m" (global $g2 f64)) + (export "v" (global 0)) + (global $g i32 (get_global 0)) + (export "w" (global $g)) + (export "x" (global $g2)) + (func (export "test") (result i32) + get_global $g2 + get_global $g2 + f64.add + drop + get_global 0 + get_global $g + i32.add + ) +) diff --git a/test/cases/wasm/export-imported-global/test.filter.js b/test/cases/wasm/export-imported-global/test.filter.js new file mode 100644 index 00000000000..23177349638 --- /dev/null +++ b/test/cases/wasm/export-imported-global/test.filter.js @@ -0,0 +1,5 @@ +var supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); + +module.exports = function(config) { + return supportsWebAssembly(); +}; diff --git a/test/cases/wasm/global-refs-imported-global/env.js b/test/cases/wasm/global-refs-imported-global/env.js new file mode 100644 index 00000000000..3d521168145 --- /dev/null +++ b/test/cases/wasm/global-refs-imported-global/env.js @@ -0,0 +1 @@ +export const n = 33; diff --git a/test/cases/wasm/global-refs-imported-global/index.js b/test/cases/wasm/global-refs-imported-global/index.js new file mode 100644 index 00000000000..3cb8ff40e28 --- /dev/null +++ b/test/cases/wasm/global-refs-imported-global/index.js @@ -0,0 +1,5 @@ +it("should allow global with imported global as initilizer", function() { + return import("./module.wat").then(function({get}) { + expect(get()).toEqual(33); + }); +}); diff --git a/test/cases/wasm/global-refs-imported-global/module.wat b/test/cases/wasm/global-refs-imported-global/module.wat new file mode 100644 index 00000000000..eb1ea8c6f6a --- /dev/null +++ b/test/cases/wasm/global-refs-imported-global/module.wat @@ -0,0 +1,9 @@ +(module + (import "./env.js" "n" (global i32)) + (global i32 (get_global 0)) + + (func (export "get") (result i32) + (get_global 1) + ) +) + diff --git a/test/cases/wasm/global-refs-imported-global/test.filter.js b/test/cases/wasm/global-refs-imported-global/test.filter.js new file mode 100644 index 00000000000..23177349638 --- /dev/null +++ b/test/cases/wasm/global-refs-imported-global/test.filter.js @@ -0,0 +1,5 @@ +var supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); + +module.exports = function(config) { + return supportsWebAssembly(); +}; diff --git a/test/cases/wasm/import-wasm-wasm/index.js b/test/cases/wasm/import-wasm-wasm/index.js index bdc8813c34c..39971c03010 100644 --- a/test/cases/wasm/import-wasm-wasm/index.js +++ b/test/cases/wasm/import-wasm-wasm/index.js @@ -1,6 +1,6 @@ it("should allow to run a WebAssembly module with imports", function() { - return import("./wasm.wasm").then(function(wasm) { + return import("./wasm.wat").then(function(wasm) { const result = wasm.addNumber(20); - result.should.be.eql(42); + expect(result).toEqual(42); }); }); diff --git a/test/cases/wasm/import-wasm-wasm/wasm.wasm b/test/cases/wasm/import-wasm-wasm/wasm.wasm deleted file mode 100644 index a05b904f6fe..00000000000 Binary files a/test/cases/wasm/import-wasm-wasm/wasm.wasm and /dev/null differ diff --git a/test/cases/wasm/import-wasm-wasm/wasm.wat b/test/cases/wasm/import-wasm-wasm/wasm.wat new file mode 100644 index 00000000000..3c9f7ca0f83 --- /dev/null +++ b/test/cases/wasm/import-wasm-wasm/wasm.wat @@ -0,0 +1,9 @@ +(module + (type $t0 (func (result i32))) + (type $t1 (func (param i32) (result i32))) + (import "./wasm2.wat" "getNumber" (func $./wasm2.wasm.getNumber (type $t0))) + (func $addNumber (export "addNumber") (type $t1) (param $p0 i32) (result i32) + (i32.add + (get_local $p0) + (call $./wasm2.wasm.getNumber)))) + diff --git a/test/cases/wasm/import-wasm-wasm/wasm2.wasm b/test/cases/wasm/import-wasm-wasm/wasm2.wasm deleted file mode 100644 index 067de62c2d0..00000000000 Binary files a/test/cases/wasm/import-wasm-wasm/wasm2.wasm and /dev/null differ diff --git a/test/cases/wasm/import-wasm-wasm/wasm2.wat b/test/cases/wasm/import-wasm-wasm/wasm2.wat new file mode 100644 index 00000000000..0331fb4fc15 --- /dev/null +++ b/test/cases/wasm/import-wasm-wasm/wasm2.wat @@ -0,0 +1,5 @@ +(module + (type $t0 (func (result i32))) + (func $getNumber (export "getNumber") (type $t0) (result i32) + (i32.const 22))) + diff --git a/test/cases/wasm/imported-global-preserve-ordering/env.js b/test/cases/wasm/imported-global-preserve-ordering/env.js new file mode 100644 index 00000000000..72ab60e17a2 --- /dev/null +++ b/test/cases/wasm/imported-global-preserve-ordering/env.js @@ -0,0 +1,2 @@ +export const a = 1; +export const b = 2; diff --git a/test/cases/wasm/imported-global-preserve-ordering/index.js b/test/cases/wasm/imported-global-preserve-ordering/index.js new file mode 100644 index 00000000000..eb6ea96f345 --- /dev/null +++ b/test/cases/wasm/imported-global-preserve-ordering/index.js @@ -0,0 +1,6 @@ +it("should preserve the ordering of globals", function() { + return import("./module.wat").then(function(e) { + expect(e.c).toBe(3); + expect(e.d).toBe(4); + }); +}); diff --git a/test/cases/wasm/imported-global-preserve-ordering/module.wat b/test/cases/wasm/imported-global-preserve-ordering/module.wat new file mode 100644 index 00000000000..091f353ce33 --- /dev/null +++ b/test/cases/wasm/imported-global-preserve-ordering/module.wat @@ -0,0 +1,10 @@ +(module + (import "./env.js" "a" (global i32)) + (import "./env.js" "b" (global i32)) + + (global $c i32 (i32.const 3)) + (global $d i32 (i32.const 4)) + + (export "c" (global $c)) + (export "d" (global $d)) +) diff --git a/test/cases/wasm/imported-global-preserve-ordering/test.filter.js b/test/cases/wasm/imported-global-preserve-ordering/test.filter.js new file mode 100644 index 00000000000..23177349638 --- /dev/null +++ b/test/cases/wasm/imported-global-preserve-ordering/test.filter.js @@ -0,0 +1,5 @@ +var supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); + +module.exports = function(config) { + return supportsWebAssembly(); +}; diff --git a/test/cases/wasm/imported-global-preserve-type/env.js b/test/cases/wasm/imported-global-preserve-type/env.js new file mode 100644 index 00000000000..af1a64d99f5 --- /dev/null +++ b/test/cases/wasm/imported-global-preserve-type/env.js @@ -0,0 +1 @@ +export const number = 0xFFFFFFFFFF; diff --git a/test/cases/wasm/imported-global-preserve-type/index.js b/test/cases/wasm/imported-global-preserve-type/index.js new file mode 100644 index 00000000000..0b146de6671 --- /dev/null +++ b/test/cases/wasm/imported-global-preserve-type/index.js @@ -0,0 +1,5 @@ +it("should preserve the valtype of the imported global", function() { + return import("./module.wat").then(function({get}) { + expect(get()).toBe(0xFFFFFFFFFF); + }); +}); diff --git a/test/cases/wasm/imported-global-preserve-type/module.wat b/test/cases/wasm/imported-global-preserve-type/module.wat new file mode 100644 index 00000000000..e8a590fe6ac --- /dev/null +++ b/test/cases/wasm/imported-global-preserve-type/module.wat @@ -0,0 +1,7 @@ +(module + (import "./env.js" "number" (global f64)) + + (func (export "get") (result f64) + (get_global 0) + ) +) diff --git a/test/cases/wasm/imported-global-preserve-type/test.filter.js b/test/cases/wasm/imported-global-preserve-type/test.filter.js new file mode 100644 index 00000000000..23177349638 --- /dev/null +++ b/test/cases/wasm/imported-global-preserve-type/test.filter.js @@ -0,0 +1,5 @@ +var supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); + +module.exports = function(config) { + return supportsWebAssembly(); +}; diff --git a/test/cases/wasm/imports-circular/index.js b/test/cases/wasm/imports-circular/index.js index c76871b0009..288ab421310 100644 --- a/test/cases/wasm/imports-circular/index.js +++ b/test/cases/wasm/imports-circular/index.js @@ -1,5 +1,5 @@ it("should allow to run a WebAssembly module importing JS circular", function() { return import("./module").then(function(mod) { - mod.result.should.be.eql(42); + expect(mod.result).toBe(42); }); }); diff --git a/test/cases/wasm/imports-circular/module.js b/test/cases/wasm/imports-circular/module.js index fa8daba1094..eeede2a5a03 100644 --- a/test/cases/wasm/imports-circular/module.js +++ b/test/cases/wasm/imports-circular/module.js @@ -1,4 +1,4 @@ -import { addNumber } from "./wasm.wasm"; +import { addNumber } from "./wasm.wat"; export var result = addNumber(22); diff --git a/test/cases/wasm/imports-circular/wasm.wasm b/test/cases/wasm/imports-circular/wasm.wasm deleted file mode 100644 index f5a703f15e1..00000000000 Binary files a/test/cases/wasm/imports-circular/wasm.wasm and /dev/null differ diff --git a/test/cases/wasm/imports-circular/wasm.wat b/test/cases/wasm/imports-circular/wasm.wat new file mode 100644 index 00000000000..2cf1e2f1c61 --- /dev/null +++ b/test/cases/wasm/imports-circular/wasm.wat @@ -0,0 +1,9 @@ +(module + (type $t0 (func (result i32))) + (type $t1 (func (param i32) (result i32))) + (import "./module" "getNumber" (func $./module.getNumber (type $t0))) + (func $addNumber (export "addNumber") (type $t1) (param $p0 i32) (result i32) + (i32.add + (get_local $p0) + (call $./module.getNumber)))) + diff --git a/test/cases/wasm/imports-complex-types/index.js b/test/cases/wasm/imports-complex-types/index.js new file mode 100644 index 00000000000..c2e0b23fead --- /dev/null +++ b/test/cases/wasm/imports-complex-types/index.js @@ -0,0 +1,6 @@ +it("should allow to run a WebAssembly module with non-js-compatible imports", function() { + return import("./wasm.wasm").then(function(wasm) { + const result = wasm.testI64(); + expect(result).toEqual(42); + }); +}); diff --git a/test/cases/wasm/imports-complex-types/other.wasm b/test/cases/wasm/imports-complex-types/other.wasm new file mode 100644 index 00000000000..70c5aee0fa3 Binary files /dev/null and b/test/cases/wasm/imports-complex-types/other.wasm differ diff --git a/test/cases/wasm/imports-complex-types/test.filter.js b/test/cases/wasm/imports-complex-types/test.filter.js new file mode 100644 index 00000000000..23177349638 --- /dev/null +++ b/test/cases/wasm/imports-complex-types/test.filter.js @@ -0,0 +1,5 @@ +var supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); + +module.exports = function(config) { + return supportsWebAssembly(); +}; diff --git a/test/cases/wasm/imports-complex-types/wasm.wasm b/test/cases/wasm/imports-complex-types/wasm.wasm new file mode 100644 index 00000000000..8374df1439f Binary files /dev/null and b/test/cases/wasm/imports-complex-types/wasm.wasm differ diff --git a/test/cases/wasm/imports-many-direct/index.js b/test/cases/wasm/imports-many-direct/index.js new file mode 100644 index 00000000000..b203bb26563 --- /dev/null +++ b/test/cases/wasm/imports-many-direct/index.js @@ -0,0 +1,6 @@ +it("should allow to run a WebAssembly module with many direct wasm dependencies", function() { + return import("./wasm.wat").then(function(wasm) { + const result = wasm.testI64(); + expect(result).toEqual(42); + }); +}); diff --git a/test/cases/wasm/imports-many-direct/other1.wat b/test/cases/wasm/imports-many-direct/other1.wat new file mode 100644 index 00000000000..34e5244de57 --- /dev/null +++ b/test/cases/wasm/imports-many-direct/other1.wat @@ -0,0 +1,7 @@ +(module + (type $t0 (func (param i64) (result i64))) + (func $getI64 (type $t0) (param $p0 i64) (result i64) + get_local $p0 + i64.const 20 + i64.add) + (export "getI64" (func $getI64))) diff --git a/test/cases/wasm/imports-many-direct/other2.wat b/test/cases/wasm/imports-many-direct/other2.wat new file mode 100644 index 00000000000..cffc26b9a1f --- /dev/null +++ b/test/cases/wasm/imports-many-direct/other2.wat @@ -0,0 +1,7 @@ +(module + (type $t0 (func (param i64) (result i64))) + (func $getI64 (type $t0) (param $p0 i64) (result i64) + get_local $p0 + i64.const 22 + i64.add) + (export "getI64" (func $getI64))) diff --git a/test/cases/wasm/imports-many-direct/test.filter.js b/test/cases/wasm/imports-many-direct/test.filter.js new file mode 100644 index 00000000000..23177349638 --- /dev/null +++ b/test/cases/wasm/imports-many-direct/test.filter.js @@ -0,0 +1,5 @@ +var supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); + +module.exports = function(config) { + return supportsWebAssembly(); +}; diff --git a/test/cases/wasm/imports-many-direct/wasm.wat b/test/cases/wasm/imports-many-direct/wasm.wat new file mode 100644 index 00000000000..8657746e381 --- /dev/null +++ b/test/cases/wasm/imports-many-direct/wasm.wat @@ -0,0 +1,13 @@ +(module + (type $t0 (func (param i64) (result i64))) + (type $t1 (func (result i32))) + (import "./other1.wat" "getI64" (func $getI641 (type $t0))) + (import "./other2.wat" "getI64" (func $getI642 (type $t0))) + (func $testI64 (type $t1) (result i32) + i64.const 1152921504606846976 + call $getI641 + call $getI642 + i64.const 1152921504606846976 + i64.sub + i32.wrap/i64) + (export "testI64" (func $testI64))) diff --git a/test/cases/wasm/imports-multiple/index.js b/test/cases/wasm/imports-multiple/index.js new file mode 100644 index 00000000000..d33df356e44 --- /dev/null +++ b/test/cases/wasm/imports-multiple/index.js @@ -0,0 +1,5 @@ +it("should allow to run a WebAssembly module importing from multiple modules", function() { + return import("./module").then(function(mod) { + expect(mod.result).toBe(42); + }); +}); diff --git a/test/cases/wasm/imports-multiple/module.js b/test/cases/wasm/imports-multiple/module.js new file mode 100644 index 00000000000..deccad21fe4 --- /dev/null +++ b/test/cases/wasm/imports-multiple/module.js @@ -0,0 +1,7 @@ +import { getResult } from "./wasm.wasm"; + +export var result = getResult(1); + +export function getNumber() { + return 20; +} diff --git a/test/cases/wasm/imports-multiple/module2.js b/test/cases/wasm/imports-multiple/module2.js new file mode 100644 index 00000000000..60b7eac0eab --- /dev/null +++ b/test/cases/wasm/imports-multiple/module2.js @@ -0,0 +1,5 @@ +import { getNumber as getN } from "./wasm.wasm"; + +export function getNumber() { + return getN(); +} diff --git a/test/cases/wasm/imports-multiple/test.filter.js b/test/cases/wasm/imports-multiple/test.filter.js new file mode 100644 index 00000000000..23177349638 --- /dev/null +++ b/test/cases/wasm/imports-multiple/test.filter.js @@ -0,0 +1,5 @@ +var supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); + +module.exports = function(config) { + return supportsWebAssembly(); +}; diff --git a/test/cases/wasm/imports-multiple/wasm.wasm b/test/cases/wasm/imports-multiple/wasm.wasm new file mode 100644 index 00000000000..19fef4041f6 Binary files /dev/null and b/test/cases/wasm/imports-multiple/wasm.wasm differ diff --git a/test/cases/wasm/imports/index.js b/test/cases/wasm/imports/index.js index d562c4a28cf..d674c659db2 100644 --- a/test/cases/wasm/imports/index.js +++ b/test/cases/wasm/imports/index.js @@ -1,6 +1,6 @@ it("should allow to run a WebAssembly module with imports", function() { - return import("./wasm.wasm?1").then(function(wasm) { + return import("./wasm.wat?1").then(function(wasm) { const result = wasm.addNumber(3); - result.should.be.eql(11); + expect(result).toEqual(11); }); }); diff --git a/test/cases/wasm/imports/wasm.wasm b/test/cases/wasm/imports/wasm.wasm deleted file mode 100644 index f5a703f15e1..00000000000 Binary files a/test/cases/wasm/imports/wasm.wasm and /dev/null differ diff --git a/test/cases/wasm/imports/wasm.wat b/test/cases/wasm/imports/wasm.wat new file mode 100644 index 00000000000..2cf1e2f1c61 --- /dev/null +++ b/test/cases/wasm/imports/wasm.wat @@ -0,0 +1,9 @@ +(module + (type $t0 (func (result i32))) + (type $t1 (func (param i32) (result i32))) + (import "./module" "getNumber" (func $./module.getNumber (type $t0))) + (func $addNumber (export "addNumber") (type $t1) (param $p0 i32) (result i32) + (i32.add + (get_local $p0) + (call $./module.getNumber)))) + diff --git a/test/cases/wasm/js-incompatible-type/env.js b/test/cases/wasm/js-incompatible-type/env.js new file mode 100644 index 00000000000..39a36559da0 --- /dev/null +++ b/test/cases/wasm/js-incompatible-type/env.js @@ -0,0 +1 @@ +export const n = 1; diff --git a/test/cases/wasm/js-incompatible-type/errors.js b/test/cases/wasm/js-incompatible-type/errors.js new file mode 100644 index 00000000000..e06824329ce --- /dev/null +++ b/test/cases/wasm/js-incompatible-type/errors.js @@ -0,0 +1,17 @@ +module.exports = [ + [ + /export-i64-param\.wat/, + /Export "a" with i64 as parameter can only be used for direct wasm to wasm dependencies/, + /export-i64-param\.js/ + ], + [ + /export-i64-result\.wat/, + /Export "a" with i64 as result can only be used for direct wasm to wasm dependencies/, + /export-i64-result\.js/ + ], + [ + /import-i64\.wat/, + /Import "n" from "\.\/env.js" with Non-JS-compatible Global Type \(i64\) can only be used for direct wasm to wasm dependencies/, + /index\.js/ + ] +] diff --git a/test/cases/wasm/js-incompatible-type/export-i64-param.js b/test/cases/wasm/js-incompatible-type/export-i64-param.js new file mode 100644 index 00000000000..db1be78bea6 --- /dev/null +++ b/test/cases/wasm/js-incompatible-type/export-i64-param.js @@ -0,0 +1 @@ +export { a } from "./export-i64-param.wat"; diff --git a/test/cases/wasm/js-incompatible-type/export-i64-param.wat b/test/cases/wasm/js-incompatible-type/export-i64-param.wat new file mode 100644 index 00000000000..f22fc6f5793 --- /dev/null +++ b/test/cases/wasm/js-incompatible-type/export-i64-param.wat @@ -0,0 +1,3 @@ +(module + (func (export "a") (param i64) (nop)) +) diff --git a/test/cases/wasm/js-incompatible-type/export-i64-result.js b/test/cases/wasm/js-incompatible-type/export-i64-result.js new file mode 100644 index 00000000000..96a1241ee02 --- /dev/null +++ b/test/cases/wasm/js-incompatible-type/export-i64-result.js @@ -0,0 +1 @@ +export { a } from "./export-i64-result.wat"; diff --git a/test/cases/wasm/js-incompatible-type/export-i64-result.wat b/test/cases/wasm/js-incompatible-type/export-i64-result.wat new file mode 100644 index 00000000000..1aada93dbd6 --- /dev/null +++ b/test/cases/wasm/js-incompatible-type/export-i64-result.wat @@ -0,0 +1,5 @@ +(module + (func (export "a") (result i64) + (i64.const 1) + ) +) diff --git a/test/cases/wasm/js-incompatible-type/import-i64.wat b/test/cases/wasm/js-incompatible-type/import-i64.wat new file mode 100644 index 00000000000..5be32abf044 --- /dev/null +++ b/test/cases/wasm/js-incompatible-type/import-i64.wat @@ -0,0 +1,3 @@ +(module + (import "./env.js" "n" (global i64)) +) diff --git a/test/cases/wasm/js-incompatible-type/index.js b/test/cases/wasm/js-incompatible-type/index.js new file mode 100644 index 00000000000..f5258dc4277 --- /dev/null +++ b/test/cases/wasm/js-incompatible-type/index.js @@ -0,0 +1,17 @@ +const errorRegex = /wasm function signature contains illegal type|invalid type/; + +it("should disallow exporting a func signature with result i64", function() { + return import("./export-i64-result").then(({a}) => { + expect(() => a()).toThrow(errorRegex); + }); +}); + +it("should disallow exporting a func signature with param i64", function() { + return import("./export-i64-param").then(({a}) => { + expect(() => a()).toThrow(errorRegex); + }); +}); + +it("should disallow importing a value type of i64", function() { + return expect(import("./import-i64.wat")).rejects.toThrow(errorRegex); +}); diff --git a/test/cases/wasm/js-incompatible-type/test.filter.js b/test/cases/wasm/js-incompatible-type/test.filter.js new file mode 100644 index 00000000000..bd31021b996 --- /dev/null +++ b/test/cases/wasm/js-incompatible-type/test.filter.js @@ -0,0 +1,5 @@ +var supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); + +module.exports = function(config) { + return supportsWebAssembly() && config.mode === "production"; +}; diff --git a/test/cases/wasm/memory/index.js b/test/cases/wasm/memory/index.js new file mode 100644 index 00000000000..7b3387ebe2a --- /dev/null +++ b/test/cases/wasm/memory/index.js @@ -0,0 +1,8 @@ +it("should allow direct memory connection between wasm modules", function() { + return import("./run").then(function(module) { + expect(module.x1).toBe(42); + expect(module.x2).toBe(42); + expect(module.y1).toBe(11); + expect(module.y2).toBe(11); + }); +}); diff --git a/test/cases/wasm/memory/mem-access.wat b/test/cases/wasm/memory/mem-access.wat new file mode 100644 index 00000000000..50870824331 --- /dev/null +++ b/test/cases/wasm/memory/mem-access.wat @@ -0,0 +1,11 @@ +(module + (type $t0 (func (result i32))) + (type $t1 (func (param i32))) + (import "./memory.wat" "memory" (memory $./memory.wasm.memory 1)) + (func $get (export "get") (type $t0) (result i32) + (i32.load + (i32.const 0))) + (func $set (export "set") (type $t1) (param $p i32) + (i32.store + (i32.const 0) + (get_local $p)))) diff --git a/test/cases/wasm/memory/memory.wat b/test/cases/wasm/memory/memory.wat new file mode 100644 index 00000000000..c9c59eb1589 --- /dev/null +++ b/test/cases/wasm/memory/memory.wat @@ -0,0 +1,4 @@ +(module + (memory $memory (export "memory") 1) + (data (i32.const 12) "\00\00\00\00")) + diff --git a/test/cases/wasm/memory/run.js b/test/cases/wasm/memory/run.js new file mode 100644 index 00000000000..f4950c81303 --- /dev/null +++ b/test/cases/wasm/memory/run.js @@ -0,0 +1,9 @@ +import * as a1 from "./mem-access.wat?1"; +import * as a2 from "./mem-access.wat?2"; + +a1.set(42); +export const x1 = a1.get(); +export const x2 = a2.get(); +a2.set(11); +export const y1 = a1.get(); +export const y2 = a2.get(); diff --git a/test/cases/wasm/memory/test.filter.js b/test/cases/wasm/memory/test.filter.js new file mode 100644 index 00000000000..23177349638 --- /dev/null +++ b/test/cases/wasm/memory/test.filter.js @@ -0,0 +1,5 @@ +var supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); + +module.exports = function(config) { + return supportsWebAssembly(); +}; diff --git a/test/cases/wasm/order/a.js b/test/cases/wasm/order/a.js index 5c381c7f6a1..a77ec86343f 100644 --- a/test/cases/wasm/order/a.js +++ b/test/cases/wasm/order/a.js @@ -1,6 +1,6 @@ import { trackA, results } from "./tracker"; import "./b.js"; -import "./wasm.wasm"; +import "./wasm.wat"; trackA(); diff --git a/test/cases/wasm/order/index.js b/test/cases/wasm/order/index.js index 9fb91d7e67a..f272a900234 100644 --- a/test/cases/wasm/order/index.js +++ b/test/cases/wasm/order/index.js @@ -1,7 +1,7 @@ it("should be evaluated in the correct order", () => { return import("./a").then(({ default: results }) => { return Promise.resolve().then(() => { // wait an extra tick to get the tick from the tracker - results.should.be.eql(["b", "c", "wasm42", "a", "tick"]); + expect(results).toEqual(["b", "c", "wasm42", "a", "tick"]); }); }); }); diff --git a/test/cases/wasm/order/wasm.wasm b/test/cases/wasm/order/wasm.wasm deleted file mode 100644 index 105c6a1a97f..00000000000 Binary files a/test/cases/wasm/order/wasm.wasm and /dev/null differ diff --git a/test/cases/wasm/simple/index.js b/test/cases/wasm/simple/index.js index ab607d81bc5..b4dcd1014ed 100644 --- a/test/cases/wasm/simple/index.js +++ b/test/cases/wasm/simple/index.js @@ -1,13 +1,13 @@ it("should allow to run a WebAssembly module (indirect)", function() { return import("./module").then(function(module) { const result = module.run(); - result.should.be.eql(42); + expect(result).toEqual(42); }); }); it("should allow to run a WebAssembly module (direct)", function() { - return import("./wasm.wasm?2").then(function(wasm) { + return import("./wasm.wat?2").then(function(wasm) { const result = wasm.add(wasm.getNumber(), 2); - result.should.be.eql(42); + expect(result).toEqual(42); }); }); diff --git a/test/cases/wasm/simple/module.js b/test/cases/wasm/simple/module.js index aeeab03082b..75232dccede 100644 --- a/test/cases/wasm/simple/module.js +++ b/test/cases/wasm/simple/module.js @@ -1,4 +1,4 @@ -import { add, getNumber } from "./wasm.wasm?1"; +import { add, getNumber } from "./wasm.wat?1"; export function run() { return add(getNumber(), 2); diff --git a/test/cases/wasm/simple/wasm.wasm b/test/cases/wasm/simple/wasm.wasm deleted file mode 100644 index 5364a02e784..00000000000 Binary files a/test/cases/wasm/simple/wasm.wasm and /dev/null differ diff --git a/test/cases/wasm/simple/wasm.wat b/test/cases/wasm/simple/wasm.wat new file mode 100644 index 00000000000..477902e7f3c --- /dev/null +++ b/test/cases/wasm/simple/wasm.wat @@ -0,0 +1,10 @@ +(module + (type $t0 (func (param i32 i32) (result i32))) + (type $t1 (func (result i32))) + (func $add (export "add") (type $t0) (param $p0 i32) (param $p1 i32) (result i32) + (i32.add + (get_local $p0) + (get_local $p1))) + (func $getNumber (export "getNumber") (type $t1) (result i32) + (i32.const 40))) + diff --git a/test/cases/wasm/table/index.js b/test/cases/wasm/table/index.js new file mode 100644 index 00000000000..4d3d85a3b5b --- /dev/null +++ b/test/cases/wasm/table/index.js @@ -0,0 +1,31 @@ +// the message is inconsistency between some nodejs versions +const UNKNOWN_FUNCTION_TABLE = /invalid index into function table|invalid function/; + +it("should support tables", function() { + return import("./wasm-table.wat").then(function(wasm) { + expect(wasm.callByIndex(0)).toEqual(42); + expect(wasm.callByIndex(1)).toEqual(13); + expect(() => wasm.callByIndex(2)).toThrow(UNKNOWN_FUNCTION_TABLE); + }); +}); + +it("should support exported tables", function() { + return import("./wasm-table-export.wat").then(function(wasm) { + expect(wasm.table).toBeInstanceOf(WebAssembly.Table); + expect(wasm.table.length).toBe(2); + const e0 = wasm.table.get(0); + const e1 = wasm.table.get(1); + expect(e0).toBeInstanceOf(Function); + expect(e1).toBeInstanceOf(Function); + expect(e0()).toEqual(42); + expect(e1()).toEqual(13); + }); +}); + +it("should support imported tables", function() { + return import("./wasm-table-imported.wat").then(function(wasm) { + expect(wasm.callByIndex(0)).toEqual(42); + expect(wasm.callByIndex(1)).toEqual(13); + expect(() => wasm.callByIndex(2)).toThrow(UNKNOWN_FUNCTION_TABLE); + }); +}); diff --git a/test/cases/wasm/table/test.filter.js b/test/cases/wasm/table/test.filter.js new file mode 100644 index 00000000000..23177349638 --- /dev/null +++ b/test/cases/wasm/table/test.filter.js @@ -0,0 +1,5 @@ +var supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); + +module.exports = function(config) { + return supportsWebAssembly(); +}; diff --git a/test/cases/wasm/table/wasm-table-export.wat b/test/cases/wasm/table/wasm-table-export.wat new file mode 100644 index 00000000000..1771a2b546f --- /dev/null +++ b/test/cases/wasm/table/wasm-table-export.wat @@ -0,0 +1,9 @@ +(module + (type $t0 (func (result i32))) + (func $f1 (type $t0) (result i32) + (i32.const 42)) + (func $f2 (type $t0) (result i32) + (i32.const 13)) + (table $table (export "table") 2 anyfunc) + (elem (i32.const 0) $f1 $f2)) + diff --git a/test/cases/wasm/table/wasm-table-imported.wat b/test/cases/wasm/table/wasm-table-imported.wat new file mode 100644 index 00000000000..1ccabddd132 --- /dev/null +++ b/test/cases/wasm/table/wasm-table-imported.wat @@ -0,0 +1,8 @@ +(module + (type $t0 (func (result i32))) + (type $t1 (func (param i32) (result i32))) + (import "./wasm-table-export.wat" "table" (table $./wasm-table-export.wasm.table 2 anyfunc)) + (func $callByIndex (export "callByIndex") (type $t1) (param $i i32) (result i32) + (call_indirect (type $t0) + (get_local $i)))) + diff --git a/test/cases/wasm/table/wasm-table.wat b/test/cases/wasm/table/wasm-table.wat new file mode 100644 index 00000000000..6ddcde499a9 --- /dev/null +++ b/test/cases/wasm/table/wasm-table.wat @@ -0,0 +1,14 @@ +(module + (type $t0 (func (result i32))) + (type $t1 (func (result i32))) + (type $t2 (func (param i32) (result i32))) + (func $f0 (type $t0) (result i32) + (i32.const 42)) + (func $f1 (type $t0) (result i32) + (i32.const 13)) + (func $callByIndex (export "callByIndex") (type $t2) (param $p0 i32) (result i32) + (call_indirect (type $t1) + (get_local $p0))) + (table $T0 2 anyfunc) + (elem (i32.const 0) $f0 $f1)) + diff --git a/test/cases/wasm/two-files-loader/index.js b/test/cases/wasm/two-files-loader/index.js new file mode 100644 index 00000000000..36682a4ad1d --- /dev/null +++ b/test/cases/wasm/two-files-loader/index.js @@ -0,0 +1,11 @@ +it("should be able to create two modules from loader", function() { + return import("./wrapper-loader!./src/wasm.dat").then(function(wasm) { + expect(wasm.getString()).toEqual("Hello World"); + }); +}); + +it("should be able to create two modules from loader with remaining request", function() { + return import("./wrapper-loader2!./src/wasm.dat?2").then(function(wasm) { + expect(wasm.getString()).toEqual("Hello World"); + }); +}); diff --git a/test/cases/wasm/two-files-loader/src/wasm.dat b/test/cases/wasm/two-files-loader/src/wasm.dat new file mode 100644 index 00000000000..50335ed4944 --- /dev/null +++ b/test/cases/wasm/two-files-loader/src/wasm.dat @@ -0,0 +1,8 @@ +(module + (memory (export "memory") 1) + (data (i32.const 16) "Hello World\00") + (func (export "getString") (result i32) + (i32.const 16) + ) +) + diff --git a/test/cases/wasm/two-files-loader/test.filter.js b/test/cases/wasm/two-files-loader/test.filter.js new file mode 100644 index 00000000000..23177349638 --- /dev/null +++ b/test/cases/wasm/two-files-loader/test.filter.js @@ -0,0 +1,5 @@ +var supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); + +module.exports = function(config) { + return supportsWebAssembly(); +}; diff --git a/test/cases/wasm/two-files-loader/wrapper-loader.js b/test/cases/wasm/two-files-loader/wrapper-loader.js new file mode 100644 index 00000000000..544fc1a789c --- /dev/null +++ b/test/cases/wasm/two-files-loader/wrapper-loader.js @@ -0,0 +1,17 @@ +const stringifyRequest = require("loader-utils").stringifyRequest; + +module.exports.pitch = function(remainingRequest) { + return ` + import { getString as _getString, memory } from ${stringifyRequest(this, + `${this.resourcePath}.wat!=!${remainingRequest}` + )}; + + export function getString() { + const strBuf = new Uint8Array(memory.buffer, _getString()); + const idx = strBuf.indexOf(0); + const strBuf2 = strBuf.slice(0, idx); + const str = Buffer.from(strBuf2).toString("utf-8"); + return str; + }; + `; +}; diff --git a/test/cases/wasm/two-files-loader/wrapper-loader2.js b/test/cases/wasm/two-files-loader/wrapper-loader2.js new file mode 100644 index 00000000000..6cd67a7258f --- /dev/null +++ b/test/cases/wasm/two-files-loader/wrapper-loader2.js @@ -0,0 +1,18 @@ +const stringifyRequest = require("loader-utils").stringifyRequest; + +module.exports.pitch = function(remainingRequest) { + return ` + import { getString as _getString, memory } from ${stringifyRequest( + this, + `${this.resourcePath}.wasm!=!wast-loader!${remainingRequest}` + )}; + + export function getString() { + const strBuf = new Uint8Array(memory.buffer, _getString()); + const idx = strBuf.indexOf(0); + const strBuf2 = strBuf.slice(0, idx); + const str = Buffer.from(strBuf2).toString("utf-8"); + return str; + }; + `; +}; diff --git a/test/cases/wasm/unused-export/index.js b/test/cases/wasm/unused-export/index.js new file mode 100644 index 00000000000..6def057c2cd --- /dev/null +++ b/test/cases/wasm/unused-export/index.js @@ -0,0 +1,6 @@ +it("should allow wasm with unused exports", function() { + return import("./module").then(function(module) { + const result = module.run(); + expect(result).toEqual(42); + }); +}); diff --git a/test/cases/wasm/unused-export/module.js b/test/cases/wasm/unused-export/module.js new file mode 100644 index 00000000000..cad01039e37 --- /dev/null +++ b/test/cases/wasm/unused-export/module.js @@ -0,0 +1,5 @@ +import { getNumber } from "./wasm.wat"; + +export function run() { + return getNumber(); +} diff --git a/test/cases/wasm/unused-export/test.filter.js b/test/cases/wasm/unused-export/test.filter.js new file mode 100644 index 00000000000..23177349638 --- /dev/null +++ b/test/cases/wasm/unused-export/test.filter.js @@ -0,0 +1,5 @@ +var supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); + +module.exports = function(config) { + return supportsWebAssembly(); +}; diff --git a/test/cases/wasm/unused-export/wasm.wat b/test/cases/wasm/unused-export/wasm.wat new file mode 100644 index 00000000000..3a135271020 --- /dev/null +++ b/test/cases/wasm/unused-export/wasm.wat @@ -0,0 +1,10 @@ +(module + (type $t0 (func (param i32 i32) (result i32))) + (type $t1 (func (result i32))) + (func $add (export "add") (type $t0) (param $p0 i32) (param $p1 i32) (result i32) + (i32.add + (get_local $p0) + (get_local $p1))) + (func $getNumber (export "getNumber") (type $t1) (result i32) + (i32.const 42))) + diff --git a/test/cases/wasm/wasm-explorer-examples-async/Q_rsqrt.wasm b/test/cases/wasm/wasm-explorer-examples-async/Q_rsqrt.wasm new file mode 100644 index 00000000000..e5c17c16d93 Binary files /dev/null and b/test/cases/wasm/wasm-explorer-examples-async/Q_rsqrt.wasm differ diff --git a/test/cases/wasm/wasm-explorer-examples-async/duff.wasm b/test/cases/wasm/wasm-explorer-examples-async/duff.wasm new file mode 100644 index 00000000000..0b75ea455a8 Binary files /dev/null and b/test/cases/wasm/wasm-explorer-examples-async/duff.wasm differ diff --git a/test/cases/wasm/wasm-explorer-examples-async/fact.wasm b/test/cases/wasm/wasm-explorer-examples-async/fact.wasm new file mode 100644 index 00000000000..50ce8c098a4 Binary files /dev/null and b/test/cases/wasm/wasm-explorer-examples-async/fact.wasm differ diff --git a/test/cases/wasm/wasm-explorer-examples-async/fast-math.wasm b/test/cases/wasm/wasm-explorer-examples-async/fast-math.wasm new file mode 100644 index 00000000000..1733deb9ba7 Binary files /dev/null and b/test/cases/wasm/wasm-explorer-examples-async/fast-math.wasm differ diff --git a/test/cases/wasm/wasm-explorer-examples-async/index.js b/test/cases/wasm/wasm-explorer-examples-async/index.js new file mode 100644 index 00000000000..d2eed3af85e --- /dev/null +++ b/test/cases/wasm/wasm-explorer-examples-async/index.js @@ -0,0 +1,55 @@ +it("Q_rsqrt should work", function() { + return import("./Q_rsqrt.wasm").then(function(wasm) { + const result = wasm._Z7Q_rsqrtf(1/1764); + expect(result).toBeGreaterThan(41.9); + expect(result).toBeLessThan(42.1); + }); +}); + +it("testFunction should work", function() { + return import("./testFunction.wasm").then(function(wasm) { + const view = new Int32Array(wasm.memory.buffer); + view[0] = 123; + view[1] = 1; + view[2] = 2; + view[3] = 3; + const result = wasm._Z12testFunctionPii(4, 3); + expect(result).toEqual(6); + }); +}); + +it("fact should work", function() { + return import("./fact.wasm").then(function(wasm) { + const result = wasm._Z4facti(11); + expect(result).toEqual(39916800); + }); +}); + +it("popcnt should work", function() { + return import("./popcnt.wasm").then(function(wasm) { + expect(wasm.main(0xF0F)).toEqual(16); + expect(wasm._Z5countj(0xF0F)).toEqual(8); + }); +}); + +it("fast-math should work", function() { + return import("./fast-math.wasm").then(function(wasm) { + expect(wasm._Z3food(42)).toEqual(14); + expect(wasm._Z9maybe_mindd(42, 24)).toEqual(24); + expect(wasm._Z8call_powd(42)).toEqual(9682651996416); + expect(wasm._Z6do_powd(42)).toEqual(9682651996416); + expect(wasm._Z6factorddd(42, 42, 42)).toEqual(3528); + }); +}); + +it("duff should work", function() { + return import("./duff.wasm").then(function(wasm) { + const view = new Uint8Array(wasm.memory.buffer); + view[0] = 123; + for(let i = 1; i < 100; i++) + view[i] = i; + const result = wasm._Z4sendPcS_m(200, 1, 100); + for(let i = 1; i < 100; i++) + expect(view[199 + i]).toEqual(i); + }); +}); diff --git a/test/cases/wasm/wasm-explorer-examples-async/node_modules/env.js b/test/cases/wasm/wasm-explorer-examples-async/node_modules/env.js new file mode 100644 index 00000000000..bb82d984bdc --- /dev/null +++ b/test/cases/wasm/wasm-explorer-examples-async/node_modules/env.js @@ -0,0 +1 @@ +export const _Z3powdd = Math.pow; diff --git a/test/cases/wasm/wasm-explorer-examples-async/popcnt.wasm b/test/cases/wasm/wasm-explorer-examples-async/popcnt.wasm new file mode 100644 index 00000000000..f605a5a95f7 Binary files /dev/null and b/test/cases/wasm/wasm-explorer-examples-async/popcnt.wasm differ diff --git a/test/cases/wasm/wasm-explorer-examples-async/test.filter.js b/test/cases/wasm/wasm-explorer-examples-async/test.filter.js new file mode 100644 index 00000000000..23177349638 --- /dev/null +++ b/test/cases/wasm/wasm-explorer-examples-async/test.filter.js @@ -0,0 +1,5 @@ +var supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); + +module.exports = function(config) { + return supportsWebAssembly(); +}; diff --git a/test/cases/wasm/wasm-explorer-examples-async/testFunction.wasm b/test/cases/wasm/wasm-explorer-examples-async/testFunction.wasm new file mode 100644 index 00000000000..3be47ce57b4 Binary files /dev/null and b/test/cases/wasm/wasm-explorer-examples-async/testFunction.wasm differ diff --git a/test/cases/wasm/wasm-explorer-examples-sync/Q_rsqrt.wasm b/test/cases/wasm/wasm-explorer-examples-sync/Q_rsqrt.wasm new file mode 100644 index 00000000000..e5c17c16d93 Binary files /dev/null and b/test/cases/wasm/wasm-explorer-examples-sync/Q_rsqrt.wasm differ diff --git a/test/cases/wasm/wasm-explorer-examples-sync/duff.wasm b/test/cases/wasm/wasm-explorer-examples-sync/duff.wasm new file mode 100644 index 00000000000..0b75ea455a8 Binary files /dev/null and b/test/cases/wasm/wasm-explorer-examples-sync/duff.wasm differ diff --git a/test/cases/wasm/wasm-explorer-examples-sync/fact.wasm b/test/cases/wasm/wasm-explorer-examples-sync/fact.wasm new file mode 100644 index 00000000000..50ce8c098a4 Binary files /dev/null and b/test/cases/wasm/wasm-explorer-examples-sync/fact.wasm differ diff --git a/test/cases/wasm/wasm-explorer-examples-sync/fast-math.wasm b/test/cases/wasm/wasm-explorer-examples-sync/fast-math.wasm new file mode 100644 index 00000000000..1733deb9ba7 Binary files /dev/null and b/test/cases/wasm/wasm-explorer-examples-sync/fast-math.wasm differ diff --git a/test/cases/wasm/wasm-explorer-examples-sync/index.js b/test/cases/wasm/wasm-explorer-examples-sync/index.js new file mode 100644 index 00000000000..a9cfd3a36de --- /dev/null +++ b/test/cases/wasm/wasm-explorer-examples-sync/index.js @@ -0,0 +1,23 @@ +it("Q_rsqrt should work", function() { + return import("./tests").then(t => t.run_Q_rsqrt()); +}); + +it("testFunction should work", function() { + return import("./tests").then(t => t.run_testFunction()); +}); + +it("fact should work", function() { + return import("./tests").then(t => t.run_fact()); +}); + +it("popcnt should work", function() { + return import("./tests").then(t => t.run_popcnt()); +}); + +it("fast-math should work", function() { + return import("./tests").then(t => t.run_fastMath()); +}); + +it("duff should work", function() { + return import("./tests").then(t => t.run_duff()); +}); diff --git a/test/cases/wasm/wasm-explorer-examples-sync/node_modules/env.js b/test/cases/wasm/wasm-explorer-examples-sync/node_modules/env.js new file mode 100644 index 00000000000..bb82d984bdc --- /dev/null +++ b/test/cases/wasm/wasm-explorer-examples-sync/node_modules/env.js @@ -0,0 +1 @@ +export const _Z3powdd = Math.pow; diff --git a/test/cases/wasm/wasm-explorer-examples-sync/popcnt.wasm b/test/cases/wasm/wasm-explorer-examples-sync/popcnt.wasm new file mode 100644 index 00000000000..f605a5a95f7 Binary files /dev/null and b/test/cases/wasm/wasm-explorer-examples-sync/popcnt.wasm differ diff --git a/test/cases/wasm/wasm-explorer-examples-sync/test.filter.js b/test/cases/wasm/wasm-explorer-examples-sync/test.filter.js new file mode 100644 index 00000000000..23177349638 --- /dev/null +++ b/test/cases/wasm/wasm-explorer-examples-sync/test.filter.js @@ -0,0 +1,5 @@ +var supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); + +module.exports = function(config) { + return supportsWebAssembly(); +}; diff --git a/test/cases/wasm/wasm-explorer-examples-sync/testFunction.wasm b/test/cases/wasm/wasm-explorer-examples-sync/testFunction.wasm new file mode 100644 index 00000000000..3be47ce57b4 Binary files /dev/null and b/test/cases/wasm/wasm-explorer-examples-sync/testFunction.wasm differ diff --git a/test/cases/wasm/wasm-explorer-examples-sync/tests.js b/test/cases/wasm/wasm-explorer-examples-sync/tests.js new file mode 100644 index 00000000000..c957248a967 --- /dev/null +++ b/test/cases/wasm/wasm-explorer-examples-sync/tests.js @@ -0,0 +1,50 @@ +import * as Q_rsqrt from "./Q_rsqrt.wasm"; +import * as testFunction from "./testFunction.wasm"; +import * as fact from "./fact.wasm"; +import * as popcnt from "./popcnt.wasm"; +import * as fastMath from "./fast-math.wasm"; +import * as duff from "./duff.wasm"; + +export function run_Q_rsqrt() { + const result = Q_rsqrt._Z7Q_rsqrtf(1/1764); + expect(result).toBeGreaterThan(41.9); + expect(result).toBeLessThan(42.1); +} + +export function run_testFunction() { + const view = new Int32Array(testFunction.memory.buffer); + view[0] = 123; + view[1] = 1; + view[2] = 2; + view[3] = 3; + const result = testFunction._Z12testFunctionPii(4, 3); + expect(result).toEqual(6); +} + +export function run_fact() { + const result = fact._Z4facti(11); + expect(result).toEqual(39916800); +} + +export function run_popcnt() { + expect(popcnt.main(0xF0F)).toEqual(16); + expect(popcnt._Z5countj(0xF0F)).toEqual(8); +} + +export function run_fastMath() { + expect(fastMath._Z3food(42)).toEqual(14); + expect(fastMath._Z9maybe_mindd(42, 24)).toEqual(24); + expect(fastMath._Z8call_powd(42)).toEqual(9682651996416); + expect(fastMath._Z6do_powd(42)).toEqual(9682651996416); + expect(fastMath._Z6factorddd(42, 42, 42)).toEqual(3528); +} + +export function run_duff() { + const view = new Uint8Array(duff.memory.buffer); + view[0] = 123; + for(let i = 1; i < 100; i++) + view[i] = i; + const result = duff._Z4sendPcS_m(200, 1, 100); + for(let i = 1; i < 100; i++) + expect(view[199 + i]).toEqual(i); +} diff --git a/test/compareLocations.unittest.js b/test/compareLocations.unittest.js index 4572fd5cff5..53d68daf569 100644 --- a/test/compareLocations.unittest.js +++ b/test/compareLocations.unittest.js @@ -1,8 +1,7 @@ "use strict"; -const should = require("should"); const compareLocations = require("../lib/compareLocations"); -const createPosition = function(overrides) { +const createPosition = overrides => { return Object.assign( { line: 10, @@ -12,7 +11,7 @@ const createPosition = function(overrides) { ); }; -const createLocation = function(start, end, index) { +const createLocation = (start, end, index) => { return { start: createPosition(start), end: createPosition(end), @@ -22,14 +21,17 @@ const createLocation = function(start, end, index) { describe("compareLocations", () => { describe("string location comparison", () => { - it("returns -1 when the first string comes before the second string", () => - compareLocations("alpha", "beta").should.be.exactly(-1)); + it("returns -1 when the first string comes before the second string", () => { + expect(compareLocations("alpha", "beta")).toBe(-1); + }); - it("returns 1 when the first string comes after the second string", () => - compareLocations("beta", "alpha").should.be.exactly(1)); + it("returns 1 when the first string comes after the second string", () => { + expect(compareLocations("beta", "alpha")).toBe(1); + }); - it("returns 0 when the first string is the same as the second string", () => - compareLocations("charlie", "charlie").should.be.exactly(0)); + it("returns 0 when the first string is the same as the second string", () => { + expect(compareLocations("charlie", "charlie")).toBe(0); + }); }); describe("object location comparison", () => { @@ -46,11 +48,12 @@ describe("compareLocations", () => { }); it("returns -1 when the first location line number comes before the second location line number", () => { - return compareLocations(a, b).should.be.exactly(-1); + expect(compareLocations(a, b)).toBe(-1); }); - it("returns 1 when the first location line number comes after the second location line number", () => - compareLocations(b, a).should.be.exactly(1)); + it("returns 1 when the first location line number comes after the second location line number", () => { + expect(compareLocations(b, a)).toBe(1); + }); }); describe("location column number", () => { @@ -63,11 +66,13 @@ describe("compareLocations", () => { }); }); - it("returns -1 when the first location column number comes before the second location column number", () => - compareLocations(a, b).should.be.exactly(-1)); + it("returns -1 when the first location column number comes before the second location column number", () => { + expect(compareLocations(a, b)).toBe(-1); + }); - it("returns 1 when the first location column number comes after the second location column number", () => - compareLocations(b, a).should.be.exactly(1)); + it("returns 1 when the first location column number comes after the second location column number", () => { + expect(compareLocations(b, a)).toBe(1); + }); }); describe("location index number", () => { @@ -76,11 +81,13 @@ describe("compareLocations", () => { b = createLocation(null, null, 20); }); - it("returns -1 when the first location index number comes before the second location index number", () => - compareLocations(a, b).should.be.exactly(-1)); + it("returns -1 when the first location index number comes before the second location index number", () => { + expect(compareLocations(a, b)).toBe(-1); + }); - it("returns 1 when the first location index number comes after the second location index number", () => - compareLocations(b, a).should.be.exactly(1)); + it("returns 1 when the first location index number comes after the second location index number", () => { + expect(compareLocations(b, a)).toBe(1); + }); }); describe("same location", () => { @@ -90,33 +97,40 @@ describe("compareLocations", () => { }); it("returns 0", () => { - compareLocations(a, b).should.be.exactly(0); + expect(compareLocations(a, b)).toBe(0); }); }); }); describe("string and object location comparison", () => { - it("returns 1 when the first parameter is a string and the second parameter is an object", () => - compareLocations("alpha", createLocation()).should.be.exactly(1)); + it("returns 1 when the first parameter is a string and the second parameter is an object", () => { + expect(compareLocations("alpha", createLocation())).toBe(1); + }); - it("returns -1 when the first parameter is an object and the second parameter is a string", () => - compareLocations(createLocation(), "alpha").should.be.exactly(-1)); + it("returns -1 when the first parameter is an object and the second parameter is a string", () => { + expect(compareLocations(createLocation(), "alpha")).toBe(-1); + }); }); describe("unknown location type comparison", () => { - it("returns 0 when the first parameter is an object and the second parameter is a number", () => - compareLocations(createLocation(), 123).should.be.exactly(0)); + it("returns 0 when the first parameter is an object and the second parameter is a number", () => { + expect(compareLocations(createLocation(), 123)).toBe(0); + }); - it("returns undefined when the first parameter is a number and the second parameter is an object", () => - should(compareLocations(123, createLocation())).be.undefined()); + it("returns undefined when the first parameter is a number and the second parameter is an object", () => { + expect(compareLocations(123, createLocation())).toBe(undefined); + }); - it("returns 0 when the first parameter is a string and the second parameter is a number", () => - compareLocations("alpha", 123).should.be.exactly(0)); + it("returns 0 when the first parameter is a string and the second parameter is a number", () => { + expect(compareLocations("alpha", 123)).toBe(0); + }); - it("returns undefined when the first parameter is a number and the second parameter is a string", () => - should(compareLocations(123, "alpha")).be.undefined()); + it("returns undefined when the first parameter is a number and the second parameter is a string", () => { + expect(compareLocations(123, "alpha")).toBe(undefined); + }); - it("returns undefined when both the first parameter and the second parameter is a number", () => - should(compareLocations(123, 456)).be.undefined()); + it("returns undefined when both the first parameter and the second parameter is a number", () => { + expect(compareLocations(123, 456)).toBe(undefined); + }); }); }); diff --git a/test/configCases/async-commons-chunk/all-selected/index.js b/test/configCases/async-commons-chunk/all-selected/index.js index 474da4c1600..cfc15c09ed8 100644 --- a/test/configCases/async-commons-chunk/all-selected/index.js +++ b/test/configCases/async-commons-chunk/all-selected/index.js @@ -1,22 +1,22 @@ it("should load the full async commons", function(done) { require.ensure(["./a"], function(require) { - require("./a").should.be.eql("a"); + expect(require("./a")).toBe("a"); done(); }); }); it("should load a chunk with async commons (AMD)", function(done) { require(["./a", "./b"], function(a, b) { - a.should.be.eql("a"); - b.should.be.eql("b"); + expect(a).toBe("a"); + expect(b).toBe("b"); done(); }); }); it("should load a chunk with async commons (require.ensure)", function(done) { require.ensure([], function(require) { - require("./a").should.be.eql("a"); - require("./c").should.be.eql("c"); + expect(require("./a")).toBe("a"); + expect(require("./c")).toBe("c"); done(); }); }); diff --git a/test/configCases/async-commons-chunk/duplicate/index.js b/test/configCases/async-commons-chunk/duplicate/index.js index 8209ce0990c..7370a40649c 100644 --- a/test/configCases/async-commons-chunk/duplicate/index.js +++ b/test/configCases/async-commons-chunk/duplicate/index.js @@ -1,28 +1,28 @@ it("should load nested commons chunk", function(done) { var counter = 0; require.ensure(["./a"], function(require) { - require("./a").should.be.eql("a"); + expect(require("./a")).toBe("a"); require.ensure(["./c", "./d"], function(require) { - require("./c").should.be.eql("c"); - require("./d").should.be.eql("d"); + expect(require("./c")).toBe("c"); + expect(require("./d")).toBe("d"); if(++counter == 4) done(); }); require.ensure(["./c", "./e"], function(require) { - require("./c").should.be.eql("c"); - require("./e").should.be.eql("e"); + expect(require("./c")).toBe("c"); + expect(require("./e")).toBe("e"); if(++counter == 4) done(); }); }); require.ensure(["./b"], function(require) { - require("./b").should.be.eql("b"); + expect(require("./b")).toBe("b"); require.ensure(["./c", "./d"], function(require) { - require("./c").should.be.eql("c"); - require("./d").should.be.eql("d"); + expect(require("./c")).toBe("c"); + expect(require("./d")).toBe("d"); if(++counter == 4) done(); }); require.ensure(["./c", "./e"], function(require) { - require("./c").should.be.eql("c"); - require("./e").should.be.eql("e"); + expect(require("./c")).toBe("c"); + expect(require("./e")).toBe("e"); if(++counter == 4) done(); }); }); diff --git a/test/configCases/async-commons-chunk/existing-name/index.js b/test/configCases/async-commons-chunk/existing-name/index.js index 3166ba89366..b05f483e755 100644 --- a/test/configCases/async-commons-chunk/existing-name/index.js +++ b/test/configCases/async-commons-chunk/existing-name/index.js @@ -1,33 +1,50 @@ -require("should"); -const sinon = require("sinon"); -const chunkLoadingSpy = sinon.spy(__webpack_require__, "e"); +const chunkLoadingSpy = jest.spyOn(__webpack_require__, "e"); it("should not have duplicate chunks in blocks", function(done) { - // This split point should contain: a - require.ensure([], function(require) { - require("./a").should.be.eql("a"); - }, "a"); + // This split point should contain: a + require.ensure( + [], + function(require) { + expect(require("./a")).toBe("a"); + }, + "a" + ); - // This split point should contain: a and b - we use CommonsChunksPlugin to - // have it only contain b and make chunk a be an async dependency. - require.ensure([], function(require) { - require("./a").should.be.eql("a"); - require("./b").should.be.eql("b"); - }, "a+b"); + // This split point should contain: a and b - we use CommonsChunksPlugin to + // have it only contain b and make chunk a be an async dependency. + require.ensure( + [], + function(require) { + expect(require("./a")).toBe("a"); + expect(require("./b")).toBe("b"); + }, + "a+b" + ); - // This split point should contain: a, b and c - we use CommonsChunksPlugin to - // have it only contain c and make chunks a and a+b be async dependencies. - require.ensure([], function(require) { - require("./a").should.be.eql("a"); - require("./b").should.be.eql("b"); - require("./c").should.be.eql("c"); - }, "a+b+c"); + // This split point should contain: a, b and c - we use CommonsChunksPlugin to + // have it only contain c and make chunks a and a+b be async dependencies. + require.ensure( + [], + function(require) { + expect(require("./a")).toBe("a"); + expect(require("./b")).toBe("b"); + expect(require("./c")).toBe("c"); + }, + "a+b+c" + ); - // Each of the require.ensures above should end up resolving chunks: - // - a - // - a, a+b - // - a, a+b, a+b+c - chunkLoadingSpy.callCount.should.be.eql(6); - chunkLoadingSpy.args.should.be.eql([["a"], ["a"], ["a+b~a+b+c" /* == b */], ["a"], ["a+b~a+b+c" /* == b */], ["a+b+c"]]); + // Each of the require.ensures above should end up resolving chunks: + // - a + // - a, a+b + // - a, a+b, a+b+c + expect(chunkLoadingSpy.mock.calls.length).toBe(6); + expect(chunkLoadingSpy.mock.calls).toEqual([ + ["a"], + ["a"], + ["a+b" /* == b */], + ["a"], + ["a+b" /* == b */], + ["a+b+c" /* == c */] + ]); done(); }); diff --git a/test/configCases/async-commons-chunk/nested/index.js b/test/configCases/async-commons-chunk/nested/index.js index 374a2cca82a..255659c5c84 100644 --- a/test/configCases/async-commons-chunk/nested/index.js +++ b/test/configCases/async-commons-chunk/nested/index.js @@ -1,19 +1,19 @@ it("should load nested commons chunk", function(done) { require.ensure(["./a"], function(require) { - require("./a").should.be.eql("a"); + expect(require("./a")).toBe("a"); var counter = 0; require.ensure(["./b", "./c"], function(require) { - require("./b").should.be.eql("b"); - require("./c").should.be.eql("c"); + expect(require("./b")).toBe("b"); + expect(require("./c")).toBe("c"); if(++counter == 3) done(); }); require.ensure(["./b", "./d"], function(require) { - require("./b").should.be.eql("b"); - require("./d").should.be.eql("d"); + expect(require("./b")).toBe("b"); + expect(require("./d")).toBe("d"); if(++counter == 3) done(); }); require.ensure(["./b"], function(require) { - require("./b").should.be.eql("b"); + expect(require("./b")).toBe("b"); if(++counter == 3) done(); }); }); diff --git a/test/configCases/async-commons-chunk/simple/index.js b/test/configCases/async-commons-chunk/simple/index.js index 474da4c1600..cfc15c09ed8 100644 --- a/test/configCases/async-commons-chunk/simple/index.js +++ b/test/configCases/async-commons-chunk/simple/index.js @@ -1,22 +1,22 @@ it("should load the full async commons", function(done) { require.ensure(["./a"], function(require) { - require("./a").should.be.eql("a"); + expect(require("./a")).toBe("a"); done(); }); }); it("should load a chunk with async commons (AMD)", function(done) { require(["./a", "./b"], function(a, b) { - a.should.be.eql("a"); - b.should.be.eql("b"); + expect(a).toBe("a"); + expect(b).toBe("b"); done(); }); }); it("should load a chunk with async commons (require.ensure)", function(done) { require.ensure([], function(require) { - require("./a").should.be.eql("a"); - require("./c").should.be.eql("c"); + expect(require("./a")).toBe("a"); + expect(require("./c")).toBe("c"); done(); }); }); diff --git a/test/configCases/code-generation/require-context-id/index.js b/test/configCases/code-generation/require-context-id/index.js index a3002be8909..6dc75d007b9 100644 --- a/test/configCases/code-generation/require-context-id/index.js +++ b/test/configCases/code-generation/require-context-id/index.js @@ -1,5 +1,5 @@ it("should escape require.context id correctly", function() { var context = require.context("./folder"); - context("./a").should.be.eql("a"); - context.id.should.be.type("string"); + expect(context("./a")).toBe("a"); + expect(context.id).toBeTypeOf("string"); }); diff --git a/test/configCases/code-generation/use-strict/index.js b/test/configCases/code-generation/use-strict/index.js index ff811c676d1..cf05674bee8 100644 --- a/test/configCases/code-generation/use-strict/index.js +++ b/test/configCases/code-generation/use-strict/index.js @@ -15,7 +15,7 @@ it("should include only one use strict per module", function() { match = regExp.exec(source); } - matches.should.be.eql([ + expect(matches).toEqual([ "__webpack_require__.r(__webpack_exports__);", "/* unused harmony default export */ var _unused_webpack_default_export = (\"a\");", "__webpack_require__.r(__webpack_exports__);", diff --git a/test/configCases/commons-chunk-plugin/correct-order/index.js b/test/configCases/commons-chunk-plugin/correct-order/index.js index 10d9a9900f3..112e38a7866 100644 --- a/test/configCases/commons-chunk-plugin/correct-order/index.js +++ b/test/configCases/commons-chunk-plugin/correct-order/index.js @@ -1,13 +1,11 @@ -require("should"); - var a = require("./a"); it("should run", function() { - a.should.be.eql("a"); + expect(a).toBe("a"); }); var mainModule = require.main; it("should be main", function() { - mainModule.should.be.eql(module); + expect(mainModule).toBe(module); }); diff --git a/test/configCases/commons-chunk-plugin/extract-async-from-entry/index.js b/test/configCases/commons-chunk-plugin/extract-async-from-entry/index.js index f53987e508a..cbab26b2d99 100644 --- a/test/configCases/commons-chunk-plugin/extract-async-from-entry/index.js +++ b/test/configCases/commons-chunk-plugin/extract-async-from-entry/index.js @@ -1,4 +1 @@ -require("should"); - -it("should run successful", function() { -}); +it("should run successful", function() {}); diff --git a/test/configCases/commons-chunk-plugin/hot-multi/first.js b/test/configCases/commons-chunk-plugin/hot-multi/first.js index 0775bfc22cb..751a8042f9f 100644 --- a/test/configCases/commons-chunk-plugin/hot-multi/first.js +++ b/test/configCases/commons-chunk-plugin/hot-multi/first.js @@ -1,8 +1,6 @@ -require("should"); - require("./common"); it("should have the correct main flag for multi first module", function() { var multiModule = __webpack_require__.c[module.parents[0]]; - multiModule.hot._main.should.be.eql(true); + expect(multiModule.hot._main).toBe(true); }); diff --git a/test/configCases/commons-chunk-plugin/hot-multi/second.js b/test/configCases/commons-chunk-plugin/hot-multi/second.js index facb4a27e88..fd42f814811 100644 --- a/test/configCases/commons-chunk-plugin/hot-multi/second.js +++ b/test/configCases/commons-chunk-plugin/hot-multi/second.js @@ -1,8 +1,6 @@ -require("should"); - require("./common"); it("should have the correct main flag for multi second module", function() { var multiModule = __webpack_require__.c[module.parents[0]]; - multiModule.hot._main.should.be.eql(true); + expect(multiModule.hot._main).toBe(true); }); diff --git a/test/configCases/commons-chunk-plugin/hot-multi/vendor.js b/test/configCases/commons-chunk-plugin/hot-multi/vendor.js index b2c70c298aa..abba7de3a31 100644 --- a/test/configCases/commons-chunk-plugin/hot-multi/vendor.js +++ b/test/configCases/commons-chunk-plugin/hot-multi/vendor.js @@ -4,5 +4,5 @@ module.exports = "vendor"; it("should have the correct main flag for multi vendor module", function() { var multiModule = __webpack_require__.c[module.parents[0]]; - multiModule.hot._main.should.be.eql(true); + expect(multiModule.hot._main).toBe(true); }); diff --git a/test/configCases/commons-chunk-plugin/hot/index.js b/test/configCases/commons-chunk-plugin/hot/index.js index affedf39c2e..105978c4e63 100644 --- a/test/configCases/commons-chunk-plugin/hot/index.js +++ b/test/configCases/commons-chunk-plugin/hot/index.js @@ -1,11 +1,9 @@ -require("should"); - it("should have the correct main flag", function() { var a = require("./vendor"); - a._main.should.be.eql(false); - module.hot._main.should.be.eql(true); + expect(a._main).toBe(false); + expect(module.hot._main).toBe(true); }); it("should be main", function() { - require.main.should.be.eql(module); + expect(require.main).toBe(module); }); diff --git a/test/configCases/commons-chunk-plugin/inverted-order/index.js b/test/configCases/commons-chunk-plugin/inverted-order/index.js index 10d9a9900f3..112e38a7866 100644 --- a/test/configCases/commons-chunk-plugin/inverted-order/index.js +++ b/test/configCases/commons-chunk-plugin/inverted-order/index.js @@ -1,13 +1,11 @@ -require("should"); - var a = require("./a"); it("should run", function() { - a.should.be.eql("a"); + expect(a).toBe("a"); }); var mainModule = require.main; it("should be main", function() { - mainModule.should.be.eql(module); + expect(mainModule).toBe(module); }); diff --git a/test/configCases/commons-chunk-plugin/library/index.js b/test/configCases/commons-chunk-plugin/library/index.js index 6bef6f16623..02d3fa5c364 100644 --- a/test/configCases/commons-chunk-plugin/library/index.js +++ b/test/configCases/commons-chunk-plugin/library/index.js @@ -1,4 +1,3 @@ -require("should"); require.include("external1"); require.ensure([], function() { require.include("external2"); @@ -6,7 +5,7 @@ require.ensure([], function() { it("should have externals in main file", function() { var a = require("./a"); - a.vendor.should.containEql("require(\"external0\")"); - a.main.should.containEql("require(\"external1\")"); - a.main.should.containEql("require(\"external2\")"); + expect(a.vendor).toMatch("require(\"external0\")"); + expect(a.main).toMatch("require(\"external1\")"); + expect(a.main).toMatch("require(\"external2\")"); }); diff --git a/test/configCases/commons-chunk-plugin/move-entry/index.js b/test/configCases/commons-chunk-plugin/move-entry/index.js index 0263082b9aa..36b4da6e9bd 100644 --- a/test/configCases/commons-chunk-plugin/move-entry/index.js +++ b/test/configCases/commons-chunk-plugin/move-entry/index.js @@ -1,5 +1,3 @@ -require("should"); - it("should not be moved", function() { - new Error().stack.should.not.match(/webpackBootstrap/); + expect(new Error().stack).not.toMatch(/webpackBootstrap/); }); diff --git a/test/configCases/commons-chunk-plugin/move-to-grandparent/index.js b/test/configCases/commons-chunk-plugin/move-to-grandparent/index.js index 5c459f21543..abee1e85c1b 100644 --- a/test/configCases/commons-chunk-plugin/move-to-grandparent/index.js +++ b/test/configCases/commons-chunk-plugin/move-to-grandparent/index.js @@ -3,8 +3,8 @@ it("should correctly include indirect children in common chunk", function(done) import('./pageA'), import('./pageB').then(m => m.default) ]).then((imports) => { - imports[0].default.should.be.eql("reuse"); - imports[1].default.should.be.eql("reuse"); + expect(imports[0].default).toBe("reuse"); + expect(imports[1].default).toBe("reuse"); done(); }).catch(e => { done(e); diff --git a/test/configCases/commons-chunk-plugin/move-to-grandparent/second.js b/test/configCases/commons-chunk-plugin/move-to-grandparent/second.js index c661ef82829..750ace95c71 100644 --- a/test/configCases/commons-chunk-plugin/move-to-grandparent/second.js +++ b/test/configCases/commons-chunk-plugin/move-to-grandparent/second.js @@ -1,6 +1,6 @@ it("should handle indirect children with multiple parents correctly", function(done) { import('./pageB').then(b => { - b.default.should.be.eql("reuse"); + expect(b.default).toBe("reuse"); done() }).catch(e => { done(); diff --git a/test/configCases/commons-chunk-plugin/simple/index.js b/test/configCases/commons-chunk-plugin/simple/index.js index 60fcce8a7de..ca28fa41fc9 100644 --- a/test/configCases/commons-chunk-plugin/simple/index.js +++ b/test/configCases/commons-chunk-plugin/simple/index.js @@ -1,10 +1,8 @@ -require("should"); - it("should run", function() { var a = require("./a"); - a.should.be.eql("a"); + expect(a).toBe("a"); }); it("should be main", function() { - require.main.should.be.eql(module); -}); \ No newline at end of file + expect(require.main).toBe(module); +}); diff --git a/test/configCases/context-exclusion/simple/index.js b/test/configCases/context-exclusion/simple/index.js index 90ea0274461..47eb9afe063 100644 --- a/test/configCases/context-exclusion/simple/index.js +++ b/test/configCases/context-exclusion/simple/index.js @@ -3,18 +3,15 @@ function requireInContext(someVariable) { } it("should not exclude paths not matching the exclusion pattern", function() { - requireInContext("file").should.be.eql("thats good"); - requireInContext("check-here/file").should.be.eql("thats good"); - requireInContext("check-here/check-here/file").should.be.eql("thats good"); + expect(requireInContext("file")).toBe("thats good"); + expect(requireInContext("check-here/file")).toBe("thats good"); + expect(requireInContext("check-here/check-here/file")).toBe("thats good"); }); it("should exclude paths/files matching the exclusion pattern", function() { - (() => requireInContext("dont")). - should.throw(/Cannot find module ".\/dont"/); + expect(() => requireInContext("dont")).toThrowError(/Cannot find module '.\/dont'/); - (() => requireInContext("dont-check-here/file")). - should.throw(/Cannot find module ".\/dont-check-here\/file"/); + expect(() => requireInContext("dont-check-here/file")).toThrowError(/Cannot find module '.\/dont-check-here\/file'/); - (() => requireInContext("check-here/dont-check-here/file")). - should.throw(/Cannot find module ".\/check-here\/dont-check-here\/file"/); + expect(() => requireInContext("check-here/dont-check-here/file")).toThrowError(/Cannot find module '.\/check-here\/dont-check-here\/file'/); }); diff --git a/test/configCases/context-replacement/System.import/index.js b/test/configCases/context-replacement/System.import/index.js index b50ae4885d1..c2afdd5a49e 100644 --- a/test/configCases/context-replacement/System.import/index.js +++ b/test/configCases/context-replacement/System.import/index.js @@ -1,6 +1,6 @@ it("should replace a async context with a manual map", function() { var a = "a"; return import(a).then(function(a) { - a.should.be.eql({ default: "b" }); + expect(a).toEqual({ default: "b", [Symbol.toStringTag]: "Module" }); }); }); diff --git a/test/configCases/context-replacement/a/index.js b/test/configCases/context-replacement/a/index.js index a46ac19f2fd..ec1eba1a8c8 100644 --- a/test/configCases/context-replacement/a/index.js +++ b/test/configCases/context-replacement/a/index.js @@ -5,7 +5,7 @@ it("should replace a context with a new resource and reqExp", function(done) { }); } rqInContext("replaced", function(r) { - r.should.be.eql("ok"); + expect(r).toBe("ok"); done(); }); -}); \ No newline at end of file +}); diff --git a/test/configCases/context-replacement/b/index.js b/test/configCases/context-replacement/b/index.js index fb4221a4f73..b01b43bec4c 100644 --- a/test/configCases/context-replacement/b/index.js +++ b/test/configCases/context-replacement/b/index.js @@ -2,5 +2,5 @@ it("should replace a context with a new regExp", function() { function rqInContext(x) { return require(x); } - rqInContext("./only-this").should.be.eql("ok"); -}); \ No newline at end of file + expect(rqInContext("./only-this")).toBe("ok"); +}); diff --git a/test/configCases/context-replacement/c/index.js b/test/configCases/context-replacement/c/index.js index 7f1b1afe4bf..5ee5fb8bb91 100644 --- a/test/configCases/context-replacement/c/index.js +++ b/test/configCases/context-replacement/c/index.js @@ -2,12 +2,12 @@ it("should replace a context with a manual map", function() { function rqInContext(x) { return require(x); } - rqInContext("a").should.be.eql("a"); - rqInContext("b").should.be.eql("b"); - rqInContext("./c").should.be.eql("b"); - rqInContext("d").should.be.eql("d"); - rqInContext("./d").should.be.eql("d"); - (function() { + expect(rqInContext("a")).toBe("a"); + expect(rqInContext("b")).toBe("b"); + expect(rqInContext("./c")).toBe("b"); + expect(rqInContext("d")).toBe("d"); + expect(rqInContext("./d")).toBe("d"); + (expect(function() { rqInContext("module-b") - }.should.throw()); + }).toThrowError()); }); diff --git a/test/configCases/context-replacement/d/index.js b/test/configCases/context-replacement/d/index.js index e8a4f576f91..325fd05f2aa 100644 --- a/test/configCases/context-replacement/d/index.js +++ b/test/configCases/context-replacement/d/index.js @@ -2,7 +2,7 @@ it("should replace a context with resource query and manual map", function() { function rqInContext(x) { return require(x); } - rqInContext("a").should.be.eql({ + expect(rqInContext("a")).toEqual({ resourceQuery: "?cats=meow", query: "?lions=roar", prev: "module.exports = \"a\";\n", diff --git a/test/configCases/custom-hash-function/xxhash/index.js b/test/configCases/custom-hash-function/xxhash/index.js index 903df73bd5e..9a989c6c4c6 100644 --- a/test/configCases/custom-hash-function/xxhash/index.js +++ b/test/configCases/custom-hash-function/xxhash/index.js @@ -2,7 +2,7 @@ it("should have unique ids", function () { var ids = []; for(var i = 1; i <= 15; i++) { var id = require("./files/file" + i + ".js"); - ids.indexOf(id).should.be.eql(-1); + expect(ids.indexOf(id)).toBe(-1); ids.push(id); } }); diff --git a/test/configCases/delegated-hash/simple/index.js b/test/configCases/delegated-hash/simple/index.js index 68324068981..4a11393aefb 100644 --- a/test/configCases/delegated-hash/simple/index.js +++ b/test/configCases/delegated-hash/simple/index.js @@ -1,7 +1,7 @@ it("should delegate the modules", function() { - require("./a").should.be.eql("a"); - require("./loader!./b").should.be.eql("b"); - require("./dir/c").should.be.eql("c"); - require("./d").should.be.eql("d"); - require("./e").should.be.eql("e"); + expect(require("./a")).toBe("a"); + expect(require("./loader!./b")).toBe("b"); + expect(require("./dir/c")).toBe("c"); + expect(require("./d")).toBe("d"); + expect(require("./e")).toBe("e"); }); diff --git a/test/configCases/delegated/simple/index.js b/test/configCases/delegated/simple/index.js index 43353216ce7..d918d437c16 100644 --- a/test/configCases/delegated/simple/index.js +++ b/test/configCases/delegated/simple/index.js @@ -1,5 +1,5 @@ it("should delegate the modules", function() { - require("./a").should.be.eql("a"); - require("./loader!./b").should.be.eql("b"); - require("./dir/c").should.be.eql("c"); + expect(require("./a")).toBe("a"); + expect(require("./loader!./b")).toBe("b"); + expect(require("./dir/c")).toBe("c"); }); diff --git a/test/configCases/dll-plugin-entry/0-create-dll/dep.js b/test/configCases/dll-plugin-entry/0-create-dll/dep.js new file mode 100644 index 00000000000..bca818d4d63 --- /dev/null +++ b/test/configCases/dll-plugin-entry/0-create-dll/dep.js @@ -0,0 +1,5 @@ +export function foo() { + console.log("foo"); +} + +export const bar = "bar"; diff --git a/test/configCases/dll-plugin-entry/0-create-dll/dep2.js b/test/configCases/dll-plugin-entry/0-create-dll/dep2.js new file mode 100644 index 00000000000..e7134e7006d --- /dev/null +++ b/test/configCases/dll-plugin-entry/0-create-dll/dep2.js @@ -0,0 +1 @@ +module.exports = "foo"; diff --git a/test/configCases/dll-plugin-entry/0-create-dll/index.js b/test/configCases/dll-plugin-entry/0-create-dll/index.js new file mode 100644 index 00000000000..80cdc870f74 --- /dev/null +++ b/test/configCases/dll-plugin-entry/0-create-dll/index.js @@ -0,0 +1,4 @@ +export { bar } from "./dep"; +export default 42; + +require("./dep2"); diff --git a/test/configCases/dll-plugin-entry/0-create-dll/test.config.js b/test/configCases/dll-plugin-entry/0-create-dll/test.config.js new file mode 100644 index 00000000000..08ea6c319c8 --- /dev/null +++ b/test/configCases/dll-plugin-entry/0-create-dll/test.config.js @@ -0,0 +1 @@ +exports.noTests = true; diff --git a/test/configCases/dll-plugin-entry/0-create-dll/webpack.config.js b/test/configCases/dll-plugin-entry/0-create-dll/webpack.config.js new file mode 100644 index 00000000000..6824e7f92bf --- /dev/null +++ b/test/configCases/dll-plugin-entry/0-create-dll/webpack.config.js @@ -0,0 +1,20 @@ +var path = require("path"); +var webpack = require("../../../../"); + +module.exports = { + entry: ["."], + output: { + filename: "dll.js", + chunkFilename: "[id].dll.js", + libraryTarget: "commonjs2" + }, + plugins: [ + new webpack.DllPlugin({ + path: path.resolve( + __dirname, + "../../../js/config/dll-plugin-entry/manifest0.json" + ), + entryOnly: true + }) + ] +}; diff --git a/test/configCases/dll-plugin-entry/1-use-dll/index.js b/test/configCases/dll-plugin-entry/1-use-dll/index.js new file mode 100644 index 00000000000..ec66e9e5fd9 --- /dev/null +++ b/test/configCases/dll-plugin-entry/1-use-dll/index.js @@ -0,0 +1,21 @@ +import Answer, { bar } from "dll/index"; + +it("should load a module from dll", function() { + expect(require("dll/index")).toEqual({ bar: "bar", default: 42, [Symbol.toStringTag]: "Module" }); +}); + +it("should load an harmony module from dll (default export)", function() { + expect(Answer).toBe(42); +}); + +it("should load an harmony module from dll (star export)", function() { + expect(bar).toBe("bar"); +}); + +it("should give modules the correct ids", function() { + expect(Object.keys(__webpack_modules__).filter(m => !m.startsWith("../.."))).toEqual([ + "./index.js", + "dll-reference ../0-create-dll/dll.js", + "dll/index.js" + ]); +}); diff --git a/test/configCases/dll-plugin-entry/1-use-dll/webpack.config.js b/test/configCases/dll-plugin-entry/1-use-dll/webpack.config.js new file mode 100644 index 00000000000..c708464f132 --- /dev/null +++ b/test/configCases/dll-plugin-entry/1-use-dll/webpack.config.js @@ -0,0 +1,13 @@ +var webpack = require("../../../../"); + +module.exports = { + plugins: [ + new webpack.DllReferencePlugin({ + manifest: require("../../../js/config/dll-plugin-entry/manifest0.json"), // eslint-disable-line node/no-missing-require + name: "../0-create-dll/dll.js", + scope: "dll", + sourceType: "commonjs2" + }), + new webpack.NamedModulesPlugin() + ] +}; diff --git a/test/configCases/dll-plugin-entry/2-error-non-entry/errors.js b/test/configCases/dll-plugin-entry/2-error-non-entry/errors.js new file mode 100644 index 00000000000..857282ec937 --- /dev/null +++ b/test/configCases/dll-plugin-entry/2-error-non-entry/errors.js @@ -0,0 +1 @@ +module.exports = [[/Can't resolve 'dll\/dep2'/]]; diff --git a/test/configCases/dll-plugin-entry/2-error-non-entry/index.js b/test/configCases/dll-plugin-entry/2-error-non-entry/index.js new file mode 100644 index 00000000000..901f17038f8 --- /dev/null +++ b/test/configCases/dll-plugin-entry/2-error-non-entry/index.js @@ -0,0 +1 @@ +require("dll/dep2"); diff --git a/test/configCases/dll-plugin-entry/2-error-non-entry/webpack.config.js b/test/configCases/dll-plugin-entry/2-error-non-entry/webpack.config.js new file mode 100644 index 00000000000..c708464f132 --- /dev/null +++ b/test/configCases/dll-plugin-entry/2-error-non-entry/webpack.config.js @@ -0,0 +1,13 @@ +var webpack = require("../../../../"); + +module.exports = { + plugins: [ + new webpack.DllReferencePlugin({ + manifest: require("../../../js/config/dll-plugin-entry/manifest0.json"), // eslint-disable-line node/no-missing-require + name: "../0-create-dll/dll.js", + scope: "dll", + sourceType: "commonjs2" + }), + new webpack.NamedModulesPlugin() + ] +}; diff --git a/test/configCases/dll-plugin/1-use-dll/index.js b/test/configCases/dll-plugin/1-use-dll/index.js index 942617dbc79..7f844261291 100644 --- a/test/configCases/dll-plugin/1-use-dll/index.js +++ b/test/configCases/dll-plugin/1-use-dll/index.js @@ -1,40 +1,39 @@ -var should = require("should"); import d from "dll/d"; import { x1, y2 } from "./e"; import { x2, y1 } from "dll/e"; it("should load a module from dll", function() { - require("dll/a").should.be.eql("a"); + expect(require("dll/a")).toBe("a"); }); it("should load a module of non-default type without extension from dll", function() { - require("dll/f").should.be.eql("f"); + expect(require("dll/f")).toBe("f"); }); it("should load an async module from dll", function(done) { require("dll/b")().then(function(c) { - c.should.be.eql({ default: "c" }); + expect(c).toEqual({ default: "c", [Symbol.toStringTag]: "Module" }); done(); }).catch(done); }); it("should load an harmony module from dll (default export)", function() { - d.should.be.eql("d"); + expect(d).toBe("d"); }); it("should load an harmony module from dll (star export)", function() { - x1.should.be.eql(123); - x2.should.be.eql(123); - y1.should.be.eql(456); - y2.should.be.eql(456); + expect(x1).toBe(123); + expect(x2).toBe(123); + expect(y1).toBe(456); + expect(y2).toBe(456); }); it("should load a module with loader applied", function() { - require("dll/g.abc.js").should.be.eql("number"); + expect(require("dll/g.abc.js")).toBe("number"); }); it("should give modules the correct ids", function() { - Object.keys(__webpack_modules__).filter(m => !m.startsWith("../..")).should.be.eql([ + expect(Object.keys(__webpack_modules__).filter(m => !m.startsWith("../.."))).toEqual([ "./index.js", "dll-reference ../0-create-dll/dll.js", "dll/a.js", diff --git a/test/configCases/dll-plugin/2-use-dll-without-scope/index.js b/test/configCases/dll-plugin/2-use-dll-without-scope/index.js index fe5086064d7..704f6b1589c 100644 --- a/test/configCases/dll-plugin/2-use-dll-without-scope/index.js +++ b/test/configCases/dll-plugin/2-use-dll-without-scope/index.js @@ -1,40 +1,39 @@ -var should = require("should"); import d from "../0-create-dll/d"; import { x1, y2 } from "./e"; import { x2, y1 } from "../0-create-dll/e"; it("should load a module from dll", function() { - require("../0-create-dll/a").should.be.eql("a"); + expect(require("../0-create-dll/a")).toBe("a"); }); it("should load a module of non-default type without extension from dll", function() { - require("../0-create-dll/f").should.be.eql("f"); + expect(require("../0-create-dll/f")).toBe("f"); }); it("should load an async module from dll", function(done) { require("../0-create-dll/b")().then(function(c) { - c.should.be.eql({ default: "c" }); + expect(c).toEqual({ default: "c", [Symbol.toStringTag]: "Module" }); done(); }).catch(done); }); it("should load an harmony module from dll (default export)", function() { - d.should.be.eql("d"); + expect(d).toBe("d"); }); it("should load an harmony module from dll (star export)", function() { - x1.should.be.eql(123); - x2.should.be.eql(123); - y1.should.be.eql(456); - y2.should.be.eql(456); + expect(x1).toBe(123); + expect(x2).toBe(123); + expect(y1).toBe(456); + expect(y2).toBe(456); }); it("should load a module with loader applied", function() { - require("../0-create-dll/g.abc.js").should.be.eql("number"); + expect(require("../0-create-dll/g.abc.js")).toBe("number"); }); it("should give modules the correct ids", function() { - Object.keys(__webpack_modules__).filter(m => !m.startsWith("../..")).should.be.eql([ + expect(Object.keys(__webpack_modules__).filter(m => !m.startsWith("../.."))).toEqual([ "../0-create-dll/a.js", "../0-create-dll/b.js", "../0-create-dll/d.js", diff --git a/test/configCases/dll-plugin/3-use-dll-with-hashid/index.js b/test/configCases/dll-plugin/3-use-dll-with-hashid/index.js index 06b1d222a29..0967a518eea 100644 --- a/test/configCases/dll-plugin/3-use-dll-with-hashid/index.js +++ b/test/configCases/dll-plugin/3-use-dll-with-hashid/index.js @@ -1,32 +1,29 @@ -var should = require("should"); import d from "../0-create-dll/d"; import { x1, y2 } from "./e"; import { x2, y1 } from "../0-create-dll/e"; it("should load a module from dll", function() { - require("../0-create-dll/a").should.be.eql("a"); + expect(require("../0-create-dll/a")).toBe("a"); }); it("should load an async module from dll", function(done) { require("../0-create-dll/b")().then(function(c) { - c.should.be.eql({ default: "c" }); + expect(c).toEqual({ default: "c", [Symbol.toStringTag]: "Module" }); done(); }).catch(done); }); it("should load an harmony module from dll (default export)", function() { - d.should.be.eql("d"); + expect(d).toBe("d"); }); it("should load an harmony module from dll (star export)", function() { - x1.should.be.eql(123); - x2.should.be.eql(123); - y1.should.be.eql(456); - y2.should.be.eql(456); + expect(x1).toBe(123); + expect(x2).toBe(123); + expect(y1).toBe(456); + expect(y2).toBe(456); }); it("should load a module with loader applied", function() { - require("../0-create-dll/g.abc.js").should.be.eql("number"); + expect(require("../0-create-dll/g.abc.js")).toBe("number"); }); - - diff --git a/test/configCases/entry/issue-1068/test.js b/test/configCases/entry/issue-1068/test.js index 8eb9b5d027c..5c5e3570f06 100644 --- a/test/configCases/entry/issue-1068/test.js +++ b/test/configCases/entry/issue-1068/test.js @@ -1,7 +1,7 @@ var order = global.order; delete global.order; it("should run the modules in the correct order", function() { - order.should.be.eql([ + expect(order).toEqual([ "a", "b", "c", diff --git a/test/configCases/errors/multi-entry-missing-module/index.js b/test/configCases/errors/multi-entry-missing-module/index.js index 1c088a209b7..e4dec7f2285 100644 --- a/test/configCases/errors/multi-entry-missing-module/index.js +++ b/test/configCases/errors/multi-entry-missing-module/index.js @@ -2,9 +2,9 @@ it("Should use WebpackMissingModule when module is missing with multiple entry s var fs = require("fs"); var path = require("path"); var source = fs.readFileSync(path.join(__dirname, "b.js"), "utf-8"); - source.should.containEql("!(function webpackMissingModule() { var e = new Error(\"Cannot find module \\\"./intentionally-missing-module.js\\\"\"); e.code = 'MODULE_NOT_FOUND'; throw e; }());"); + expect(source).toMatch("!(function webpackMissingModule() { var e = new Error(\"Cannot find module './intentionally-missing-module.js'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }());"); - (function() { + expect(function() { require("./intentionally-missing-module"); - }).should.throw("Cannot find module \"./intentionally-missing-module\""); + }).toThrowError("Cannot find module './intentionally-missing-module'"); }); diff --git a/test/configCases/errors/self-reexport/a.js b/test/configCases/errors/self-reexport/a.js new file mode 100644 index 00000000000..2e7b7dfa33c --- /dev/null +++ b/test/configCases/errors/self-reexport/a.js @@ -0,0 +1 @@ +export { something } from "./a"; diff --git a/test/configCases/errors/self-reexport/aa.js b/test/configCases/errors/self-reexport/aa.js new file mode 100644 index 00000000000..f17945401ed --- /dev/null +++ b/test/configCases/errors/self-reexport/aa.js @@ -0,0 +1,3 @@ +import { something } from "./a"; + +something(); diff --git a/test/configCases/errors/self-reexport/b.js b/test/configCases/errors/self-reexport/b.js new file mode 100644 index 00000000000..b7565f73ca5 --- /dev/null +++ b/test/configCases/errors/self-reexport/b.js @@ -0,0 +1,7 @@ + +import { something, other } from "./b"; + +export { + something as other, + other as something +} diff --git a/test/configCases/errors/self-reexport/bb.js b/test/configCases/errors/self-reexport/bb.js new file mode 100644 index 00000000000..8df66a08574 --- /dev/null +++ b/test/configCases/errors/self-reexport/bb.js @@ -0,0 +1,3 @@ +import {something} from "./b"; + +something(); diff --git a/test/configCases/errors/self-reexport/c1.js b/test/configCases/errors/self-reexport/c1.js new file mode 100644 index 00000000000..6de1ce6ac83 --- /dev/null +++ b/test/configCases/errors/self-reexport/c1.js @@ -0,0 +1 @@ +export { something } from "./c2"; diff --git a/test/configCases/errors/self-reexport/c2.js b/test/configCases/errors/self-reexport/c2.js new file mode 100644 index 00000000000..246f1144e53 --- /dev/null +++ b/test/configCases/errors/self-reexport/c2.js @@ -0,0 +1 @@ +export { something } from "./c1"; diff --git a/test/configCases/errors/self-reexport/cc.js b/test/configCases/errors/self-reexport/cc.js new file mode 100644 index 00000000000..ba0580405c9 --- /dev/null +++ b/test/configCases/errors/self-reexport/cc.js @@ -0,0 +1,3 @@ +import {something} from "./c1"; + +something(); diff --git a/test/configCases/errors/self-reexport/errors.js b/test/configCases/errors/self-reexport/errors.js new file mode 100644 index 00000000000..3d8a2be43ec --- /dev/null +++ b/test/configCases/errors/self-reexport/errors.js @@ -0,0 +1,5 @@ +module.exports = [ + [/Circular reexports "\.\/a.js"\.something -\(circular\)-> "\.\/a.js"\.something/], + [/Circular reexports "\.\/b.js"\.other --> "\.\/b.js"\.something -\(circular\)-> "\.\/b.js"\.other/], + [/Circular reexports "\.\/c2.js"\.something --> "\.\/c1.js"\.something -\(circular\)-> "\.\/c2.js"\.something/] +]; diff --git a/test/configCases/errors/self-reexport/index.js b/test/configCases/errors/self-reexport/index.js new file mode 100644 index 00000000000..3440faac4a9 --- /dev/null +++ b/test/configCases/errors/self-reexport/index.js @@ -0,0 +1,7 @@ +it("should not crash on incorrect exports", function() { + if(Math.random() < -1) { + import(/* webpackChunkName: "a" */ "./aa"); + import(/* webpackChunkName: "b" */ "./bb"); + import(/* webpackChunkName: "c" */ "./cc"); + } +}); diff --git a/test/configCases/errors/self-reexport/webpack.config.js b/test/configCases/errors/self-reexport/webpack.config.js new file mode 100644 index 00000000000..b913c78abb1 --- /dev/null +++ b/test/configCases/errors/self-reexport/webpack.config.js @@ -0,0 +1,3 @@ +module.exports = { + mode: "production" +}; diff --git a/test/configCases/externals/externals-in-chunk/index.js b/test/configCases/externals/externals-in-chunk/index.js index 7dcfdcf9f32..f6b3a7c1fa3 100644 --- a/test/configCases/externals/externals-in-chunk/index.js +++ b/test/configCases/externals/externals-in-chunk/index.js @@ -1,16 +1,16 @@ it("should move externals in chunks into entry chunk", function(done) { var fs = require("fs"); var source = fs.readFileSync(__filename, "utf-8"); - source.should.containEql("1+" + (1+1)); - source.should.containEql("3+" + (2+2)); - source.should.containEql("5+" + (3+3)); + expect(source).toMatch("1+" + (1+1)); + expect(source).toMatch("3+" + (2+2)); + expect(source).toMatch("5+" + (3+3)); import("./chunk").then(function(chunk) { - chunk.default.a.should.be.eql(3); + expect(chunk.default.a).toBe(3); chunk.default.b.then(function(chunk2) { - chunk2.default.should.be.eql(7); + expect(chunk2.default).toBe(7); import("external3").then(function(ex) { - ex.default.should.be.eql(11); + expect(ex.default).toBe(11); done(); }); }); diff --git a/test/configCases/externals/externals-in-commons-chunk/index.js b/test/configCases/externals/externals-in-commons-chunk/index.js index b49eb2c2397..9eaec4bc753 100644 --- a/test/configCases/externals/externals-in-commons-chunk/index.js +++ b/test/configCases/externals/externals-in-commons-chunk/index.js @@ -1,18 +1,17 @@ it("should not move externals into the commons chunk", function() { - require("should"); - var fs = require("fs"); - var source1 = fs.readFileSync(__dirname + "/main.js", "utf-8"); - var source2 = fs.readFileSync(__dirname + "/other.js", "utf-8"); - var source3 = fs.readFileSync(__dirname + "/common.js", "utf-8"); - source1.should.containEql("1+" + (1+1)); - source1.should.containEql("3+" + (2+2)); - source2.should.containEql("1+" + (1+1)); - source2.should.containEql("5+" + (3+3)); - source3.should.not.containEql("1+" + (1+1)); - source3.should.not.containEql("3+" + (2+2)); - source3.should.not.containEql("5+" + (3+3)); + var fs = require("fs"); + var source1 = fs.readFileSync(__dirname + "/main.js", "utf-8"); + var source2 = fs.readFileSync(__dirname + "/other.js", "utf-8"); + var source3 = fs.readFileSync(__dirname + "/common.js", "utf-8"); + expect(source1).toMatch("1+" + (1+1)); + expect(source1).toMatch("3+" + (2+2)); + expect(source2).toMatch("1+" + (1+1)); + expect(source2).toMatch("5+" + (3+3)); + expect(source3).not.toMatch("1+" + (1+1)); + expect(source3).not.toMatch("3+" + (2+2)); + expect(source3).not.toMatch("5+" + (3+3)); - require("external"); - require("external2"); - require("./module"); + require("external"); + require("external2"); + require("./module"); }); diff --git a/test/configCases/externals/harmony/index.js b/test/configCases/externals/harmony/index.js index 904a2a0d1a5..c0e029c9936 100644 --- a/test/configCases/externals/harmony/index.js +++ b/test/configCases/externals/harmony/index.js @@ -1,5 +1,5 @@ import external from "external"; it("should harmony import a dependency", function() { - external.should.be.eql("abc"); + expect(external).toBe("abc"); }); diff --git a/test/configCases/externals/non-umd-externals-umd/index.js b/test/configCases/externals/non-umd-externals-umd/index.js index 9ef058ee968..fc0b3fc1046 100644 --- a/test/configCases/externals/non-umd-externals-umd/index.js +++ b/test/configCases/externals/non-umd-externals-umd/index.js @@ -1,23 +1,22 @@ -require("should"); var fs = require("fs"); var path = require("path"); it("should correctly import a UMD external", function() { var external = require("external0"); - external.should.be.eql("module 0"); + expect(external).toBe("module 0"); }); it("should contain `require()` statements for the UMD external", function() { var source = fs.readFileSync(path.join(__dirname, "bundle0.js"), "utf-8"); - source.should.containEql("require(\"external0\")"); + expect(source).toMatch("require(\"external0\")"); }); it("should correctly import a non-UMD external", function() { var external = require("external1"); - external.should.be.eql("abc"); + expect(external).toBe("abc"); }); it("should not contain `require()` statements for the non-UMD external", function() { var source = fs.readFileSync(path.join(__dirname, "bundle0.js"), "utf-8"); - source.should.not.containEql("require(\"'abc'\")"); + expect(source).not.toMatch("require(\"'abc'\")"); }); diff --git a/test/configCases/externals/non-umd-externals-umd2/index.js b/test/configCases/externals/non-umd-externals-umd2/index.js index fdb4a1f507b..dac36a05afe 100644 --- a/test/configCases/externals/non-umd-externals-umd2/index.js +++ b/test/configCases/externals/non-umd-externals-umd2/index.js @@ -1,23 +1,22 @@ -require("should"); var fs = require("fs"); var path = require("path"); it("should correctly import a UMD2 external", function() { var external = require("external0"); - external.should.be.eql("module 0"); + expect(external).toBe("module 0"); }); it("should contain `require()` statements for the UMD2 external", function() { var source = fs.readFileSync(path.join(__dirname, "bundle0.js"), "utf-8"); - source.should.containEql("require(\"external0\")"); + expect(source).toMatch("require(\"external0\")"); }); it("should correctly import a non-UMD2 external", function() { var external = require("external1"); - external.should.be.eql("abc"); + expect(external).toBe("abc"); }); it("should not contain `require()` statements for the non-UMD2 external", function() { var source = fs.readFileSync(path.join(__dirname, "bundle0.js"), "utf-8"); - source.should.not.containEql("require(\"'abc'\")"); + expect(source).not.toMatch("require(\"'abc'\")"); }); diff --git a/test/configCases/externals/optional-externals-cjs/index.js b/test/configCases/externals/optional-externals-cjs/index.js index d38bf3d300d..70700065cbe 100644 --- a/test/configCases/externals/optional-externals-cjs/index.js +++ b/test/configCases/externals/optional-externals-cjs/index.js @@ -2,9 +2,9 @@ it("should not fail on optional externals", function() { try { require("external"); } catch(e) { - e.should.be.instanceof(Error); - e.code.should.be.eql("MODULE_NOT_FOUND"); + expect(e).toBeInstanceOf(Error); + expect(e.code).toBe("MODULE_NOT_FOUND"); return; } throw new Error("It doesn't fail"); -}); \ No newline at end of file +}); diff --git a/test/configCases/externals/optional-externals-root/index.js b/test/configCases/externals/optional-externals-root/index.js index d38bf3d300d..70700065cbe 100644 --- a/test/configCases/externals/optional-externals-root/index.js +++ b/test/configCases/externals/optional-externals-root/index.js @@ -2,9 +2,9 @@ it("should not fail on optional externals", function() { try { require("external"); } catch(e) { - e.should.be.instanceof(Error); - e.code.should.be.eql("MODULE_NOT_FOUND"); + expect(e).toBeInstanceOf(Error); + expect(e.code).toBe("MODULE_NOT_FOUND"); return; } throw new Error("It doesn't fail"); -}); \ No newline at end of file +}); diff --git a/test/configCases/externals/optional-externals-umd/index.js b/test/configCases/externals/optional-externals-umd/index.js index d38bf3d300d..70700065cbe 100644 --- a/test/configCases/externals/optional-externals-umd/index.js +++ b/test/configCases/externals/optional-externals-umd/index.js @@ -2,9 +2,9 @@ it("should not fail on optional externals", function() { try { require("external"); } catch(e) { - e.should.be.instanceof(Error); - e.code.should.be.eql("MODULE_NOT_FOUND"); + expect(e).toBeInstanceOf(Error); + expect(e.code).toBe("MODULE_NOT_FOUND"); return; } throw new Error("It doesn't fail"); -}); \ No newline at end of file +}); diff --git a/test/configCases/externals/optional-externals-umd2-mixed/index.js b/test/configCases/externals/optional-externals-umd2-mixed/index.js index 67be49aaacd..bc72d6a7722 100644 --- a/test/configCases/externals/optional-externals-umd2-mixed/index.js +++ b/test/configCases/externals/optional-externals-umd2-mixed/index.js @@ -3,9 +3,9 @@ it("should not fail on optional externals", function() { try { require("external"); } catch(e) { - e.should.be.instanceof(Error); - e.code.should.be.eql("MODULE_NOT_FOUND"); + expect(e).toBeInstanceOf(Error); + expect(e.code).toBe("MODULE_NOT_FOUND"); return; } throw new Error("It doesn't fail"); -}); \ No newline at end of file +}); diff --git a/test/configCases/externals/optional-externals-umd2/index.js b/test/configCases/externals/optional-externals-umd2/index.js index d38bf3d300d..70700065cbe 100644 --- a/test/configCases/externals/optional-externals-umd2/index.js +++ b/test/configCases/externals/optional-externals-umd2/index.js @@ -2,9 +2,9 @@ it("should not fail on optional externals", function() { try { require("external"); } catch(e) { - e.should.be.instanceof(Error); - e.code.should.be.eql("MODULE_NOT_FOUND"); + expect(e).toBeInstanceOf(Error); + expect(e.code).toBe("MODULE_NOT_FOUND"); return; } throw new Error("It doesn't fail"); -}); \ No newline at end of file +}); diff --git a/test/configCases/filename-template/module-filename-template/index.js b/test/configCases/filename-template/module-filename-template/index.js index 4ba38d5ad86..a8a8e6fa5e1 100644 --- a/test/configCases/filename-template/module-filename-template/index.js +++ b/test/configCases/filename-template/module-filename-template/index.js @@ -2,7 +2,7 @@ it("should include test.js in SourceMap", function() { var fs = require("fs"); var source = fs.readFileSync(__filename + ".map", "utf-8"); var map = JSON.parse(source); - map.sources.should.containEql("dummy:///./test.js"); + expect(map.sources).toContain("dummy:///./test.js"); }); require.include("./test.js"); diff --git a/test/configCases/hash-length/hashed-module-ids/index.js b/test/configCases/hash-length/hashed-module-ids/index.js index 903df73bd5e..9a989c6c4c6 100644 --- a/test/configCases/hash-length/hashed-module-ids/index.js +++ b/test/configCases/hash-length/hashed-module-ids/index.js @@ -2,7 +2,7 @@ it("should have unique ids", function () { var ids = []; for(var i = 1; i <= 15; i++) { var id = require("./files/file" + i + ".js"); - ids.indexOf(id).should.be.eql(-1); + expect(ids.indexOf(id)).toBe(-1); ids.push(id); } }); diff --git a/test/configCases/hash-length/output-filename/test.config.js b/test/configCases/hash-length/output-filename/test.config.js index a6d2483ca2f..c378cab5525 100644 --- a/test/configCases/hash-length/output-filename/test.config.js +++ b/test/configCases/hash-length/output-filename/test.config.js @@ -1,5 +1,4 @@ var fs = require("fs"); -require("should"); var findFile = function(files, regex) { return files.find(function(file) { @@ -10,7 +9,7 @@ var findFile = function(files, regex) { }; var verifyFilenameLength = function(filename, expectedNameLength) { - filename.should.match(new RegExp("^.{" + expectedNameLength + "}$")); + expect(filename).toMatch(new RegExp("^.{" + expectedNameLength + "}$")); }; module.exports = { diff --git a/test/configCases/ignore/only-resource-context/test.js b/test/configCases/ignore/only-resource-context/test.js index f8d17ff9072..9fd0c934b91 100644 --- a/test/configCases/ignore/only-resource-context/test.js +++ b/test/configCases/ignore/only-resource-context/test.js @@ -6,16 +6,16 @@ it("should ignore ignored resources", function() { require("./src/" + mod); }; - (function() { + expect(function() { folderBContext("ignored-module"); - }).should.throw(); + }).toThrowError(); }); it("should not ignore resources that do not match", function() { const folderBContext = function(mod) { require("./src/" + mod); }; - (function() { + expect(function() { folderBContext("normal-module"); - }).should.not.throw(); + }).not.toThrowError(); }); diff --git a/test/configCases/ignore/only-resource/test.js b/test/configCases/ignore/only-resource/test.js index 64d65a0410f..93ce8146bd8 100644 --- a/test/configCases/ignore/only-resource/test.js +++ b/test/configCases/ignore/only-resource/test.js @@ -2,12 +2,12 @@ "use strict"; it("should ignore ignored resources", function() { - (function() { + expect(function() { require("./ignored-module"); - }).should.throw(); + }).toThrowError(); }); it("should not ignore resources that do not match", function() { - (function() { + expect(function() { require("./normal-module"); - }).should.not.throw(); + }).not.toThrowError(); }); diff --git a/test/configCases/ignore/resource-and-context-contextmodule/test.js b/test/configCases/ignore/resource-and-context-contextmodule/test.js index fbd74da53a5..150d2d127e2 100644 --- a/test/configCases/ignore/resource-and-context-contextmodule/test.js +++ b/test/configCases/ignore/resource-and-context-contextmodule/test.js @@ -6,9 +6,9 @@ it("should ignore context modules that match resource regex and context", functi require("./folder-b/" + mod); }; - (function() { + expect(function() { folderBContext("normal-module"); - }).should.throw(); + }).toThrowError(); }); it("should not ignore context modules that dont match the resource", function() { @@ -16,9 +16,9 @@ it("should not ignore context modules that dont match the resource", function() require("./folder-b/" + mod); }; - (function() { + expect(function() { folderBContext("only-context-match"); - }).should.not.throw(); + }).not.toThrowError(); }); it("should not ignore context modules that dont match the context", function() { @@ -26,10 +26,10 @@ it("should not ignore context modules that dont match the context", function() { require("./folder-a/" + mod); }; - (function() { + expect(function() { folderBContext("normal-module"); - }).should.not.throw(); - (function() { + }).not.toThrowError(); + expect(function() { folderBContext("ignored-module"); - }).should.not.throw(); + }).not.toThrowError(); }); diff --git a/test/configCases/ignore/resource-and-context/test.js b/test/configCases/ignore/resource-and-context/test.js index 48149de447e..ae4f1ae2c67 100644 --- a/test/configCases/ignore/resource-and-context/test.js +++ b/test/configCases/ignore/resource-and-context/test.js @@ -2,19 +2,19 @@ "use strict"; it("should ignore resources that match resource regex and context", function() { - (function() { + expect(function() { require("./folder-b/normal-module"); - }).should.throw(); + }).toThrowError(); }); it("should not ignore resources that match resource but not context", function() { - (function() { + expect(function() { require("./folder-a/normal-module"); - }).should.not.throw(); + }).not.toThrowError(); }); it("should not ignore resources that do not match resource but do match context", function() { - (function() { + expect(function() { require("./folder-b/only-context-match"); - }).should.not.throw(); + }).not.toThrowError(); }); diff --git a/test/configCases/issues/issue-7470/index.js b/test/configCases/issues/issue-7470/index.js new file mode 100644 index 00000000000..6267ef7b114 --- /dev/null +++ b/test/configCases/issues/issue-7470/index.js @@ -0,0 +1,3 @@ +it("should set NODE_ENV according to mode", () => { + expect(process.env.NODE_ENV).toBe(__MODE__); +}); diff --git a/test/configCases/issues/issue-7470/webpack.config.js b/test/configCases/issues/issue-7470/webpack.config.js new file mode 100644 index 00000000000..4d4a87ba768 --- /dev/null +++ b/test/configCases/issues/issue-7470/webpack.config.js @@ -0,0 +1,21 @@ +"use strict"; + +const DefinePlugin = require("../../../../lib/DefinePlugin"); + +module.exports = [ + { + name: "development", + mode: "development", + plugins: [new DefinePlugin({ __MODE__: `"development"` })] + }, + { + name: "production", + mode: "production", + plugins: [new DefinePlugin({ __MODE__: `"production"` })] + }, + { + name: "none", + mode: "none", + plugins: [new DefinePlugin({ __MODE__: `"none"` })] + } +]; diff --git a/test/configCases/library/1-use-library/default-test.js b/test/configCases/library/1-use-library/default-test.js index 0f007524366..ea4e84d0d16 100644 --- a/test/configCases/library/1-use-library/default-test.js +++ b/test/configCases/library/1-use-library/default-test.js @@ -2,6 +2,6 @@ import d from "library"; var data = require("library"); it("should get default export from library (" + NAME + ")", function() { - data.should.be.eql("default-value"); - d.should.be.eql("default-value"); + expect(data).toBe("default-value"); + expect(d).toBe("default-value"); }); diff --git a/test/configCases/library/1-use-library/global-test.js b/test/configCases/library/1-use-library/global-test.js index 9ebb91168f2..f0f8efb8c3e 100644 --- a/test/configCases/library/1-use-library/global-test.js +++ b/test/configCases/library/1-use-library/global-test.js @@ -1,7 +1,7 @@ var data = require("library"); it("should be able get items from library (" + NAME + ")", function() { - data.should.have.property("default").be.eql("default-value"); - data.should.have.property("a").be.eql("a"); - data.should.have.property("b").be.eql("b"); + expect(data).toHaveProperty("default", "default-value"); + expect(data).toHaveProperty("a", "a"); + expect(data).toHaveProperty("b", "b"); }); diff --git a/test/configCases/library/1-use-library/index.js b/test/configCases/library/1-use-library/index.js index c8b879c52c3..726072db8f0 100644 --- a/test/configCases/library/1-use-library/index.js +++ b/test/configCases/library/1-use-library/index.js @@ -2,13 +2,13 @@ import d from "library"; import { a, b, external } from "library"; it("should be able to import harmony exports from library (" + NAME + ")", function() { - d.should.be.eql("default-value"); - a.should.be.eql("a"); - b.should.be.eql("b"); + expect(d).toBe("default-value"); + expect(a).toBe("a"); + expect(b).toBe("b"); if(typeof TEST_EXTERNAL !== "undefined" && TEST_EXTERNAL) { - external.should.be.eql(["external"]); - external.should.be.equal(require("external")); + expect(external).toEqual(["external"]); + expect(external).toBe(require("external")); } else { - external.should.be.eql("non-external"); + expect(external).toBe("non-external"); } }); diff --git a/test/configCases/library/b/index.js b/test/configCases/library/b/index.js index ec6626bc0bf..6fe35d71849 100644 --- a/test/configCases/library/b/index.js +++ b/test/configCases/library/b/index.js @@ -4,8 +4,8 @@ it("should run", function() { it("should have exported", function(done) { setTimeout(function() { - exported.object.should.be.eql(module.exports.object); - exported.second.should.be.eql(module.exports.second); + expect(exported.object).toBe(module.exports.object); + expect(exported.second).toBe(module.exports.second); done(); }, 1); }); diff --git a/test/configCases/library/umd-array/index.js b/test/configCases/library/umd-array/index.js new file mode 100644 index 00000000000..9970130cc2c --- /dev/null +++ b/test/configCases/library/umd-array/index.js @@ -0,0 +1,3 @@ +it("should run", function() { + +}); \ No newline at end of file diff --git a/test/configCases/library/umd-array/webpack.config.js b/test/configCases/library/umd-array/webpack.config.js new file mode 100644 index 00000000000..fba3d5e17a1 --- /dev/null +++ b/test/configCases/library/umd-array/webpack.config.js @@ -0,0 +1,10 @@ +module.exports = { + output: { + libraryTarget: "umd", + library: { + root: ["test", "library"], + amd: "test-library", + commonjs: "test-library" + } + } +}; diff --git a/test/configCases/loaders/generate-ident/index.js b/test/configCases/loaders/generate-ident/index.js index 1ba367dbebc..f4693e19cb4 100644 --- a/test/configCases/loaders/generate-ident/index.js +++ b/test/configCases/loaders/generate-ident/index.js @@ -1,6 +1,6 @@ it("should correctly pass complex query object with remaining request", function() { - require("./a").should.be.eql("ok"); - require("./b").should.be.eql("maybe"); - require("./c").should.be.eql("yes"); - require("./d").should.be.eql("ok"); + expect(require("./a")).toBe("ok"); + expect(require("./b")).toBe("maybe"); + expect(require("./c")).toBe("yes"); + expect(require("./d")).toBe("ok"); }); diff --git a/test/configCases/loaders/hot-in-context/index.js b/test/configCases/loaders/hot-in-context/index.js index 87b8abacaab..a150c3a92f0 100644 --- a/test/configCases/loaders/hot-in-context/index.js +++ b/test/configCases/loaders/hot-in-context/index.js @@ -1,3 +1,3 @@ it("should have hmr flag in loader context", function() { - require("./loader!").should.be.eql(!!module.hot); + expect(require("./loader!")).toBe(!!module.hot); }); diff --git a/test/configCases/loaders/issue-3320/index.js b/test/configCases/loaders/issue-3320/index.js index 7dbdbd57603..7d496b8ebef 100644 --- a/test/configCases/loaders/issue-3320/index.js +++ b/test/configCases/loaders/issue-3320/index.js @@ -1,23 +1,23 @@ it("should resolve aliased loader module with query", function() { var foo = require('./a'); - foo.should.be.eql("someMessage"); + expect(foo).toBe("someMessage"); }); it("should favor explicit loader query over aliased query (options in rule)", function() { var foo = require('./b'); - foo.should.be.eql("someOtherMessage"); + expect(foo).toBe("someOtherMessage"); }); it("should favor explicit loader query over aliased query (inline query in rule)", function() { var foo = require('./b2'); - foo.should.be.eql("someOtherMessage"); + expect(foo).toBe("someOtherMessage"); }); it("should favor explicit loader query over aliased query (inline query in rule.use)", function() { var foo = require('./b3'); - foo.should.be.eql("someOtherMessage"); + expect(foo).toBe("someOtherMessage"); }); diff --git a/test/configCases/loaders/pre-post-loader/index.js b/test/configCases/loaders/pre-post-loader/index.js index 6a18d04e2ba..d69ad146f71 100644 --- a/test/configCases/loaders/pre-post-loader/index.js +++ b/test/configCases/loaders/pre-post-loader/index.js @@ -1,6 +1,6 @@ it("should apply pre and post loaders correctly", function() { - require("./a").should.be.eql("resource loader2 loader1 loader3"); - require("!./a").should.be.eql("resource loader2 loader3"); - require("!!./a").should.be.eql("resource"); - require("-!./a").should.be.eql("resource loader3"); + expect(require("./a")).toBe("resource loader2 loader1 loader3"); + expect(require("!./a")).toBe("resource loader2 loader3"); + expect(require("!!./a")).toBe("resource"); + expect(require("-!./a")).toBe("resource loader3"); }); diff --git a/test/configCases/loaders/remaining-request/index.js b/test/configCases/loaders/remaining-request/index.js index 7285ccdba42..53247f52994 100644 --- a/test/configCases/loaders/remaining-request/index.js +++ b/test/configCases/loaders/remaining-request/index.js @@ -1,3 +1,3 @@ it("should correctly pass complex query object with remaining request", function() { - require("./a").should.be.eql("ok"); + expect(require("./a")).toBe("ok"); }); diff --git a/test/configCases/module-name/different-issuers-for-same-module/a.js b/test/configCases/module-name/different-issuers-for-same-module/a.js new file mode 100644 index 00000000000..1463fc5989a --- /dev/null +++ b/test/configCases/module-name/different-issuers-for-same-module/a.js @@ -0,0 +1 @@ +module.exports = require("./c"); diff --git a/test/configCases/module-name/different-issuers-for-same-module/b.js b/test/configCases/module-name/different-issuers-for-same-module/b.js new file mode 100644 index 00000000000..1463fc5989a --- /dev/null +++ b/test/configCases/module-name/different-issuers-for-same-module/b.js @@ -0,0 +1 @@ +module.exports = require("./c"); diff --git a/test/configCases/module-name/different-issuers-for-same-module/c.js b/test/configCases/module-name/different-issuers-for-same-module/c.js new file mode 100644 index 00000000000..3cec1b77aad --- /dev/null +++ b/test/configCases/module-name/different-issuers-for-same-module/c.js @@ -0,0 +1 @@ +module.exports = module.id; diff --git a/test/configCases/module-name/different-issuers-for-same-module/loader-a.js b/test/configCases/module-name/different-issuers-for-same-module/loader-a.js new file mode 100644 index 00000000000..bd8581ca4a4 --- /dev/null +++ b/test/configCases/module-name/different-issuers-for-same-module/loader-a.js @@ -0,0 +1,3 @@ +module.exports = function(src) { + return `module.exports = "loader-a" + module.id`; +}; diff --git a/test/configCases/module-name/different-issuers-for-same-module/loader-b.js b/test/configCases/module-name/different-issuers-for-same-module/loader-b.js new file mode 100644 index 00000000000..5365e2fd355 --- /dev/null +++ b/test/configCases/module-name/different-issuers-for-same-module/loader-b.js @@ -0,0 +1,3 @@ +module.exports = function(src) { + return `module.exports = "loader-b" + module.id`; +}; diff --git a/test/configCases/module-name/different-issuers-for-same-module/test.js b/test/configCases/module-name/different-issuers-for-same-module/test.js new file mode 100644 index 00000000000..c68cda023bf --- /dev/null +++ b/test/configCases/module-name/different-issuers-for-same-module/test.js @@ -0,0 +1,6 @@ +it("should assign different names to the same module with different issuers ", function() { + var regex = "\\./c\\.js\\?\\w{4}"; + expect(require("./c")).toMatch(new RegExp(regex)); + expect(require("./a")).toMatch(new RegExp("loader-a" + regex)); + expect(require("./b")).toMatch(new RegExp("loader-b" + regex)); +}); diff --git a/test/configCases/module-name/different-issuers-for-same-module/webpack.config.js b/test/configCases/module-name/different-issuers-for-same-module/webpack.config.js new file mode 100644 index 00000000000..6527d721c87 --- /dev/null +++ b/test/configCases/module-name/different-issuers-for-same-module/webpack.config.js @@ -0,0 +1,18 @@ +module.exports = { + mode: "development", + entry: ["./a", "./b", "./test"], + module: { + rules: [ + { + test: /c\.js/, + issuer: /a\.js/, + loader: "./loader-a" + }, + { + test: /c\.js/, + issuer: /b\.js/, + loader: "./loader-b" + } + ] + } +}; diff --git a/test/configCases/no-parse/module.exports/index.js b/test/configCases/no-parse/module.exports/index.js index fe0db2daa21..3db446c8296 100644 --- a/test/configCases/no-parse/module.exports/index.js +++ b/test/configCases/no-parse/module.exports/index.js @@ -1,4 +1,4 @@ it("should correctly export stuff from not parsed modules", function() { - require("./not-parsed-a").should.be.eql("ok"); - require("./not-parsed-b").should.be.eql("ok"); + expect(require("./not-parsed-a")).toBe("ok"); + expect(require("./not-parsed-b")).toBe("ok"); }); diff --git a/test/configCases/no-parse/no-parse-function/index.js b/test/configCases/no-parse/no-parse-function/index.js index fe0db2daa21..3db446c8296 100644 --- a/test/configCases/no-parse/no-parse-function/index.js +++ b/test/configCases/no-parse/no-parse-function/index.js @@ -1,4 +1,4 @@ it("should correctly export stuff from not parsed modules", function() { - require("./not-parsed-a").should.be.eql("ok"); - require("./not-parsed-b").should.be.eql("ok"); + expect(require("./not-parsed-a")).toBe("ok"); + expect(require("./not-parsed-b")).toBe("ok"); }); diff --git a/test/configCases/parsing/context/index.js b/test/configCases/parsing/context/index.js index baffd5e40e4..c11c62d9e65 100644 --- a/test/configCases/parsing/context/index.js +++ b/test/configCases/parsing/context/index.js @@ -1,5 +1,5 @@ it("should automatically create contexts", function() { var template = "tmpl", templateFull = "./tmpl.js"; - require("../../../cases/parsing/context/templates/templateLoader")(templateFull).should.be.eql("test template"); - require("../../../cases/parsing/context/templates/templateLoaderIndirect")(templateFull).should.be.eql("test template"); -}); \ No newline at end of file + expect(require("../../../cases/parsing/context/templates/templateLoader")(templateFull)).toBe("test template"); + expect(require("../../../cases/parsing/context/templates/templateLoaderIndirect")(templateFull)).toBe("test template"); +}); diff --git a/test/configCases/parsing/extended-api/index.js b/test/configCases/parsing/extended-api/index.js index b33fb25bdd9..6b10bd1e430 100644 --- a/test/configCases/parsing/extended-api/index.js +++ b/test/configCases/parsing/extended-api/index.js @@ -1,8 +1,8 @@ it("should have __webpack_hash__", function() { - (typeof __webpack_hash__).should.be.type("string"); - __webpack_hash__.should.match(/^[0-9a-f]{20}$/); + expect(__webpack_hash__).toBeTypeOf("string"); + expect(__webpack_hash__).toMatch(/^[0-9a-f]{20}$/); }); it("should have __webpack_chunkname__", function() { - (typeof __webpack_chunkname__).should.be.type("string"); - __webpack_chunkname__.should.be.eql('other'); + expect(__webpack_chunkname__).toBeTypeOf("string"); + expect(__webpack_chunkname__).toBe("other"); }); diff --git a/test/configCases/parsing/harmony-global/index.js b/test/configCases/parsing/harmony-global/index.js index fde7f60f6cd..d61502ebe69 100644 --- a/test/configCases/parsing/harmony-global/index.js +++ b/test/configCases/parsing/harmony-global/index.js @@ -1,5 +1,4 @@ -require("should"); it("should be able to use global in a harmony module", function() { var x = require("./module1"); - (x.default === global).should.be.ok(); + expect(x.default === global).toBeTruthy(); }); diff --git a/test/configCases/parsing/harmony-this-concat/index.js b/test/configCases/parsing/harmony-this-concat/index.js index af774470be5..e2b94f2eb89 100644 --- a/test/configCases/parsing/harmony-this-concat/index.js +++ b/test/configCases/parsing/harmony-this-concat/index.js @@ -7,16 +7,16 @@ import * as abc from "./abc"; function x() { throw new Error("should not be executed"); } it("should have this = undefined on imported non-strict functions", function() { x - d().should.be.eql("undefined"); + expect(d()).toBe("undefined"); x - a().should.be.eql("undefined"); + expect(a()).toBe("undefined"); x - B().should.be.eql("undefined"); + expect(B()).toBe("undefined"); x - abc.a().should.be.type("object"); + expect(abc.a()).toMatchObject({}); x var thing = abc.a(); - Object.keys(thing).should.be.eql(["a", "b", "default"]); + expect(Object.keys(thing)).toEqual(["a", "b", "default"]); }); import C2, { C } from "./new"; @@ -25,9 +25,9 @@ import * as New from "./new"; it("should be possible to use new correctly", function() { x - new C().should.match({ok: true}); + expect(new C()).toEqual({ok: true}); x - new C2().should.match({ok: true}); + expect(new C2()).toEqual({ok: true}); x - new New.C().should.match({ok: true}); + expect(new New.C()).toEqual({ok: true}); }); diff --git a/test/configCases/parsing/harmony-this/index.js b/test/configCases/parsing/harmony-this/index.js index 06933c8d674..a8af2750006 100644 --- a/test/configCases/parsing/harmony-this/index.js +++ b/test/configCases/parsing/harmony-this/index.js @@ -1,64 +1,73 @@ "use strict"; -import should from "should"; import {extendThisClass, returnThisArrow, returnThisMember, that} from "./abc"; import d, {a, b as B, C as _C, D as _D, E, F, f1, f2, f3, G} from "./abc"; +import {bindThis, callThis, applyThis} from "./issue-7213"; import * as abc from "./abc"; -it("should have this = undefined on harmony modules", function() { - (typeof that).should.be.eql("undefined"); - (typeof abc.that).should.be.eql("undefined"); - (typeof returnThisArrow()).should.be.eql("undefined"); - (typeof abc.returnThisArrow()).should.be.eql("undefined"); - (function() { +it("should have this = undefined on harmony modules", () => { + expect((typeof that)).toBe("undefined"); + expect((typeof abc.that)).toBe("undefined"); + expect((typeof returnThisArrow())).toBe("undefined"); + expect((typeof abc.returnThisArrow())).toBe("undefined"); + expect(function() { returnThisMember(); - }).should.throw(); - (function() { + }).toThrowError(); + expect(function() { abc.returnThisMember(); - }).should.throw(); - (function() { + }).toThrowError(); + expect(function() { extendThisClass(); - }).should.throw(); + }).toThrowError(); }); -it("should not break classes and functions", function() { - (new _C).foo().should.be.eql("bar"); - (new _C).bar().should.be.eql("bar"); - (new _D).prop().should.be.eql("ok"); - E.foo().should.be.eql("bar"); - F.should.be.eql("ok"); - f1.call({x: "f1"}).should.be.eql("f1"); - f2.call({x: "f2"}).should.be.eql("f2"); - should(f3.call("f3")).be.eql(undefined); - should(f3()).be.eql(undefined); - (new G("ok")).getX().should.be.eql("ok"); +it("should not break classes and functions", () => { + expect((new _C).foo()).toBe("bar"); + expect((new _C).bar()).toBe("bar"); + expect((new _D).prop()).toBe("ok"); + expect(E.foo()).toBe("bar"); + expect(F).toBe("ok"); + expect(f1.call({x: "f1"})).toBe("f1"); + expect(f2.call({x: "f2"})).toBe("f2"); + expect(f3.call("f3")).toBe(undefined); + expect(f3()).toBe(undefined); + expect((new G("ok")).getX()).toBe("ok"); }); -function x() { throw new Error("should not be executed"); } -it("should have this = undefined on imported non-strict functions", function() { +function x() { + throw new Error("should not be executed"); +} + +it("should have this = undefined on imported non-strict functions", () => { x - d().should.be.eql("undefined"); + expect(d()).toBe("undefined"); x - a().should.be.eql("undefined"); + expect(a()).toBe("undefined"); x - B().should.be.eql("undefined"); + expect(B()).toBe("undefined"); x - abc.a().should.be.type("object"); + expect(abc.a()).toBeTypeOf("object"); x var thing = abc.a(); - Object.keys(thing).should.be.eql(Object.keys(abc)); + expect(Object.keys(thing)).toEqual(Object.keys(abc)); }); import C2, { C } from "./new"; import * as New from "./new"; -it("should be possible to use new correctly", function() { +it("should be possible to use new correctly", () => { x - new C().should.match({ok: true}); + expect(new C()).toEqual({ok: true}); x - new C2().should.match({ok: true}); + expect(new C2()).toEqual({ok: true}); x - new New.C().should.match({ok: true}); + expect(new New.C()).toEqual({ok: true}); +}); + +it("should not break Babel arrow function transform", () => { + expect(bindThis()).toBe(undefined); + expect(callThis).toBe(undefined); + expect(applyThis).toBe(undefined); }); diff --git a/test/configCases/parsing/harmony-this/issue-7213.js b/test/configCases/parsing/harmony-this/issue-7213.js new file mode 100644 index 00000000000..0e3a36512b7 --- /dev/null +++ b/test/configCases/parsing/harmony-this/issue-7213.js @@ -0,0 +1,20 @@ +// This helper is taken from Babel +function _newArrowCheck(innerThis, boundThis) { + if (innerThis !== boundThis) { + throw new TypeError("Cannot instantiate an arrow function"); + } +} + +let _this = this; +export let bindThis = function() { + _newArrowCheck(this, _this); + return this +}.bind(this); + +export let callThis = function() { + return this +}.call(this) + +export let applyThis = function() { + return this +}.apply(this) diff --git a/test/configCases/parsing/import-ignore/index.js b/test/configCases/parsing/import-ignore/index.js new file mode 100644 index 00000000000..1706a861bd0 --- /dev/null +++ b/test/configCases/parsing/import-ignore/index.js @@ -0,0 +1,8 @@ +const fs = require("fs"); +const path = require("path"); + +it("should be able to ignore import()", () => { + const source = fs.readFileSync(path.join(__dirname, "bundle1.js"), "utf-8"); + expect(source).toMatch(`import(/* webpackIgnore: true */ "./other2.js")`); + expect(source).not.toMatch(`import(/* webpackIgnore: false */ "./other3.js")`); +}); diff --git a/test/configCases/parsing/import-ignore/other.js b/test/configCases/parsing/import-ignore/other.js new file mode 100644 index 00000000000..3f8179d0933 --- /dev/null +++ b/test/configCases/parsing/import-ignore/other.js @@ -0,0 +1,2 @@ +import(/* webpackIgnore: true */ "./other2.js"); +import(/* webpackIgnore: false */ "./other3.js"); diff --git a/test/configCases/parsing/import-ignore/other2.js b/test/configCases/parsing/import-ignore/other2.js new file mode 100644 index 00000000000..5d999f67246 --- /dev/null +++ b/test/configCases/parsing/import-ignore/other2.js @@ -0,0 +1 @@ +export default "other2"; diff --git a/test/configCases/parsing/import-ignore/other3.js b/test/configCases/parsing/import-ignore/other3.js new file mode 100644 index 00000000000..f5e8052628f --- /dev/null +++ b/test/configCases/parsing/import-ignore/other3.js @@ -0,0 +1 @@ +export default "other3"; diff --git a/test/configCases/parsing/import-ignore/webpack.config.js b/test/configCases/parsing/import-ignore/webpack.config.js new file mode 100644 index 00000000000..4fcaf47ef7d --- /dev/null +++ b/test/configCases/parsing/import-ignore/webpack.config.js @@ -0,0 +1,12 @@ +module.exports = { + entry: { + bundle0: "./index.js", + bundle1: "./other.js" + }, + output: { + filename: "[name].js" + }, + node: { + __dirname: false + } +}; diff --git a/test/configCases/parsing/issue-336/index.js b/test/configCases/parsing/issue-336/index.js index b6b5e2f84a1..5b4f4798ef8 100644 --- a/test/configCases/parsing/issue-336/index.js +++ b/test/configCases/parsing/issue-336/index.js @@ -1,4 +1,4 @@ it("should provide a module to a free var in a var decl", function() { var x = aaa.test; - x.should.be.eql("test"); -}); \ No newline at end of file + expect(x).toBe("test"); +}); diff --git a/test/configCases/parsing/issue-4857/index.js b/test/configCases/parsing/issue-4857/index.js index db6e3222956..a1d24f3ae88 100644 --- a/test/configCases/parsing/issue-4857/index.js +++ b/test/configCases/parsing/issue-4857/index.js @@ -23,7 +23,7 @@ it("should transpile unreachable branches", () => { true ? count++ : import("NOT_REACHABLE"); false ? import("NOT_REACHABLE") : count++; - count.should.be.eql(6); + expect(count).toBe(6); }); it("should not remove hoisted variable declarations", () => { @@ -55,7 +55,7 @@ it("should not remove hoisted variable declarations", () => { var withVar; } } - (() => { + expect(() => { a; b; c; @@ -71,19 +71,19 @@ it("should not remove hoisted variable declarations", () => { m; n; o; - }).should.not.throw(); - (() => { + }).not.toThrowError(); + expect(() => { withVar; - }).should.throw(); + }).toThrowError(); }); it("should not remove hoisted function declarations in loose mode", () => { if(false) { function funcDecl() {} } - (() => { + expect(() => { funcDecl; - }).should.not.throw(); + }).not.toThrowError(); }); it("should remove hoisted function declarations in strict mode", () => { @@ -91,7 +91,7 @@ it("should remove hoisted function declarations in strict mode", () => { if(false) { function funcDecl() {} } - (() => { + expect(() => { funcDecl; - }).should.throw(); + }).toThrowError(); }); diff --git a/test/configCases/parsing/issue-5624/index.js b/test/configCases/parsing/issue-5624/index.js index 04fe1e47852..8b4624326cc 100644 --- a/test/configCases/parsing/issue-5624/index.js +++ b/test/configCases/parsing/issue-5624/index.js @@ -2,10 +2,10 @@ import * as M from "./module"; it("should allow conditionals as callee", function() { var x = (true ? M.fn : M.fn)(); - x.should.be.eql("ok"); + expect(x).toBe("ok"); }); it("should allow conditionals as object", function() { var x = (true ? M : M).fn(); - x.should.be.eql("ok"); + expect(x).toBe("ok"); }); diff --git a/test/configCases/parsing/node-source-plugin-off/index.js b/test/configCases/parsing/node-source-plugin-off/index.js index ed447c13f0b..322337ef345 100644 --- a/test/configCases/parsing/node-source-plugin-off/index.js +++ b/test/configCases/parsing/node-source-plugin-off/index.js @@ -1,5 +1,3 @@ -require("should"); - it("should not load node-libs-browser when node option is false", function() { - (typeof process).should.be.eql("undefined"); + expect((typeof process)).toBe("undefined"); }); diff --git a/test/configCases/parsing/node-source-plugin/index.js b/test/configCases/parsing/node-source-plugin/index.js index 2e945a3e235..c1671f16f0b 100644 --- a/test/configCases/parsing/node-source-plugin/index.js +++ b/test/configCases/parsing/node-source-plugin/index.js @@ -1,5 +1,3 @@ -require("should"); - it("should add node-libs-browser to target web by default", function() { - process.browser.should.be.eql(true); + expect(process.browser).toBe(true); }); diff --git a/test/configCases/parsing/relative-filedirname/index.js b/test/configCases/parsing/relative-filedirname/index.js index 6f2e4fc53c4..2753225efd1 100644 --- a/test/configCases/parsing/relative-filedirname/index.js +++ b/test/configCases/parsing/relative-filedirname/index.js @@ -1,6 +1,6 @@ it("should define __dirname and __filename", function() { - __dirname.should.be.eql(""); - __filename.should.be.eql("index.js"); - require("./dir/file").dirname.should.be.eql("dir"); - require("./dir/file").filename.should.match(/^dir[\\\/]file.js$/); -}); \ No newline at end of file + expect(__dirname).toBe(""); + expect(__filename).toBe("index.js"); + expect(require("./dir/file").dirname).toBe("dir"); + expect(require("./dir/file").filename).toMatch(/^dir[\\\/]file.js$/); +}); diff --git a/test/configCases/parsing/require.main/index.js b/test/configCases/parsing/require.main/index.js index c72bb927a6d..91a94843f1c 100644 --- a/test/configCases/parsing/require.main/index.js +++ b/test/configCases/parsing/require.main/index.js @@ -1,3 +1,3 @@ it("should define require.main", function() { - require.main.should.be.eql(module); + expect(require.main).toBe(module); }); diff --git a/test/configCases/parsing/system.import/index.js b/test/configCases/parsing/system.import/index.js index d294961f896..754a325d9f3 100644 --- a/test/configCases/parsing/system.import/index.js +++ b/test/configCases/parsing/system.import/index.js @@ -1,18 +1,18 @@ it("should answer typeof System correctly", () => { if(__SYSTEM__ === false) { - (typeof System).should.be.eql("undefined"); + expect((typeof System)).toBe("undefined"); } else { - (typeof System).should.be.eql("object"); + expect((typeof System)).toBe("object"); } }); it("should answer typeof System.import correctly", () => { if(__SYSTEM__ === false) { - (() => { + expect(() => { typeof System.import; - }).should.throw(); + }).toThrowError(); } else { - (typeof System.import).should.be.eql("function"); + expect((typeof System.import)).toBe("function"); } }); @@ -22,7 +22,7 @@ it("should be able to use System.import()", done => { if(__SYSTEM__ === false) { done(new Error("System.import should not be parsed")); } else { - mod.should.be.eql({ default: "ok" }); + expect(mod).toEqual({ default: "ok", [Symbol.toStringTag]: "Module" }); done(); } }); diff --git a/test/configCases/performance/many-exports/index.js b/test/configCases/performance/many-exports/index.js index 09e6f32034f..a68c803f1b9 100644 --- a/test/configCases/performance/many-exports/index.js +++ b/test/configCases/performance/many-exports/index.js @@ -1,5 +1,5 @@ import sum from "./reexport.loader.js!"; it("should compile a module with many harmony exports in acceptable time", function() { - sum.should.be.eql(499500); + expect(sum).toBe(499500); }); diff --git a/test/configCases/plugins/banner-plugin-hashing/index.js b/test/configCases/plugins/banner-plugin-hashing/index.js index 65a407780f4..166837a7aeb 100644 --- a/test/configCases/plugins/banner-plugin-hashing/index.js +++ b/test/configCases/plugins/banner-plugin-hashing/index.js @@ -18,35 +18,35 @@ const banner = parseBanner(source) const REGEXP_HASH = /^[A-Za-z0-9]{20}$/ it("should interpolate file hash in chunk banner", () => { - REGEXP_HASH.test(banner["hash"]).should.be.true; + expect(REGEXP_HASH.test(banner["hash"])).toBe(true); }); it("should interpolate chunkHash in chunk banner", () => { - REGEXP_HASH.test(banner["chunkhash"]).should.be.true; + expect(REGEXP_HASH.test(banner["chunkhash"])).toBe(true); }); it("should interpolate file into chunk banner", () => { - banner["file"].should.equal("dist/banner.js"); + expect(banner["file"]).toBe("dist/banner.js"); }); it("should interpolate name in chunk banner", () => { - banner["name"].should.equal("dist/banner"); + expect(banner["name"]).toBe("dist/banner"); }); it("should interpolate basename in chunk banner", () => { - banner["filebase"].should.equal("banner.js"); + expect(banner["filebase"]).toBe("banner.js"); }); it("should interpolate query in chunk banner", () => { - banner["query"].should.equal("?value"); + expect(banner["query"]).toBe("?value"); }); it("should parse entry into file in chunk banner", () => { - banner["file"].should.not.equal(banner["filebase"]); + expect(banner["file"]).not.toBe(banner["filebase"]); }); it("should parse entry into name in chunk banner", () => { - banner["filebase"].should.not.equal(banner["name"]); + expect(banner["filebase"]).not.toBe(banner["name"]); }); require.include("./test.js"); diff --git a/test/configCases/plugins/banner-plugin/index.js b/test/configCases/plugins/banner-plugin/index.js index 50db600245b..105a1f91b12 100644 --- a/test/configCases/plugins/banner-plugin/index.js +++ b/test/configCases/plugins/banner-plugin/index.js @@ -1,14 +1,17 @@ -it("should contain banner in bundle0 chunk", function() { - var fs = require("fs"); - var source = fs.readFileSync(__filename, "utf-8"); - source.should.containEql("A test value"); +const fs = require("fs"); +const path = require("path"); + +it("should contain banner in bundle0 chunk", () => { + const source = fs.readFileSync(__filename, "utf-8"); + expect(source).toMatch("A test value"); + expect(source).toMatch("banner is a string"); + expect(source).toMatch("banner is a function"); + expect(source).toMatch("/*!\n * multiline\n * banner\n * 1\n */"); }); -it("should not contain banner in vendors chunk", function() { - var fs = require("fs"), - path = require("path"); - var source = fs.readFileSync(path.join(__dirname, "vendors.js"), "utf-8"); - source.should.not.containEql("A test value"); +it("should not contain banner in vendors chunk", () => { + const source = fs.readFileSync(path.join(__dirname, "vendors.js"), "utf-8"); + expect(source).not.toMatch("A test value"); }); require.include("./test.js"); diff --git a/test/configCases/plugins/banner-plugin/webpack.config.js b/test/configCases/plugins/banner-plugin/webpack.config.js index f8dda4c4dcc..fcaaee27a46 100644 --- a/test/configCases/plugins/banner-plugin/webpack.config.js +++ b/test/configCases/plugins/banner-plugin/webpack.config.js @@ -12,9 +12,14 @@ module.exports = { filename: "[name].js" }, plugins: [ + new webpack.BannerPlugin("banner is a string"), + new webpack.BannerPlugin(() => "banner is a function"), new webpack.BannerPlugin({ banner: "A test value", exclude: ["vendors.js"] + }), + new webpack.BannerPlugin({ + banner: ({ chunk }) => `multiline\nbanner\n${chunk.id}` }) ] }; diff --git a/test/configCases/plugins/define-plugin/index.js b/test/configCases/plugins/define-plugin/index.js index 5716a30c37c..8d08c201499 100644 --- a/test/configCases/plugins/define-plugin/index.js +++ b/test/configCases/plugins/define-plugin/index.js @@ -1,77 +1,77 @@ /* globals it, should */ it("should define FALSE", function() { - FALSE.should.be.eql(false); - (typeof TRUE).should.be.eql("boolean"); + expect(FALSE).toBe(false); + expect((typeof TRUE)).toBe("boolean"); var x = require(FALSE ? "fail" : "./a"); var y = FALSE ? require("fail") : require("./a"); }); it("should define CODE", function() { - CODE.should.be.eql(3); - (typeof CODE).should.be.eql("number"); + expect(CODE).toBe(3); + expect((typeof CODE)).toBe("number"); if(CODE !== 3) require("fail"); if(typeof CODE !== "number") require("fail"); }); it("should define FUNCTION", function() { - (FUNCTION(5)).should.be.eql(6); - (typeof FUNCTION).should.be.eql("function"); + expect((FUNCTION(5))).toBe(6); + expect((typeof FUNCTION)).toBe("function"); if(typeof FUNCTION !== "function") require("fail"); }); it("should define UNDEFINED", function() { - (typeof UNDEFINED).should.be.eql("undefined"); + expect((typeof UNDEFINED)).toBe("undefined"); if(typeof UNDEFINED !== "undefined") require("fail"); }); it("should define REGEXP", function() { - REGEXP.toString().should.be.eql("/abc/i"); - (typeof REGEXP).should.be.eql("object"); + expect(REGEXP.toString()).toBe("/abc/i"); + expect((typeof REGEXP)).toBe("object"); if(typeof REGEXP !== "object") require("fail"); }); it("should define OBJECT", function() { var o = OBJECT; - o.SUB.FUNCTION(10).should.be.eql(11); + expect(o.SUB.FUNCTION(10)).toBe(11); }); it("should define OBJECT.SUB.CODE", function() { - (typeof OBJECT.SUB.CODE).should.be.eql("number"); - OBJECT.SUB.CODE.should.be.eql(3); + expect((typeof OBJECT.SUB.CODE)).toBe("number"); + expect(OBJECT.SUB.CODE).toBe(3); if(OBJECT.SUB.CODE !== 3) require("fail"); if(typeof OBJECT.SUB.CODE !== "number") require("fail"); (function(sub) { // should not crash - sub.CODE.should.be.eql(3); + expect(sub.CODE).toBe(3); }(OBJECT.SUB)); }); it("should define OBJECT.SUB.STRING", function() { - (typeof OBJECT.SUB.STRING).should.be.eql("string"); - OBJECT.SUB.STRING.should.be.eql("string"); + expect((typeof OBJECT.SUB.STRING)).toBe("string"); + expect(OBJECT.SUB.STRING).toBe("string"); if(OBJECT.SUB.STRING !== "string") require("fail"); if(typeof OBJECT.SUB.STRING !== "string") require("fail"); (function(sub) { // should not crash - sub.STRING.should.be.eql("string"); + expect(sub.STRING).toBe("string"); }(OBJECT.SUB)); }); it("should define process.env.DEFINED_NESTED_KEY", function() { - (process.env.DEFINED_NESTED_KEY).should.be.eql(5); - (typeof process.env.DEFINED_NESTED_KEY).should.be.eql("number"); + expect((process.env.DEFINED_NESTED_KEY)).toBe(5); + expect((typeof process.env.DEFINED_NESTED_KEY)).toBe("number"); if(process.env.DEFINED_NESTED_KEY !== 5) require("fail"); if(typeof process.env.DEFINED_NESTED_KEY !== "number") require("fail"); var x = process.env.DEFINED_NESTED_KEY; - x.should.be.eql(5); + expect(x).toBe(5); var indirect = process.env; - (indirect.DEFINED_NESTED_KEY).should.be.eql(5); + expect((indirect.DEFINED_NESTED_KEY)).toBe(5); (function(env) { - (env.DEFINED_NESTED_KEY).should.be.eql(5); - (typeof env.DEFINED_NESTED_KEY).should.be.eql("number"); + expect((env.DEFINED_NESTED_KEY)).toBe(5); + expect((typeof env.DEFINED_NESTED_KEY)).toBe("number"); if(env.DEFINED_NESTED_KEY !== 5) require("fail"); if(typeof env.DEFINED_NESTED_KEY !== "number") require("fail"); var x = env.DEFINED_NESTED_KEY; - x.should.be.eql(5); + expect(x).toBe(5); }(process.env)); }); it("should define process.env.DEFINED_NESTED_KEY_STRING", function() { @@ -79,7 +79,7 @@ it("should define process.env.DEFINED_NESTED_KEY_STRING", function() { }); it("should assign to process.env", function() { process.env.TEST = "test"; - process.env.TEST.should.be.eql("test"); + expect(process.env.TEST).toBe("test"); }); it("should not have brackets on start", function() { function f() { @@ -90,13 +90,13 @@ it("should not have brackets on start", function() { }); it("should not explode on recursive typeof calls", function() { - (typeof wurst).should.eql("undefined"); // <- is recursively defined in config + expect(typeof wurst).toEqual("undefined"); // <- is recursively defined in config }); it("should not explode on recursive statements", function() { - (function() { + expect(function() { wurst; // <- is recursively defined in config - }).should.throw("suppe is not defined"); + }).toThrowError("suppe is not defined"); }); it("should evaluate composed expressions (issue 5100)", function() { @@ -111,6 +111,6 @@ it("should follow renamings in var (issue 5215)", function() { var _process$env = process.env, TEST = _process$env.TEST, DEFINED_NESTED_KEY = _process$env.DEFINED_NESTED_KEY; - TEST.should.be.eql("test"); - DEFINED_NESTED_KEY.should.be.eql(5); + expect(TEST).toBe("test"); + expect(DEFINED_NESTED_KEY).toBe(5); }); diff --git a/test/configCases/plugins/define-plugin/webpack.config.js b/test/configCases/plugins/define-plugin/webpack.config.js index 867ee31867c..74a140740e3 100644 --- a/test/configCases/plugins/define-plugin/webpack.config.js +++ b/test/configCases/plugins/define-plugin/webpack.config.js @@ -5,7 +5,7 @@ module.exports = { TRUE: true, FALSE: false, UNDEFINED: undefined, - FUNCTION: function(a) { + FUNCTION: /* istanbul ignore next */ function(a) { return a + 1; }, CODE: "(1+2)", @@ -13,7 +13,7 @@ module.exports = { OBJECT: { SUB: { UNDEFINED: undefined, - FUNCTION: function(a) { + FUNCTION: /* istanbul ignore next */ function(a) { return a + 1; }, CODE: "(1+2)", diff --git a/test/configCases/plugins/lib-manifest-plugin/index.js b/test/configCases/plugins/lib-manifest-plugin/index.js index 30e1318dee7..0994b64ac81 100644 --- a/test/configCases/plugins/lib-manifest-plugin/index.js +++ b/test/configCases/plugins/lib-manifest-plugin/index.js @@ -3,15 +3,16 @@ var path = require("path"); it("should complete", function(done) { require.ensure(["./a"], function(require) { - require("./a").should.be.eql("a"); + expect(require("./a")).toBe("a"); done(); }); }); it("should write the correct manifest", function() { var manifest = JSON.parse(fs.readFileSync(path.join(__dirname, 'bundle0-manifest.json'), "utf-8")); - manifest.should.have.key("content", "name"); - manifest.content.should.not.have.property("./a.js"); - manifest.content.should.have.property("./index.js"); - manifest.content["./index.js"].should.have.property("id").eql(module.id); + expect(manifest).toHaveProperty("content"); + expect(manifest).toHaveProperty("name"); + expect(manifest.content).not.toHaveProperty(["./a.js"]); + expect(manifest.content).toHaveProperty(["./index.js"]); + expect(manifest.content["./index.js"]).toHaveProperty("id", module.id); }); diff --git a/test/configCases/plugins/loader-options-plugin/index.js b/test/configCases/plugins/loader-options-plugin/index.js index ec6279f294a..efce2b7fc7d 100644 --- a/test/configCases/plugins/loader-options-plugin/index.js +++ b/test/configCases/plugins/loader-options-plugin/index.js @@ -1,11 +1,11 @@ it("should set correct options on js files", function() { - require("./loader!./index.js").should.be.eql({ + expect(require("./loader!./index.js")).toEqual({ minimize: true, jsfile: true }); }); it("should set correct options on other files", function() { - require("./loader!./txt.txt").should.be.eql({ + expect(require("./loader!./txt.txt")).toEqual({ minimize: true }); }); diff --git a/test/configCases/plugins/min-chunk-size/index.js b/test/configCases/plugins/min-chunk-size/index.js index 33290592b84..fb78614445f 100644 --- a/test/configCases/plugins/min-chunk-size/index.js +++ b/test/configCases/plugins/min-chunk-size/index.js @@ -1,18 +1,18 @@ it("should combine two chunk if too small", done => { // b should not yet available var bf = __webpack_modules__[require.resolveWeak("./b")]; - (typeof bf).should.be.eql("undefined"); + expect((typeof bf)).toBe("undefined"); // load a import("./a").then(a => { - a.default.should.be.eql("a"); + expect(a.default).toBe("a"); // check if b is available too var bf = __webpack_modules__[require.resolveWeak("./b")]; - (typeof bf).should.be.eql("function"); + expect((typeof bf)).toBe("function"); // load b (just to check if it's ok) import("./b").then(b => { - b.default.should.be.eql("b"); + expect(b.default).toBe("b"); done(); }).catch(done); }).catch(done); diff --git a/test/configCases/plugins/profiling-plugin/index.js b/test/configCases/plugins/profiling-plugin/index.js index bd111552cf0..c7b9eae8332 100644 --- a/test/configCases/plugins/profiling-plugin/index.js +++ b/test/configCases/plugins/profiling-plugin/index.js @@ -3,8 +3,9 @@ import "./test.json"; it("should generate a events.json file", () => { var fs = require("fs"), path = require("path"), - os = require("os"); - fs.existsSync(path.join(os.tmpdir(), "events.json")).should.be.true(); + os = require("os"); + + expect(fs.existsSync(path.join(__dirname, "events.json"))).toBe(true); }); it("should have proper setup record inside of the json stream", () => { @@ -12,7 +13,7 @@ it("should have proper setup record inside of the json stream", () => { path = require("path"), os = require("os"); - // convert json stream to valid - var source = JSON.parse(fs.readFileSync(path.join(os.tmpdir(), "events.json"), "utf-8").toString() + "{}]"); - source[0].id.should.eql(1); + // convert json stream to valid + var source = JSON.parse(fs.readFileSync(path.join(__dirname, "events.json"), "utf-8").toString() + "{}]"); + expect(source[0].id).toEqual(1); }); diff --git a/test/configCases/plugins/profiling-plugin/test.filter.js b/test/configCases/plugins/profiling-plugin/test.filter.js new file mode 100644 index 00000000000..b36fb8fa768 --- /dev/null +++ b/test/configCases/plugins/profiling-plugin/test.filter.js @@ -0,0 +1,3 @@ +module.exports = function(config) { + return !process.env.CI; +}; diff --git a/test/configCases/plugins/profiling-plugin/webpack.config.js b/test/configCases/plugins/profiling-plugin/webpack.config.js index 58933fe417d..1d0eb54fb95 100644 --- a/test/configCases/plugins/profiling-plugin/webpack.config.js +++ b/test/configCases/plugins/profiling-plugin/webpack.config.js @@ -1,16 +1,15 @@ var rootPath = "../../../../"; var webpack = require(rootPath); var path = require("path"); -var os = require("os"); -module.exports = { +module.exports = (env, { testPath }) => ({ plugins: [ new webpack.debug.ProfilingPlugin({ - outputPath: path.join(os.tmpdir(), "events.json") + outputPath: path.join(testPath, "events.json") }) ], node: { __dirname: false, __filename: false } -}; +}); diff --git a/test/configCases/plugins/progress-plugin/index.js b/test/configCases/plugins/progress-plugin/index.js index cf113439405..d91f53a9c13 100644 --- a/test/configCases/plugins/progress-plugin/index.js +++ b/test/configCases/plugins/progress-plugin/index.js @@ -1,6 +1,6 @@ it("should contain the custom progress messages", function() { var data = require(__dirname + "/data"); - data.should.containEql("optimizing"); - data.should.containEql("optimizing|CustomPlugin"); - data.should.containEql("optimizing|CustomPlugin|custom category|custom message"); + expect(data).toContain("optimizing"); + expect(data).toContain("optimizing|CustomPlugin"); + expect(data).toContain("optimizing|CustomPlugin|custom category|custom message"); }); diff --git a/test/configCases/plugins/provide-plugin/index.js b/test/configCases/plugins/provide-plugin/index.js index 7bfad58c0f8..00d4fe5c700 100644 --- a/test/configCases/plugins/provide-plugin/index.js +++ b/test/configCases/plugins/provide-plugin/index.js @@ -1,58 +1,58 @@ it("should provide a module for a simple free var", function() { - aaa.should.be.eql("aaa"); + expect(aaa).toBe("aaa"); }); it("should provide a module for a nested var", function() { - (bbb.ccc).should.be.eql("bbbccc"); + expect((bbb.ccc)).toBe("bbbccc"); var x = bbb.ccc; - x.should.be.eql("bbbccc"); + expect(x).toBe("bbbccc"); }); it("should provide a module for a nested var within a IIFE's argument", function() { (function(process) { - (process.env.NODE_ENV).should.be.eql("development"); + expect((process.env.NODE_ENV)).toBe("development"); var x = process.env.NODE_ENV; - x.should.be.eql("development"); + expect(x).toBe("development"); }(process)); }); it("should provide a module for thisExpression", () => { - (this.aaa).should.be.eql("aaa"); + expect(this.aaa).toBe("aaa"); }); it("should provide a module for a nested var within a IIFE's this", function() { (function() { - (this.env.NODE_ENV).should.be.eql("development"); + expect((this.env.NODE_ENV)).toBe("development"); var x = this.env.NODE_ENV; - x.should.be.eql("development"); + expect(x).toBe("development"); }.call(process)); }); it("should provide a module for a nested var within a nested IIFE's this", function() { (function() { (function() { - (this.env.NODE_ENV).should.be.eql("development"); + expect((this.env.NODE_ENV)).toBe("development"); var x = this.env.NODE_ENV; - x.should.be.eql("development"); + expect(x).toBe("development"); }.call(this)); }.call(process)); }); it("should not provide a module for a part of a var", function() { - (typeof bbb).should.be.eql("undefined"); + expect((typeof bbb)).toBe("undefined"); }); it("should provide a module for a property request", function() { - (dddeeefff).should.be.eql("fff"); + expect((dddeeefff)).toBe("fff"); var x = dddeeefff; - x.should.be.eql("fff"); + expect(x).toBe("fff"); }); it("should provide ES2015 modules", function() { - (es2015.default).should.be.eql("ECMAScript 2015"); - (es2015.alias).should.be.eql("ECMAScript Harmony"); - (es2015.year).should.be.eql(2015); - (es2015_name).should.be.eql("ECMAScript 2015"); - (es2015_alias).should.be.eql("ECMAScript Harmony"); - (es2015_year).should.be.eql(2015); + expect((es2015.default)).toBe("ECMAScript 2015"); + expect((es2015.alias)).toBe("ECMAScript Harmony"); + expect((es2015.year)).toBe(2015); + expect((es2015_name)).toBe("ECMAScript 2015"); + expect((es2015_alias)).toBe("ECMAScript Harmony"); + expect((es2015_year)).toBe(2015); }); diff --git a/test/configCases/plugins/source-map-dev-tool-plugin/index.js b/test/configCases/plugins/source-map-dev-tool-plugin/index.js index af9165efbec..53b37f635a1 100644 --- a/test/configCases/plugins/source-map-dev-tool-plugin/index.js +++ b/test/configCases/plugins/source-map-dev-tool-plugin/index.js @@ -2,11 +2,11 @@ it("should contain publicPath prefix in [url] and resolve relatively to fileCont var fs = require("fs"), path = require("path"); var source = fs.readFileSync(path.join(__dirname, "public/test.js"), "utf-8"); - source.should.containEql("//# sourceMappingURL=https://10.10.10.10/project/sourcemaps/test.js.map"); + expect(source).toMatch("//# sourceMappingURL=https://10.10.10.10/project/sourcemaps/test.js.map"); }); it("should write sourcemap file relative fo fileContext", function() { var fs = require("fs"), path = require("path"); - fs.existsSync(path.join(__dirname, "sourcemaps/test.js.map")).should.be.true(); + expect(fs.existsSync(path.join(__dirname, "sourcemaps/test.js.map"))).toBe(true); }); diff --git a/test/configCases/plugins/uglifyjs-plugin/index.js b/test/configCases/plugins/uglifyjs-plugin/index.js index bf62cee3178..55279a25663 100644 --- a/test/configCases/plugins/uglifyjs-plugin/index.js +++ b/test/configCases/plugins/uglifyjs-plugin/index.js @@ -3,9 +3,9 @@ it("should contain no comments in out chunk", () => { const source = fs.readFileSync(__filename, "utf-8"); - source.should.not.match(/[^\"]comment should be stripped test\.1[^\"]/); - source.should.not.match(/[^\"]comment should be stripped test\.2[^\"]/); - source.should.not.match(/[^\"]comment should be stripped test\.3[^\"]/); + expect(source).not.toMatch(/[^\"]comment should be stripped test\.1[^\"]/); + expect(source).not.toMatch(/[^\"]comment should be stripped test\.2[^\"]/); + expect(source).not.toMatch(/[^\"]comment should be stripped test\.3[^\"]/); }); it("should contain comments in vendors chunk", function() { @@ -14,9 +14,9 @@ it("should contain comments in vendors chunk", function() { const source = fs.readFileSync(path.join(__dirname, "vendors.js"), "utf-8"); - source.should.containEql("comment should not be stripped vendors.1"); - source.should.containEql("// comment should not be stripped vendors.2"); - source.should.containEql(" * comment should not be stripped vendors.3"); + expect(source).toMatch("comment should not be stripped vendors.1"); + expect(source).toMatch("// comment should not be stripped vendors.2"); + expect(source).toMatch(" * comment should not be stripped vendors.3"); }); it("should extract comments to separate file", function() { @@ -25,10 +25,10 @@ it("should extract comments to separate file", function() { const source = fs.readFileSync(path.join(__dirname, "extract.js.LICENSE"), "utf-8"); - source.should.containEql("comment should be extracted extract-test.1"); - source.should.not.containEql("comment should be stripped extract-test.2"); - source.should.containEql("comment should be extracted extract-test.3"); - source.should.not.containEql("comment should be stripped extract-test.4"); + expect(source).toMatch("comment should be extracted extract-test.1"); + expect(source).not.toMatch("comment should be stripped extract-test.2"); + expect(source).toMatch("comment should be extracted extract-test.3"); + expect(source).not.toMatch("comment should be stripped extract-test.4"); }); it("should remove extracted comments and insert a banner", function() { @@ -37,11 +37,11 @@ it("should remove extracted comments and insert a banner", function() { const source = fs.readFileSync(path.join(__dirname, "extract.js"), "utf-8"); - source.should.not.containEql("comment should be extracted extract-test.1"); - source.should.not.containEql("comment should be stripped extract-test.2"); - source.should.not.containEql("comment should be extracted extract-test.3"); - source.should.not.containEql("comment should be stripped extract-test.4"); - source.should.containEql("/*! For license information please see extract.js.LICENSE */"); + expect(source).not.toMatch("comment should be extracted extract-test.1"); + expect(source).not.toMatch("comment should be stripped extract-test.2"); + expect(source).not.toMatch("comment should be extracted extract-test.3"); + expect(source).not.toMatch("comment should be stripped extract-test.4"); + expect(source).toMatch("/*! For license information please see extract.js.LICENSE */"); }); it("should pass mangle options", function() { @@ -50,7 +50,7 @@ it("should pass mangle options", function() { const source = fs.readFileSync(path.join(__dirname, "ie8.js"), "utf-8"); - source.should.containEql("t.exports=function(t){return function(n){try{t()}catch(t){n(t)}}}"); + expect(source).toMatch(".exports=function(e){return function(t){try{e()}catch(e){t(e)}}}"); }); it("should pass compress options", function() { @@ -59,7 +59,7 @@ it("should pass compress options", function() { const source = fs.readFileSync(path.join(__dirname, "compress.js"), "utf-8"); - source.should.containEql("o.exports=function(){console.log(4),console.log(6),console.log(4),console.log(7)}"); + expect(source).toMatch(".exports=function(){console.log(4),console.log(6),console.log(4),console.log(7)}"); }); require.include("./test.js"); diff --git a/test/configCases/plugins/uglifyjs-plugin/webpack.config.js b/test/configCases/plugins/uglifyjs-plugin/webpack.config.js index b8f7ec16798..bc737f8e767 100644 --- a/test/configCases/plugins/uglifyjs-plugin/webpack.config.js +++ b/test/configCases/plugins/uglifyjs-plugin/webpack.config.js @@ -18,13 +18,19 @@ module.exports = { minimize: true, minimizer: [ new UglifyJsPlugin({ + cache: false, + parallel: false, exclude: ["vendors.js", "extract.js"] }), new UglifyJsPlugin({ + cache: false, + parallel: false, extractComments: true, include: ["extract.js"] }), new UglifyJsPlugin({ + cache: false, + parallel: false, uglifyOptions: { compress: { passes: 2 diff --git a/test/configCases/race-conditions/load-module/index.js b/test/configCases/race-conditions/load-module/index.js index 34d52e7640b..668417cd2ba 100644 --- a/test/configCases/race-conditions/load-module/index.js +++ b/test/configCases/race-conditions/load-module/index.js @@ -1,4 +1,4 @@ it("should not deadlock when using loadModule", () => { const result = require("./loader!"); - result.should.match(/console.log\(42\)/); + expect(result).toMatch(/console.log\(42\)/); }); diff --git a/test/configCases/records/issue-295/test.js b/test/configCases/records/issue-295/test.js index 04974582bb8..c56f7adbb36 100644 --- a/test/configCases/records/issue-295/test.js +++ b/test/configCases/records/issue-295/test.js @@ -5,5 +5,5 @@ it("should write relative paths to records", function() { var fs = require("fs"); var path = require("path"); var content = fs.readFileSync(path.join(__dirname, "records.json"), "utf-8"); - content.should.not.match(/webpack|issue/); + expect(content).not.toMatch(/webpack|issue/); }); diff --git a/test/configCases/records/issue-2991/test.js b/test/configCases/records/issue-2991/test.js index 8199725dea9..81673a393b9 100644 --- a/test/configCases/records/issue-2991/test.js +++ b/test/configCases/records/issue-2991/test.js @@ -1,34 +1,10 @@ try { require("pkgs/somepackage/foo"); -} catch(e){} +} catch (e) {} it("should write relative paths to records", function() { var fs = require("fs"); var path = require("path"); var content = fs.readFileSync(path.join(__dirname, "records.json"), "utf-8"); - content.should.eql(`{ - "modules": { - "byIdentifier": { - "external \\"path\\"": 0, - "external \\"fs\\"": 1, - "ignored pkgs/somepackage/foo": 2, - "test.js": 3 - }, - "usedIds": { - "0": 0, - "1": 1, - "2": 2, - "3": 3 - } - }, - "chunks": { - "byName": { - "main": 0 - }, - "bySource": {}, - "usedIds": [ - 0 - ] - } -}`); + expect(content).toMatchSnapshot(); }); diff --git a/test/configCases/records/issue-7339/dependencies/bar.js b/test/configCases/records/issue-7339/dependencies/bar.js new file mode 100644 index 00000000000..f06bcb5d726 --- /dev/null +++ b/test/configCases/records/issue-7339/dependencies/bar.js @@ -0,0 +1 @@ +module.exports = "Bar" \ No newline at end of file diff --git a/test/configCases/records/issue-7339/dependencies/foo.js b/test/configCases/records/issue-7339/dependencies/foo.js new file mode 100644 index 00000000000..ae748a84148 --- /dev/null +++ b/test/configCases/records/issue-7339/dependencies/foo.js @@ -0,0 +1 @@ +module.exports = "Foo" \ No newline at end of file diff --git a/test/configCases/records/issue-7339/test.js b/test/configCases/records/issue-7339/test.js new file mode 100644 index 00000000000..98081ef1c8a --- /dev/null +++ b/test/configCases/records/issue-7339/test.js @@ -0,0 +1,10 @@ +function loadDependency(dep) { + require("./dependencies/" + dep); +} + +it("should write relative dynamic-require paths to records", function() { + var fs = require("fs"); + var path = require("path"); + var content = fs.readFileSync(path.join(__dirname, "records.json"), "utf-8"); + expect(content).toMatchSnapshot(); +}); diff --git a/test/configCases/records/issue-7339/webpack.config.js b/test/configCases/records/issue-7339/webpack.config.js new file mode 100644 index 00000000000..0d7b9410f4f --- /dev/null +++ b/test/configCases/records/issue-7339/webpack.config.js @@ -0,0 +1,13 @@ +var path = require("path"); + +module.exports = { + entry: "./test", + recordsOutputPath: path.resolve( + __dirname, + "../../../js/config/records/issue-7339/records.json" + ), + target: "node", + node: { + __dirname: false + } +}; diff --git a/test/configCases/records/issue-7492/async.js b/test/configCases/records/issue-7492/async.js new file mode 100644 index 00000000000..e08a1b185c2 --- /dev/null +++ b/test/configCases/records/issue-7492/async.js @@ -0,0 +1 @@ +import "vendor"; diff --git a/test/configCases/records/issue-7492/index.js b/test/configCases/records/issue-7492/index.js new file mode 100644 index 00000000000..15c49532184 --- /dev/null +++ b/test/configCases/records/issue-7492/index.js @@ -0,0 +1,3 @@ +it("should load fine", () => { + return import(/* webpackChunkName: "async" */"./async"); +}); diff --git a/test/statsCases/preset-none-array/expected.txt b/test/configCases/records/issue-7492/node_modules/vendor.js similarity index 100% rename from test/statsCases/preset-none-array/expected.txt rename to test/configCases/records/issue-7492/node_modules/vendor.js diff --git a/test/configCases/records/issue-7492/records.json b/test/configCases/records/issue-7492/records.json new file mode 100644 index 00000000000..dcca409b109 --- /dev/null +++ b/test/configCases/records/issue-7492/records.json @@ -0,0 +1,10 @@ +{ + "chunks": { + "byName": { + "vendors~async": 123 + }, + "bySource": { + "1 index.js ./async": 123 + } + } +} diff --git a/test/configCases/records/issue-7492/webpack.config.js b/test/configCases/records/issue-7492/webpack.config.js new file mode 100644 index 00000000000..32bbc5f696e --- /dev/null +++ b/test/configCases/records/issue-7492/webpack.config.js @@ -0,0 +1,14 @@ +var path = require("path"); + +module.exports = { + entry: "./index", + recordsInputPath: path.resolve(__dirname, "records.json"), + output: { + chunkFilename: "[name]-[chunkhash].js" + }, + optimization: { + splitChunks: { + minSize: 0 + } + } +}; diff --git a/test/statsCases/preset-none-error/expected.txt b/test/configCases/records/stable-sort/split-2.js similarity index 100% rename from test/statsCases/preset-none-error/expected.txt rename to test/configCases/records/stable-sort/split-2.js diff --git a/test/statsCases/preset-none/expected.txt b/test/configCases/records/stable-sort/split.js similarity index 100% rename from test/statsCases/preset-none/expected.txt rename to test/configCases/records/stable-sort/split.js diff --git a/test/configCases/records/stable-sort/test.js b/test/configCases/records/stable-sort/test.js new file mode 100644 index 00000000000..9a7c63ce254 --- /dev/null +++ b/test/configCases/records/stable-sort/test.js @@ -0,0 +1,14 @@ +require.ensure([], function(require) { + require('./split.js') +}) + +require.ensure([], function(require) { + require('./split-2.js') +}, "split") + +it("sorts the usedIds array to prevent churn", function() { + var fs = require("fs"); + var path = require("path"); + var records = JSON.parse(fs.readFileSync(path.join(__dirname, "records.json"), "utf-8")); + expect(records.chunks.usedIds).toEqual([0, 1, 2]); +}); diff --git a/test/configCases/records/stable-sort/webpack.config.js b/test/configCases/records/stable-sort/webpack.config.js new file mode 100644 index 00000000000..56c58a64209 --- /dev/null +++ b/test/configCases/records/stable-sort/webpack.config.js @@ -0,0 +1,17 @@ +var path = require("path"); + +module.exports = { + mode: "development", + entry: "./test", + recordsOutputPath: path.resolve( + __dirname, + "../../../js/config/records/stable-sort/records.json" + ), + optimization: { + namedChunks: false + }, + target: "node", + node: { + __dirname: false + } +}; diff --git a/test/configCases/rule-set/chaining/index.js b/test/configCases/rule-set/chaining/index.js index ca3b76c2cb9..ccb162203fe 100644 --- a/test/configCases/rule-set/chaining/index.js +++ b/test/configCases/rule-set/chaining/index.js @@ -1,6 +1,6 @@ it("should match rule with multiple loaders in 'loader'", function() { var abc = require("./abc"); - abc.should.be.eql([ + expect(abc).toEqual([ "abc", "?b", "?a" @@ -8,7 +8,7 @@ it("should match rule with multiple loaders in 'loader'", function() { }); it("should match rule with multiple loaders in 'loaders'", function() { var def = require("./def"); - def.should.be.eql([ + expect(def).toEqual([ "def", "?d", "?c" diff --git a/test/configCases/rule-set/compiler/index.js b/test/configCases/rule-set/compiler/index.js index ae9a155a95b..6eb52e6c4d6 100644 --- a/test/configCases/rule-set/compiler/index.js +++ b/test/configCases/rule-set/compiler/index.js @@ -1,6 +1,6 @@ it("should match rule with compiler name", function() { var a = require("./a"); - a.should.be.eql("loader matched"); + expect(a).toBe("loader matched"); var b = require("./b"); - b.should.be.eql("loader not matched"); + expect(b).toBe("loader not matched"); }); diff --git a/test/configCases/rule-set/custom/index.js b/test/configCases/rule-set/custom/index.js index 8c73ef9fa27..e4894af5161 100644 --- a/test/configCases/rule-set/custom/index.js +++ b/test/configCases/rule-set/custom/index.js @@ -1,6 +1,6 @@ it("should match a custom loader", function() { var a = require("./a"); - a.should.be.eql([ + expect(a).toEqual([ "a", { issuer: "index.js", @@ -9,7 +9,7 @@ it("should match a custom loader", function() { } ]); var b = require("./b?hello"); - b.should.be.eql([ + expect(b).toEqual([ "b", { issuer: "index.js", @@ -18,7 +18,7 @@ it("should match a custom loader", function() { } ]); var ca = require("./call-a?hello"); - ca.should.be.eql([ + expect(ca).toEqual([ "a", { issuer: "call-a.js", diff --git a/test/configCases/rule-set/query/index.js b/test/configCases/rule-set/query/index.js index baeb9e1e991..7114b977882 100644 --- a/test/configCases/rule-set/query/index.js +++ b/test/configCases/rule-set/query/index.js @@ -1,15 +1,15 @@ it("should match rule with resource query", function() { var a1 = require("./a"); - a1.should.be.eql([ + expect(a1).toEqual([ "a" ]); var a2 = require("./a?loader"); - a2.should.be.eql([ + expect(a2).toEqual([ "a", "?query" ]); var a3 = require("./a?other"); - a3.should.be.eql([ + expect(a3).toEqual([ "a" ]); }); diff --git a/test/configCases/rule-set/resolve-options/index.js b/test/configCases/rule-set/resolve-options/index.js index c5da4bedd7c..5baf4c239f1 100644 --- a/test/configCases/rule-set/resolve-options/index.js +++ b/test/configCases/rule-set/resolve-options/index.js @@ -1,6 +1,6 @@ it("should allow to set custom resolving rules", function() { var a = require("./a"); - a.should.be.eql("ok"); + expect(a).toBe("ok"); var b = require("./b"); - b.should.be.eql("wrong"); + expect(b).toBe("wrong"); }); diff --git a/test/configCases/rule-set/simple-use-array-fn/index.js b/test/configCases/rule-set/simple-use-array-fn/index.js index 5c0fb12559b..64637f8ab82 100644 --- a/test/configCases/rule-set/simple-use-array-fn/index.js +++ b/test/configCases/rule-set/simple-use-array-fn/index.js @@ -1,6 +1,6 @@ it("should match only one rule in a oneOf block", function() { var ab = require("./ab"); - ab.should.be.eql([ + expect(ab).toEqual([ "ab", "?first" ]); @@ -8,11 +8,11 @@ it("should match only one rule in a oneOf block", function() { it("should match with issuer and any option value", function() { var a = require("./a"); var b = require("./b"); - a.should.be.eql([ + expect(a).toEqual([ "a", "?third", ]); - b.should.be.eql([[ + expect(b).toEqual([[ "a", "second-3", "?second-2", diff --git a/test/configCases/rule-set/simple-use-fn-array/index.js b/test/configCases/rule-set/simple-use-fn-array/index.js index 5c0fb12559b..64637f8ab82 100644 --- a/test/configCases/rule-set/simple-use-fn-array/index.js +++ b/test/configCases/rule-set/simple-use-fn-array/index.js @@ -1,6 +1,6 @@ it("should match only one rule in a oneOf block", function() { var ab = require("./ab"); - ab.should.be.eql([ + expect(ab).toEqual([ "ab", "?first" ]); @@ -8,11 +8,11 @@ it("should match only one rule in a oneOf block", function() { it("should match with issuer and any option value", function() { var a = require("./a"); var b = require("./b"); - a.should.be.eql([ + expect(a).toEqual([ "a", "?third", ]); - b.should.be.eql([[ + expect(b).toEqual([[ "a", "second-3", "?second-2", diff --git a/test/configCases/rule-set/simple/index.js b/test/configCases/rule-set/simple/index.js index 5c0fb12559b..64637f8ab82 100644 --- a/test/configCases/rule-set/simple/index.js +++ b/test/configCases/rule-set/simple/index.js @@ -1,6 +1,6 @@ it("should match only one rule in a oneOf block", function() { var ab = require("./ab"); - ab.should.be.eql([ + expect(ab).toEqual([ "ab", "?first" ]); @@ -8,11 +8,11 @@ it("should match only one rule in a oneOf block", function() { it("should match with issuer and any option value", function() { var a = require("./a"); var b = require("./b"); - a.should.be.eql([ + expect(a).toEqual([ "a", "?third", ]); - b.should.be.eql([[ + expect(b).toEqual([[ "a", "second-3", "?second-2", diff --git a/test/configCases/runtime/opt-in-finally/index.js b/test/configCases/runtime/opt-in-finally/index.js index 5c5047db5a8..5d0bac929f9 100644 --- a/test/configCases/runtime/opt-in-finally/index.js +++ b/test/configCases/runtime/opt-in-finally/index.js @@ -1,8 +1,8 @@ it("should throw exception on every try to load a module", function() { - (function() { + expect(function() { require("./exception"); - }).should.throw(); - (function() { + }).toThrowError(); + expect(function() { require("./exception"); - }).should.throw(); + }).toThrowError(); }); diff --git a/test/configCases/scope-hoisting/dll-plugin/index.js b/test/configCases/scope-hoisting/dll-plugin/index.js index 90b28ea4e68..c1533a31a8d 100644 --- a/test/configCases/scope-hoisting/dll-plugin/index.js +++ b/test/configCases/scope-hoisting/dll-plugin/index.js @@ -1,5 +1,5 @@ import value from "dll/module"; it("should not scope hoist delegated modules", function() { - value.should.be.eql("ok"); + expect(value).toBe("ok"); }); diff --git a/test/configCases/scope-hoisting/named-modules/index.js b/test/configCases/scope-hoisting/named-modules/index.js index 2339e0ccdcf..9e915eb939e 100644 --- a/test/configCases/scope-hoisting/named-modules/index.js +++ b/test/configCases/scope-hoisting/named-modules/index.js @@ -1,5 +1,5 @@ import value from "./module"; it("should generate valid code", function() { - value.should.be.eql("ok"); + expect(value).toBe("ok"); }); diff --git a/test/configCases/scope-hoisting/strictThisContextOnImports/index.js b/test/configCases/scope-hoisting/strictThisContextOnImports/index.js index 9f14a72291b..174d19ee47f 100644 --- a/test/configCases/scope-hoisting/strictThisContextOnImports/index.js +++ b/test/configCases/scope-hoisting/strictThisContextOnImports/index.js @@ -2,10 +2,10 @@ import value, { identity } from "./module"; import * as m from "./module"; it("should parse and translate identifiers correctly", function() { - identity(value).should.be.eql(1234); - m.identity(value).should.be.eql(1234); - m.identity(identity).should.be.eql(identity); - m.identity(m.identity).should.be.eql(m.identity); - identity(m.identity).should.be.eql(m.identity); - identity(m.default).should.be.eql(1234); + expect(identity(value)).toBe(1234); + expect(m.identity(value)).toBe(1234); + expect(m.identity(identity)).toBe(identity); + expect(m.identity(m.identity)).toBe(m.identity); + expect(identity(m.identity)).toBe(m.identity); + expect(identity(m.default)).toBe(1234); }); diff --git a/test/configCases/side-effects/side-effects-override/index.js b/test/configCases/side-effects/side-effects-override/index.js index b15057fe02d..ca444036afe 100644 --- a/test/configCases/side-effects/side-effects-override/index.js +++ b/test/configCases/side-effects/side-effects-override/index.js @@ -4,8 +4,8 @@ import p from "pmodule"; import n from "nmodule"; it("should be able to override side effects", function() { - p.should.be.eql("def"); - n.should.be.eql("def"); - plog.should.be.eql(["a.js", "b.js", "c.js", "index.js"]); - nlog.should.be.eql(["index.js"]); + expect(p).toBe("def"); + expect(n).toBe("def"); + expect(plog).toEqual(["a.js", "b.js", "c.js", "index.js"]); + expect(nlog).toEqual(["index.js"]); }); diff --git a/test/configCases/side-effects/side-effects-values/index.js b/test/configCases/side-effects/side-effects-values/index.js index 1e8a69e2a72..c2c5c0ffdfa 100644 --- a/test/configCases/side-effects/side-effects-values/index.js +++ b/test/configCases/side-effects/side-effects-values/index.js @@ -4,13 +4,13 @@ import { log as globValueModuleLog } from "glob-value-module/tracker"; import globValueModule from "glob-value-module"; it("should handle a boolean", function() { - booleanValueModule.should.be.eql("def"); - booleanValueModuleLog.should.be.eql(["index.js"]); + expect(booleanValueModule).toBe("def"); + expect(booleanValueModuleLog).toEqual(["index.js"]); }); it("should handle globs", function() { - globValueModule.should.be.eql("def"); - globValueModuleLog.should.be.eql([ + expect(globValueModule).toBe("def"); + expect(globValueModuleLog).toEqual([ "./src/a.js", "a.js", "index.js", diff --git a/test/configCases/source-map/exclude-chunks-source-map/index.js b/test/configCases/source-map/exclude-chunks-source-map/index.js index 9be4dd596f7..810a47f9fdb 100644 --- a/test/configCases/source-map/exclude-chunks-source-map/index.js +++ b/test/configCases/source-map/exclude-chunks-source-map/index.js @@ -2,14 +2,14 @@ it("should include test.js in SourceMap for bundle0 chunk", function() { var fs = require("fs"); var source = fs.readFileSync(__filename + ".map", "utf-8"); var map = JSON.parse(source); - map.sources.should.containEql("webpack:///./test.js"); + expect(map.sources).toContain("webpack:///./test.js"); }); it("should not produce a SourceMap for vendors chunk", function() { var fs = require("fs"), path = require("path"), assert = require("assert"); - fs.existsSync(path.join(__dirname, "vendors.js.map")).should.be.false(); + expect(fs.existsSync(path.join(__dirname, "vendors.js.map"))).toBe(false); }); require.include("./test.js"); diff --git a/test/configCases/source-map/exclude-modules-source-map/index.js b/test/configCases/source-map/exclude-modules-source-map/index.js index 942871944e9..bb54f271649 100644 --- a/test/configCases/source-map/exclude-modules-source-map/index.js +++ b/test/configCases/source-map/exclude-modules-source-map/index.js @@ -2,7 +2,7 @@ it("bundle1 should include eval sourcemapped test1.js and test2.js as is", funct var fs = require("fs"); var path = require("path"); var bundle1 = fs.readFileSync(path.join(__dirname, "bundle1.js"), "utf-8"); - bundle1.should.containEql("eval(\"var test1marker"); - bundle1.should.containEql("var test2marker"); - bundle1.should.not.containEql("eval(\"var test2marker"); + expect(bundle1).toMatch("eval(\"var test1marker"); + expect(bundle1).toMatch("var test2marker"); + expect(bundle1).not.toMatch("eval(\"var test2marker"); }); diff --git a/test/configCases/source-map/line-to-line/index.js b/test/configCases/source-map/line-to-line/index.js index d4c6fd6ccc5..23a95f012f7 100644 --- a/test/configCases/source-map/line-to-line/index.js +++ b/test/configCases/source-map/line-to-line/index.js @@ -2,7 +2,7 @@ it("should include test.js in SourceMap", function() { var fs = require("fs"); var source = fs.readFileSync(__filename + ".map", "utf-8"); var map = JSON.parse(source); - map.sources.should.containEql("webpack:///./test.js"); + expect(map.sources).toContain("webpack:///./test.js"); }); require.include("./test.js"); diff --git a/test/configCases/source-map/module-names/index.js b/test/configCases/source-map/module-names/index.js index e776749dfa8..f1c338c721e 100644 --- a/test/configCases/source-map/module-names/index.js +++ b/test/configCases/source-map/module-names/index.js @@ -7,14 +7,14 @@ function getSourceMap(filename) { it("should include test.js in SourceMap", function() { var map = getSourceMap("bundle0.js"); - map.sources.should.containEql("module"); - map.sources.should.containEql("fallback"); - map.sources.should.containEql("fallback**"); + expect(map.sources).toContain("module"); + expect(map.sources).toContain("fallback"); + expect(map.sources).toContain("fallback**"); map = getSourceMap("chunk-a.js"); - map.sources.should.containEql("fallback*"); + expect(map.sources).toContain("fallback*"); map = getSourceMap("chunk-b.js"); - map.sources.should.containEql("fallback*"); - map.sources.should.containEql("fallback***"); + expect(map.sources).toContain("fallback*"); + expect(map.sources).toContain("fallback***"); }); require.ensure(["./test.js"], function(require) {}, "chunk-a"); diff --git a/test/configCases/source-map/namespace-source-path.library/index.js b/test/configCases/source-map/namespace-source-path.library/index.js index 5dfce4d598f..3f99426355e 100644 --- a/test/configCases/source-map/namespace-source-path.library/index.js +++ b/test/configCases/source-map/namespace-source-path.library/index.js @@ -2,7 +2,7 @@ it("should include webpack://mylibrary/./test.js in SourceMap", function() { var fs = require("fs"); var source = fs.readFileSync(__filename + ".map", "utf-8"); var map = JSON.parse(source); - map.sources.should.containEql("webpack://mylibrary/./test.js"); + expect(map.sources).toContain("webpack://mylibrary/./test.js"); }); require.include("./test.js"); diff --git a/test/configCases/source-map/namespace-source-path/index.js b/test/configCases/source-map/namespace-source-path/index.js index da7dbac424c..cbe53a9c45a 100644 --- a/test/configCases/source-map/namespace-source-path/index.js +++ b/test/configCases/source-map/namespace-source-path/index.js @@ -2,7 +2,7 @@ it("should include webpack://mynamespace/./test.js in SourceMap", function() { var fs = require("fs"); var source = fs.readFileSync(__filename + ".map", "utf-8"); var map = JSON.parse(source); - map.sources.should.containEql("webpack://mynamespace/./test.js"); + expect(map.sources).toContain("webpack://mynamespace/./test.js"); }); require.include("./test.js"); diff --git a/test/configCases/source-map/nosources/index.js b/test/configCases/source-map/nosources/index.js index ccd3cad0618..25bfc59c5a3 100644 --- a/test/configCases/source-map/nosources/index.js +++ b/test/configCases/source-map/nosources/index.js @@ -2,7 +2,7 @@ it("should not include sourcesContent if noSources option is used", function() { var fs = require("fs"); var source = fs.readFileSync(__filename + ".map", "utf-8"); var map = JSON.parse(source); - map.should.not.have.property('sourcesContent'); + expect(map).not.toHaveProperty('sourcesContent'); }); require.include("./test.js"); diff --git a/test/configCases/source-map/relative-source-map-path/index.js b/test/configCases/source-map/relative-source-map-path/index.js index 3a94a8228cd..c919336620e 100644 --- a/test/configCases/source-map/relative-source-map-path/index.js +++ b/test/configCases/source-map/relative-source-map-path/index.js @@ -2,11 +2,12 @@ it("should have a relative url to the source-map", function() { var fs = require("fs"); var source = fs.readFileSync(__filename, "utf-8"); var match = /sourceMappingURL\s*=\s*(.*)/.exec(source); - match[1].should.be.eql("bundle0.js.map"); + expect(match[1]).toBe("bundle0.js.map"); }); it("should have a relative url to the source-map with prefix", function(done) { require.ensure([], function(require) { + global.expect = expect; require("./test.js"); done(); }); diff --git a/test/configCases/source-map/relative-source-map-path/test.js b/test/configCases/source-map/relative-source-map-path/test.js index 46627acd3c9..02ac3dd399a 100644 --- a/test/configCases/source-map/relative-source-map-path/test.js +++ b/test/configCases/source-map/relative-source-map-path/test.js @@ -1,4 +1,4 @@ var fs = require("fs"); var source = fs.readFileSync(__filename, "utf-8"); var match = /sourceMappingURL\s*=\s*(.*)/.exec(source); -match[1].should.be.eql("c.js.map"); \ No newline at end of file +expect(match[1]).toBe("c.js.map"); diff --git a/test/configCases/source-map/source-map-filename-contenthash/index.js b/test/configCases/source-map/source-map-filename-contenthash/index.js index 455b624c9f2..dd9fc97ab3c 100644 --- a/test/configCases/source-map/source-map-filename-contenthash/index.js +++ b/test/configCases/source-map/source-map-filename-contenthash/index.js @@ -2,5 +2,5 @@ it("should contain contenthash as query parameter and path", function() { var fs = require("fs"); var source = fs.readFileSync(__filename, "utf-8"); var match = /sourceMappingURL\s*=.*-([A-Fa-f0-9]{32})\.map\?([A-Fa-f0-9]{32})-([A-Fa-f0-9]{32})/.exec(source); - match.length.should.be.eql(4); + expect(match.length).toBe(4); }); diff --git a/test/configCases/source-map/source-map-with-profiling-plugin/index.js b/test/configCases/source-map/source-map-with-profiling-plugin/index.js index c970d7e6cf0..dac5992eee5 100644 --- a/test/configCases/source-map/source-map-with-profiling-plugin/index.js +++ b/test/configCases/source-map/source-map-with-profiling-plugin/index.js @@ -2,7 +2,7 @@ it("bundle0 should include sourcemapped test.js", function() { var fs = require("fs"); var source = fs.readFileSync(__filename + ".map", "utf-8"); var map = JSON.parse(source); - map.sources.should.containEql("webpack:///./test.js"); + expect(map.sources).toContain("webpack:///./test.js"); }); require.include("./test.js"); diff --git a/test/configCases/source-map/source-map-with-profiling-plugin/test.filter.js b/test/configCases/source-map/source-map-with-profiling-plugin/test.filter.js new file mode 100644 index 00000000000..b36fb8fa768 --- /dev/null +++ b/test/configCases/source-map/source-map-with-profiling-plugin/test.filter.js @@ -0,0 +1,3 @@ +module.exports = function(config) { + return !process.env.CI; +}; diff --git a/test/configCases/source-map/sources-array-production/index.js b/test/configCases/source-map/sources-array-production/index.js index d4c6fd6ccc5..23a95f012f7 100644 --- a/test/configCases/source-map/sources-array-production/index.js +++ b/test/configCases/source-map/sources-array-production/index.js @@ -2,7 +2,7 @@ it("should include test.js in SourceMap", function() { var fs = require("fs"); var source = fs.readFileSync(__filename + ".map", "utf-8"); var map = JSON.parse(source); - map.sources.should.containEql("webpack:///./test.js"); + expect(map.sources).toContain("webpack:///./test.js"); }); require.include("./test.js"); diff --git a/test/configCases/split-chunks/chunk-filename-delimiter-default/index.js b/test/configCases/split-chunks/chunk-filename-delimiter-default/index.js index 15b22fc951e..0b3d46fd340 100644 --- a/test/configCases/split-chunks/chunk-filename-delimiter-default/index.js +++ b/test/configCases/split-chunks/chunk-filename-delimiter-default/index.js @@ -1,5 +1,3 @@ -require("should"); - it("should run", function() { Promise.all( [ @@ -12,5 +10,5 @@ it("should run", function() { const files = require("fs").readdirSync(__dirname); const hasFile = files.indexOf('a~b~c.bundle.js') !== -1; - hasFile.should.be.eql(true); + expect(hasFile).toBe(true); }); diff --git a/test/configCases/split-chunks/chunk-filename-delimiter/index.js b/test/configCases/split-chunks/chunk-filename-delimiter/index.js index 47a30f17f9a..c0179cf77c7 100644 --- a/test/configCases/split-chunks/chunk-filename-delimiter/index.js +++ b/test/configCases/split-chunks/chunk-filename-delimiter/index.js @@ -1,5 +1,3 @@ -require("should"); - it("should run", function() { Promise.all( [ @@ -12,5 +10,5 @@ it("should run", function() { const files = require("fs").readdirSync(__dirname); const hasFile = files.indexOf('a-b-c.bundle.js') !== -1; - hasFile.should.be.eql(true); + expect(hasFile).toBe(true); }); diff --git a/test/configCases/split-chunks/incorrect-chunk-reuse/a.js b/test/configCases/split-chunks/incorrect-chunk-reuse/a.js new file mode 100644 index 00000000000..ee845b6fcb8 --- /dev/null +++ b/test/configCases/split-chunks/incorrect-chunk-reuse/a.js @@ -0,0 +1,2 @@ +import "./x/1"; +import "./y/1"; diff --git a/test/configCases/split-chunks/incorrect-chunk-reuse/b.js b/test/configCases/split-chunks/incorrect-chunk-reuse/b.js new file mode 100644 index 00000000000..cac278046ab --- /dev/null +++ b/test/configCases/split-chunks/incorrect-chunk-reuse/b.js @@ -0,0 +1 @@ +import "./y/2"; diff --git a/test/configCases/split-chunks/incorrect-chunk-reuse/c.js b/test/configCases/split-chunks/incorrect-chunk-reuse/c.js new file mode 100644 index 00000000000..d693e1171b0 --- /dev/null +++ b/test/configCases/split-chunks/incorrect-chunk-reuse/c.js @@ -0,0 +1 @@ +import "./y/3"; diff --git a/test/configCases/split-chunks/incorrect-chunk-reuse/index.js b/test/configCases/split-chunks/incorrect-chunk-reuse/index.js new file mode 100644 index 00000000000..f777440f308 --- /dev/null +++ b/test/configCases/split-chunks/incorrect-chunk-reuse/index.js @@ -0,0 +1,7 @@ +it("should find all modules", function() { + return Promise.all([ + import(/* webpackChunkName: "a" */ "./a"), // has 3 modules (1 into x, 1 into y) + import(/* webpackChunkName: "b" */ "./b"), // has 2 modules (1 into y) + import(/* webpackChunkName: "c" */ "./c"), // has 2 modules (1 into y) + ]) +}); diff --git a/test/configCases/split-chunks/incorrect-chunk-reuse/webpack.config.js b/test/configCases/split-chunks/incorrect-chunk-reuse/webpack.config.js new file mode 100644 index 00000000000..9c635ed7c4f --- /dev/null +++ b/test/configCases/split-chunks/incorrect-chunk-reuse/webpack.config.js @@ -0,0 +1,24 @@ +const path = require("path"); + +module.exports = { + entry: "./index", + optimization: { + splitChunks: { + cacheGroups: { + x: { + test: path.resolve(__dirname, "x"), + name: "x", + priority: 2, + enforce: true + }, + y: { + test: path.resolve(__dirname, "y"), + priority: 1, + name: "y", + enforce: true, + reuseExistingChunk: true + } + } + } + } +}; diff --git a/test/configCases/split-chunks/incorrect-chunk-reuse/x/1.js b/test/configCases/split-chunks/incorrect-chunk-reuse/x/1.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/configCases/split-chunks/incorrect-chunk-reuse/y/1.js b/test/configCases/split-chunks/incorrect-chunk-reuse/y/1.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/configCases/split-chunks/incorrect-chunk-reuse/y/2.js b/test/configCases/split-chunks/incorrect-chunk-reuse/y/2.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/configCases/split-chunks/incorrect-chunk-reuse/y/3.js b/test/configCases/split-chunks/incorrect-chunk-reuse/y/3.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/configCases/split-chunks/no-options/index.js b/test/configCases/split-chunks/no-options/index.js index b5158af8104..dfc5a1f6d9f 100644 --- a/test/configCases/split-chunks/no-options/index.js +++ b/test/configCases/split-chunks/no-options/index.js @@ -1,6 +1,4 @@ -require("should"); - it("should run", function() { var a = require("./a"); - a.should.be.eql("a"); + expect(a).toBe("a"); }); diff --git a/test/configCases/split-chunks/runtime-chunk-no-async/index.js b/test/configCases/split-chunks/runtime-chunk-no-async/index.js new file mode 100644 index 00000000000..6068c292057 --- /dev/null +++ b/test/configCases/split-chunks/runtime-chunk-no-async/index.js @@ -0,0 +1 @@ +it("should compile and evaluate fine", () => {}); diff --git a/test/configCases/split-chunks/runtime-chunk-no-async/test.config.js b/test/configCases/split-chunks/runtime-chunk-no-async/test.config.js new file mode 100644 index 00000000000..7eafe4ed79c --- /dev/null +++ b/test/configCases/split-chunks/runtime-chunk-no-async/test.config.js @@ -0,0 +1,7 @@ +const fs = require("fs"); +module.exports = { + findBundle: function(i, options) { + var files = fs.readdirSync(options.output.path); + return ["runtime.js", files.filter(f => /^main/.test(f))[0]]; + } +}; diff --git a/test/configCases/split-chunks/runtime-chunk-no-async/webpack.config.js b/test/configCases/split-chunks/runtime-chunk-no-async/webpack.config.js new file mode 100644 index 00000000000..5f4da7943f0 --- /dev/null +++ b/test/configCases/split-chunks/runtime-chunk-no-async/webpack.config.js @@ -0,0 +1,13 @@ +module.exports = { + entry: { + main: "./index" + }, + target: "web", + output: { + filename: "[name].js", + chunkFilename: "main.[contenthash:8].js" + }, + optimization: { + runtimeChunk: "single" + } +}; diff --git a/test/configCases/split-chunks/runtime-chunk/a.js b/test/configCases/split-chunks/runtime-chunk/a.js new file mode 100644 index 00000000000..e135684891b --- /dev/null +++ b/test/configCases/split-chunks/runtime-chunk/a.js @@ -0,0 +1,10 @@ +it("should be able to load the split chunk on demand", () => { + const promise = import(/* webpackChunkName: "shared" */ "./shared"); + + const script = document.head._children[0]; + expect(script.src).toBe("dep~b~shared.js"); + + __non_webpack_require__("./dep~b~shared.js"); + + return promise; +}); diff --git a/test/configCases/split-chunks/runtime-chunk/b.js b/test/configCases/split-chunks/runtime-chunk/b.js new file mode 100644 index 00000000000..d44247b1607 --- /dev/null +++ b/test/configCases/split-chunks/runtime-chunk/b.js @@ -0,0 +1 @@ +import "./shared"; diff --git a/test/configCases/split-chunks/runtime-chunk/shared.js b/test/configCases/split-chunks/runtime-chunk/shared.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/configCases/split-chunks/runtime-chunk/test.config.js b/test/configCases/split-chunks/runtime-chunk/test.config.js new file mode 100644 index 00000000000..dad54da8f4a --- /dev/null +++ b/test/configCases/split-chunks/runtime-chunk/test.config.js @@ -0,0 +1,5 @@ +module.exports = { + findBundle: function(i, options) { + return ["runtime.js", "a.js"]; + } +}; diff --git a/test/configCases/split-chunks/runtime-chunk/webpack.config.js b/test/configCases/split-chunks/runtime-chunk/webpack.config.js new file mode 100644 index 00000000000..1958da90461 --- /dev/null +++ b/test/configCases/split-chunks/runtime-chunk/webpack.config.js @@ -0,0 +1,24 @@ +const path = require("path"); + +module.exports = { + entry: { + a: "./a", + b: "./b" + }, + target: "web", + output: { + filename: "[name].js" + }, + optimization: { + runtimeChunk: "single", + splitChunks: { + cacheGroups: { + dep: { + chunks: "all", + test: path.resolve(__dirname, "shared.js"), + enforce: true + } + } + } + } +}; diff --git a/test/configCases/target/buffer-default/index.js b/test/configCases/target/buffer-default/index.js index 8ffa85e2ff9..9f0b5f8ba42 100644 --- a/test/configCases/target/buffer-default/index.js +++ b/test/configCases/target/buffer-default/index.js @@ -1,10 +1,8 @@ -require("should"); - it("should provide a global Buffer shim", function () { - Buffer.should.be.a.Function(); + expect(Buffer).toBeInstanceOf(Function); }); it("should provide the buffer module", function () { var buffer = require("buffer"); - (typeof buffer).should.be.eql("object"); + expect((typeof buffer)).toBe("object"); }); diff --git a/test/configCases/target/buffer/index.js b/test/configCases/target/buffer/index.js index 1af4ad18816..570c0e3433e 100644 --- a/test/configCases/target/buffer/index.js +++ b/test/configCases/target/buffer/index.js @@ -1,13 +1,3 @@ -require("should"); - it("should provide a global Buffer shim", function () { - Buffer.should.be.a.Function(); + expect(Buffer).toBeInstanceOf(Function); }); - -it("should fail on the buffer module"/*, function () { - (function(argument) { - try { - require("buffer"); - } catch(e) { throw e; } - }).should.throw(); -}*/); diff --git a/test/configCases/target/electron-renderer/index.js b/test/configCases/target/electron-renderer/index.js index 71155221891..6e8c81abb62 100644 --- a/test/configCases/target/electron-renderer/index.js +++ b/test/configCases/target/electron-renderer/index.js @@ -1,5 +1,5 @@ const foo = require("foo"); it("should use browser main field", () => { - foo.should.be.eql("browser"); + expect(foo).toBe("browser"); }); diff --git a/test/configCases/target/node-dynamic-import/index.js b/test/configCases/target/node-dynamic-import/index.js index e5bcc97a816..2c354b52920 100644 --- a/test/configCases/target/node-dynamic-import/index.js +++ b/test/configCases/target/node-dynamic-import/index.js @@ -2,11 +2,11 @@ function testCase(load, done) { load("two", 2, function() { var sync = true; load("one", 1, function() { - sync.should.be.eql(false); + expect(sync).toBe(false); load("three", 3, function() { var sync = true; load("two", 2, function() { - sync.should.be.eql(true); + expect(sync).toBe(true); done(); }); Promise.resolve().then(function() {}).then(function() {}).then(function() { @@ -23,7 +23,10 @@ function testCase(load, done) { it("should be able to use expressions in import", function(done) { function load(name, expected, callback) { import("./dir/" + name + '.js') - .then((result) => {result.should.be.eql({ default: expected }); callback()}) + .then((result) => {expect(result).toEqual({ + default: expected, + [Symbol.toStringTag]: "Module" + }); callback()}) .catch((err) => {done(err)}); } testCase(load, done); @@ -32,7 +35,10 @@ it("should be able to use expressions in import", function(done) { it("should be able to use expressions in lazy-once import", function(done) { function load(name, expected, callback) { import(/* webpackMode: "lazy-once" */ "./dir/" + name + '.js') - .then((result) => {result.should.be.eql({ default: expected }); callback()}) + .then((result) => {expect(result).toEqual({ + default: expected, + [Symbol.toStringTag]: "Module" + }); callback()}) .catch((err) => {done(err)}); } testCase(load, done); @@ -41,7 +47,10 @@ it("should be able to use expressions in lazy-once import", function(done) { it("should be able to use expressions in import", function(done) { function load(name, expected, callback) { import("./dir2/" + name).then((result) => { - result.should.be.eql({ default: expected }); + expect(result).toEqual({ + default: expected, + [Symbol.toStringTag]: "Module" + }); callback(); }).catch((err) => { done(err); @@ -51,12 +60,15 @@ it("should be able to use expressions in import", function(done) { }); it("should convert to function in node", function() { - (typeof __webpack_require__.e).should.be.eql("function"); + expect((typeof __webpack_require__.e)).toBe("function"); }) it("should be able to use import", function(done) { import("./two").then((two) => { - two.should.be.eql({ default: 2 }); + expect(two).toEqual({ + default: 2, + [Symbol.toStringTag]: "Module" + }); done(); }).catch(function(err) { done(err); diff --git a/test/configCases/target/strict-mode-global/index.js b/test/configCases/target/strict-mode-global/index.js index da530ef4d2f..ba0b15cfa7a 100644 --- a/test/configCases/target/strict-mode-global/index.js +++ b/test/configCases/target/strict-mode-global/index.js @@ -1,8 +1,6 @@ "use strict"; -require("should"); - it("should be able to use global in strict mode", function() { - (typeof global).should.be.eql("object"); - (global === null).should.be.eql(false) + expect((typeof global)).toBe("object"); + expect((global === null)).toBe(false) }); diff --git a/test/configCases/target/umd-auxiliary-comments-object/index.js b/test/configCases/target/umd-auxiliary-comments-object/index.js index fd7de7e3cdc..ce88eecbfc7 100644 --- a/test/configCases/target/umd-auxiliary-comments-object/index.js +++ b/test/configCases/target/umd-auxiliary-comments-object/index.js @@ -6,8 +6,8 @@ it("should have auxiliary comments", function() { var fs = require("fs"); var source = fs.readFileSync(__filename, "utf-8"); - source.should.containEql("//test " + "comment " + "commonjs"); - source.should.containEql("//test " + "comment " + "commonjs2"); - source.should.containEql("//test " + "comment " + "amd"); - source.should.containEql("//test " + "comment " + "root"); + expect(source).toMatch("//test " + "comment " + "commonjs"); + expect(source).toMatch("//test " + "comment " + "commonjs2"); + expect(source).toMatch("//test " + "comment " + "amd"); + expect(source).toMatch("//test " + "comment " + "root"); }); diff --git a/test/configCases/target/umd-auxiliary-comments-string/index.js b/test/configCases/target/umd-auxiliary-comments-string/index.js index a02a54a0336..9d9454a3439 100644 --- a/test/configCases/target/umd-auxiliary-comments-string/index.js +++ b/test/configCases/target/umd-auxiliary-comments-string/index.js @@ -5,6 +5,6 @@ it("should run", function() { it("should have auxiliary comment string", function() { var fs = require("fs"); var source = fs.readFileSync(__filename, "utf-8"); - - source.should.containEql("//test " + "comment"); + + expect(source).toMatch("//test " + "comment"); }); diff --git a/test/configCases/target/umd-named-define/index.js b/test/configCases/target/umd-named-define/index.js index 749fbe37bba..0d9cc474b4f 100644 --- a/test/configCases/target/umd-named-define/index.js +++ b/test/configCases/target/umd-named-define/index.js @@ -6,5 +6,5 @@ it("should name define", function() { var fs = require("fs"); var source = fs.readFileSync(__filename, "utf-8"); - source.should.containEql("define(\"NamedLibrary\","); + expect(source).toMatch("define(\"NamedLibrary\","); }); diff --git a/test/configCases/target/web/index.js b/test/configCases/target/web/index.js index 5b659b74616..9e30bd08e1f 100644 --- a/test/configCases/target/web/index.js +++ b/test/configCases/target/web/index.js @@ -1,101 +1,90 @@ -require("should"); - -// shimming global XMLHttpRequest object so the http-module is happy. global.XMLHttpRequest = function() {}; global.XMLHttpRequest.prototype.open = function() {}; it("should provide a global Buffer constructor", function() { - Buffer.should.be.a.Function(); + expect(Buffer).toBeInstanceOf(Function); }); -// Webpack is not providing a console shim by default -// @see lib/WebpackOptionsDefaulter.js -// Uncomment this when defaults are changed -//it("should provide a global console shim", function () { -// console.should.be.an.Object(); -// console.time.should.be.a.Function(); -//}); - it("should provide a global process shim", function () { - process.should.be.an.Object(); + expect(process).toBeInstanceOf(Object); }); it("should provide a global setImmediate shim", function () { - setImmediate.should.be.a.Function(); + expect(setImmediate).toBeInstanceOf(Function); }); it("should provide a global clearImmediate shim", function () { - clearImmediate.should.be.a.Function(); + expect(clearImmediate).toBeInstanceOf(Function); }); it("should provide an assert shim", function () { - require("assert").should.be.a.Function(); + expect(require("assert")).toBeInstanceOf(Function); }); it("should provide a util shim", function () { - require("util").should.be.an.Object(); + expect(require("util")).toBeInstanceOf(Object); }); it("should provide a buffer shim", function () { - require("buffer").should.be.an.Object(); + expect(require("buffer")).toBeInstanceOf(Object); }); it("should provide a crypto shim", function () { - require("crypto").should.be.an.Object(); + expect(require("crypto")).toBeInstanceOf(Object); }); it("should provide a domain shim", function () { - require("domain").should.be.an.Object(); + expect(require("domain")).toBeInstanceOf(Object); }); it("should provide an events shim", function () { - require("events").should.be.a.Function(); + expect(require("events")).toBeInstanceOf(Function); }); it("should provide an http shim", function () { - require("http").should.be.an.Object(); + expect(require("http")).toBeInstanceOf(Object); }); it("should provide an https shim", function () { - require("https").should.be.an.Object(); + expect(require("https")).toBeInstanceOf(Object); }); it("should provide an os shim", function () { - require("os").should.be.an.Object(); + expect(require("os")).toBeInstanceOf(Object); }); it("should provide a path shim", function () { - require("path").should.be.an.Object(); + expect(require("path")).toBeInstanceOf(Object); }); it("should provide a punycode shim", function () { - require("punycode").should.be.an.Object(); + expect(require("punycode")).toBeInstanceOf(Object); }); it("should provide a stream shim", function () { - require("stream").should.be.a.Function(); + expect(require("stream")).toBeInstanceOf(Function); }); it("should provide a tty shim", function () { - require("tty").should.be.an.Object(); + expect(require("tty")).toBeInstanceOf(Object); }); it("should provide a url shim", function () { - require("url").should.be.an.Object(); + expect(require("url")).toBeInstanceOf(Object); }); it("should provide a util shim", function () { - require("util").should.be.an.Object(); + expect(require("util")).toBeInstanceOf(Object); }); it("should provide a vm shim", function () { - require("vm").should.be.an.Object(); + expect(require("vm")).toBeInstanceOf(Object); }); it("should provide a zlib shim", function () { - require("zlib").should.be.an.Object(); + expect(require("zlib")).toBeInstanceOf(Object); }); it("should provide a shim for a path in a build-in module", function () { - require("process/in.js").should.be.eql("in process"); + expect(require("process/in.js")).toBe("in process"); }); diff --git a/test/configCases/target/webworker/index.js b/test/configCases/target/webworker/index.js index 63a9cf2ceee..40d1f61278f 100644 --- a/test/configCases/target/webworker/index.js +++ b/test/configCases/target/webworker/index.js @@ -1,98 +1,95 @@ -var should = require("should"); -// shimming global window object so the http-module is happy. -// window is assigned without var on purpose. global.XMLHttpRequest = function() {}; global.XMLHttpRequest.prototype.open = function() {}; it("should provide a global Buffer constructor", function() { - Buffer.should.be.a.Function(); + expect(Buffer).toBeInstanceOf(Function); }); it("should provide a global console shim", function () { - console.should.be.an.Object(); - console.time.should.be.a.Function(); + expect(console).toBeTypeOf("object"); + expect(console.time).toBeTypeOf("function"); }); it("should provide a global process shim", function () { - process.should.be.an.Object(); + expect(process).toBeInstanceOf(Object); }); it("should provide a global setImmediate shim", function () { - setImmediate.should.be.a.Function(); + expect(setImmediate).toBeInstanceOf(Function); }); it("should provide a global clearImmediate shim", function () { - clearImmediate.should.be.a.Function(); + expect(clearImmediate).toBeInstanceOf(Function); }); it("should provide an assert shim", function () { - require("assert").should.be.a.Function(); + expect(require("assert")).toBeInstanceOf(Function); }); it("should provide a util shim", function () { - require("util").should.be.an.Object(); + expect(require("util")).toBeInstanceOf(Object); }); it("should provide a buffer shim", function () { - require("buffer").should.be.an.Object(); + expect(require("buffer")).toBeInstanceOf(Object); }); it("should provide a crypto shim", function () { - require("crypto").should.be.an.Object(); + expect(require("crypto")).toBeInstanceOf(Object); }); it("should provide a domain shim", function () { - require("domain").should.be.an.Object(); + expect(require("domain")).toBeInstanceOf(Object); }); it("should provide an events shim", function () { - require("events").should.be.a.Function(); + expect(require("events")).toBeInstanceOf(Function); }); it("should provide an http shim", function () { - require("http").should.be.an.Object(); + expect(require("http")).toBeInstanceOf(Object); }); it("should provide an https shim", function () { - require("https").should.be.an.Object(); + expect(require("https")).toBeInstanceOf(Object); }); it("should provide an os shim", function () { - require("os").should.be.an.Object(); + expect(require("os")).toBeInstanceOf(Object); }); it("should provide a path shim", function () { - require("path").should.be.an.Object(); + expect(require("path")).toBeInstanceOf(Object); }); it("should provide a punycode shim", function () { - require("punycode").should.be.an.Object(); + expect(require("punycode")).toBeInstanceOf(Object); }); it("should provide a stream shim", function () { - require("stream").should.be.a.Function(); + expect(require("stream")).toBeInstanceOf(Function); }); it("should provide a tty shim", function () { - require("tty").should.be.an.Object(); + expect(require("tty")).toBeInstanceOf(Object); }); it("should provide a url shim", function () { - require("url").should.be.an.Object(); + expect(require("url")).toBeInstanceOf(Object); }); it("should provide a util shim", function () { - require("util").should.be.an.Object(); + expect(require("util")).toBeInstanceOf(Object); }); it("should provide a vm shim", function () { - require("vm").should.be.an.Object(); + expect(require("vm")).toBeInstanceOf(Object); }); it("should provide a zlib shim", function () { - require("zlib").should.be.an.Object(); + expect(require("zlib")).toBeInstanceOf(Object); }); it("should provide a shim for a path in a build-in module", function () { - require("process/in.js").should.be.eql("in process"); + expect(require("process/in.js")).toBe("in process"); }); diff --git a/test/configCases/web/prefetch-preload/chunk1-a.js b/test/configCases/web/prefetch-preload/chunk1-a.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/configCases/web/prefetch-preload/chunk1-b.js b/test/configCases/web/prefetch-preload/chunk1-b.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/configCases/web/prefetch-preload/chunk1-c.js b/test/configCases/web/prefetch-preload/chunk1-c.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/configCases/web/prefetch-preload/chunk1.js b/test/configCases/web/prefetch-preload/chunk1.js new file mode 100644 index 00000000000..60d6f1685b7 --- /dev/null +++ b/test/configCases/web/prefetch-preload/chunk1.js @@ -0,0 +1,5 @@ +export default function() { + import(/* webpackPrefetch: true, webpackChunkName: "chunk1-a" */ "./chunk1-a"); + import(/* webpackPreload: true, webpackChunkName: "chunk1-b" */ "./chunk1-b"); + import(/* webpackPrefetch: 10, webpackChunkName: "chunk1-c" */ "./chunk1-c"); +} diff --git a/test/configCases/web/prefetch-preload/chunk2.js b/test/configCases/web/prefetch-preload/chunk2.js new file mode 100644 index 00000000000..a225cae317f --- /dev/null +++ b/test/configCases/web/prefetch-preload/chunk2.js @@ -0,0 +1,4 @@ +export default function() { + import(/* webpackPrefetch: true, webpackChunkName: "chunk1-a" */ "./chunk1-a"); + import(/* webpackPreload: true, webpackChunkName: "chunk1-b" */ "./chunk1-b"); +} diff --git a/test/configCases/web/prefetch-preload/index.js b/test/configCases/web/prefetch-preload/index.js new file mode 100644 index 00000000000..2d393f55a6b --- /dev/null +++ b/test/configCases/web/prefetch-preload/index.js @@ -0,0 +1,99 @@ + +let oldNonce; +let oldPublicPath; + +beforeEach(() => { + oldNonce = __webpack_nonce__; + oldPublicPath = __webpack_public_path__; +}); + +afterEach(() => { + __webpack_nonce__ = oldNonce; + __webpack_public_path__ = oldPublicPath; +}) + +it("should prefetch and preload child chunks on chunk load", () => { + __webpack_nonce__ = "nonce"; + __webpack_public_path__ = "/public/path/"; + + let link, script; + + expect(document.head._children).toHaveLength(1); + + // Test prefetch from entry chunk + link = document.head._children[0]; + expect(link._type).toBe("link"); + expect(link.rel).toBe("prefetch"); + expect(link.href).toMatch(/chunk1\.js$/); + + const promise = import(/* webpackChunkName: "chunk1", webpackPrefetch: true */ "./chunk1"); + + expect(document.head._children).toHaveLength(3); + + // Test normal script loading + script = document.head._children[1]; + expect(script._type).toBe("script"); + expect(script.src).toMatch(/chunk1\.js$/); + expect(script.getAttribute("nonce")).toBe("nonce") + expect(script.crossOrigin).toBe("anonymous"); + expect(script.onload).toBeTypeOf("function"); + + // Test preload of chunk1-b + link = document.head._children[2]; + expect(link._type).toBe("link"); + expect(link.rel).toBe("preload"); + expect(link.as).toBe("script"); + expect(link.href).toMatch(/chunk1-b\.js$/); + expect(link.charset).toBe("utf-8"); + expect(link.getAttribute("nonce")).toBe("nonce"); + expect(link.crossOrigin).toBe("anonymous"); + + // Run the script + __non_webpack_require__("./chunk1.js"); + + script.onload(); + + return promise.then(() => { + expect(document.head._children).toHaveLength(5); + + // Test prefetching for chunk1-c and chunk1-a in this order + link = document.head._children[3]; + expect(link._type).toBe("link"); + expect(link.rel).toBe("prefetch"); + expect(link.href).toMatch(/chunk1-c\.js$/); + expect(link.crossOrigin).toBe("anonymous"); + + link = document.head._children[4]; + expect(link._type).toBe("link"); + expect(link.rel).toBe("prefetch"); + expect(link.href).toMatch(/chunk1-a\.js$/); + expect(link.crossOrigin).toBe("anonymous"); + + const promise2 = import(/* webpackChunkName: "chunk1", webpackPrefetch: true */ "./chunk1"); + + // Loading chunk1 again should not trigger prefetch/preload + expect(document.head._children).toHaveLength(5); + + const promise3 = import(/* webpackChunkName: "chunk2" */ "./chunk2"); + + expect(document.head._children).toHaveLength(6); + + // Test normal script loading + script = document.head._children[5]; + expect(script._type).toBe("script"); + expect(script.src).toMatch(/chunk2\.js$/); + expect(script.getAttribute("nonce")).toBe("nonce") + expect(script.crossOrigin).toBe("anonymous"); + expect(script.onload).toBeTypeOf("function"); + + // Run the script + __non_webpack_require__("./chunk2.js"); + + script.onload(); + + return promise3.then(() => { + // Loading chunk2 again should not trigger prefetch/preload as it's already prefetch/preloaded + expect(document.head._children).toHaveLength(6); + }); + }); +}) diff --git a/test/configCases/web/prefetch-preload/webpack.config.js b/test/configCases/web/prefetch-preload/webpack.config.js new file mode 100644 index 00000000000..34460c414c7 --- /dev/null +++ b/test/configCases/web/prefetch-preload/webpack.config.js @@ -0,0 +1,13 @@ +module.exports = { + target: "web", + output: { + chunkFilename: "[name].js", + crossOriginLoading: "anonymous" + }, + performance: { + hints: false + }, + optimization: { + minimize: false + } +}; diff --git a/test/fixtures/errors/async-error-loader.js b/test/fixtures/errors/async-error-loader.js new file mode 100644 index 00000000000..a0eba8a9d54 --- /dev/null +++ b/test/fixtures/errors/async-error-loader.js @@ -0,0 +1,5 @@ +module.exports = function(source) { + const callback = this.async(); + const error = new Error("this is a callback error"); + callback(error, source); +}; diff --git a/test/fixtures/errors/emit-error-loader.js b/test/fixtures/errors/emit-error-loader.js new file mode 100644 index 00000000000..57164e2206c --- /dev/null +++ b/test/fixtures/errors/emit-error-loader.js @@ -0,0 +1,5 @@ +module.exports = function(source) { + this.emitWarning(new Error("this is a warning")); + this.emitError(new Error("this is an error")); + return source; +}; diff --git a/test/fixtures/errors/entry-point-error-loader-required.js b/test/fixtures/errors/entry-point-error-loader-required.js new file mode 100644 index 00000000000..6811cb8072c --- /dev/null +++ b/test/fixtures/errors/entry-point-error-loader-required.js @@ -0,0 +1 @@ +require("./emit-error-loader.js!./file"); diff --git a/test/fixtures/errors/irregular-error-loader.js b/test/fixtures/errors/irregular-error-loader.js new file mode 100644 index 00000000000..8b38ff7eff0 --- /dev/null +++ b/test/fixtures/errors/irregular-error-loader.js @@ -0,0 +1,10 @@ +module.exports = function(source) { + const empty = null; + const emptyError = new Error(); + this.emitWarning(empty); + this.emitWarning(emptyError); + this.emitError(empty); + this.emitError(emptyError); + throw "a string error"; + return source; +}; diff --git a/test/fixtures/errors/no-return-loader.js b/test/fixtures/errors/no-return-loader.js new file mode 100644 index 00000000000..0a4b3bfaa71 --- /dev/null +++ b/test/fixtures/errors/no-return-loader.js @@ -0,0 +1,2 @@ +module.exports = function(){ +} diff --git a/test/fixtures/errors/not-a-json.js b/test/fixtures/errors/not-a-json.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/fixtures/errors/throw-error-loader.js b/test/fixtures/errors/throw-error-loader.js new file mode 100644 index 00000000000..3142eedc09d --- /dev/null +++ b/test/fixtures/errors/throw-error-loader.js @@ -0,0 +1,3 @@ +module.exports = function(source) { + throw new Error("this is a thrown error"); +}; diff --git a/test/formatLocation.unittest.js b/test/formatLocation.unittest.js index 5cebdb4051a..1d4f64b615c 100644 --- a/test/formatLocation.unittest.js +++ b/test/formatLocation.unittest.js @@ -1,6 +1,5 @@ "use strict"; -require("should"); const formatLocation = require("../lib/formatLocation"); describe("formatLocation", () => { @@ -102,7 +101,7 @@ describe("formatLocation", () => { ]; testCases.forEach(testCase => { it(`should format location correctly for ${testCase.name}`, () => { - formatLocation(testCase.loc).should.be.eql(testCase.result); + expect(formatLocation(testCase.loc)).toEqual(testCase.result); }); }); }); diff --git a/test/helpers/FakeDocument.js b/test/helpers/FakeDocument.js new file mode 100644 index 00000000000..0c9d80de06f --- /dev/null +++ b/test/helpers/FakeDocument.js @@ -0,0 +1,36 @@ +module.exports = class FakeDocument { + constructor() { + this.head = this.createElement("head"); + } + + createElement(type) { + return new FakeElement(type); + } + + getElementsByTagName(name) { + if (name === "head") return [this.head]; + throw new Error( + `FakeDocument.getElementsByTagName(${name}): not implemented` + ); + } +}; + +class FakeElement { + constructor(type) { + this._type = type; + this._children = []; + this._attributes = Object.create(null); + } + + appendChild(node) { + this._children.push(node); + } + + setAttribute(name, value) { + this._attributes[name] = value; + } + + getAttribute(name) { + return this._attributes[name]; + } +} diff --git a/lib/prepareOptions.js b/test/helpers/prepareOptions.js similarity index 100% rename from lib/prepareOptions.js rename to test/helpers/prepareOptions.js diff --git a/test/helpers/remove.js b/test/helpers/remove.js new file mode 100644 index 00000000000..747e9302dae --- /dev/null +++ b/test/helpers/remove.js @@ -0,0 +1,13 @@ +module.exports.remove = function remove(src) { + if (!fs.existsSync(src)) return; + const files = fs.readdirSync(src); + files.forEach(filename => { + const srcFile = path.join(src, filename); + const directory = fs.statSync(srcFile).isDirectory(); + if (directory) { + remove(srcFile); + } else { + fs.unlinkSync(srcFile); + } + }); +} diff --git a/test/helpers/supportsOptionalCatchBinding.js b/test/helpers/supportsOptionalCatchBinding.js new file mode 100644 index 00000000000..8e3edbfb254 --- /dev/null +++ b/test/helpers/supportsOptionalCatchBinding.js @@ -0,0 +1,8 @@ +module.exports = function supportsOptionalCatchBinding() { + try { + eval("try {} catch {}"); + return true; + } catch(e) { + return false; + } +}; diff --git a/test/hotCases/chunks/accept-system-import/index.js b/test/hotCases/chunks/accept-system-import/index.js index b9df9862d35..33bdc93b40c 100644 --- a/test/hotCases/chunks/accept-system-import/index.js +++ b/test/hotCases/chunks/accept-system-import/index.js @@ -1,14 +1,14 @@ -it("should import a changed chunk", function(done) { - import("./chunk").then(function(chunk) { - chunk.value.should.be.eql(1); - import("./chunk2").then(function(chunk2) { - chunk2.value.should.be.eql(1); +it("should import a changed chunk", (done) => { + import("./chunk").then((chunk) => { + expect(chunk.value).toBe(1); + import("./chunk2").then((chunk2) => { + expect(chunk2.value).toBe(1); NEXT(require("../../update")(done)); - module.hot.accept(["./chunk", "./chunk2"], function() { - import("./chunk").then(function(chunk) { - chunk.value.should.be.eql(2); - import("./chunk2").then(function(chunk2) { - chunk2.value.should.be.eql(2); + module.hot.accept(["./chunk", "./chunk2"], () => { + import("./chunk").then((chunk) => { + expect(chunk.value).toBe(2); + import("./chunk2").then((chunk2) => { + expect(chunk2.value).toBe(2); done(); }).catch(done); }).catch(done); diff --git a/test/hotCases/chunks/dynamic-system-import/index.js b/test/hotCases/chunks/dynamic-system-import/index.js index 156938628e7..49ffb821506 100644 --- a/test/hotCases/chunks/dynamic-system-import/index.js +++ b/test/hotCases/chunks/dynamic-system-import/index.js @@ -2,12 +2,12 @@ it("should import a changed chunk (dynamic import)", function(done) { function load(name) { return import("./chunk" + name); } - load(1).then(function(chunk) { - chunk.value.should.be.eql(1); - NEXT(require("../../update")(done, true, function() { - chunk.value.should.be.eql(2); - load(2).then(function(chunk2) { - chunk2.value.should.be.eql(2); + load(1).then((chunk) => { + expect(chunk.value).toBe(1); + NEXT(require("../../update")(done, true, () => { + expect(chunk.value).toBe(2); + load(2).then((chunk2) => { + expect(chunk2.value).toBe(2); done(); }).catch(done); })); diff --git a/test/hotCases/chunks/system-import/index.js b/test/hotCases/chunks/system-import/index.js index 0a0d4003883..707a554fc6e 100644 --- a/test/hotCases/chunks/system-import/index.js +++ b/test/hotCases/chunks/system-import/index.js @@ -1,16 +1,16 @@ -it("should import a changed chunk", function(done) { - import("./chunk").then(function(chunk) { - chunk.value.should.be.eql(1); - chunk.value2.should.be.eql(3); - chunk.counter.should.be.eql(0); - NEXT(require("../../update")(done, true, function() { - chunk.value.should.be.eql(2); - chunk.value2.should.be.eql(4); - chunk.counter.should.be.eql(1); +it("should import a changed chunk", (done) => { + import("./chunk").then((chunk) => { + expect(chunk.value).toBe(1); + expect(chunk.value2).toBe(3); + expect(chunk.counter).toBe(0); + NEXT(require("../../update")(done, true, () => { + expect(chunk.value).toBe(2); + expect(chunk.value2).toBe(4); + expect(chunk.counter).toBe(1); import("./chunk2").then(function(chunk2) { - chunk2.value.should.be.eql(2); - chunk2.value2.should.be.eql(4); - chunk2.counter.should.be.eql(0); + expect(chunk2.value).toBe(2); + expect(chunk2.value2).toBe(4); + expect(chunk2.counter).toBe(0); done(); }).catch(done); })); diff --git a/test/hotCases/concat/reload-compat-flag/index.js b/test/hotCases/concat/reload-compat-flag/index.js index 7f36344a73d..495849e609e 100644 --- a/test/hotCases/concat/reload-compat-flag/index.js +++ b/test/hotCases/concat/reload-compat-flag/index.js @@ -1,15 +1,15 @@ var x = require("./module"); -it("should allow to hot replace modules in a ConcatenatedModule", function(done) { - x.should.be.eql({ +it("should allow to hot replace modules in a ConcatenatedModule", (done) => { + expect(x).toEqual({ default: "ok1", - __esModule: true + [Symbol.toStringTag]: "Module" }); - module.hot.accept("./module", function() { + module.hot.accept("./module", () => { x = require("./module"); - x.should.be.eql({ + expect(x).toEqual({ default: "ok2", - __esModule: true + [Symbol.toStringTag]: "Module" }); done(); }); diff --git a/test/hotCases/concat/reload-external/module.js b/test/hotCases/concat/reload-external/module.js index e24ad7de786..c77601225c9 100644 --- a/test/hotCases/concat/reload-external/module.js +++ b/test/hotCases/concat/reload-external/module.js @@ -1,15 +1,15 @@ import value1 from "./a"; import value2 from "./b"; -it("should allow to hot replace modules in a ConcatenatedModule", function(done) { - value1.should.be.eql(1); - value2.should.be.eql(10); - module.hot.accept("./a", function() { - value1.should.be.eql(2); +it("should allow to hot replace modules in a ConcatenatedModule", (done) => { + expect(value1).toBe(1); + expect(value2).toBe(10); + module.hot.accept("./a", () => { + expect(value1).toBe(2); NEXT(require("../../update")(done)); }); - module.hot.accept("./b", function() { - value2.should.be.eql(20); + module.hot.accept("./b", () => { + expect(value2).toBe(20); done(); }); NEXT(require("../../update")(done)); diff --git a/test/hotCases/define/issue-6962/a.js b/test/hotCases/define/issue-6962/a.js new file mode 100644 index 00000000000..4fd27070716 --- /dev/null +++ b/test/hotCases/define/issue-6962/a.js @@ -0,0 +1,3 @@ +export default 1; +--- +export default 2; diff --git a/test/hotCases/define/issue-6962/index.js b/test/hotCases/define/issue-6962/index.js new file mode 100644 index 00000000000..78b4fb26bba --- /dev/null +++ b/test/hotCases/define/issue-6962/index.js @@ -0,0 +1 @@ +import "./module"; diff --git a/test/hotCases/define/issue-6962/module.js b/test/hotCases/define/issue-6962/module.js new file mode 100644 index 00000000000..542fc4de460 --- /dev/null +++ b/test/hotCases/define/issue-6962/module.js @@ -0,0 +1,19 @@ +import value1 from "./a"; + +it("should have the expected static path defined", function() { + expect(DEFINE_PATH).toBe('./a'); +}); + +it("should hot.accept the module located at the static file path without breaking the compiler", function() { + module.hot.accept("./a"); + expect(value1).toBe(1); +}); + +it("should hot.accept the module located at the defined file path without breaking the compiler, when one argument is passed to hot.accept", function() { + module.hot.accept(DEFINE_PATH); +}); + +it("should hot.accept the module located at the defined file path without breaking the compiler, when multiple arguments are passed to hot.accept", function(done) { + module.hot.accept(DEFINE_PATH, () => done()); + NEXT(require("../../update")(done)); +}); diff --git a/test/hotCases/define/issue-6962/webpack.config.js b/test/hotCases/define/issue-6962/webpack.config.js new file mode 100644 index 00000000000..3d212ee5e1c --- /dev/null +++ b/test/hotCases/define/issue-6962/webpack.config.js @@ -0,0 +1,11 @@ +"use strict"; + +const webpack = require("../../../../"); + +module.exports = { + plugins: [ + new webpack.DefinePlugin({ + DEFINE_PATH: JSON.stringify("./a") + }) + ] +}; diff --git a/test/hotCases/errors/decline/index.js b/test/hotCases/errors/decline/index.js index 8b6f79bcce9..e7b844a0a5d 100644 --- a/test/hotCases/errors/decline/index.js +++ b/test/hotCases/errors/decline/index.js @@ -1,11 +1,14 @@ import a from "./a"; -it("should abort when module is declined by parent", function(done) { - a.should.be.eql(1); - NEXT(require("../../update")(function(err) { +it("should abort when module is declined by parent", (done) => { + expect(a).toBe(1); + NEXT(require("../../update")((err) => { try { - err.message.should.match(/Aborted because of declined dependency: \.\/b\.js in \.\/a\.js\nUpdate propagation: \.\/c\.js -> \.\/b\.js -> \.\/a\.js/); + expect(/Aborted because of declined dependency: \.\/b\.js in \.\/a\.js/.test(err.message)).toBe(true); + expect(/Update propagation: \.\/c\.js -> \.\/b\.js -> \.\/a\.js/.test(err.message)).toBe(true); done(); - } catch(e) { done(e); } + } catch(e) { + done(e); + } })); }); diff --git a/test/hotCases/errors/events/index.js b/test/hotCases/errors/events/index.js index 38806691215..d28545594ed 100644 --- a/test/hotCases/errors/events/index.js +++ b/test/hotCases/errors/events/index.js @@ -5,28 +5,30 @@ import f from "./f"; import h from "./h"; import j from "./j"; -it("should fire the correct events", function(done) { +it("should fire the correct events", (done) => { var events = []; var options = { ignoreUnaccepted: true, ignoreDeclined: true, ignoreErrored: true, - onDeclined: function(data) { events.push(data); }, - onUnaccepted: function(data) { events.push(data); }, - onAccepted: function(data) { events.push(data); }, - onErrored: function(data) { events.push(data); } + onDeclined(data) { events.push(data); }, + onUnaccepted(data) { events.push(data); }, + onAccepted(data) { events.push(data); }, + onErrored(data) { events.push(data); } }; function waitForUpdate(fn) { - NEXT(require("../../update")(done, options, function() { + NEXT(require("../../update")(done, options, () => { try { fn(); - } catch(e) { done(e); } + } catch(e) { + done(e); + } })); } - waitForUpdate(function() { - events.should.be.eql([ + waitForUpdate(() => { + expect(events).toEqual([ { type: "unaccepted", moduleId: "./index.js", diff --git a/test/hotCases/errors/self-decline/index.js b/test/hotCases/errors/self-decline/index.js index fb93936a533..b5814ee0867 100644 --- a/test/hotCases/errors/self-decline/index.js +++ b/test/hotCases/errors/self-decline/index.js @@ -1,11 +1,14 @@ import a from "./a"; -it("should abort when module is declined by itself", function(done) { - a.should.be.eql(1); - NEXT(require("../../update")(function(err) { +it("should abort when module is declined by itself", (done) => { + expect(a).toBe(1); + NEXT(require("../../update")((err) => { try { - err.message.should.match(/Aborted because of self decline: \.\/a\.js\nUpdate propagation: \.\/c\.js -> \.\/b\.js -> \.\/a\.js/); + expect(/Aborted because of self decline: \.\/a\.js/.test(err.message)).toBe(true); + expect(/Update propagation: \.\/c\.js -> \.\/b\.js -> \.\/a\.js/.test(err.message)).toBe(true); done(); - } catch(e) { done(e); } + } catch(e) { + done(e); + } })); }); diff --git a/test/hotCases/errors/unaccepted-ignored/index.js b/test/hotCases/errors/unaccepted-ignored/index.js index d20b4b65e71..05cc280c156 100644 --- a/test/hotCases/errors/unaccepted-ignored/index.js +++ b/test/hotCases/errors/unaccepted-ignored/index.js @@ -3,22 +3,22 @@ import get from "./b"; var options = { ignoreUnaccepted: true }; -it("should ignore unaccepted module updates", function(done) { +it("should ignore unaccepted module updates", (done) => { function waitForUpdate(fn) { NEXT(require("../../update")(done, options, fn)); } - a.should.be.eql(2); - get().should.be.eql(1); - waitForUpdate(function() { - a.should.be.eql(2); - get().should.be.eql(1); - waitForUpdate(function() { - a.should.be.eql(2); - get().should.be.eql(2); - waitForUpdate(function() { - a.should.be.eql(2); - get().should.be.eql(3); + expect(a).toBe(2); + expect(get()).toBe(1); + waitForUpdate(() => { + expect(a).toBe(2); + expect(get()).toBe(1); + waitForUpdate(() => { + expect(a).toBe(2); + expect(get()).toBe(2); + waitForUpdate(() => { + expect(a).toBe(2); + expect(get()).toBe(3); done(); }); }); diff --git a/test/hotCases/errors/unaccepted/index.js b/test/hotCases/errors/unaccepted/index.js index 359ec5c64ea..5409a58f740 100644 --- a/test/hotCases/errors/unaccepted/index.js +++ b/test/hotCases/errors/unaccepted/index.js @@ -1,12 +1,13 @@ import a from "./a"; import b from "./b"; -it("should abort when module is not accepted", function(done) { - a.should.be.eql(2); - b.should.be.eql(1); - NEXT(require("../../update")(function(err) { +it("should abort when module is not accepted", (done) => { + expect(a).toBe(2); + expect(b).toBe(1); + NEXT(require("../../update")((err) => { try { - err.message.should.match(/Aborted because \.\/c\.js is not accepted\nUpdate propagation: \.\/c\.js -> \.\/b\.js -> \.\/index\.js/); + expect(/Aborted because \.\/c\.js is not accepted/.test(err.message)).toBe(true); + expect(/Update propagation: \.\/c\.js -> \.\/b\.js -> \.\/index\.js/.test(err.message)).toBe(true); done(); } catch(e) { done(e); } })); diff --git a/test/hotCases/harmony/auto-import-default/index.js b/test/hotCases/harmony/auto-import-default/index.js index 53a4b6fe06b..976b95a7fbc 100644 --- a/test/hotCases/harmony/auto-import-default/index.js +++ b/test/hotCases/harmony/auto-import-default/index.js @@ -1,9 +1,9 @@ import value from "./file"; -it("should auto-import a ES6 imported default value from non-harmony module on accept", function(done) { - value.should.be.eql(1); - module.hot.accept("./file", function() { - value.should.be.eql(2); +it("should auto-import a ES6 imported default value from non-harmony module on accept", (done) => { + expect(value).toBe(1); + module.hot.accept("./file", () => { + expect(value).toBe(2); outside(); done(); }); @@ -11,5 +11,5 @@ it("should auto-import a ES6 imported default value from non-harmony module on a }); function outside() { - value.should.be.eql(2); + expect(value).toBe(2); } diff --git a/test/hotCases/harmony/auto-import-default/out/bundle.js b/test/hotCases/harmony/auto-import-default/out/bundle.js deleted file mode 100644 index c99f1b02be1..00000000000 --- a/test/hotCases/harmony/auto-import-default/out/bundle.js +++ /dev/null @@ -1,784 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ function hotDisposeChunk(chunkId) { -/******/ delete installedChunks[chunkId]; -/******/ } -/******/ var parentHotUpdateCallback = this["webpackHotUpdate"]; -/******/ this["webpackHotUpdate"] = function webpackHotUpdateCallback(chunkId, moreModules) { // eslint-disable-line no-unused-vars -/******/ hotAddUpdateChunk(chunkId, moreModules); -/******/ if(parentHotUpdateCallback) parentHotUpdateCallback(chunkId, moreModules); -/******/ } ; -/******/ -/******/ function hotDownloadUpdateChunk(chunkId) { // eslint-disable-line no-unused-vars -/******/ var head = document.getElementsByTagName("head")[0]; -/******/ var script = document.createElement("script"); -/******/ script.charset = "utf-8"; -/******/ script.src = __webpack_require__.p + "" + chunkId + "." + hotCurrentHash + ".hot-update.js"; -/******/ ; -/******/ head.appendChild(script); -/******/ } -/******/ -/******/ function hotDownloadManifest(requestTimeout) { // eslint-disable-line no-unused-vars -/******/ requestTimeout = requestTimeout || 10000; -/******/ return new Promise(function(resolve, reject) { -/******/ if(typeof XMLHttpRequest === "undefined") -/******/ return reject(new Error("No browser support")); -/******/ try { -/******/ var request = new XMLHttpRequest(); -/******/ var requestPath = __webpack_require__.p + "" + hotCurrentHash + ".hot-update.json"; -/******/ request.open("GET", requestPath, true); -/******/ request.timeout = requestTimeout; -/******/ request.send(null); -/******/ } catch(err) { -/******/ return reject(err); -/******/ } -/******/ request.onreadystatechange = function() { -/******/ if(request.readyState !== 4) return; -/******/ if(request.status === 0) { -/******/ // timeout -/******/ reject(new Error("Manifest request to " + requestPath + " timed out.")); -/******/ } else if(request.status === 404) { -/******/ // no update available -/******/ resolve(); -/******/ } else if(request.status !== 200 && request.status !== 304) { -/******/ // other failure -/******/ reject(new Error("Manifest request to " + requestPath + " failed.")); -/******/ } else { -/******/ // success -/******/ try { -/******/ var update = JSON.parse(request.responseText); -/******/ } catch(e) { -/******/ reject(e); -/******/ return; -/******/ } -/******/ resolve(update); -/******/ } -/******/ }; -/******/ }); -/******/ } -/******/ -/******/ -/******/ var hotApplyOnUpdate = true; -/******/ var hotCurrentHash = "9e66a96510409aa06627"; // eslint-disable-line no-unused-vars -/******/ var hotRequestTimeout = 10000; -/******/ var hotCurrentModuleData = {}; -/******/ var hotCurrentChildModule; // eslint-disable-line no-unused-vars -/******/ var hotCurrentParents = []; // eslint-disable-line no-unused-vars -/******/ var hotCurrentParentsTemp = []; // eslint-disable-line no-unused-vars -/******/ -/******/ function hotCreateRequire(moduleId) { // eslint-disable-line no-unused-vars -/******/ var me = installedModules[moduleId]; -/******/ if(!me) return __webpack_require__; -/******/ var fn = function(request) { -/******/ if(me.hot.active) { -/******/ if(installedModules[request]) { -/******/ if(installedModules[request].parents.indexOf(moduleId) < 0) -/******/ installedModules[request].parents.push(moduleId); -/******/ } else { -/******/ hotCurrentParents = [moduleId]; -/******/ hotCurrentChildModule = request; -/******/ } -/******/ if(me.children.indexOf(request) < 0) -/******/ me.children.push(request); -/******/ } else { -/******/ console.warn("[HMR] unexpected require(" + request + ") from disposed module " + moduleId); -/******/ hotCurrentParents = []; -/******/ } -/******/ return __webpack_require__(request); -/******/ }; -/******/ var ObjectFactory = function ObjectFactory(name) { -/******/ return { -/******/ configurable: true, -/******/ enumerable: true, -/******/ get: function() { -/******/ return __webpack_require__[name]; -/******/ }, -/******/ set: function(value) { -/******/ __webpack_require__[name] = value; -/******/ } -/******/ }; -/******/ }; -/******/ for(var name in __webpack_require__) { -/******/ if(Object.prototype.hasOwnProperty.call(__webpack_require__, name) && name !== "e") { -/******/ Object.defineProperty(fn, name, ObjectFactory(name)); -/******/ } -/******/ } -/******/ fn.e = function(chunkId) { -/******/ if(hotStatus === "ready") -/******/ hotSetStatus("prepare"); -/******/ hotChunksLoading++; -/******/ return __webpack_require__.e(chunkId).then(finishChunkLoading, function(err) { -/******/ finishChunkLoading(); -/******/ throw err; -/******/ }); -/******/ -/******/ function finishChunkLoading() { -/******/ hotChunksLoading--; -/******/ if(hotStatus === "prepare") { -/******/ if(!hotWaitingFilesMap[chunkId]) { -/******/ hotEnsureUpdateChunk(chunkId); -/******/ } -/******/ if(hotChunksLoading === 0 && hotWaitingFiles === 0) { -/******/ hotUpdateDownloaded(); -/******/ } -/******/ } -/******/ } -/******/ }; -/******/ return fn; -/******/ } -/******/ -/******/ function hotCreateModule(moduleId) { // eslint-disable-line no-unused-vars -/******/ var hot = { -/******/ // private stuff -/******/ _acceptedDependencies: {}, -/******/ _declinedDependencies: {}, -/******/ _selfAccepted: false, -/******/ _selfDeclined: false, -/******/ _disposeHandlers: [], -/******/ _main: hotCurrentChildModule !== moduleId, -/******/ -/******/ // Module API -/******/ active: true, -/******/ accept: function(dep, callback) { -/******/ if(typeof dep === "undefined") -/******/ hot._selfAccepted = true; -/******/ else if(typeof dep === "function") -/******/ hot._selfAccepted = dep; -/******/ else if(typeof dep === "object") -/******/ for(var i = 0; i < dep.length; i++) -/******/ hot._acceptedDependencies[dep[i]] = callback || function() {}; -/******/ else -/******/ hot._acceptedDependencies[dep] = callback || function() {}; -/******/ }, -/******/ decline: function(dep) { -/******/ if(typeof dep === "undefined") -/******/ hot._selfDeclined = true; -/******/ else if(typeof dep === "object") -/******/ for(var i = 0; i < dep.length; i++) -/******/ hot._declinedDependencies[dep[i]] = true; -/******/ else -/******/ hot._declinedDependencies[dep] = true; -/******/ }, -/******/ dispose: function(callback) { -/******/ hot._disposeHandlers.push(callback); -/******/ }, -/******/ addDisposeHandler: function(callback) { -/******/ hot._disposeHandlers.push(callback); -/******/ }, -/******/ removeDisposeHandler: function(callback) { -/******/ var idx = hot._disposeHandlers.indexOf(callback); -/******/ if(idx >= 0) hot._disposeHandlers.splice(idx, 1); -/******/ }, -/******/ -/******/ // Management API -/******/ check: hotCheck, -/******/ apply: hotApply, -/******/ status: function(l) { -/******/ if(!l) return hotStatus; -/******/ hotStatusHandlers.push(l); -/******/ }, -/******/ addStatusHandler: function(l) { -/******/ hotStatusHandlers.push(l); -/******/ }, -/******/ removeStatusHandler: function(l) { -/******/ var idx = hotStatusHandlers.indexOf(l); -/******/ if(idx >= 0) hotStatusHandlers.splice(idx, 1); -/******/ }, -/******/ -/******/ //inherit from previous dispose call -/******/ data: hotCurrentModuleData[moduleId] -/******/ }; -/******/ hotCurrentChildModule = undefined; -/******/ return hot; -/******/ } -/******/ -/******/ var hotStatusHandlers = []; -/******/ var hotStatus = "idle"; -/******/ -/******/ function hotSetStatus(newStatus) { -/******/ hotStatus = newStatus; -/******/ for(var i = 0; i < hotStatusHandlers.length; i++) -/******/ hotStatusHandlers[i].call(null, newStatus); -/******/ } -/******/ -/******/ // while downloading -/******/ var hotWaitingFiles = 0; -/******/ var hotChunksLoading = 0; -/******/ var hotWaitingFilesMap = {}; -/******/ var hotRequestedFilesMap = {}; -/******/ var hotAvailableFilesMap = {}; -/******/ var hotDeferred; -/******/ -/******/ // The update info -/******/ var hotUpdate, hotUpdateNewHash; -/******/ -/******/ function toModuleId(id) { -/******/ var isNumber = (+id) + "" === id; -/******/ return isNumber ? +id : id; -/******/ } -/******/ -/******/ function hotCheck(apply) { -/******/ if(hotStatus !== "idle") throw new Error("check() is only allowed in idle status"); -/******/ hotApplyOnUpdate = apply; -/******/ hotSetStatus("check"); -/******/ return hotDownloadManifest(hotRequestTimeout).then(function(update) { -/******/ if(!update) { -/******/ hotSetStatus("idle"); -/******/ return null; -/******/ } -/******/ hotRequestedFilesMap = {}; -/******/ hotWaitingFilesMap = {}; -/******/ hotAvailableFilesMap = update.c; -/******/ hotUpdateNewHash = update.h; -/******/ -/******/ hotSetStatus("prepare"); -/******/ var promise = new Promise(function(resolve, reject) { -/******/ hotDeferred = { -/******/ resolve: resolve, -/******/ reject: reject -/******/ }; -/******/ }); -/******/ hotUpdate = {}; -/******/ var chunkId = "main"; -/******/ { // eslint-disable-line no-lone-blocks -/******/ /*globals chunkId */ -/******/ hotEnsureUpdateChunk(chunkId); -/******/ } -/******/ if(hotStatus === "prepare" && hotChunksLoading === 0 && hotWaitingFiles === 0) { -/******/ hotUpdateDownloaded(); -/******/ } -/******/ return promise; -/******/ }); -/******/ } -/******/ -/******/ function hotAddUpdateChunk(chunkId, moreModules) { // eslint-disable-line no-unused-vars -/******/ if(!hotAvailableFilesMap[chunkId] || !hotRequestedFilesMap[chunkId]) -/******/ return; -/******/ hotRequestedFilesMap[chunkId] = false; -/******/ for(var moduleId in moreModules) { -/******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { -/******/ hotUpdate[moduleId] = moreModules[moduleId]; -/******/ } -/******/ } -/******/ if(--hotWaitingFiles === 0 && hotChunksLoading === 0) { -/******/ hotUpdateDownloaded(); -/******/ } -/******/ } -/******/ -/******/ function hotEnsureUpdateChunk(chunkId) { -/******/ if(!hotAvailableFilesMap[chunkId]) { -/******/ hotWaitingFilesMap[chunkId] = true; -/******/ } else { -/******/ hotRequestedFilesMap[chunkId] = true; -/******/ hotWaitingFiles++; -/******/ hotDownloadUpdateChunk(chunkId); -/******/ } -/******/ } -/******/ -/******/ function hotUpdateDownloaded() { -/******/ hotSetStatus("ready"); -/******/ var deferred = hotDeferred; -/******/ hotDeferred = null; -/******/ if(!deferred) return; -/******/ if(hotApplyOnUpdate) { -/******/ // Wrap deferred object in Promise to mark it as a well-handled Promise to -/******/ // avoid triggering uncaught exception warning in Chrome. -/******/ // See https://bugs.chromium.org/p/chromium/issues/detail?id=465666 -/******/ Promise.resolve().then(function() { -/******/ return hotApply(hotApplyOnUpdate); -/******/ }).then( -/******/ function(result) { -/******/ deferred.resolve(result); -/******/ }, -/******/ function(err) { -/******/ deferred.reject(err); -/******/ } -/******/ ); -/******/ } else { -/******/ var outdatedModules = []; -/******/ for(var id in hotUpdate) { -/******/ if(Object.prototype.hasOwnProperty.call(hotUpdate, id)) { -/******/ outdatedModules.push(toModuleId(id)); -/******/ } -/******/ } -/******/ deferred.resolve(outdatedModules); -/******/ } -/******/ } -/******/ -/******/ function hotApply(options) { -/******/ if(hotStatus !== "ready") throw new Error("apply() is only allowed in ready status"); -/******/ options = options || {}; -/******/ -/******/ var cb; -/******/ var i; -/******/ var j; -/******/ var module; -/******/ var moduleId; -/******/ -/******/ function getAffectedStuff(updateModuleId) { -/******/ var outdatedModules = [updateModuleId]; -/******/ var outdatedDependencies = {}; -/******/ -/******/ var queue = outdatedModules.slice().map(function(id) { -/******/ return { -/******/ chain: [id], -/******/ id: id -/******/ }; -/******/ }); -/******/ while(queue.length > 0) { -/******/ var queueItem = queue.pop(); -/******/ var moduleId = queueItem.id; -/******/ var chain = queueItem.chain; -/******/ module = installedModules[moduleId]; -/******/ if(!module || module.hot._selfAccepted) -/******/ continue; -/******/ if(module.hot._selfDeclined) { -/******/ return { -/******/ type: "self-declined", -/******/ chain: chain, -/******/ moduleId: moduleId -/******/ }; -/******/ } -/******/ if(module.hot._main) { -/******/ return { -/******/ type: "unaccepted", -/******/ chain: chain, -/******/ moduleId: moduleId -/******/ }; -/******/ } -/******/ for(var i = 0; i < module.parents.length; i++) { -/******/ var parentId = module.parents[i]; -/******/ var parent = installedModules[parentId]; -/******/ if(!parent) continue; -/******/ if(parent.hot._declinedDependencies[moduleId]) { -/******/ return { -/******/ type: "declined", -/******/ chain: chain.concat([parentId]), -/******/ moduleId: moduleId, -/******/ parentId: parentId -/******/ }; -/******/ } -/******/ if(outdatedModules.indexOf(parentId) >= 0) continue; -/******/ if(parent.hot._acceptedDependencies[moduleId]) { -/******/ if(!outdatedDependencies[parentId]) -/******/ outdatedDependencies[parentId] = []; -/******/ addAllToSet(outdatedDependencies[parentId], [moduleId]); -/******/ continue; -/******/ } -/******/ delete outdatedDependencies[parentId]; -/******/ outdatedModules.push(parentId); -/******/ queue.push({ -/******/ chain: chain.concat([parentId]), -/******/ id: parentId -/******/ }); -/******/ } -/******/ } -/******/ -/******/ return { -/******/ type: "accepted", -/******/ moduleId: updateModuleId, -/******/ outdatedModules: outdatedModules, -/******/ outdatedDependencies: outdatedDependencies -/******/ }; -/******/ } -/******/ -/******/ function addAllToSet(a, b) { -/******/ for(var i = 0; i < b.length; i++) { -/******/ var item = b[i]; -/******/ if(a.indexOf(item) < 0) -/******/ a.push(item); -/******/ } -/******/ } -/******/ -/******/ // at begin all updates modules are outdated -/******/ // the "outdated" status can propagate to parents if they don't accept the children -/******/ var outdatedDependencies = {}; -/******/ var outdatedModules = []; -/******/ var appliedUpdate = {}; -/******/ -/******/ var warnUnexpectedRequire = function warnUnexpectedRequire() { -/******/ console.warn("[HMR] unexpected require(" + result.moduleId + ") to disposed module"); -/******/ }; -/******/ -/******/ for(var id in hotUpdate) { -/******/ if(Object.prototype.hasOwnProperty.call(hotUpdate, id)) { -/******/ moduleId = toModuleId(id); -/******/ var result; -/******/ if(hotUpdate[id]) { -/******/ result = getAffectedStuff(moduleId); -/******/ } else { -/******/ result = { -/******/ type: "disposed", -/******/ moduleId: id -/******/ }; -/******/ } -/******/ var abortError = false; -/******/ var doApply = false; -/******/ var doDispose = false; -/******/ var chainInfo = ""; -/******/ if(result.chain) { -/******/ chainInfo = "\nUpdate propagation: " + result.chain.join(" -> "); -/******/ } -/******/ switch(result.type) { -/******/ case "self-declined": -/******/ if(options.onDeclined) -/******/ options.onDeclined(result); -/******/ if(!options.ignoreDeclined) -/******/ abortError = new Error("Aborted because of self decline: " + result.moduleId + chainInfo); -/******/ break; -/******/ case "declined": -/******/ if(options.onDeclined) -/******/ options.onDeclined(result); -/******/ if(!options.ignoreDeclined) -/******/ abortError = new Error("Aborted because of declined dependency: " + result.moduleId + " in " + result.parentId + chainInfo); -/******/ break; -/******/ case "unaccepted": -/******/ if(options.onUnaccepted) -/******/ options.onUnaccepted(result); -/******/ if(!options.ignoreUnaccepted) -/******/ abortError = new Error("Aborted because " + moduleId + " is not accepted" + chainInfo); -/******/ break; -/******/ case "accepted": -/******/ if(options.onAccepted) -/******/ options.onAccepted(result); -/******/ doApply = true; -/******/ break; -/******/ case "disposed": -/******/ if(options.onDisposed) -/******/ options.onDisposed(result); -/******/ doDispose = true; -/******/ break; -/******/ default: -/******/ throw new Error("Unexception type " + result.type); -/******/ } -/******/ if(abortError) { -/******/ hotSetStatus("abort"); -/******/ return Promise.reject(abortError); -/******/ } -/******/ if(doApply) { -/******/ appliedUpdate[moduleId] = hotUpdate[moduleId]; -/******/ addAllToSet(outdatedModules, result.outdatedModules); -/******/ for(moduleId in result.outdatedDependencies) { -/******/ if(Object.prototype.hasOwnProperty.call(result.outdatedDependencies, moduleId)) { -/******/ if(!outdatedDependencies[moduleId]) -/******/ outdatedDependencies[moduleId] = []; -/******/ addAllToSet(outdatedDependencies[moduleId], result.outdatedDependencies[moduleId]); -/******/ } -/******/ } -/******/ } -/******/ if(doDispose) { -/******/ addAllToSet(outdatedModules, [result.moduleId]); -/******/ appliedUpdate[moduleId] = warnUnexpectedRequire; -/******/ } -/******/ } -/******/ } -/******/ -/******/ // Store self accepted outdated modules to require them later by the module system -/******/ var outdatedSelfAcceptedModules = []; -/******/ for(i = 0; i < outdatedModules.length; i++) { -/******/ moduleId = outdatedModules[i]; -/******/ if(installedModules[moduleId] && installedModules[moduleId].hot._selfAccepted) -/******/ outdatedSelfAcceptedModules.push({ -/******/ module: moduleId, -/******/ errorHandler: installedModules[moduleId].hot._selfAccepted -/******/ }); -/******/ } -/******/ -/******/ // Now in "dispose" phase -/******/ hotSetStatus("dispose"); -/******/ Object.keys(hotAvailableFilesMap).forEach(function(chunkId) { -/******/ if(hotAvailableFilesMap[chunkId] === false) { -/******/ hotDisposeChunk(chunkId); -/******/ } -/******/ }); -/******/ -/******/ var idx; -/******/ var queue = outdatedModules.slice(); -/******/ while(queue.length > 0) { -/******/ moduleId = queue.pop(); -/******/ module = installedModules[moduleId]; -/******/ if(!module) continue; -/******/ -/******/ var data = {}; -/******/ -/******/ // Call dispose handlers -/******/ var disposeHandlers = module.hot._disposeHandlers; -/******/ for(j = 0; j < disposeHandlers.length; j++) { -/******/ cb = disposeHandlers[j]; -/******/ cb(data); -/******/ } -/******/ hotCurrentModuleData[moduleId] = data; -/******/ -/******/ // disable module (this disables requires from this module) -/******/ module.hot.active = false; -/******/ -/******/ // remove module from cache -/******/ delete installedModules[moduleId]; -/******/ -/******/ // when disposing there is no need to call dispose handler -/******/ delete outdatedDependencies[moduleId]; -/******/ -/******/ // remove "parents" references from all children -/******/ for(j = 0; j < module.children.length; j++) { -/******/ var child = installedModules[module.children[j]]; -/******/ if(!child) continue; -/******/ idx = child.parents.indexOf(moduleId); -/******/ if(idx >= 0) { -/******/ child.parents.splice(idx, 1); -/******/ } -/******/ } -/******/ } -/******/ -/******/ // remove outdated dependency from module children -/******/ var dependency; -/******/ var moduleOutdatedDependencies; -/******/ for(moduleId in outdatedDependencies) { -/******/ if(Object.prototype.hasOwnProperty.call(outdatedDependencies, moduleId)) { -/******/ module = installedModules[moduleId]; -/******/ if(module) { -/******/ moduleOutdatedDependencies = outdatedDependencies[moduleId]; -/******/ for(j = 0; j < moduleOutdatedDependencies.length; j++) { -/******/ dependency = moduleOutdatedDependencies[j]; -/******/ idx = module.children.indexOf(dependency); -/******/ if(idx >= 0) module.children.splice(idx, 1); -/******/ } -/******/ } -/******/ } -/******/ } -/******/ -/******/ // Not in "apply" phase -/******/ hotSetStatus("apply"); -/******/ -/******/ hotCurrentHash = hotUpdateNewHash; -/******/ -/******/ // insert new code -/******/ for(moduleId in appliedUpdate) { -/******/ if(Object.prototype.hasOwnProperty.call(appliedUpdate, moduleId)) { -/******/ modules[moduleId] = appliedUpdate[moduleId]; -/******/ } -/******/ } -/******/ -/******/ // call accept handlers -/******/ var error = null; -/******/ for(moduleId in outdatedDependencies) { -/******/ if(Object.prototype.hasOwnProperty.call(outdatedDependencies, moduleId)) { -/******/ module = installedModules[moduleId]; -/******/ if(module) { -/******/ moduleOutdatedDependencies = outdatedDependencies[moduleId]; -/******/ var callbacks = []; -/******/ for(i = 0; i < moduleOutdatedDependencies.length; i++) { -/******/ dependency = moduleOutdatedDependencies[i]; -/******/ cb = module.hot._acceptedDependencies[dependency]; -/******/ if(cb) { -/******/ if(callbacks.indexOf(cb) >= 0) continue; -/******/ callbacks.push(cb); -/******/ } -/******/ } -/******/ for(i = 0; i < callbacks.length; i++) { -/******/ cb = callbacks[i]; -/******/ try { -/******/ cb(moduleOutdatedDependencies); -/******/ } catch(err) { -/******/ if(options.onErrored) { -/******/ options.onErrored({ -/******/ type: "accept-errored", -/******/ moduleId: moduleId, -/******/ dependencyId: moduleOutdatedDependencies[i], -/******/ error: err -/******/ }); -/******/ } -/******/ if(!options.ignoreErrored) { -/******/ if(!error) -/******/ error = err; -/******/ } -/******/ } -/******/ } -/******/ } -/******/ } -/******/ } -/******/ -/******/ // Load self accepted modules -/******/ for(i = 0; i < outdatedSelfAcceptedModules.length; i++) { -/******/ var item = outdatedSelfAcceptedModules[i]; -/******/ moduleId = item.module; -/******/ hotCurrentParents = [moduleId]; -/******/ try { -/******/ __webpack_require__(moduleId); -/******/ } catch(err) { -/******/ if(typeof item.errorHandler === "function") { -/******/ try { -/******/ item.errorHandler(err); -/******/ } catch(err2) { -/******/ if(options.onErrored) { -/******/ options.onErrored({ -/******/ type: "self-accept-error-handler-errored", -/******/ moduleId: moduleId, -/******/ error: err2, -/******/ originalError: err -/******/ }); -/******/ } -/******/ if(!options.ignoreErrored) { -/******/ if(!error) -/******/ error = err2; -/******/ } -/******/ if(!error) -/******/ error = err; -/******/ } -/******/ } else { -/******/ if(options.onErrored) { -/******/ options.onErrored({ -/******/ type: "self-accept-errored", -/******/ moduleId: moduleId, -/******/ error: err -/******/ }); -/******/ } -/******/ if(!options.ignoreErrored) { -/******/ if(!error) -/******/ error = err; -/******/ } -/******/ } -/******/ } -/******/ } -/******/ -/******/ // handle errors in accept handlers and self accepted module load -/******/ if(error) { -/******/ hotSetStatus("fail"); -/******/ return Promise.reject(error); -/******/ } -/******/ -/******/ hotSetStatus("idle"); -/******/ return new Promise(function(resolve) { -/******/ resolve(outdatedModules); -/******/ }); -/******/ } -/******/ -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {}, -/******/ hot: hotCreateModule(moduleId), -/******/ parents: (hotCurrentParentsTemp = hotCurrentParents, hotCurrentParents = [], hotCurrentParentsTemp), -/******/ children: [] -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId)); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { -/******/ configurable: false, -/******/ enumerable: true, -/******/ get: getter -/******/ }); -/******/ } -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // __webpack_hash__ -/******/ __webpack_require__.h = function() { return hotCurrentHash; }; -/******/ -/******/ // Load entry module and return exports -/******/ return hotCreateRequire("./index.js")(__webpack_require__.s = "./index.js"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ "../../update.js": -/*!*****************************************!*\ - !*** (webpack)/test/hotCases/update.js ***! - \*****************************************/ -/***/ (function(module, exports) { - -module.exports = function(done, options, callback) { - return function(stats) { - module.hot.check(options || true).then(function() { - if(callback) - callback(stats); - }).catch(function(err) { - done(err); - }); - } -}; - - -/***/ }), - -/***/ "./file.js": -/*!*****************!*\ - !*** ./file.js ***! - \*****************/ -/***/ (function(module, exports) { - -throw new Error("Module parse failed: Unexpected token (3:0)\nYou may need an appropriate loader to handle this file type.\n| export var value = 1;\r\n| ---\r\n| export var value = 2;\r\n| "); - -/***/ }), - -/***/ "./index.js": -/*!******************!*\ - !*** ./index.js ***! - \******************/ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _file__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./file */"./file.js"); -/* harmony import */ var _file__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_file__WEBPACK_IMPORTED_MODULE_0__); - - -it("should auto-import a ES6 imported value on accept", function(done) { - _file__WEBPACK_IMPORTED_MODULE_0__["value"].should.be.eql(1); - module.hot.accept(/*! ./file */ "./file.js", function(__WEBPACK_OUTDATED_DEPENDENCIES__) { /* harmony import */ _file__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./file */"./file.js"); /* harmony import */ _file__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_file__WEBPACK_IMPORTED_MODULE_0__); (function() { - _file__WEBPACK_IMPORTED_MODULE_0__["value"].should.be.eql(2); - outside(); - done(); - })(__WEBPACK_OUTDATED_DEPENDENCIES__); }); - NEXT(__webpack_require__(/*! ../../update */ "../../update.js")(done)); -}); - -function outside() { - _file__WEBPACK_IMPORTED_MODULE_0__["value"].should.be.eql(2); -} - - -/***/ }) - -/******/ }); \ No newline at end of file diff --git a/test/hotCases/harmony/auto-import-multiple/index.js b/test/hotCases/harmony/auto-import-multiple/index.js index 6af6743534e..d947a929666 100644 --- a/test/hotCases/harmony/auto-import-multiple/index.js +++ b/test/hotCases/harmony/auto-import-multiple/index.js @@ -1,12 +1,12 @@ import { value } from "./file"; import value2 from "./commonjs"; -it("should auto-import multiple ES6 imported values on accept", function(done) { - value.should.be.eql(1); - value2.should.be.eql(10); - module.hot.accept(["./file", "./commonjs"], function() { - value.should.be.eql(2); - value2.should.be.eql(20); +it("should auto-import multiple ES6 imported values on accept", (done) => { + expect(value).toBe(1); + expect(value2).toBe(10); + module.hot.accept(["./file", "./commonjs"], () => { + expect(value).toBe(2); + expect(value2).toBe(20); outside(); done(); }); @@ -14,6 +14,6 @@ it("should auto-import multiple ES6 imported values on accept", function(done) { }); function outside() { - value.should.be.eql(2); - value2.should.be.eql(20); + expect(value).toBe(2); + expect(value2).toBe(20); } diff --git a/test/hotCases/harmony/auto-import/index.js b/test/hotCases/harmony/auto-import/index.js index f7a7049f1cc..cd36482c2d1 100644 --- a/test/hotCases/harmony/auto-import/index.js +++ b/test/hotCases/harmony/auto-import/index.js @@ -1,9 +1,9 @@ import { value } from "./file"; it("should auto-import a ES6 imported value on accept", function(done) { - value.should.be.eql(1); + expect(value).toBe(1); module.hot.accept("./file", function() { - value.should.be.eql(2); + expect(value).toBe(2); outside(); done(); }); @@ -11,5 +11,5 @@ it("should auto-import a ES6 imported value on accept", function(done) { }); function outside() { - value.should.be.eql(2); + expect(value).toBe(2); } diff --git a/test/hotCases/recover/recover-after-error/index.js b/test/hotCases/recover/recover-after-error/index.js index f57c89af4a5..2b3b0287679 100644 --- a/test/hotCases/recover/recover-after-error/index.js +++ b/test/hotCases/recover/recover-after-error/index.js @@ -1,15 +1,15 @@ import a from "./a"; -it("should abort when module is not accepted", function(done) { - a.should.be.eql(1); +it("should abort when module is not accepted", (done) => { + expect(a).toBe(1); NEXT(require("../../update")(done, { ignoreErrored: true - }, function() { - a.should.be.eql(1); + }, () => { + expect(a).toBe(1); NEXT(require("../../update")(done, { ignoreErrored: true - }, function() { - a.should.be.eql(3); + }, () => { + expect(a).toBe(3); done(); })); })); diff --git a/test/hotCases/recover/recover-after-loader-error/index.js b/test/hotCases/recover/recover-after-loader-error/index.js index 186b26ef47d..babc2a4972e 100644 --- a/test/hotCases/recover/recover-after-loader-error/index.js +++ b/test/hotCases/recover/recover-after-loader-error/index.js @@ -1,15 +1,15 @@ import a from "./loader!./a"; -it("should abort when module is not accepted", function(done) { - a.should.be.eql(1); +it("should abort when module is not accepted", (done) => { + expect(a).toBe(1); NEXT(require("../../update")(done, { ignoreErrored: true - }, function() { - a.should.be.eql(1); + }, () => { + expect(a).toBe(1); NEXT(require("../../update")(done, { ignoreErrored: true }, function() { - a.should.be.eql(3); + expect(a).toBe(3); done(); })); })); diff --git a/test/hotCases/recover/recover-after-parsing-error/index.js b/test/hotCases/recover/recover-after-parsing-error/index.js index f57c89af4a5..2b3b0287679 100644 --- a/test/hotCases/recover/recover-after-parsing-error/index.js +++ b/test/hotCases/recover/recover-after-parsing-error/index.js @@ -1,15 +1,15 @@ import a from "./a"; -it("should abort when module is not accepted", function(done) { - a.should.be.eql(1); +it("should abort when module is not accepted", (done) => { + expect(a).toBe(1); NEXT(require("../../update")(done, { ignoreErrored: true - }, function() { - a.should.be.eql(1); + }, () => { + expect(a).toBe(1); NEXT(require("../../update")(done, { ignoreErrored: true - }, function() { - a.should.be.eql(3); + }, () => { + expect(a).toBe(3); done(); })); })); diff --git a/test/hotCases/runtime/accept/index.js b/test/hotCases/runtime/accept/index.js index 3c4f3dd2bd7..9ecba8cdc9e 100644 --- a/test/hotCases/runtime/accept/index.js +++ b/test/hotCases/runtime/accept/index.js @@ -1,10 +1,10 @@ var value = require("./file"); -it("should accept a dependencies and require a new value", function(done) { - value.should.be.eql(1); - module.hot.accept("./file", function() { +it("should accept a dependencies and require a new value", (done) => { + expect(value).toBe(1); + module.hot.accept("./file", () => { value = require("./file"); - value.should.be.eql(2); + expect(value).toBe(2); outside(); done(); }); @@ -12,5 +12,5 @@ it("should accept a dependencies and require a new value", function(done) { }); function outside() { - value.should.be.eql(2); + expect(value).toBe(2); } diff --git a/test/hotCases/runtime/bubble-async/file.js b/test/hotCases/runtime/bubble-async/file.js new file mode 100644 index 00000000000..77e3c4ea564 --- /dev/null +++ b/test/hotCases/runtime/bubble-async/file.js @@ -0,0 +1,3 @@ +module.exports = 1; +--- +module.exports = 2; diff --git a/test/hotCases/runtime/bubble-async/index.js b/test/hotCases/runtime/bubble-async/index.js new file mode 100644 index 00000000000..f1fca336436 --- /dev/null +++ b/test/hotCases/runtime/bubble-async/index.js @@ -0,0 +1,16 @@ +import { load } from "./parent-file"; +import update from "../../update"; + +it("should bubble update from a nested dependency", () => { + return load().then(value => { + expect(value).toBe(1); + return new Promise((resolve, reject) => { + module.hot.accept("./parent-file", () => { + resolve(load().then(value => { + expect(value).toBe(2); + })); + }); + NEXT(update(reject)); + }); + }) +}); diff --git a/test/hotCases/runtime/bubble-async/parent-file.js b/test/hotCases/runtime/bubble-async/parent-file.js new file mode 100644 index 00000000000..d1fc9fb33a0 --- /dev/null +++ b/test/hotCases/runtime/bubble-async/parent-file.js @@ -0,0 +1,3 @@ +export function load() { + return import("./file").then(file => file.default); +} diff --git a/test/hotCases/runtime/bubble-update/index.js b/test/hotCases/runtime/bubble-update/index.js index 355baef0d41..7827b07538b 100644 --- a/test/hotCases/runtime/bubble-update/index.js +++ b/test/hotCases/runtime/bubble-update/index.js @@ -1,10 +1,10 @@ var value = require("./parent-file"); -it("should bubble update from a nested dependency", function(done) { - value.should.be.eql(1); - module.hot.accept("./parent-file", function() { +it("should bubble update from a nested dependency", (done) => { + expect(value).toBe(1); + module.hot.accept("./parent-file", () => { value = require("./parent-file"); - value.should.be.eql(2); + expect(value).toBe(2); done(); }); NEXT(require("../../update")(done)); diff --git a/test/hotCases/runtime/circular/index.js b/test/hotCases/runtime/circular/index.js index 84af64ba855..0d4655d3ef5 100644 --- a/test/hotCases/runtime/circular/index.js +++ b/test/hotCases/runtime/circular/index.js @@ -1,9 +1,9 @@ import a from "./a"; -it("should not throw on circular dependencies", function(done) { - a.should.be.eql(1); - module.hot.accept("./a", function() { - a.should.be.eql(2); +it("should not throw on circular dependencies", (done) => { + expect(a).toBe(1); + module.hot.accept("./a", () => { + expect(a).toBe(2); done(); }); NEXT(require("../../update")(done)); diff --git a/test/hotCases/runtime/dispose-removed-chunk/index.js b/test/hotCases/runtime/dispose-removed-chunk/index.js index 155c4918278..c73676af413 100644 --- a/test/hotCases/runtime/dispose-removed-chunk/index.js +++ b/test/hotCases/runtime/dispose-removed-chunk/index.js @@ -1,13 +1,13 @@ -it("should dispose a chunk which is removed from bundle", function(done) { +it("should dispose a chunk which is removed from bundle", (done) => { var m1 = require("./module"); m1.default.then((x1) => { - NEXT(require("../../update")(done, true, function() { + NEXT(require("../../update")(done, true, () => { var m2 = require("./module"); m2.default.then((x2) => { - NEXT(require("../../update")(done, true, function() { + NEXT(require("../../update")(done, true, () => { var m3 = require("./module"); m3.default.then((x3) => { - x1.should.be.not.eql(x2); + expect(x1).not.toEqual(x2); done(); }).catch(done); })); diff --git a/test/hotCases/runtime/dispose-removed-module/index.js b/test/hotCases/runtime/dispose-removed-module/index.js index bd3da8723c9..0a86e02114d 100644 --- a/test/hotCases/runtime/dispose-removed-module/index.js +++ b/test/hotCases/runtime/dispose-removed-module/index.js @@ -1,15 +1,15 @@ var m = require("./module"); -it("should dispose a module which is removed from bundle", function(done) { +it("should dispose a module which is removed from bundle", (done) => { var disposed = []; - m.setHandler(function(id) { + m.setHandler((id) => { disposed.push(id); }); - NEXT(require("../../update")(done, true, function() { + NEXT(require("../../update")(done, true, () => { require("./module"); - NEXT(require("../../update")(done, true, function() { + NEXT(require("../../update")(done, true, () => { var newModule = require("./module"); - disposed.should.be.eql([newModule.default]); + expect(disposed).toEqual([newModule.default]); done(); })); })); diff --git a/test/hotCases/runtime/self-accept-and-dispose/index.js b/test/hotCases/runtime/self-accept-and-dispose/index.js index b94303d2183..510388c9551 100644 --- a/test/hotCases/runtime/self-accept-and-dispose/index.js +++ b/test/hotCases/runtime/self-accept-and-dispose/index.js @@ -1,4 +1,4 @@ -it("should accept itself and pass data", function(done) { +it("should accept itself and pass data", (done) => { require("./file")(done); NEXT(require("../../update")(done)); }); diff --git a/test/hotCases/runtime/update-multiple-modules/index.js b/test/hotCases/runtime/update-multiple-modules/index.js index 65e98e3e413..9ac1450a932 100644 --- a/test/hotCases/runtime/update-multiple-modules/index.js +++ b/test/hotCases/runtime/update-multiple-modules/index.js @@ -1,10 +1,10 @@ var value = require("./parent-file"); -it("should update multiple modules at the same time", function(done) { - value.should.be.eql(2); - module.hot.accept("./parent-file", function() { +it("should update multiple modules at the same time", (done) => { + expect(value).toBe(2); + module.hot.accept("./parent-file", () => { value = require("./parent-file"); - value.should.be.eql(4); + expect(value).toBe(4); done(); }); NEXT(require("../../update")(done)); diff --git a/test/hotCases/runtime/update-multiple-times/index.js b/test/hotCases/runtime/update-multiple-times/index.js index e2a8b9e7baa..93749263199 100644 --- a/test/hotCases/runtime/update-multiple-times/index.js +++ b/test/hotCases/runtime/update-multiple-times/index.js @@ -1,11 +1,11 @@ var value = require("./file"); -it("should accept a dependencies multiple times", function(done) { - value.should.be.eql(1); - module.hot.accept("./file", function() { +it("should accept a dependencies multiple times", (done) => { + expect(value).toBe(1); + module.hot.accept("./file", () => { var oldValue = value; value = require("./file"); - value.should.be.eql(oldValue + 1); + expect(value).toBe(oldValue + 1); if(value < 4) NEXT(require("../../update")(done)); else diff --git a/test/hotCases/update.js b/test/hotCases/update.js index fd30ee103f3..e85933acc2b 100644 --- a/test/hotCases/update.js +++ b/test/hotCases/update.js @@ -1,9 +1,9 @@ module.exports = function(done, options, callback) { return function(stats) { - module.hot.check(options || true).then(function() { + module.hot.check(options || true).then(() => { if(callback) callback(stats); - }).catch(function(err) { + }).catch((err) => { done(err); }); } diff --git a/test/identifier.unittest.js b/test/identifier.unittest.js index 4ef2fc33b56..19a2990d9a2 100644 --- a/test/identifier.unittest.js +++ b/test/identifier.unittest.js @@ -1,8 +1,6 @@ /* globals describe, beforeEach, it */ "use strict"; -const should = require("should"); - const identifierUtil = require("../lib/util/identifier"); describe("util/identifier", () => { @@ -16,9 +14,9 @@ describe("util/identifier", () => { }); it("computes the correct relative results for the path construct", () => { - should( - identifierUtil.makePathsRelative(context, pathConstruct) - ).be.exactly(expected); + expect(identifierUtil.makePathsRelative(context, pathConstruct)).toBe( + expected + ); }); }); }); diff --git a/test/lint-mocha.opts b/test/lint-mocha.opts deleted file mode 100644 index 84fc1681af2..00000000000 --- a/test/lint-mocha.opts +++ /dev/null @@ -1 +0,0 @@ ---reporter min diff --git a/test/mocha.opts b/test/mocha.opts deleted file mode 100644 index f3d5690d48f..00000000000 --- a/test/mocha.opts +++ /dev/null @@ -1,4 +0,0 @@ ---full-trace ---reporter dot ---check-leaks ---globals Base64 diff --git a/test/objectToMap.unittest.js b/test/objectToMap.unittest.js index c0f1aff7be7..3b8f70e8bc6 100644 --- a/test/objectToMap.unittest.js +++ b/test/objectToMap.unittest.js @@ -1,17 +1,15 @@ /* globals describe it */ -require("should"); - var objectToMap = require("../lib/util/objectToMap"); -describe("objectToMap", function() { - it("should convert a plain object into a Map successfully", function() { +describe("objectToMap", () => { + it("should convert a plain object into a Map successfully", () => { const map = objectToMap({ foo: "bar", bar: "baz" }); - map.get("foo").should.eql("bar"); - map.get("bar").should.eql("baz"); + expect(map.get("foo")).toBe("bar"); + expect(map.get("bar")).toBe("baz"); }); }); diff --git a/test/setupTestFramework.js b/test/setupTestFramework.js new file mode 100644 index 00000000000..b6c1a049df8 --- /dev/null +++ b/test/setupTestFramework.js @@ -0,0 +1,25 @@ +/* globals expect */ +expect.extend({ + toBeTypeOf(received, expected) { + const objType = typeof received; + const pass = objType === expected; + + const message = pass + ? () => + this.utils.matcherHint(".not.toBeTypeOf") + + "\n\n" + + "Expected value to not be (using typeof):\n" + + ` ${this.utils.printExpected(expected)}\n` + + "Received:\n" + + ` ${this.utils.printReceived(objType)}` + : () => + this.utils.matcherHint(".toBeTypeOf") + + "\n\n" + + "Expected value to be (using typeof):\n" + + ` ${this.utils.printExpected(expected)}\n` + + "Received:\n" + + ` ${this.utils.printReceived(objType)}`; + + return { message, pass }; + } +}); diff --git a/test/statsCases/accept-stats.js b/test/statsCases/accept-stats.js deleted file mode 100644 index 04ec7bab4d2..00000000000 --- a/test/statsCases/accept-stats.js +++ /dev/null @@ -1,15 +0,0 @@ -var fs = require("fs"); -var path = require("path"); -var dirs = fs.readdirSync(__dirname); -dirs.forEach(function(dir) { - var actual = path.join(__dirname, dir, "actual.txt"); - var expected = path.join(__dirname, dir, "expected.txt"); - try { - if(fs.existsSync(actual)) { - fs.unlinkSync(expected); - fs.renameSync(actual, expected); - } - } catch(e) { - console.log(e); - } -}); diff --git a/test/statsCases/aggressive-splitting-entry/expected.txt b/test/statsCases/aggressive-splitting-entry/expected.txt deleted file mode 100644 index bbfccc3b570..00000000000 --- a/test/statsCases/aggressive-splitting-entry/expected.txt +++ /dev/null @@ -1,53 +0,0 @@ -Hash: a82dbd8d6c7a22df1cafa82dbd8d6c7a22df1caf -Child fitting: - Hash: a82dbd8d6c7a22df1caf - Time: Xms - Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - fb95acf7c457672e70d0.js 1.05 KiB 0 [emitted] - a1e683753eca705a0882.js 9.97 KiB 1 [emitted] - d43339a3d0f86c6b8d90.js 1.94 KiB 2 [emitted] - 6c7fb52c5514dbfbf094.js 1.94 KiB 3 [emitted] - Entrypoint main = d43339a3d0f86c6b8d90.js 6c7fb52c5514dbfbf094.js a1e683753eca705a0882.js - chunk {0} fb95acf7c457672e70d0.js 916 bytes <{1}> <{2}> <{3}> - > ./g [4] ./index.js 7:0-13 - [7] ./g.js 916 bytes {0} [built] - chunk {1} a1e683753eca705a0882.js 1.87 KiB ={2}= ={3}= >{0}< [entry] [rendered] - > ./index main - [3] ./e.js 899 bytes {1} [built] - [4] ./index.js 111 bytes {1} [built] - [6] ./f.js 900 bytes {1} [built] - chunk {2} d43339a3d0f86c6b8d90.js 1.76 KiB ={1}= ={3}= >{0}< [initial] [rendered] [recorded] aggressive splitted - > ./index main - [0] ./b.js 899 bytes {2} [built] - [5] ./a.js 899 bytes {2} [built] - chunk {3} 6c7fb52c5514dbfbf094.js 1.76 KiB ={1}= ={2}= >{0}< [initial] [rendered] [recorded] aggressive splitted - > ./index main - [1] ./c.js 899 bytes {3} [built] - [2] ./d.js 899 bytes {3} [built] -Child content-change: - Hash: a82dbd8d6c7a22df1caf - Time: Xms - Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - fb95acf7c457672e70d0.js 1.05 KiB 0 [emitted] - a1e683753eca705a0882.js 9.97 KiB 1 [emitted] - d43339a3d0f86c6b8d90.js 1.94 KiB 2 [emitted] - 6c7fb52c5514dbfbf094.js 1.94 KiB 3 [emitted] - Entrypoint main = d43339a3d0f86c6b8d90.js 6c7fb52c5514dbfbf094.js a1e683753eca705a0882.js - chunk {0} fb95acf7c457672e70d0.js 916 bytes <{1}> <{2}> <{3}> - > ./g [4] ./index.js 7:0-13 - [7] ./g.js 916 bytes {0} [built] - chunk {1} a1e683753eca705a0882.js 1.87 KiB ={2}= ={3}= >{0}< [entry] [rendered] - > ./index main - [3] ./e.js 899 bytes {1} [built] - [4] ./index.js 111 bytes {1} [built] - [6] ./f.js 900 bytes {1} [built] - chunk {2} d43339a3d0f86c6b8d90.js 1.76 KiB ={1}= ={3}= >{0}< [initial] [rendered] [recorded] aggressive splitted - > ./index main - [0] ./b.js 899 bytes {2} [built] - [5] ./a.js 899 bytes {2} [built] - chunk {3} 6c7fb52c5514dbfbf094.js 1.76 KiB ={1}= ={2}= >{0}< [initial] [rendered] [recorded] aggressive splitted - > ./index main - [1] ./c.js 899 bytes {3} [built] - [2] ./d.js 899 bytes {3} [built] \ No newline at end of file diff --git a/test/statsCases/aggressive-splitting-on-demand/expected.txt b/test/statsCases/aggressive-splitting-on-demand/expected.txt deleted file mode 100644 index a64ff2fd668..00000000000 --- a/test/statsCases/aggressive-splitting-on-demand/expected.txt +++ /dev/null @@ -1,65 +0,0 @@ -Hash: 7a73868d9be286944b0a -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names -620d3f8d9bdb989cde07.js 1.94 KiB 6, 7 [emitted] -4467a9f70ef8365bcb32.js 1.93 KiB 0 [emitted] -8debdc7e72b763a13e35.js 1.96 KiB 2 [emitted] -6a2c2702ac98f9f90db9.js 1.94 KiB 3, 1 [emitted] -258ba4b441feff644266.js 1.01 KiB 4 [emitted] -8ae4998ca98adb2a08ea.js 1.94 KiB 5 [emitted] -aafb9d82e452def4c3bb.js 1 KiB 1 [emitted] -344e13508b62e833aacf.js 1 KiB 7 [emitted] -2aaed192bbfbc2302c53.js 1.94 KiB 8 [emitted] -72e04d4eaed46d9aac4c.js 1.94 KiB 9 [emitted] -d20b83dfd7d0fd0c8793.js 8.41 KiB 10 [emitted] main -1165c0cca1ba14a506ff.js 1.94 KiB 11 [emitted] -Entrypoint main = d20b83dfd7d0fd0c8793.js -chunk {0} 4467a9f70ef8365bcb32.js 1.76 KiB <{10}> ={1}= ={2}= ={3}= ={7}= ={9}= [recorded] aggressive splitted - > ./b ./d ./e ./f ./g [11] ./index.js 5:0-44 - > ./b ./d ./e ./f ./g ./h ./i ./j ./k [11] ./index.js 6:0-72 - [0] ./b.js 899 bytes {0} {5} [built] - [1] ./d.js 899 bytes {0} {8} [built] -chunk {1} aafb9d82e452def4c3bb.js 899 bytes <{10}> ={0}= ={2}= ={8}= - > ./c ./d ./e [11] ./index.js 3:0-30 - > ./b ./d ./e ./f ./g [11] ./index.js 5:0-44 - [2] ./e.js 899 bytes {1} {3} [built] -chunk {2} 8debdc7e72b763a13e35.js 1.76 KiB <{10}> ={0}= ={1}= ={11}= ={3}= ={6}= ={7}= ={9}= [recorded] aggressive splitted - > ./f ./g ./h ./i ./j ./k [11] ./index.js 4:0-51 - > ./b ./d ./e ./f ./g [11] ./index.js 5:0-44 - > ./b ./d ./e ./f ./g ./h ./i ./j ./k [11] ./index.js 6:0-72 - [3] ./f.js 899 bytes {2} [built] - [4] ./g.js 901 bytes {2} [built] -chunk {3} 6a2c2702ac98f9f90db9.js 1.76 KiB <{10}> ={0}= ={2}= ={7}= ={9}= [rendered] [recorded] aggressive splitted - > ./b ./d ./e ./f ./g ./h ./i ./j ./k [11] ./index.js 6:0-72 - [2] ./e.js 899 bytes {1} {3} [built] - [6] ./h.js 899 bytes {3} {11} [built] -chunk {4} 258ba4b441feff644266.js 899 bytes <{10}> - > ./a [11] ./index.js 1:0-16 - [10] ./a.js 899 bytes {4} [built] -chunk {5} 8ae4998ca98adb2a08ea.js 1.76 KiB <{10}> - > ./b ./c [11] ./index.js 2:0-23 - [0] ./b.js 899 bytes {0} {5} [built] - [5] ./c.js 899 bytes {5} {8} [built] -chunk {6} 620d3f8d9bdb989cde07.js 1.76 KiB <{10}> ={11}= ={2}= - > ./f ./g ./h ./i ./j ./k [11] ./index.js 4:0-51 - [8] ./j.js 901 bytes {6} {9} [built] - [9] ./k.js 899 bytes {6} {7} [built] -chunk {7} 344e13508b62e833aacf.js 899 bytes <{10}> ={0}= ={2}= ={3}= ={9}= - > ./b ./d ./e ./f ./g ./h ./i ./j ./k [11] ./index.js 6:0-72 - [9] ./k.js 899 bytes {6} {7} [built] -chunk {8} 2aaed192bbfbc2302c53.js 1.76 KiB <{10}> ={1}= [recorded] aggressive splitted - > ./c ./d ./e [11] ./index.js 3:0-30 - [1] ./d.js 899 bytes {0} {8} [built] - [5] ./c.js 899 bytes {5} {8} [built] -chunk {9} 72e04d4eaed46d9aac4c.js 1.76 KiB <{10}> ={0}= ={2}= ={3}= ={7}= [rendered] [recorded] aggressive splitted - > ./b ./d ./e ./f ./g ./h ./i ./j ./k [11] ./index.js 6:0-72 - [7] ./i.js 899 bytes {9} {11} [built] - [8] ./j.js 901 bytes {6} {9} [built] -chunk {10} d20b83dfd7d0fd0c8793.js (main) 248 bytes >{0}< >{1}< >{11}< >{2}< >{3}< >{4}< >{5}< >{6}< >{7}< >{8}< >{9}< [entry] [rendered] - > ./index main - [11] ./index.js 248 bytes {10} [built] -chunk {11} 1165c0cca1ba14a506ff.js 1.76 KiB <{10}> ={2}= ={6}= [rendered] [recorded] aggressive splitted - > ./f ./g ./h ./i ./j ./k [11] ./index.js 4:0-51 - [6] ./h.js 899 bytes {3} {11} [built] - [7] ./i.js 899 bytes {9} {11} [built] \ No newline at end of file diff --git a/test/statsCases/async-commons-chunk-auto/expected.txt b/test/statsCases/async-commons-chunk-auto/expected.txt deleted file mode 100644 index 5aea082f1a6..00000000000 --- a/test/statsCases/async-commons-chunk-auto/expected.txt +++ /dev/null @@ -1,321 +0,0 @@ -Child disabled: - Entrypoint main = disabled/main.js - Entrypoint a = disabled/a.js - Entrypoint b = disabled/b.js - Entrypoint c = disabled/c.js - chunk {0} disabled/async-g.js (async-g) 54 bytes <{1}> <{5}> [rendered] - > ./g [] 6:0-47 - > ./g [] 6:0-47 - [2] ./f.js 20 bytes {0} {2} {3} {6} {7} [built] - [8] ./g.js 34 bytes {0} [built] - chunk {1} disabled/async-a.js (async-a) 216 bytes <{4}> >{0}< [rendered] - > ./a [7] ./index.js 1:0-47 - [0] ./d.js 20 bytes {1} {2} {3} {5} {6} {7} [built] - [1] ./node_modules/x.js 20 bytes {1} {2} {3} {5} {6} {7} [built] - [3] ./node_modules/y.js 20 bytes {1} {2} {5} {6} [built] - [5] ./a.js + 1 modules 156 bytes {1} {5} [built] - | ./a.js 121 bytes [built] - | ./e.js 20 bytes [built] - chunk {2} disabled/async-b.js (async-b) 152 bytes <{4}> [rendered] - > ./b [7] ./index.js 2:0-47 - [0] ./d.js 20 bytes {1} {2} {3} {5} {6} {7} [built] - [1] ./node_modules/x.js 20 bytes {1} {2} {3} {5} {6} {7} [built] - [2] ./f.js 20 bytes {0} {2} {3} {6} {7} [built] - [3] ./node_modules/y.js 20 bytes {1} {2} {5} {6} [built] - [4] ./b.js 72 bytes {2} {6} [built] - chunk {3} disabled/async-c.js (async-c) 167 bytes <{4}> [rendered] - > ./c [7] ./index.js 3:0-47 - [0] ./d.js 20 bytes {1} {2} {3} {5} {6} {7} [built] - [1] ./node_modules/x.js 20 bytes {1} {2} {3} {5} {6} {7} [built] - [2] ./f.js 20 bytes {0} {2} {3} {6} {7} [built] - [6] ./c.js + 1 modules 107 bytes {3} {7} [built] - | ./c.js 72 bytes [built] - | ./node_modules/z.js 20 bytes [built] - chunk {4} disabled/main.js (main) 147 bytes >{1}< >{2}< >{3}< [entry] [rendered] - > ./ main - [7] ./index.js 147 bytes {4} [built] - chunk {5} disabled/a.js (a) 216 bytes >{0}< [entry] [rendered] - > ./a a - [0] ./d.js 20 bytes {1} {2} {3} {5} {6} {7} [built] - [1] ./node_modules/x.js 20 bytes {1} {2} {3} {5} {6} {7} [built] - [3] ./node_modules/y.js 20 bytes {1} {2} {5} {6} [built] - [5] ./a.js + 1 modules 156 bytes {1} {5} [built] - | ./a.js 121 bytes [built] - | ./e.js 20 bytes [built] - chunk {6} disabled/b.js (b) 152 bytes [entry] [rendered] - > ./b b - [0] ./d.js 20 bytes {1} {2} {3} {5} {6} {7} [built] - [1] ./node_modules/x.js 20 bytes {1} {2} {3} {5} {6} {7} [built] - [2] ./f.js 20 bytes {0} {2} {3} {6} {7} [built] - [3] ./node_modules/y.js 20 bytes {1} {2} {5} {6} [built] - [4] ./b.js 72 bytes {2} {6} [built] - chunk {7} disabled/c.js (c) 167 bytes [entry] [rendered] - > ./c c - [0] ./d.js 20 bytes {1} {2} {3} {5} {6} {7} [built] - [1] ./node_modules/x.js 20 bytes {1} {2} {3} {5} {6} {7} [built] - [2] ./f.js 20 bytes {0} {2} {3} {6} {7} [built] - [6] ./c.js + 1 modules 107 bytes {3} {7} [built] - | ./c.js 72 bytes [built] - | ./node_modules/z.js 20 bytes [built] -Child default: - Entrypoint main = default/main.js - Entrypoint a = default/a.js - Entrypoint b = default/b.js - Entrypoint c = default/c.js - chunk {0} default/vendors~async-a~async-b~async-c.js (vendors~async-a~async-b~async-c) 20 bytes <{9}> ={1}= ={2}= ={3}= ={5}= ={6}= ={7}= ={8}= >{2}< >{4}< [rendered] split chunk (cache group: vendors) (name: vendors~async-a~async-b~async-c) - > ./a [8] ./index.js 1:0-47 - > ./b [8] ./index.js 2:0-47 - > ./c [8] ./index.js 3:0-47 - [1] ./node_modules/x.js 20 bytes {0} {10} {11} {12} [built] - chunk {1} default/async-a~async-b~async-c.js (async-a~async-b~async-c) 20 bytes <{9}> ={0}= ={2}= ={3}= ={5}= ={6}= ={7}= ={8}= >{2}< >{4}< [rendered] split chunk (cache group: default) (name: async-a~async-b~async-c) - > ./a [8] ./index.js 1:0-47 - > ./b [8] ./index.js 2:0-47 - > ./c [8] ./index.js 3:0-47 - [0] ./d.js 20 bytes {1} {10} {11} {12} [built] - chunk {2} default/async-b~async-c~async-g.js (async-b~async-c~async-g) 20 bytes <{0}> <{1}> <{10}> <{3}> <{5}> <{9}> ={0}= ={1}= ={3}= ={4}= ={6}= ={7}= ={8}= [rendered] split chunk (cache group: default) (name: async-b~async-c~async-g) - > ./g [] 6:0-47 - > ./g [] 6:0-47 - > ./b [8] ./index.js 2:0-47 - > ./c [8] ./index.js 3:0-47 - [2] ./f.js 20 bytes {2} {11} {12} [built] - chunk {3} default/vendors~async-a~async-b.js (vendors~async-a~async-b) 20 bytes <{9}> ={0}= ={1}= ={2}= ={5}= ={6}= >{2}< >{4}< [rendered] split chunk (cache group: vendors) (name: vendors~async-a~async-b) - > ./a [8] ./index.js 1:0-47 - > ./b [8] ./index.js 2:0-47 - [3] ./node_modules/y.js 20 bytes {3} {10} {11} [built] - chunk {4} default/async-g.js (async-g) 34 bytes <{0}> <{1}> <{10}> <{3}> <{5}> ={2}= [rendered] - > ./g [] 6:0-47 - > ./g [] 6:0-47 - [9] ./g.js 34 bytes {4} [built] - chunk {5} default/async-a.js (async-a) 156 bytes <{9}> ={0}= ={1}= ={3}= >{2}< >{4}< [rendered] - > ./a [8] ./index.js 1:0-47 - [7] ./a.js + 1 modules 156 bytes {5} {10} [built] - | ./a.js 121 bytes [built] - | ./e.js 20 bytes [built] - chunk {6} default/async-b.js (async-b) 72 bytes <{9}> ={0}= ={1}= ={2}= ={3}= [rendered] - > ./b [8] ./index.js 2:0-47 - [5] ./b.js 72 bytes {6} {11} [built] - chunk {7} default/async-c.js (async-c) 72 bytes <{9}> ={0}= ={1}= ={2}= ={8}= [rendered] - > ./c [8] ./index.js 3:0-47 - [6] ./c.js 72 bytes {7} {12} [built] - chunk {8} default/vendors~async-c.js (vendors~async-c) 20 bytes <{9}> ={0}= ={1}= ={2}= ={7}= [rendered] split chunk (cache group: vendors) (name: vendors~async-c) - > ./c [8] ./index.js 3:0-47 - [4] ./node_modules/z.js 20 bytes {8} {12} [built] - chunk {9} default/main.js (main) 147 bytes >{0}< >{1}< >{2}< >{3}< >{5}< >{6}< >{7}< >{8}< [entry] [rendered] - > ./ main - [8] ./index.js 147 bytes {9} [built] - chunk {10} default/a.js (a) 216 bytes >{2}< >{4}< [entry] [rendered] - > ./a a - [0] ./d.js 20 bytes {1} {10} {11} {12} [built] - [1] ./node_modules/x.js 20 bytes {0} {10} {11} {12} [built] - [3] ./node_modules/y.js 20 bytes {3} {10} {11} [built] - [7] ./a.js + 1 modules 156 bytes {5} {10} [built] - | ./a.js 121 bytes [built] - | ./e.js 20 bytes [built] - chunk {11} default/b.js (b) 152 bytes [entry] [rendered] - > ./b b - [0] ./d.js 20 bytes {1} {10} {11} {12} [built] - [1] ./node_modules/x.js 20 bytes {0} {10} {11} {12} [built] - [2] ./f.js 20 bytes {2} {11} {12} [built] - [3] ./node_modules/y.js 20 bytes {3} {10} {11} [built] - [5] ./b.js 72 bytes {6} {11} [built] - chunk {12} default/c.js (c) 152 bytes [entry] [rendered] - > ./c c - [0] ./d.js 20 bytes {1} {10} {11} {12} [built] - [1] ./node_modules/x.js 20 bytes {0} {10} {11} {12} [built] - [2] ./f.js 20 bytes {2} {11} {12} [built] - [4] ./node_modules/z.js 20 bytes {8} {12} [built] - [6] ./c.js 72 bytes {7} {12} [built] -Child vendors: - Entrypoint main = vendors/main.js - Entrypoint a = vendors/vendors.js vendors/a.js - Entrypoint b = vendors/vendors.js vendors/b.js - Entrypoint c = vendors/vendors.js vendors/c.js - chunk {0} vendors/async-g.js (async-g) 54 bytes <{1}> <{4}> <{6}> [rendered] - > ./g [] 6:0-47 - > ./g [] 6:0-47 - [2] ./f.js 20 bytes {0} {2} {3} {7} {8} [built] - [9] ./g.js 34 bytes {0} [built] - chunk {1} vendors/async-a.js (async-a) 216 bytes <{5}> >{0}< [rendered] - > ./a [8] ./index.js 1:0-47 - [0] ./d.js 20 bytes {1} {2} {3} {6} {7} {8} [built] - [1] ./node_modules/x.js 20 bytes {1} {2} {3} {4} [built] - [3] ./node_modules/y.js 20 bytes {1} {2} {4} [built] - [7] ./a.js + 1 modules 156 bytes {1} {6} [built] - | ./a.js 121 bytes [built] - | ./e.js 20 bytes [built] - chunk {2} vendors/async-b.js (async-b) 152 bytes <{5}> [rendered] - > ./b [8] ./index.js 2:0-47 - [0] ./d.js 20 bytes {1} {2} {3} {6} {7} {8} [built] - [1] ./node_modules/x.js 20 bytes {1} {2} {3} {4} [built] - [2] ./f.js 20 bytes {0} {2} {3} {7} {8} [built] - [3] ./node_modules/y.js 20 bytes {1} {2} {4} [built] - [5] ./b.js 72 bytes {2} {7} [built] - chunk {3} vendors/async-c.js (async-c) 152 bytes <{5}> [rendered] - > ./c [8] ./index.js 3:0-47 - [0] ./d.js 20 bytes {1} {2} {3} {6} {7} {8} [built] - [1] ./node_modules/x.js 20 bytes {1} {2} {3} {4} [built] - [2] ./f.js 20 bytes {0} {2} {3} {7} {8} [built] - [4] ./node_modules/z.js 20 bytes {3} {4} [built] - [6] ./c.js 72 bytes {3} {8} [built] - chunk {4} vendors/vendors.js (vendors) 60 bytes ={6}= ={7}= ={8}= >{0}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors) - > ./a a - > ./b b - > ./c c - [1] ./node_modules/x.js 20 bytes {1} {2} {3} {4} [built] - [3] ./node_modules/y.js 20 bytes {1} {2} {4} [built] - [4] ./node_modules/z.js 20 bytes {3} {4} [built] - chunk {5} vendors/main.js (main) 147 bytes >{1}< >{2}< >{3}< [entry] [rendered] - > ./ main - [8] ./index.js 147 bytes {5} [built] - chunk {6} vendors/a.js (a) 176 bytes ={4}= >{0}< [entry] [rendered] - > ./a a - [0] ./d.js 20 bytes {1} {2} {3} {6} {7} {8} [built] - [7] ./a.js + 1 modules 156 bytes {1} {6} [built] - | ./a.js 121 bytes [built] - | ./e.js 20 bytes [built] - chunk {7} vendors/b.js (b) 112 bytes ={4}= [entry] [rendered] - > ./b b - [0] ./d.js 20 bytes {1} {2} {3} {6} {7} {8} [built] - [2] ./f.js 20 bytes {0} {2} {3} {7} {8} [built] - [5] ./b.js 72 bytes {2} {7} [built] - chunk {8} vendors/c.js (c) 112 bytes ={4}= [entry] [rendered] - > ./c c - [0] ./d.js 20 bytes {1} {2} {3} {6} {7} {8} [built] - [2] ./f.js 20 bytes {0} {2} {3} {7} {8} [built] - [6] ./c.js 72 bytes {3} {8} [built] -Child multiple-vendors: - Entrypoint main = multiple-vendors/main.js - Entrypoint a = multiple-vendors/libs-x.js multiple-vendors/vendors~a~async-a~async-b~b.js multiple-vendors/a.js - Entrypoint b = multiple-vendors/libs-x.js multiple-vendors/vendors~a~async-a~async-b~b.js multiple-vendors/b.js - Entrypoint c = multiple-vendors/libs-x.js multiple-vendors/vendors~async-c~c.js multiple-vendors/c.js - chunk {0} multiple-vendors/libs-x.js (libs-x) 20 bytes <{9}> ={1}= ={10}= ={11}= ={12}= ={2}= ={3}= ={4}= ={6}= ={7}= ={8}= >{2}< >{5}< [initial] [rendered] split chunk (cache group: libs) (name: libs-x) - > ./a a - > ./b b - > ./c c - > ./a [8] ./index.js 1:0-47 - > ./b [8] ./index.js 2:0-47 - > ./c [8] ./index.js 3:0-47 - [2] ./node_modules/x.js 20 bytes {0} [built] - chunk {1} multiple-vendors/a~async-a~async-b~async-c~b~c.js (a~async-a~async-b~async-c~b~c) 20 bytes <{9}> ={0}= ={2}= ={3}= ={4}= ={6}= ={7}= ={8}= >{2}< >{5}< [rendered] split chunk (cache group: default) (name: a~async-a~async-b~async-c~b~c) - > ./a [8] ./index.js 1:0-47 - > ./b [8] ./index.js 2:0-47 - > ./c [8] ./index.js 3:0-47 - [0] ./d.js 20 bytes {1} {10} {11} {12} [built] - chunk {2} multiple-vendors/async-b~async-c~async-g~b~c.js (async-b~async-c~async-g~b~c) 20 bytes <{0}> <{1}> <{10}> <{3}> <{8}> <{9}> ={0}= ={1}= ={3}= ={4}= ={5}= ={6}= ={7}= [rendered] split chunk (cache group: default) (name: async-b~async-c~async-g~b~c) - > ./g [] 6:0-47 - > ./g [] 6:0-47 - > ./b [8] ./index.js 2:0-47 - > ./c [8] ./index.js 3:0-47 - [1] ./f.js 20 bytes {2} {11} {12} [built] - chunk {3} multiple-vendors/vendors~a~async-a~async-b~b.js (vendors~a~async-a~async-b~b) 20 bytes <{9}> ={0}= ={1}= ={10}= ={11}= ={2}= ={6}= ={8}= >{2}< >{5}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~a~async-a~async-b~b) - > ./a a - > ./b b - > ./a [8] ./index.js 1:0-47 - > ./b [8] ./index.js 2:0-47 - [3] ./node_modules/y.js 20 bytes {3} [built] - chunk {4} multiple-vendors/vendors~async-c~c.js (vendors~async-c~c) 20 bytes <{9}> ={0}= ={1}= ={12}= ={2}= ={7}= [initial] [rendered] split chunk (cache group: vendors) (name: vendors~async-c~c) - > ./c c - > ./c [8] ./index.js 3:0-47 - [7] ./node_modules/z.js 20 bytes {4} [built] - chunk {5} multiple-vendors/async-g.js (async-g) 34 bytes <{0}> <{1}> <{10}> <{3}> <{8}> ={2}= [rendered] - > ./g [] 6:0-47 - > ./g [] 6:0-47 - [9] ./g.js 34 bytes {5} [built] - chunk {6} multiple-vendors/async-b.js (async-b) 72 bytes <{9}> ={0}= ={1}= ={2}= ={3}= [rendered] - > ./b [8] ./index.js 2:0-47 - [4] ./b.js 72 bytes {6} {11} [built] - chunk {7} multiple-vendors/async-c.js (async-c) 72 bytes <{9}> ={0}= ={1}= ={2}= ={4}= [rendered] - > ./c [8] ./index.js 3:0-47 - [5] ./c.js 72 bytes {7} {12} [built] - chunk {8} multiple-vendors/a~async-a.js (a~async-a) 156 bytes <{9}> ={0}= ={1}= ={3}= >{2}< >{5}< [rendered] split chunk (cache group: default) (name: a~async-a) - > ./a [8] ./index.js 1:0-47 - [6] ./a.js + 1 modules 156 bytes {8} {10} [built] - | ./a.js 121 bytes [built] - | ./e.js 20 bytes [built] - chunk {9} multiple-vendors/main.js (main) 147 bytes >{0}< >{1}< >{2}< >{3}< >{4}< >{6}< >{7}< >{8}< [entry] [rendered] - > ./ main - [8] ./index.js 147 bytes {9} [built] - chunk {10} multiple-vendors/a.js (a) 176 bytes ={0}= ={3}= >{2}< >{5}< [entry] [rendered] - > ./a a - [0] ./d.js 20 bytes {1} {10} {11} {12} [built] - [6] ./a.js + 1 modules 156 bytes {8} {10} [built] - | ./a.js 121 bytes [built] - | ./e.js 20 bytes [built] - chunk {11} multiple-vendors/b.js (b) 112 bytes ={0}= ={3}= [entry] [rendered] - > ./b b - [0] ./d.js 20 bytes {1} {10} {11} {12} [built] - [1] ./f.js 20 bytes {2} {11} {12} [built] - [4] ./b.js 72 bytes {6} {11} [built] - chunk {12} multiple-vendors/c.js (c) 112 bytes ={0}= ={4}= [entry] [rendered] - > ./c c - [0] ./d.js 20 bytes {1} {10} {11} {12} [built] - [1] ./f.js 20 bytes {2} {11} {12} [built] - [5] ./c.js 72 bytes {7} {12} [built] -Child all: - Entrypoint main = all/main.js - Entrypoint a = all/vendors~a~async-a~async-b~async-c~b~c.js all/vendors~a~async-a~async-b~b.js all/a.js - Entrypoint b = all/vendors~a~async-a~async-b~async-c~b~c.js all/vendors~a~async-a~async-b~b.js all/b.js - Entrypoint c = all/vendors~a~async-a~async-b~async-c~b~c.js all/vendors~async-c~c.js all/c.js - chunk {0} all/vendors~a~async-a~async-b~async-c~b~c.js (vendors~a~async-a~async-b~async-c~b~c) 20 bytes <{9}> ={1}= ={10}= ={11}= ={12}= ={2}= ={3}= ={4}= ={6}= ={7}= ={8}= >{2}< >{5}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~a~async-a~async-b~async-c~b~c) - > ./a a - > ./b b - > ./c c - > ./a [8] ./index.js 1:0-47 - > ./b [8] ./index.js 2:0-47 - > ./c [8] ./index.js 3:0-47 - [2] ./node_modules/x.js 20 bytes {0} [built] - chunk {1} all/a~async-a~async-b~async-c~b~c.js (a~async-a~async-b~async-c~b~c) 20 bytes <{9}> ={0}= ={2}= ={3}= ={4}= ={6}= ={7}= ={8}= >{2}< >{5}< [rendered] split chunk (cache group: default) (name: a~async-a~async-b~async-c~b~c) - > ./a [8] ./index.js 1:0-47 - > ./b [8] ./index.js 2:0-47 - > ./c [8] ./index.js 3:0-47 - [0] ./d.js 20 bytes {1} {10} {11} {12} [built] - chunk {2} all/async-b~async-c~async-g~b~c.js (async-b~async-c~async-g~b~c) 20 bytes <{0}> <{1}> <{10}> <{3}> <{8}> <{9}> ={0}= ={1}= ={3}= ={4}= ={5}= ={6}= ={7}= [rendered] split chunk (cache group: default) (name: async-b~async-c~async-g~b~c) - > ./g [] 6:0-47 - > ./g [] 6:0-47 - > ./b [8] ./index.js 2:0-47 - > ./c [8] ./index.js 3:0-47 - [1] ./f.js 20 bytes {2} {11} {12} [built] - chunk {3} all/vendors~a~async-a~async-b~b.js (vendors~a~async-a~async-b~b) 20 bytes <{9}> ={0}= ={1}= ={10}= ={11}= ={2}= ={6}= ={8}= >{2}< >{5}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~a~async-a~async-b~b) - > ./a a - > ./b b - > ./a [8] ./index.js 1:0-47 - > ./b [8] ./index.js 2:0-47 - [3] ./node_modules/y.js 20 bytes {3} [built] - chunk {4} all/vendors~async-c~c.js (vendors~async-c~c) 20 bytes <{9}> ={0}= ={1}= ={12}= ={2}= ={7}= [initial] [rendered] split chunk (cache group: vendors) (name: vendors~async-c~c) - > ./c c - > ./c [8] ./index.js 3:0-47 - [7] ./node_modules/z.js 20 bytes {4} [built] - chunk {5} all/async-g.js (async-g) 34 bytes <{0}> <{1}> <{10}> <{3}> <{8}> ={2}= [rendered] - > ./g [] 6:0-47 - > ./g [] 6:0-47 - [9] ./g.js 34 bytes {5} [built] - chunk {6} all/async-b.js (async-b) 72 bytes <{9}> ={0}= ={1}= ={2}= ={3}= [rendered] - > ./b [8] ./index.js 2:0-47 - [4] ./b.js 72 bytes {6} {11} [built] - chunk {7} all/async-c.js (async-c) 72 bytes <{9}> ={0}= ={1}= ={2}= ={4}= [rendered] - > ./c [8] ./index.js 3:0-47 - [5] ./c.js 72 bytes {7} {12} [built] - chunk {8} all/a~async-a.js (a~async-a) 156 bytes <{9}> ={0}= ={1}= ={3}= >{2}< >{5}< [rendered] split chunk (cache group: default) (name: a~async-a) - > ./a [8] ./index.js 1:0-47 - [6] ./a.js + 1 modules 156 bytes {8} {10} [built] - | ./a.js 121 bytes [built] - | ./e.js 20 bytes [built] - chunk {9} all/main.js (main) 147 bytes >{0}< >{1}< >{2}< >{3}< >{4}< >{6}< >{7}< >{8}< [entry] [rendered] - > ./ main - [8] ./index.js 147 bytes {9} [built] - chunk {10} all/a.js (a) 176 bytes ={0}= ={3}= >{2}< >{5}< [entry] [rendered] - > ./a a - [0] ./d.js 20 bytes {1} {10} {11} {12} [built] - [6] ./a.js + 1 modules 156 bytes {8} {10} [built] - | ./a.js 121 bytes [built] - | ./e.js 20 bytes [built] - chunk {11} all/b.js (b) 112 bytes ={0}= ={3}= [entry] [rendered] - > ./b b - [0] ./d.js 20 bytes {1} {10} {11} {12} [built] - [1] ./f.js 20 bytes {2} {11} {12} [built] - [4] ./b.js 72 bytes {6} {11} [built] - chunk {12} all/c.js (c) 112 bytes ={0}= ={4}= [entry] [rendered] - > ./c c - [0] ./d.js 20 bytes {1} {10} {11} {12} [built] - [1] ./f.js 20 bytes {2} {11} {12} [built] - [5] ./c.js 72 bytes {7} {12} [built] \ No newline at end of file diff --git a/test/statsCases/async-commons-chunk/expected.txt b/test/statsCases/async-commons-chunk/expected.txt deleted file mode 100644 index ca011247461..00000000000 --- a/test/statsCases/async-commons-chunk/expected.txt +++ /dev/null @@ -1,15 +0,0 @@ -Entrypoint main = main.js -chunk {0} 0.js 21 bytes <{3}> ={1}= ={2}= [rendered] reused as split chunk (cache group: default) - > [3] ./index.js 17:1-21:3 - > [3] ./index.js 2:1-5:3 - > ./a ./b [3] ./index.js 9:1-13:3 - [0] ./a.js 21 bytes {0} [built] -chunk {1} 1.js 21 bytes <{3}> ={0}= [rendered] - > ./a ./b [3] ./index.js 9:1-13:3 - [1] ./b.js 21 bytes {1} [built] -chunk {2} 2.js 21 bytes <{3}> ={0}= [rendered] - > [3] ./index.js 17:1-21:3 - [2] ./c.js 21 bytes {2} [built] -chunk {3} main.js (main) 550 bytes >{0}< >{1}< >{2}< [entry] [rendered] - > ./ main - [3] ./index.js 550 bytes {3} [built] \ No newline at end of file diff --git a/test/statsCases/async-commons-chunk/index.js b/test/statsCases/async-commons-chunk/index.js index 474da4c1600..5953c692311 100644 --- a/test/statsCases/async-commons-chunk/index.js +++ b/test/statsCases/async-commons-chunk/index.js @@ -1,22 +1,22 @@ -it("should load the full async commons", function(done) { - require.ensure(["./a"], function(require) { - require("./a").should.be.eql("a"); +it("should load the full async commons", (done) => { + require.ensure(["./a"], (require) => { + expect(require("./a")).toBe("a"); done(); }); }); -it("should load a chunk with async commons (AMD)", function(done) { - require(["./a", "./b"], function(a, b) { - a.should.be.eql("a"); - b.should.be.eql("b"); +it("should load a chunk with async commons (AMD)", (done) => { + require(["./a", "./b"], (a, b) => { + expect(a).toBe("a"); + expect(b).toBe("b"); done(); }); }); -it("should load a chunk with async commons (require.ensure)", function(done) { - require.ensure([], function(require) { - require("./a").should.be.eql("a"); - require("./c").should.be.eql("c"); +it("should load a chunk with async commons (require.ensure)", (done) => { + require.ensure([], (require) => { + expect(require("./a")).toBe("a"); + expect(require("./c")).toBe("c"); done(); }); }); diff --git a/test/statsCases/chunk-module-id-range/expected.txt b/test/statsCases/chunk-module-id-range/expected.txt deleted file mode 100644 index a34fa06a649..00000000000 --- a/test/statsCases/chunk-module-id-range/expected.txt +++ /dev/null @@ -1,22 +0,0 @@ -Hash: 27b68d27e07b42624dae -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names -main2.js 3.89 KiB 0 [emitted] main2 -main1.js 3.89 KiB 1 [emitted] main1 -Entrypoint main1 = main1.js -Entrypoint main2 = main2.js -chunk {0} main2.js (main2) 136 bytes [entry] [rendered] - > ./main2 main2 - [0] ./e.js 20 bytes {0} [built] - [1] ./f.js 20 bytes {0} [built] - [2] ./main2.js 56 bytes {0} [built] - [100] ./d.js 20 bytes {0} {1} [built] - [101] ./a.js 20 bytes {0} {1} [built] -chunk {1} main1.js (main1) 136 bytes [entry] [rendered] - > ./main1 main1 - [3] ./b.js 20 bytes {1} [built] - [4] ./main1.js 56 bytes {1} [built] - [100] ./d.js 20 bytes {0} {1} [built] - [101] ./a.js 20 bytes {0} {1} [built] - [102] ./c.js 20 bytes {1} [built] \ No newline at end of file diff --git a/test/statsCases/chunks-development/expected.txt b/test/statsCases/chunks-development/expected.txt deleted file mode 100644 index fc9485d332a..00000000000 --- a/test/statsCases/chunks-development/expected.txt +++ /dev/null @@ -1,36 +0,0 @@ -Hash: e81afb52ad447e8765ab -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names -0.bundle.js 433 bytes 0 [emitted] -1.bundle.js 297 bytes 1 [emitted] -2.bundle.js 588 bytes 2 [emitted] - bundle.js 7.38 KiB main [emitted] main -Entrypoint main = bundle.js -chunk {main} bundle.js (main) 73 bytes >{0}< >{1}< [entry] [rendered] - > ./index main - [./a.js] 22 bytes {main} [built] - cjs require ./a [./index.js] 1:0-14 - cjs require ./a [./e.js] 1:0-14 - [./index.js] Xms -> factory:Xms building:Xms = Xms - [./index.js] 51 bytes {main} [built] - single entry ./index main - factory:Xms building:Xms = Xms -chunk {0} 0.bundle.js 54 bytes <{main}> >{2}< [rendered] - > ./c [./index.js] ./index.js 3:0-16 - [./c.js] 54 bytes {0} [built] - amd require ./c [./index.js] 3:0-16 - [./index.js] Xms -> factory:Xms building:Xms = Xms -chunk {1} 1.bundle.js 22 bytes <{main}> [rendered] - > ./b [./index.js] ./index.js 2:0-16 - [./b.js] 22 bytes {1} [built] - amd require ./b [./index.js] 2:0-16 - [./index.js] Xms -> factory:Xms building:Xms = Xms -chunk {2} 2.bundle.js 60 bytes <{0}> [rendered] - > [./c.js] ./c.js 1:0-52 - [./d.js] 22 bytes {2} [built] - require.ensure item ./d [./c.js] 1:0-52 - [./index.js] Xms -> [./c.js] Xms -> factory:Xms building:Xms = Xms - [./e.js] 38 bytes {2} [built] - require.ensure item ./e [./c.js] 1:0-52 - [./index.js] Xms -> [./c.js] Xms -> factory:Xms building:Xms = Xms \ No newline at end of file diff --git a/test/statsCases/chunks/expected.txt b/test/statsCases/chunks/expected.txt deleted file mode 100644 index e98a6bf8c9a..00000000000 --- a/test/statsCases/chunks/expected.txt +++ /dev/null @@ -1,35 +0,0 @@ -Hash: 4a1bda30edd6ae541ab2 -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names -0.bundle.js 152 bytes 0 [emitted] -1.bundle.js 289 bytes 1 [emitted] - bundle.js 7 KiB 2 [emitted] main -3.bundle.js 227 bytes 3 [emitted] -Entrypoint main = bundle.js -chunk {0} 0.bundle.js 22 bytes <{2}> [rendered] - > ./b [4] ./index.js 2:0-16 - [2] ./b.js 22 bytes {0} [built] - amd require ./b [4] ./index.js 2:0-16 - [4] Xms -> factory:Xms building:Xms = Xms -chunk {1} 1.bundle.js 54 bytes <{2}> >{3}< [rendered] - > ./c [4] ./index.js 3:0-16 - [3] ./c.js 54 bytes {1} [built] - amd require ./c [4] ./index.js 3:0-16 - [4] Xms -> factory:Xms building:Xms = Xms -chunk {2} bundle.js (main) 73 bytes >{0}< >{1}< [entry] [rendered] - > ./index main - [4] ./index.js 51 bytes {2} [built] - single entry ./index main - factory:Xms building:Xms = Xms - [5] ./a.js 22 bytes {2} [built] - cjs require ./a [4] ./index.js 1:0-14 - [4] Xms -> factory:Xms building:Xms = Xms -chunk {3} 3.bundle.js 44 bytes <{1}> [rendered] - > [3] ./c.js 1:0-52 - [0] ./d.js 22 bytes {3} [built] - require.ensure item ./d [3] ./c.js 1:0-52 - [4] Xms -> [3] Xms -> factory:Xms building:Xms = Xms - [1] ./e.js 22 bytes {3} [built] - require.ensure item ./e [3] ./c.js 1:0-52 - [4] Xms -> [3] Xms -> factory:Xms building:Xms = Xms \ No newline at end of file diff --git a/test/statsCases/circular-correctness/expected.txt b/test/statsCases/circular-correctness/expected.txt deleted file mode 100644 index 3501a16c336..00000000000 --- a/test/statsCases/circular-correctness/expected.txt +++ /dev/null @@ -1,9 +0,0 @@ -Entrypoint main = bundle.js -chunk {0} 0.bundle.js (a) 49 bytes <{2}> <{3}> >{3}< [rendered] - [1] ./module-a.js 49 bytes {0} [built] -chunk {1} 1.bundle.js (b) 49 bytes <{2}> <{3}> >{3}< [rendered] - [2] ./module-b.js 49 bytes {1} [built] -chunk {2} bundle.js (main) 98 bytes >{0}< >{1}< [entry] [rendered] - [3] ./index.js 98 bytes {2} [built] -chunk {3} 3.bundle.js (c) 98 bytes <{0}> <{1}> >{0}< >{1}< [rendered] - [0] ./module-c.js 98 bytes {3} [built] \ No newline at end of file diff --git a/test/statsCases/color-disabled/expected.txt b/test/statsCases/color-disabled/expected.txt deleted file mode 100644 index a61ed09c9fe..00000000000 --- a/test/statsCases/color-disabled/expected.txt +++ /dev/null @@ -1,7 +0,0 @@ -Hash: 0b32ee714cee3c8b25d4 -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names -main.js 2.61 KiB 0 [emitted] main -Entrypoint main = main.js -[0] ./index.js 0 bytes {0} [built] \ No newline at end of file diff --git a/test/statsCases/color-enabled-custom/expected.txt b/test/statsCases/color-enabled-custom/expected.txt deleted file mode 100644 index 2a18c994dd6..00000000000 --- a/test/statsCases/color-enabled-custom/expected.txt +++ /dev/null @@ -1,7 +0,0 @@ -Hash: 0b32ee714cee3c8b25d4 -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names -main.js 2.61 KiB 0 [emitted] main -Entrypoint main = main.js -[0] ./index.js 0 bytes {0} [built] \ No newline at end of file diff --git a/test/statsCases/color-enabled/expected.txt b/test/statsCases/color-enabled/expected.txt deleted file mode 100644 index bb7974c5bd3..00000000000 --- a/test/statsCases/color-enabled/expected.txt +++ /dev/null @@ -1,7 +0,0 @@ -Hash: 0b32ee714cee3c8b25d4 -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names -main.js 2.61 KiB 0 [emitted] main -Entrypoint main = main.js -[0] ./index.js 0 bytes {0} [built] \ No newline at end of file diff --git a/test/statsCases/commons-chunk-min-size-0/expected.txt b/test/statsCases/commons-chunk-min-size-0/expected.txt deleted file mode 100644 index 97d37ae2f17..00000000000 --- a/test/statsCases/commons-chunk-min-size-0/expected.txt +++ /dev/null @@ -1,14 +0,0 @@ -Hash: cad25b99a073374722a7 -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - entry-1.js 5.49 KiB 0 [emitted] entry-1 -vendor-1~entry-1.js 314 bytes 1 [emitted] vendor-1~entry-1 -Entrypoint entry-1 = vendor-1~entry-1.js entry-1.js -[0] ./entry-1.js 145 bytes {0} [built] -[1] ./modules/a.js 22 bytes {1} [built] -[2] ./modules/b.js 22 bytes {1} [built] -[3] ./modules/c.js 22 bytes {1} [built] -[4] ./modules/d.js 22 bytes {0} [built] -[5] ./modules/e.js 22 bytes {0} [built] -[6] ./modules/f.js 22 bytes {0} [built] \ No newline at end of file diff --git a/test/statsCases/commons-chunk-min-size-Infinity/expected.txt b/test/statsCases/commons-chunk-min-size-Infinity/expected.txt deleted file mode 100644 index fe6ee6e6c6c..00000000000 --- a/test/statsCases/commons-chunk-min-size-Infinity/expected.txt +++ /dev/null @@ -1,14 +0,0 @@ -Hash: c176225f44e51c7a39a4 -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - entry-1.js 5.49 KiB 0 [emitted] entry-1 -vendor-1.js 314 bytes 1 [emitted] vendor-1 -Entrypoint entry-1 = vendor-1.js entry-1.js -[0] ./entry-1.js 145 bytes {0} [built] -[1] ./modules/a.js 22 bytes {1} [built] -[2] ./modules/b.js 22 bytes {1} [built] -[3] ./modules/c.js 22 bytes {1} [built] -[4] ./modules/d.js 22 bytes {0} [built] -[5] ./modules/e.js 22 bytes {0} [built] -[6] ./modules/f.js 22 bytes {0} [built] \ No newline at end of file diff --git a/test/statsCases/commons-plugin-issue-4980/expected.txt b/test/statsCases/commons-plugin-issue-4980/expected.txt deleted file mode 100644 index 36e56796a2b..00000000000 --- a/test/statsCases/commons-plugin-issue-4980/expected.txt +++ /dev/null @@ -1,27 +0,0 @@ -Hash: 1c62a4c91035f66150df2425703c4fe7d61799b3 -Child - Hash: 1c62a4c91035f66150df - Time: Xms - Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - app.js 5.58 KiB 0 [emitted] app - vendor.c0e73bece4137a7015c2.js 619 bytes 1 [emitted] vendor - Entrypoint app = vendor.c0e73bece4137a7015c2.js app.js - [./constants.js] 87 bytes {1} [built] - [./entry-1.js] ./entry-1.js + 2 modules 190 bytes {0} [built] - | ./entry-1.js 67 bytes [built] - | ./submodule-a.js 59 bytes [built] - | ./submodule-b.js 59 bytes [built] -Child - Hash: 2425703c4fe7d61799b3 - Time: Xms - Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - app.js 5.59 KiB 0 [emitted] app - vendor.c0e73bece4137a7015c2.js 619 bytes 1 [emitted] vendor - Entrypoint app = vendor.c0e73bece4137a7015c2.js app.js - [./constants.js] 87 bytes {1} [built] - [./entry-2.js] ./entry-2.js + 2 modules 197 bytes {0} [built] - | ./entry-2.js 67 bytes [built] - | ./submodule-a.js 59 bytes [built] - | ./submodule-c.js 66 bytes [built] \ No newline at end of file diff --git a/test/statsCases/concat-and-sideeffects/expected.txt b/test/statsCases/concat-and-sideeffects/expected.txt deleted file mode 100644 index 46d86293877..00000000000 --- a/test/statsCases/concat-and-sideeffects/expected.txt +++ /dev/null @@ -1,15 +0,0 @@ -[0] ./index.js + 2 modules 119 bytes {0} [built] - | ./index.js 46 bytes [built] - | ModuleConcatenation bailout: Module is an entry point - | ./node_modules/pmodule/a.js 49 bytes [built] - | ./node_modules/pmodule/aa.js 24 bytes [built] -[1] ./node_modules/pmodule/b.js 49 bytes [built] - ModuleConcatenation bailout: Module is not in any chunk -[2] ./node_modules/pmodule/bb.js 24 bytes [built] - ModuleConcatenation bailout: Module is not in any chunk -[3] ./node_modules/pmodule/c.js 49 bytes [built] - ModuleConcatenation bailout: Module is not in any chunk -[4] ./node_modules/pmodule/cc.js 24 bytes [built] - ModuleConcatenation bailout: Module is not in any chunk -[5] ./node_modules/pmodule/index.js 63 bytes [built] - ModuleConcatenation bailout: Module is not in any chunk \ No newline at end of file diff --git a/test/statsCases/define-plugin/expected.txt b/test/statsCases/define-plugin/expected.txt deleted file mode 100644 index d43671c361e..00000000000 --- a/test/statsCases/define-plugin/expected.txt +++ /dev/null @@ -1,17 +0,0 @@ -Hash: 189d0d15eb46be80d1f9eaead63561588b554cc6 -Child - Hash: 189d0d15eb46be80d1f9 - Time: Xms - Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - main.js 2.63 KiB 0 [emitted] main - Entrypoint main = main.js - [0] ./index.js 24 bytes {0} [built] -Child - Hash: eaead63561588b554cc6 - Time: Xms - Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - main.js 2.63 KiB 0 [emitted] main - Entrypoint main = main.js - [0] ./index.js 24 bytes {0} [built] \ No newline at end of file diff --git a/test/statsCases/exclude-with-loader/expected.txt b/test/statsCases/exclude-with-loader/expected.txt deleted file mode 100644 index e51510ecfae..00000000000 --- a/test/statsCases/exclude-with-loader/expected.txt +++ /dev/null @@ -1,10 +0,0 @@ -Hash: 8b3d74c47fe62d34ee43 -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names -bundle.js 3.05 KiB 0 [emitted] main - + 1 hidden asset -Entrypoint main = bundle.js -[0] ./index.js 77 bytes {0} [built] -[1] ./a.txt 43 bytes {0} [built] - + 2 hidden modules \ No newline at end of file diff --git a/test/statsCases/external/expected.txt b/test/statsCases/external/expected.txt deleted file mode 100644 index b8ebe71bded..00000000000 --- a/test/statsCases/external/expected.txt +++ /dev/null @@ -1,8 +0,0 @@ -Hash: 3386bd94ba1fc3ae7f29 -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names -main.js 2.74 KiB 0 [emitted] main -Entrypoint main = main.js -[0] ./index.js 17 bytes {0} [built] -[1] external "test" 42 bytes {0} [built] \ No newline at end of file diff --git a/test/statsCases/filter-warnings/expected.txt b/test/statsCases/filter-warnings/expected.txt deleted file mode 100644 index 9e37978c977..00000000000 --- a/test/statsCases/filter-warnings/expected.txt +++ /dev/null @@ -1,183 +0,0 @@ -Hash: abbea59d067e262318adabbea59d067e262318adabbea59d067e262318adabbea59d067e262318adabbea59d067e262318adabbea59d067e262318adabbea59d067e262318adabbea59d067e262318adabbea59d067e262318adabbea59d067e262318adabbea59d067e262318adabbea59d067e262318adabbea59d067e262318ad -Child - Hash: abbea59d067e262318ad - Time: Xms - Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - bundle.js 2.19 KiB 0 [emitted] main - Entrypoint main = bundle.js - - WARNING in bundle.js from UglifyJs - Dropping side-effect-free statement [./index.js:6,0] - Dropping unused function someUnUsedFunction1 [./index.js:8,0] - Dropping unused function someUnUsedFunction2 [./index.js:9,0] - Dropping unused function someUnUsedFunction3 [./index.js:10,0] - Dropping unused function someUnUsedFunction4 [./index.js:11,0] - Dropping unused function someUnUsedFunction5 [./index.js:12,0] - Dropping unused function someRemoteUnUsedFunction1 [./a.js:3,0] - Dropping unused function someRemoteUnUsedFunction2 [./a.js:4,0] - Dropping unused function someRemoteUnUsedFunction3 [./a.js:5,0] - Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] - Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] -Child - Hash: abbea59d067e262318ad - Time: Xms - Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - bundle.js 2.19 KiB 0 [emitted] main - Entrypoint main = bundle.js -Child - Hash: abbea59d067e262318ad - Time: Xms - Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - bundle.js 2.19 KiB 0 [emitted] main - Entrypoint main = bundle.js -Child - Hash: abbea59d067e262318ad - Time: Xms - Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - bundle.js 2.19 KiB 0 [emitted] main - Entrypoint main = bundle.js -Child - Hash: abbea59d067e262318ad - Time: Xms - Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - bundle.js 2.19 KiB 0 [emitted] main - Entrypoint main = bundle.js -Child - Hash: abbea59d067e262318ad - Time: Xms - Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - bundle.js 2.19 KiB 0 [emitted] main - Entrypoint main = bundle.js -Child - Hash: abbea59d067e262318ad - Time: Xms - Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - bundle.js 2.19 KiB 0 [emitted] main - Entrypoint main = bundle.js -Child - Hash: abbea59d067e262318ad - Time: Xms - Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - bundle.js 2.19 KiB 0 [emitted] main - Entrypoint main = bundle.js - - WARNING in bundle.js from UglifyJs - Dropping side-effect-free statement [./index.js:6,0] - Dropping unused function someUnUsedFunction1 [./index.js:8,0] - Dropping unused function someUnUsedFunction2 [./index.js:9,0] - Dropping unused function someUnUsedFunction3 [./index.js:10,0] - Dropping unused function someUnUsedFunction4 [./index.js:11,0] - Dropping unused function someUnUsedFunction5 [./index.js:12,0] - Dropping unused function someRemoteUnUsedFunction1 [./a.js:3,0] - Dropping unused function someRemoteUnUsedFunction2 [./a.js:4,0] - Dropping unused function someRemoteUnUsedFunction3 [./a.js:5,0] - Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] - Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] -Child - Hash: abbea59d067e262318ad - Time: Xms - Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - bundle.js 2.19 KiB 0 [emitted] main - Entrypoint main = bundle.js - - WARNING in bundle.js from UglifyJs - Dropping side-effect-free statement [./index.js:6,0] - Dropping unused function someUnUsedFunction1 [./index.js:8,0] - Dropping unused function someUnUsedFunction2 [./index.js:9,0] - Dropping unused function someUnUsedFunction3 [./index.js:10,0] - Dropping unused function someUnUsedFunction4 [./index.js:11,0] - Dropping unused function someUnUsedFunction5 [./index.js:12,0] - Dropping unused function someRemoteUnUsedFunction1 [./a.js:3,0] - Dropping unused function someRemoteUnUsedFunction2 [./a.js:4,0] - Dropping unused function someRemoteUnUsedFunction3 [./a.js:5,0] - Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] - Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] -Child - Hash: abbea59d067e262318ad - Time: Xms - Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - bundle.js 2.19 KiB 0 [emitted] main - Entrypoint main = bundle.js - - WARNING in bundle.js from UglifyJs - Dropping side-effect-free statement [./index.js:6,0] - Dropping unused function someUnUsedFunction1 [./index.js:8,0] - Dropping unused function someUnUsedFunction2 [./index.js:9,0] - Dropping unused function someUnUsedFunction3 [./index.js:10,0] - Dropping unused function someUnUsedFunction4 [./index.js:11,0] - Dropping unused function someUnUsedFunction5 [./index.js:12,0] - Dropping unused function someRemoteUnUsedFunction1 [./a.js:3,0] - Dropping unused function someRemoteUnUsedFunction2 [./a.js:4,0] - Dropping unused function someRemoteUnUsedFunction3 [./a.js:5,0] - Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] - Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] -Child - Hash: abbea59d067e262318ad - Time: Xms - Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - bundle.js 2.19 KiB 0 [emitted] main - Entrypoint main = bundle.js - - WARNING in bundle.js from UglifyJs - Dropping side-effect-free statement [./index.js:6,0] - Dropping unused function someUnUsedFunction1 [./index.js:8,0] - Dropping unused function someUnUsedFunction2 [./index.js:9,0] - Dropping unused function someUnUsedFunction3 [./index.js:10,0] - Dropping unused function someUnUsedFunction4 [./index.js:11,0] - Dropping unused function someUnUsedFunction5 [./index.js:12,0] - Dropping unused function someRemoteUnUsedFunction1 [./a.js:3,0] - Dropping unused function someRemoteUnUsedFunction2 [./a.js:4,0] - Dropping unused function someRemoteUnUsedFunction3 [./a.js:5,0] - Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] - Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] -Child - Hash: abbea59d067e262318ad - Time: Xms - Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - bundle.js 2.19 KiB 0 [emitted] main - Entrypoint main = bundle.js - - WARNING in bundle.js from UglifyJs - Dropping side-effect-free statement [./index.js:6,0] - Dropping unused function someUnUsedFunction1 [./index.js:8,0] - Dropping unused function someUnUsedFunction2 [./index.js:9,0] - Dropping unused function someUnUsedFunction3 [./index.js:10,0] - Dropping unused function someUnUsedFunction4 [./index.js:11,0] - Dropping unused function someUnUsedFunction5 [./index.js:12,0] - Dropping unused function someRemoteUnUsedFunction1 [./a.js:3,0] - Dropping unused function someRemoteUnUsedFunction2 [./a.js:4,0] - Dropping unused function someRemoteUnUsedFunction3 [./a.js:5,0] - Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] - Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] -Child - Hash: abbea59d067e262318ad - Time: Xms - Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - bundle.js 2.19 KiB 0 [emitted] main - Entrypoint main = bundle.js - - WARNING in bundle.js from UglifyJs - Dropping side-effect-free statement [./index.js:6,0] - Dropping unused function someUnUsedFunction1 [./index.js:8,0] - Dropping unused function someUnUsedFunction2 [./index.js:9,0] - Dropping unused function someUnUsedFunction3 [./index.js:10,0] - Dropping unused function someUnUsedFunction4 [./index.js:11,0] - Dropping unused function someUnUsedFunction5 [./index.js:12,0] - Dropping unused function someRemoteUnUsedFunction1 [./a.js:3,0] - Dropping unused function someRemoteUnUsedFunction2 [./a.js:4,0] - Dropping unused function someRemoteUnUsedFunction3 [./a.js:5,0] - Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] - Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] \ No newline at end of file diff --git a/test/statsCases/graph-correctness-entries/expected.txt b/test/statsCases/graph-correctness-entries/expected.txt deleted file mode 100644 index 2c8c3c13eb5..00000000000 --- a/test/statsCases/graph-correctness-entries/expected.txt +++ /dev/null @@ -1,19 +0,0 @@ -Entrypoint e1 = e1.js -Entrypoint e2 = e2.js -chunk {0} c.js (c) 49 bytes <{3}> <{4}> >{1}< [rendered] - [1] ./module-c.js 49 bytes {0} [built] - import() ./module-c [2] ./module-b.js 1:0-47 - import() ./module-c [4] ./e2.js 1:0-47 -chunk {1} a.js (a) 49 bytes <{0}> <{2}> >{4}< [rendered] - [0] ./module-a.js 49 bytes {1} [built] - import() ./module-a [1] ./module-c.js 1:0-47 - import() ./module-a [3] ./e1.js 1:0-47 -chunk {2} e1.js (e1) 49 bytes >{1}< [entry] [rendered] - [3] ./e1.js 49 bytes {2} [built] - single entry ./e1 e1 -chunk {3} e2.js (e2) 49 bytes >{0}< [entry] [rendered] - [4] ./e2.js 49 bytes {3} [built] - single entry ./e2 e2 -chunk {4} b.js (b) 49 bytes <{1}> >{0}< [rendered] - [2] ./module-b.js 49 bytes {4} [built] - import() ./module-b [0] ./module-a.js 1:0-47 \ No newline at end of file diff --git a/test/statsCases/graph-correctness-modules/expected.txt b/test/statsCases/graph-correctness-modules/expected.txt deleted file mode 100644 index d19a2d2bee9..00000000000 --- a/test/statsCases/graph-correctness-modules/expected.txt +++ /dev/null @@ -1,30 +0,0 @@ -Entrypoint e1 = e1.js -Entrypoint e2 = e2.js -chunk {0} y.js (y) 0 bytes <{3}> <{4}> [rendered] - [3] ./module-y.js 0 bytes {0} [built] - import() ./module-y [0] ./module-x.js 1:0-47 -chunk {1} c.js (c) 49 bytes <{4}> <{5}> >{2}< [rendered] - [2] ./module-c.js 49 bytes {1} [built] - import() ./module-c [4] ./module-b.js 1:0-47 - import() ./module-c [6] ./e2.js 2:0-47 -chunk {2} a.js (a) 49 bytes <{1}> <{3}> >{5}< [rendered] - [1] ./module-a.js 49 bytes {2} [built] - import() ./module-a [2] ./module-c.js 1:0-47 - import() ./module-a [5] ./e1.js 2:0-47 -chunk {3} e1.js (e1) 119 bytes >{0}< >{2}< [entry] [rendered] - [0] ./module-x.js 49 bytes {3} {4} [built] - import() ./module-x [4] ./module-b.js 2:0-20 - harmony side effect evaluation ./module-x [5] ./e1.js 1:0-20 - harmony side effect evaluation ./module-x [6] ./e2.js 1:0-20 - [5] ./e1.js 70 bytes {3} [built] - single entry ./e1 e1 -chunk {4} e2.js (e2) 119 bytes >{0}< >{1}< [entry] [rendered] - [0] ./module-x.js 49 bytes {3} {4} [built] - import() ./module-x [4] ./module-b.js 2:0-20 - harmony side effect evaluation ./module-x [5] ./e1.js 1:0-20 - harmony side effect evaluation ./module-x [6] ./e2.js 1:0-20 - [6] ./e2.js 70 bytes {4} [built] - single entry ./e2 e2 -chunk {5} b.js (b) 179 bytes <{2}> >{1}< [rendered] - [4] ./module-b.js 179 bytes {5} [built] - import() ./module-b [1] ./module-a.js 1:0-47 \ No newline at end of file diff --git a/test/statsCases/import-context-filter/expected.txt b/test/statsCases/import-context-filter/expected.txt deleted file mode 100644 index 9744cd09161..00000000000 --- a/test/statsCases/import-context-filter/expected.txt +++ /dev/null @@ -1,14 +0,0 @@ -Hash: 20afe8e9eb9a69aecddb -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - 0.js 305 bytes 0 [emitted] - 1.js 314 bytes 1 [emitted] - 2.js 308 bytes 2 [emitted] -entry.js 7.8 KiB 3 [emitted] entry -Entrypoint entry = entry.js -[0] ./templates/bar.js 38 bytes {0} [optional] [built] -[1] ./templates/baz.js 38 bytes {1} [optional] [built] -[2] ./templates/foo.js 38 bytes {2} [optional] [built] -[3] ./entry.js 450 bytes {3} [built] -[4] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object 160 bytes {3} [optional] [built] \ No newline at end of file diff --git a/test/statsCases/import-weak/expected.txt b/test/statsCases/import-weak/expected.txt deleted file mode 100644 index 59bf9df5931..00000000000 --- a/test/statsCases/import-weak/expected.txt +++ /dev/null @@ -1,10 +0,0 @@ -Hash: 1f9db3ad053a3687e3bb -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - 0.js 149 bytes 0 [emitted] -entry.js 7.79 KiB 1 [emitted] entry -Entrypoint entry = entry.js -[0] ./modules/b.js 22 bytes {0} [built] -[1] ./entry.js 120 bytes {1} [built] -[2] ./modules/a.js 37 bytes [built] \ No newline at end of file diff --git a/test/statsCases/import-with-invalid-options-comments/chunk-a.js b/test/statsCases/import-with-invalid-options-comments/chunk-a.js new file mode 100644 index 00000000000..760a62d9dfe --- /dev/null +++ b/test/statsCases/import-with-invalid-options-comments/chunk-a.js @@ -0,0 +1 @@ +module.exports = "chunk-a"; \ No newline at end of file diff --git a/test/statsCases/import-with-invalid-options-comments/chunk-b.js b/test/statsCases/import-with-invalid-options-comments/chunk-b.js new file mode 100644 index 00000000000..71dcca37235 --- /dev/null +++ b/test/statsCases/import-with-invalid-options-comments/chunk-b.js @@ -0,0 +1 @@ +module.exports = "chunk-b"; \ No newline at end of file diff --git a/test/statsCases/import-with-invalid-options-comments/chunk-c.js b/test/statsCases/import-with-invalid-options-comments/chunk-c.js new file mode 100644 index 00000000000..9daca1be5c9 --- /dev/null +++ b/test/statsCases/import-with-invalid-options-comments/chunk-c.js @@ -0,0 +1 @@ +module.exports = "chunk-c"; \ No newline at end of file diff --git a/test/statsCases/import-with-invalid-options-comments/chunk-d.js b/test/statsCases/import-with-invalid-options-comments/chunk-d.js new file mode 100644 index 00000000000..5578e7b39d9 --- /dev/null +++ b/test/statsCases/import-with-invalid-options-comments/chunk-d.js @@ -0,0 +1 @@ +module.exports = "chunk-d"; \ No newline at end of file diff --git a/test/statsCases/import-with-invalid-options-comments/chunk.js b/test/statsCases/import-with-invalid-options-comments/chunk.js new file mode 100644 index 00000000000..a30499bdecb --- /dev/null +++ b/test/statsCases/import-with-invalid-options-comments/chunk.js @@ -0,0 +1,6 @@ +export default function() { + import(/* webpackPrefetch: true, webpackChunkName: notGoingToCompileChunkName */ "./chunk-a"); + import(/* webpackPrefetch: 0, webpackChunkName: "goingToCompileChunkName-b" */ "./chunk-b"); + import(/* webpack Prefetch: 0, webpackChunkName: "notGoingToCompile-c" */ "./chunk-c"); + import(/* webpackPrefetch: nope */ /* webpackChunkName: "yep" */ "./chunk-d"); +} diff --git a/test/statsCases/import-with-invalid-options-comments/index.js b/test/statsCases/import-with-invalid-options-comments/index.js new file mode 100644 index 00000000000..e7010941b37 --- /dev/null +++ b/test/statsCases/import-with-invalid-options-comments/index.js @@ -0,0 +1 @@ +import(/* webpackChunkName: "chunk" */ "./chunk"); \ No newline at end of file diff --git a/test/statsCases/import-with-invalid-options-comments/webpack.config.js b/test/statsCases/import-with-invalid-options-comments/webpack.config.js new file mode 100644 index 00000000000..7e5b36607b2 --- /dev/null +++ b/test/statsCases/import-with-invalid-options-comments/webpack.config.js @@ -0,0 +1,15 @@ +module.exports = { + mode: "production", + entry: "./index", + output: { + chunkFilename: "[name].js" + }, + stats: { + timings: false, + hash: false, + entrypoints: false, + assets: false, + errorDetails: true, + moduleTrace: true + } +}; diff --git a/test/statsCases/limit-chunk-count-plugin/expected.txt b/test/statsCases/limit-chunk-count-plugin/expected.txt deleted file mode 100644 index f6cd14a330a..00000000000 --- a/test/statsCases/limit-chunk-count-plugin/expected.txt +++ /dev/null @@ -1,69 +0,0 @@ -Hash: 599eb45be3863921e183f90c7b21ae5c6e853a0df3a313c9918d7d712c3f113bf580db9e5c6196ce -Child 1 chunks: - Hash: 599eb45be3863921e183 - Time: Xms - Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - bundle.js 5.68 KiB 0 [emitted] main - Entrypoint main = bundle.js - chunk {0} bundle.js (main) 191 bytes <{0}> >{0}< [entry] [rendered] - [0] ./index.js 73 bytes {0} [built] - [1] ./a.js 22 bytes {0} [built] - [2] ./b.js 22 bytes {0} [built] - [3] ./c.js 30 bytes {0} [built] - [4] ./d.js 22 bytes {0} [built] - [5] ./e.js 22 bytes {0} [built] -Child 2 chunks: - Hash: f90c7b21ae5c6e853a0d - Time: Xms - Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - 0.bundle.js 1 KiB 0 [emitted] - bundle.js 7.19 KiB 1 [emitted] main - Entrypoint main = bundle.js - chunk {0} 0.bundle.js 118 bytes <{0}> <{1}> >{0}< [rendered] - [0] ./d.js 22 bytes {0} [built] - [1] ./e.js 22 bytes {0} [built] - [2] ./a.js 22 bytes {0} [built] - [3] ./b.js 22 bytes {0} [built] - [4] ./c.js 30 bytes {0} [built] - chunk {1} bundle.js (main) 73 bytes >{0}< [entry] [rendered] - [5] ./index.js 73 bytes {1} [built] -Child 3 chunks: - Hash: f3a313c9918d7d712c3f - Time: Xms - Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - 0.bundle.js 886 bytes 0 [emitted] - 1.bundle.js 245 bytes 1 [emitted] - bundle.js 7.19 KiB 2 [emitted] main - Entrypoint main = bundle.js - chunk {0} 0.bundle.js 74 bytes <{0}> <{2}> >{0}< >{1}< [rendered] - [0] ./d.js 22 bytes {0} [built] - [2] ./a.js 22 bytes {0} [built] - [4] ./c.js 30 bytes {0} [built] - chunk {1} 1.bundle.js 44 bytes <{0}> <{2}> [rendered] - [1] ./e.js 22 bytes {1} [built] - [3] ./b.js 22 bytes {1} [built] - chunk {2} bundle.js (main) 73 bytes >{0}< >{1}< [entry] [rendered] - [5] ./index.js 73 bytes {2} [built] -Child 4 chunks: - Hash: 113bf580db9e5c6196ce - Time: Xms - Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - 0.bundle.js 236 bytes 0 [emitted] - 1.bundle.js 245 bytes 1 [emitted] - 2.bundle.js 715 bytes 2 [emitted] - bundle.js 7.19 KiB 3 [emitted] main - Entrypoint main = bundle.js - chunk {0} 0.bundle.js 44 bytes <{2}> <{3}> [rendered] - [0] ./d.js 22 bytes {0} [built] - [2] ./a.js 22 bytes {0} [built] - chunk {1} 1.bundle.js 44 bytes <{2}> <{3}> [rendered] - [1] ./e.js 22 bytes {1} [built] - [3] ./b.js 22 bytes {1} [built] - chunk {2} 2.bundle.js 30 bytes <{3}> >{0}< >{1}< [rendered] - [4] ./c.js 30 bytes {2} [built] - chunk {3} bundle.js (main) 73 bytes >{0}< >{1}< >{2}< [entry] [rendered] - [5] ./index.js 73 bytes {3} [built] \ No newline at end of file diff --git a/test/statsCases/max-modules-default/expected.txt b/test/statsCases/max-modules-default/expected.txt deleted file mode 100644 index f8915ebb38a..00000000000 --- a/test/statsCases/max-modules-default/expected.txt +++ /dev/null @@ -1,22 +0,0 @@ -Hash: c5cf5ab0cc0a404f1acf -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names -main.js 5.85 KiB 0 [emitted] main -Entrypoint main = main.js - [0] ./a.js?1 33 bytes {0} [built] - [1] ./a.js?2 33 bytes {0} [built] - [2] ./a.js?3 33 bytes {0} [built] - [3] ./a.js?4 33 bytes {0} [built] - [4] ./a.js?5 33 bytes {0} [built] - [5] ./a.js?6 33 bytes {0} [built] - [6] ./a.js?7 33 bytes {0} [built] - [7] ./a.js?8 33 bytes {0} [built] - [8] ./a.js?9 33 bytes {0} [built] - [9] ./a.js?10 33 bytes {0} [built] -[10] ./index.js 181 bytes {0} [built] -[11] ./c.js?1 33 bytes {0} [built] -[13] ./c.js?2 33 bytes {0} [built] -[27] ./c.js?9 33 bytes {0} [built] -[29] ./c.js?10 33 bytes {0} [built] - + 16 hidden modules \ No newline at end of file diff --git a/test/statsCases/max-modules/expected.txt b/test/statsCases/max-modules/expected.txt deleted file mode 100644 index 653fca302a5..00000000000 --- a/test/statsCases/max-modules/expected.txt +++ /dev/null @@ -1,27 +0,0 @@ -Hash: c5cf5ab0cc0a404f1acf -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names -main.js 5.85 KiB 0 [emitted] main -Entrypoint main = main.js - [0] ./a.js?1 33 bytes {0} [built] - [1] ./a.js?2 33 bytes {0} [built] - [2] ./a.js?3 33 bytes {0} [built] - [3] ./a.js?4 33 bytes {0} [built] - [4] ./a.js?5 33 bytes {0} [built] - [5] ./a.js?6 33 bytes {0} [built] - [6] ./a.js?7 33 bytes {0} [built] - [7] ./a.js?8 33 bytes {0} [built] - [8] ./a.js?9 33 bytes {0} [built] - [9] ./a.js?10 33 bytes {0} [built] -[10] ./index.js 181 bytes {0} [built] -[11] ./c.js?1 33 bytes {0} [built] -[13] ./c.js?2 33 bytes {0} [built] -[15] ./c.js?3 33 bytes {0} [built] -[17] ./c.js?4 33 bytes {0} [built] -[19] ./c.js?5 33 bytes {0} [built] -[23] ./c.js?7 33 bytes {0} [built] -[25] ./c.js?8 33 bytes {0} [built] -[27] ./c.js?9 33 bytes {0} [built] -[29] ./c.js?10 33 bytes {0} [built] - + 11 hidden modules \ No newline at end of file diff --git a/test/statsCases/module-assets/expected.txt b/test/statsCases/module-assets/expected.txt deleted file mode 100644 index bb8da025ec4..00000000000 --- a/test/statsCases/module-assets/expected.txt +++ /dev/null @@ -1,12 +0,0 @@ -Hash: d71bd16b0b20f34e994a -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT -Entrypoint main = main.js -chunk {0} 0.js 68 bytes <{1}> [rendered] - [0] ./node_modules/a/1.png 51 bytes {0} [built] [1 asset] - [1] ./node_modules/a/index.js 17 bytes {0} [built] -chunk {1} main.js (main) 12 bytes >{0}< [entry] [rendered] - [2] ./index.js 12 bytes {1} [built] -[0] ./node_modules/a/1.png 51 bytes {0} [built] [1 asset] -[1] ./node_modules/a/index.js 17 bytes {0} [built] -[2] ./index.js 12 bytes {1} [built] \ No newline at end of file diff --git a/test/statsCases/module-deduplication-named/expected.txt b/test/statsCases/module-deduplication-named/expected.txt deleted file mode 100644 index 670bcf76efd..00000000000 --- a/test/statsCases/module-deduplication-named/expected.txt +++ /dev/null @@ -1,37 +0,0 @@ - Asset Size Chunks Chunk Names -async3.js 818 bytes 0 [emitted] async3 -async1.js 818 bytes 1 [emitted] async1 -async2.js 818 bytes 2 [emitted] async2 - e1.js 8.02 KiB 3 [emitted] e1 - e2.js 8.05 KiB 4 [emitted] e2 - e3.js 8.07 KiB 5 [emitted] e3 -Entrypoint e1 = e1.js -Entrypoint e2 = e2.js -Entrypoint e3 = e3.js -chunk {0} async3.js (async3) 89 bytes <{2}> <{5}> >{1}< [rendered] - [4] ./h.js 9 bytes {0} {5} [built] - [7] ./async3.js 80 bytes {0} [built] -chunk {1} async1.js (async1) 89 bytes <{0}> <{3}> >{2}< [rendered] - [2] ./d.js 9 bytes {1} {3} [built] - [5] ./async1.js 80 bytes {1} [built] -chunk {2} async2.js (async2) 89 bytes <{1}> <{4}> >{0}< [rendered] - [3] ./f.js 9 bytes {2} {4} [built] - [6] ./async2.js 80 bytes {2} [built] -chunk {3} e1.js (e1) 144 bytes >{1}< [entry] [rendered] - [0] ./b.js 9 bytes {3} {4} {5} [built] - [1] ./a.js 9 bytes {3} {4} {5} [built] - [2] ./d.js 9 bytes {1} {3} [built] - [8] ./e1.js 108 bytes {3} [built] - [9] ./c.js 9 bytes {3} [built] -chunk {4} e2.js (e2) 144 bytes >{2}< [entry] [rendered] - [0] ./b.js 9 bytes {3} {4} {5} [built] - [1] ./a.js 9 bytes {3} {4} {5} [built] - [3] ./f.js 9 bytes {2} {4} [built] - [10] ./e2.js 108 bytes {4} [built] - [11] ./e.js 9 bytes {4} [built] -chunk {5} e3.js (e3) 144 bytes >{0}< [entry] [rendered] - [0] ./b.js 9 bytes {3} {4} {5} [built] - [1] ./a.js 9 bytes {3} {4} {5} [built] - [4] ./h.js 9 bytes {0} {5} [built] - [12] ./e3.js 108 bytes {5} [built] - [13] ./g.js 9 bytes {5} [built] \ No newline at end of file diff --git a/test/statsCases/module-deduplication/expected.txt b/test/statsCases/module-deduplication/expected.txt deleted file mode 100644 index fe5cd0993c8..00000000000 --- a/test/statsCases/module-deduplication/expected.txt +++ /dev/null @@ -1,46 +0,0 @@ -Asset Size Chunks Chunk Names - 0.js 730 bytes 0, 5 [emitted] - 1.js 730 bytes 1, 4 [emitted] - 2.js 730 bytes 2, 3 [emitted] - 3.js 661 bytes 3 [emitted] - 4.js 661 bytes 4 [emitted] - 5.js 661 bytes 5 [emitted] -e1.js 8.14 KiB 6 [emitted] e1 -e2.js 8.16 KiB 7 [emitted] e2 -e3.js 8.18 KiB 8 [emitted] e3 -Entrypoint e1 = e1.js -Entrypoint e2 = e2.js -Entrypoint e3 = e3.js -chunk {0} 0.js 37 bytes <{7}> <{8}> [rendered] - [2] ./d.js 9 bytes {0} {6} [built] - [5] ./async1.js 28 bytes {0} {5} [built] -chunk {1} 1.js 37 bytes <{6}> <{8}> [rendered] - [3] ./f.js 9 bytes {1} {7} [built] - [6] ./async2.js 28 bytes {1} {4} [built] -chunk {2} 2.js 37 bytes <{6}> <{7}> [rendered] - [4] ./h.js 9 bytes {2} {8} [built] - [7] ./async3.js 28 bytes {2} {3} [built] -chunk {3} 3.js 28 bytes <{8}> [rendered] - [7] ./async3.js 28 bytes {2} {3} [built] -chunk {4} 4.js 28 bytes <{7}> [rendered] - [6] ./async2.js 28 bytes {1} {4} [built] -chunk {5} 5.js 28 bytes <{6}> [rendered] - [5] ./async1.js 28 bytes {0} {5} [built] -chunk {6} e1.js (e1) 152 bytes >{1}< >{2}< >{5}< [entry] [rendered] - [0] ./b.js 9 bytes {6} {7} {8} [built] - [1] ./a.js 9 bytes {6} {7} {8} [built] - [2] ./d.js 9 bytes {0} {6} [built] - [8] ./e1.js 116 bytes {6} [built] - [9] ./c.js 9 bytes {6} [built] -chunk {7} e2.js (e2) 152 bytes >{0}< >{2}< >{4}< [entry] [rendered] - [0] ./b.js 9 bytes {6} {7} {8} [built] - [1] ./a.js 9 bytes {6} {7} {8} [built] - [3] ./f.js 9 bytes {1} {7} [built] - [10] ./e2.js 116 bytes {7} [built] - [11] ./e.js 9 bytes {7} [built] -chunk {8} e3.js (e3) 152 bytes >{0}< >{1}< >{3}< [entry] [rendered] - [0] ./b.js 9 bytes {6} {7} {8} [built] - [1] ./a.js 9 bytes {6} {7} {8} [built] - [4] ./h.js 9 bytes {2} {8} [built] - [12] ./e3.js 116 bytes {8} [built] - [13] ./g.js 9 bytes {8} [built] \ No newline at end of file diff --git a/test/statsCases/module-trace-disabled-in-error/expected.txt b/test/statsCases/module-trace-disabled-in-error/expected.txt deleted file mode 100644 index 4331cd1693c..00000000000 --- a/test/statsCases/module-trace-disabled-in-error/expected.txt +++ /dev/null @@ -1,9 +0,0 @@ -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names -main.js 2.79 KiB 0 main -Entrypoint main = main.js -[0] ./index.js 25 bytes {0} [built] - -ERROR in ./index.js -Module not found: Error: Can't resolve 'does-not-exist' in 'Xdir/module-trace-disabled-in-error' \ No newline at end of file diff --git a/test/statsCases/module-trace-enabled-in-error/expected.txt b/test/statsCases/module-trace-enabled-in-error/expected.txt deleted file mode 100644 index 8b4bf513455..00000000000 --- a/test/statsCases/module-trace-enabled-in-error/expected.txt +++ /dev/null @@ -1,10 +0,0 @@ -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names -main.js 2.79 KiB 0 main -Entrypoint main = main.js -[0] ./index.js 25 bytes {0} [built] - -ERROR in ./index.js -Module not found: Error: Can't resolve 'does-not-exist' in 'Xdir/module-trace-enabled-in-error' - @ ./index.js 1:0-25 \ No newline at end of file diff --git a/test/statsCases/named-chunk-groups/a.js b/test/statsCases/named-chunk-groups/a.js new file mode 100644 index 00000000000..6999047542f --- /dev/null +++ b/test/statsCases/named-chunk-groups/a.js @@ -0,0 +1,3 @@ +import "./shared"; + +export default "a"; diff --git a/test/statsCases/named-chunk-groups/b.js b/test/statsCases/named-chunk-groups/b.js new file mode 100644 index 00000000000..a47f90b65ff --- /dev/null +++ b/test/statsCases/named-chunk-groups/b.js @@ -0,0 +1,3 @@ +import "./shared"; + +export default "b"; diff --git a/test/statsCases/named-chunk-groups/c.js b/test/statsCases/named-chunk-groups/c.js new file mode 100644 index 00000000000..00c4083b286 --- /dev/null +++ b/test/statsCases/named-chunk-groups/c.js @@ -0,0 +1,4 @@ +import "x"; +import "y"; + +export default "c"; diff --git a/test/statsCases/named-chunk-groups/index.js b/test/statsCases/named-chunk-groups/index.js new file mode 100644 index 00000000000..e700f4783c6 --- /dev/null +++ b/test/statsCases/named-chunk-groups/index.js @@ -0,0 +1,3 @@ +import(/* webpackChunkName: "async-a" */ "./a"); +import(/* webpackChunkName: "async-b" */ "./b"); +import(/* webpackChunkName: "async-c" */ "./c"); \ No newline at end of file diff --git a/test/statsCases/named-chunk-groups/node_modules/x.js b/test/statsCases/named-chunk-groups/node_modules/x.js new file mode 100644 index 00000000000..3fd5ecc7a40 --- /dev/null +++ b/test/statsCases/named-chunk-groups/node_modules/x.js @@ -0,0 +1 @@ +export default "x"; diff --git a/test/statsCases/named-chunk-groups/node_modules/y.js b/test/statsCases/named-chunk-groups/node_modules/y.js new file mode 100644 index 00000000000..413e7c09da6 --- /dev/null +++ b/test/statsCases/named-chunk-groups/node_modules/y.js @@ -0,0 +1 @@ +export default "y"; diff --git a/test/statsCases/named-chunk-groups/shared.js b/test/statsCases/named-chunk-groups/shared.js new file mode 100644 index 00000000000..f53cf742a26 --- /dev/null +++ b/test/statsCases/named-chunk-groups/shared.js @@ -0,0 +1,2 @@ +// content content content content content content content content +// content content content content content content content content \ No newline at end of file diff --git a/test/statsCases/named-chunk-groups/webpack.config.js b/test/statsCases/named-chunk-groups/webpack.config.js new file mode 100644 index 00000000000..617a63e18dd --- /dev/null +++ b/test/statsCases/named-chunk-groups/webpack.config.js @@ -0,0 +1,47 @@ +const stats = { + hash: false, + timings: false, + builtAt: false, + assets: false, + chunks: true, + chunkOrigins: true, + modules: false +}; + +const config = { + mode: "production", + entry: { + main: "./" + }, + output: { + filename: "[name].js" + }, + optimization: { + splitChunks: { + minSize: 100, + cacheGroups: { + vendors: { + test: /[\\/]node_modules[\\/]/, + chunks: "async", + enforce: true, + name: "vendors" + } + } + } + } +}; + +module.exports = [ + Object.assign( + { + stats: Object.assign({ entrypoints: false, chunkGroups: true }, stats) + }, + config + ), + Object.assign( + { + stats: Object.assign({ entrypoints: true, chunkGroups: true }, stats) + }, + config + ) +]; diff --git a/test/statsCases/named-chunks-plugin-async/expected.txt b/test/statsCases/named-chunks-plugin-async/expected.txt deleted file mode 100644 index 23359057fcf..00000000000 --- a/test/statsCases/named-chunks-plugin-async/expected.txt +++ /dev/null @@ -1,11 +0,0 @@ -Hash: c5b0089a4015e8744f8e -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names -chunk-containing-__a_js.js 509 bytes chunk-containing-__a_js [emitted] -chunk-containing-__b_js.js 173 bytes chunk-containing-__b_js [emitted] - entry.js 7.28 KiB entry [emitted] entry -Entrypoint entry = entry.js -[0] ./modules/b.js 22 bytes {chunk-containing-__b_js} [built] -[1] ./modules/a.js 37 bytes {chunk-containing-__a_js} [built] -[2] ./entry.js 47 bytes {entry} [built] \ No newline at end of file diff --git a/test/statsCases/named-chunks-plugin/expected.txt b/test/statsCases/named-chunks-plugin/expected.txt deleted file mode 100644 index c5cf2bee3b9..00000000000 --- a/test/statsCases/named-chunks-plugin/expected.txt +++ /dev/null @@ -1,11 +0,0 @@ -Hash: 5df55d54223f36cc303b -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - entry.js 5.34 KiB entry [emitted] entry -vendor.js 269 bytes vendor [emitted] vendor -Entrypoint entry = vendor.js entry.js -[./entry.js] 72 bytes {entry} [built] -[./modules/a.js] 22 bytes {vendor} [built] -[./modules/b.js] 22 bytes {vendor} [built] -[./modules/c.js] 22 bytes {entry} [built] \ No newline at end of file diff --git a/test/statsCases/no-emit-on-errors-plugin-with-child-error/expected.txt b/test/statsCases/no-emit-on-errors-plugin-with-child-error/expected.txt deleted file mode 100644 index 72101dbc37c..00000000000 --- a/test/statsCases/no-emit-on-errors-plugin-with-child-error/expected.txt +++ /dev/null @@ -1,19 +0,0 @@ -Hash: 550499db0a071b393308 -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - child.js 2.61 KiB -bundle.js 2.61 KiB 0 main -Entrypoint main = bundle.js -[0] ./index.js 0 bytes {0} [built] - -WARNING in configuration -The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment. -You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/concepts/mode/ -Child child: - Asset Size Chunks Chunk Names - child.js 2.61 KiB 0 child - Entrypoint child = child.js - [0] ./index.js 0 bytes {0} [built] - - ERROR in forced error \ No newline at end of file diff --git a/test/statsCases/optimize-chunks/expected.txt b/test/statsCases/optimize-chunks/expected.txt deleted file mode 100644 index c75ed93a633..00000000000 --- a/test/statsCases/optimize-chunks/expected.txt +++ /dev/null @@ -1,47 +0,0 @@ -Hash: c4c4476c6d07e1bf7404 -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - cir1.js 299 bytes 0 [emitted] cir1 - ab.js 183 bytes 1 [emitted] ab - abd.js 277 bytes 2, 1 [emitted] abd - cir2.js 299 bytes 3 [emitted] cir2 - main.js 7.8 KiB 4 [emitted] main -cir2 from cir1.js 359 bytes 5, 3 [emitted] cir2 from cir1 - chunk.js 190 bytes 6, 7 [emitted] chunk - ac in ab.js 130 bytes 7 [emitted] ac in ab -Entrypoint main = main.js -chunk {0} cir1.js (cir1) 81 bytes <{3}> <{4}> <{5}> >{5}< [rendered] - > [3] ./circular2.js 1:0-79 - > [3] ./circular2.js 1:0-79 - > [8] ./index.js 13:0-54 - [2] ./circular1.js 81 bytes {0} [built] -chunk {1} ab.js (ab) 0 bytes <{4}> >{7}< [rendered] - > [8] ./index.js 1:0-6:8 - [0] ./modules/a.js 0 bytes {1} {2} [built] - [1] ./modules/b.js 0 bytes {1} {2} [built] -chunk {2} abd.js (abd) 0 bytes <{4}> >{6}< [rendered] - > [8] ./index.js 8:0-11:9 - [0] ./modules/a.js 0 bytes {1} {2} [built] - [1] ./modules/b.js 0 bytes {1} {2} [built] - [6] ./modules/d.js 0 bytes {2} {6} [built] -chunk {3} cir2.js (cir2) 81 bytes <{4}> >{0}< [rendered] - > [8] ./index.js 14:0-54 - [3] ./circular2.js 81 bytes {3} {5} [built] -chunk {4} main.js (main) 523 bytes >{0}< >{1}< >{2}< >{3}< [entry] [rendered] - > ./index main - [4] ./modules/f.js 0 bytes {4} [built] - [8] ./index.js 523 bytes {4} [built] -chunk {5} cir2 from cir1.js (cir2 from cir1) 81 bytes <{0}> >{0}< [rendered] - > [2] ./circular1.js 1:0-79 - > [2] ./circular1.js 1:0-79 - [3] ./circular2.js 81 bytes {3} {5} [built] - [7] ./modules/e.js 0 bytes {5} [built] -chunk {6} chunk.js (chunk) 0 bytes <{2}> <{7}> [rendered] - > [8] ./index.js 3:2-4:13 - > [8] ./index.js 9:1-10:12 - [5] ./modules/c.js 0 bytes {6} {7} [built] - [6] ./modules/d.js 0 bytes {2} {6} [built] -chunk {7} ac in ab.js (ac in ab) 0 bytes <{1}> >{6}< [rendered] - > [8] ./index.js 2:1-5:15 - [5] ./modules/c.js 0 bytes {6} {7} [built] \ No newline at end of file diff --git a/test/statsCases/parse-error/expected.txt b/test/statsCases/parse-error/expected.txt deleted file mode 100644 index fb2938a353c..00000000000 --- a/test/statsCases/parse-error/expected.txt +++ /dev/null @@ -1,18 +0,0 @@ - Asset Size Chunks Chunk Names -main.js 3.05 KiB 0 main -Entrypoint main = main.js -[0] ./b.js 169 bytes {0} [built] [failed] [1 error] -[1] ./index.js + 1 modules 35 bytes {0} [built] - | ./index.js 15 bytes [built] - | ./a.js 15 bytes [built] - -ERROR in ./b.js -Module parse failed: Unexpected token (6:7) -You may need an appropriate loader to handle this file type. -| includes -| a -| parser ) -| error -| in - @ ./a.js 2:0-13 - @ ./index.js \ No newline at end of file diff --git a/test/statsCases/performance-different-mode-and-target/expected.txt b/test/statsCases/performance-different-mode-and-target/expected.txt deleted file mode 100644 index 56a60aab9b1..00000000000 --- a/test/statsCases/performance-different-mode-and-target/expected.txt +++ /dev/null @@ -1,102 +0,0 @@ -Hash: df3a0090d24670ebd17d7094466a296a7ae4ae823f59070ac8deb95011d223ef01d5f7db6f7b0912f47482563c8b6b9dc4955fdf2e3a0c7c308a998f9bab5b59aa119495c443 -Child - Hash: df3a0090d24670ebd17d - Time: Xms - Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - warning.pro-web.js 296 KiB 0 [emitted] [big] main - Entrypoint main [big] = warning.pro-web.js - [0] ./index.js 293 KiB {0} [built] - - WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB). - This can impact web performance. - Assets: - warning.pro-web.js (296 KiB) - - WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance. - Entrypoints: - main (296 KiB) - warning.pro-web.js - - - WARNING in webpack performance recommendations: - You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application. - For more info visit https://webpack.js.org/guides/code-splitting/ -Child - Hash: 7094466a296a7ae4ae82 - Time: Xms - Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - warning.pro-webworker.js 296 KiB 0 [emitted] [big] main - Entrypoint main [big] = warning.pro-webworker.js - [0] ./index.js 293 KiB {0} [built] - - WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB). - This can impact web performance. - Assets: - warning.pro-webworker.js (296 KiB) - - WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance. - Entrypoints: - main (296 KiB) - warning.pro-webworker.js - - - WARNING in webpack performance recommendations: - You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application. - For more info visit https://webpack.js.org/guides/code-splitting/ -Child - Hash: 3f59070ac8deb95011d2 - Time: Xms - Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - no-warning.pro-node.js 296 KiB 0 [emitted] main - Entrypoint main = no-warning.pro-node.js - [0] ./index.js 293 KiB {0} [built] -Child - Hash: 23ef01d5f7db6f7b0912 - Time: Xms - Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - no-warning.dev-web.js 1.72 MiB main [emitted] main - Entrypoint main = no-warning.dev-web.js - [./index.js] 293 KiB {main} [built] -Child - Hash: f47482563c8b6b9dc495 - Time: Xms - Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - no-warning.dev-node.js 1.72 MiB main [emitted] main - Entrypoint main = no-warning.dev-node.js - [./index.js] 293 KiB {main} [built] -Child - Hash: 5fdf2e3a0c7c308a998f - Time: Xms - Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - no-warning.dev-web-with-limit-set.js 1.72 MiB main [emitted] [big] main - Entrypoint main [big] = no-warning.dev-web-with-limit-set.js - [./index.js] 293 KiB {main} [built] -Child - Hash: 9bab5b59aa119495c443 - Time: Xms - Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - warning.pro-node-with-hints-set.js 296 KiB 0 [emitted] [big] main - Entrypoint main [big] = warning.pro-node-with-hints-set.js - [0] ./index.js 293 KiB {0} [built] - - WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB). - This can impact web performance. - Assets: - warning.pro-node-with-hints-set.js (296 KiB) - - WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance. - Entrypoints: - main (296 KiB) - warning.pro-node-with-hints-set.js - - - WARNING in webpack performance recommendations: - You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application. - For more info visit https://webpack.js.org/guides/code-splitting/ \ No newline at end of file diff --git a/test/statsCases/performance-disabled/expected.txt b/test/statsCases/performance-disabled/expected.txt deleted file mode 100644 index 8747d941a7c..00000000000 --- a/test/statsCases/performance-disabled/expected.txt +++ /dev/null @@ -1,14 +0,0 @@ -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - 0.js 152 bytes 0 [emitted] - 1.js 289 bytes 1 [emitted] -main.js 300 KiB 2 [emitted] main - 3.js 227 bytes 3 [emitted] -Entrypoint main = main.js -[0] ./d.js 22 bytes {3} [built] -[1] ./e.js 22 bytes {3} [built] -[2] ./b.js 22 bytes {0} [built] -[3] ./c.js 54 bytes {1} [built] -[4] ./index.js 52 bytes {2} [built] -[5] ./a.js 293 KiB {2} [built] \ No newline at end of file diff --git a/test/statsCases/performance-error/expected.txt b/test/statsCases/performance-error/expected.txt deleted file mode 100644 index bb67d765681..00000000000 --- a/test/statsCases/performance-error/expected.txt +++ /dev/null @@ -1,25 +0,0 @@ -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - 0.js 152 bytes 0 [emitted] - 1.js 289 bytes 1 [emitted] -main.js 300 KiB 2 [emitted] [big] main - 3.js 227 bytes 3 [emitted] -Entrypoint main [big] = main.js -[0] ./d.js 22 bytes {3} [built] -[1] ./e.js 22 bytes {3} [built] -[2] ./b.js 22 bytes {0} [built] -[3] ./c.js 54 bytes {1} [built] -[4] ./index.js 52 bytes {2} [built] -[5] ./a.js 293 KiB {2} [built] - -ERROR in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB). -This can impact web performance. -Assets: - main.js (300 KiB) - -ERROR in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance. -Entrypoints: - main (300 KiB) - main.js - \ No newline at end of file diff --git a/test/statsCases/performance-no-async-chunks-shown/expected.txt b/test/statsCases/performance-no-async-chunks-shown/expected.txt deleted file mode 100644 index d3e498d8a5c..00000000000 --- a/test/statsCases/performance-no-async-chunks-shown/expected.txt +++ /dev/null @@ -1,28 +0,0 @@ -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names -main.js 296 KiB 0 [emitted] [big] main - sec.js 2.95 KiB 1 [emitted] sec -Entrypoint main [big] = main.js -Entrypoint sec = sec.js -[0] ./b.js 22 bytes {0} {1} [built] -[1] ./index.js 32 bytes {0} [built] -[2] ./a.js 293 KiB {0} [built] -[3] ./index2.js 48 bytes {1} [built] -[4] ./c.js 22 bytes {1} [built] -[5] ./d.js 22 bytes {1} [built] - -WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB). -This can impact web performance. -Assets: - main.js (296 KiB) - -WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance. -Entrypoints: - main (296 KiB) - main.js - - -WARNING in webpack performance recommendations: -You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application. -For more info visit https://webpack.js.org/guides/code-splitting/ \ No newline at end of file diff --git a/test/statsCases/performance-no-hints/expected.txt b/test/statsCases/performance-no-hints/expected.txt deleted file mode 100644 index 1181b98c510..00000000000 --- a/test/statsCases/performance-no-hints/expected.txt +++ /dev/null @@ -1,14 +0,0 @@ -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - 0.js 152 bytes 0 [emitted] - 1.js 289 bytes 1 [emitted] -main.js 300 KiB 2 [emitted] [big] main - 3.js 227 bytes 3 [emitted] -Entrypoint main [big] = main.js -[0] ./d.js 22 bytes {3} [built] -[1] ./e.js 22 bytes {3} [built] -[2] ./b.js 22 bytes {0} [built] -[3] ./c.js 54 bytes {1} [built] -[4] ./index.js 52 bytes {2} [built] -[5] ./a.js 293 KiB {2} [built] \ No newline at end of file diff --git a/test/statsCases/performance-oversize-limit-error/expected.txt b/test/statsCases/performance-oversize-limit-error/expected.txt deleted file mode 100644 index 288a58cd7a1..00000000000 --- a/test/statsCases/performance-oversize-limit-error/expected.txt +++ /dev/null @@ -1,28 +0,0 @@ -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names -main.js 296 KiB 0 [emitted] [big] main - sec.js 296 KiB 1 [emitted] [big] sec -Entrypoint main [big] = main.js -Entrypoint sec [big] = sec.js -[0] ./a.js 293 KiB {0} {1} [built] -[1] ./index.js 16 bytes {0} [built] -[2] ./index2.js 16 bytes {1} [built] - -ERROR in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB). -This can impact web performance. -Assets: - main.js (296 KiB) - sec.js (296 KiB) - -ERROR in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance. -Entrypoints: - main (296 KiB) - main.js - sec (296 KiB) - sec.js - - -ERROR in webpack performance recommendations: -You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application. -For more info visit https://webpack.js.org/guides/code-splitting/ \ No newline at end of file diff --git a/test/statsCases/prefetch-preload-mixed/a.js b/test/statsCases/prefetch-preload-mixed/a.js new file mode 100644 index 00000000000..55e534918f0 --- /dev/null +++ b/test/statsCases/prefetch-preload-mixed/a.js @@ -0,0 +1,2 @@ +import(/* webpackPrefetch: true, webpackChunkName: "a1" */ "./a1"); +import(/* webpackPrefetch: true, webpackChunkName: "a2" */ "./a2"); diff --git a/test/statsCases/prefetch-preload-mixed/a1.js b/test/statsCases/prefetch-preload-mixed/a1.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/statsCases/prefetch-preload-mixed/a2.js b/test/statsCases/prefetch-preload-mixed/a2.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/statsCases/prefetch-preload-mixed/b.js b/test/statsCases/prefetch-preload-mixed/b.js new file mode 100644 index 00000000000..756debf2d02 --- /dev/null +++ b/test/statsCases/prefetch-preload-mixed/b.js @@ -0,0 +1,3 @@ +import(/* webpackPrefetch: true, webpackChunkName: "b1" */ "./b1"); +import(/* webpackPreload: true, webpackChunkName: "b2" */ "./b2"); +import(/* webpackPrefetch: true, webpackChunkName: "b3" */ "./b3"); diff --git a/test/statsCases/prefetch-preload-mixed/b1.js b/test/statsCases/prefetch-preload-mixed/b1.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/statsCases/prefetch-preload-mixed/b2.js b/test/statsCases/prefetch-preload-mixed/b2.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/statsCases/prefetch-preload-mixed/b3.js b/test/statsCases/prefetch-preload-mixed/b3.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/statsCases/prefetch-preload-mixed/c.js b/test/statsCases/prefetch-preload-mixed/c.js new file mode 100644 index 00000000000..33838a297eb --- /dev/null +++ b/test/statsCases/prefetch-preload-mixed/c.js @@ -0,0 +1,2 @@ +import(/* webpackPreload: true, webpackChunkName: "c1" */ "./c1"); +import(/* webpackPreload: true, webpackChunkName: "c2" */ "./c2"); diff --git a/test/statsCases/prefetch-preload-mixed/c1.js b/test/statsCases/prefetch-preload-mixed/c1.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/statsCases/prefetch-preload-mixed/c2.js b/test/statsCases/prefetch-preload-mixed/c2.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/statsCases/prefetch-preload-mixed/index.js b/test/statsCases/prefetch-preload-mixed/index.js new file mode 100644 index 00000000000..a1bb65b54b3 --- /dev/null +++ b/test/statsCases/prefetch-preload-mixed/index.js @@ -0,0 +1,3 @@ +import(/* webpackPrefetch: true, webpackChunkName: "a" */"./a"); +import(/* webpackPrefetch: true, webpackChunkName: "b" */"./b"); +import(/* webpackPrefetch: true, webpackChunkName: "c" */"./c"); diff --git a/test/statsCases/prefetch-preload-mixed/webpack.config.js b/test/statsCases/prefetch-preload-mixed/webpack.config.js new file mode 100644 index 00000000000..85c108d2ed7 --- /dev/null +++ b/test/statsCases/prefetch-preload-mixed/webpack.config.js @@ -0,0 +1,8 @@ +module.exports = { + mode: "production", + entry: "./index", + stats: { + all: false, + chunks: true + } +}; diff --git a/test/statsCases/prefetch/index.js b/test/statsCases/prefetch/index.js new file mode 100644 index 00000000000..9b6aaeab545 --- /dev/null +++ b/test/statsCases/prefetch/index.js @@ -0,0 +1,5 @@ +import "./with-nested"; +import(/* webpackPrefetch: 1, webpackChunkName: "prefetched" */ "./prefetched"); +setTimeout(() => { + import(/* webpackChunkName: "normal" */"./normal"); +}, 500); diff --git a/test/statsCases/prefetch/inner.js b/test/statsCases/prefetch/inner.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/statsCases/prefetch/inner2.js b/test/statsCases/prefetch/inner2.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/statsCases/prefetch/inner3.js b/test/statsCases/prefetch/inner3.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/statsCases/prefetch/normal.js b/test/statsCases/prefetch/normal.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/statsCases/prefetch/prefetched.js b/test/statsCases/prefetch/prefetched.js new file mode 100644 index 00000000000..63683ca2794 --- /dev/null +++ b/test/statsCases/prefetch/prefetched.js @@ -0,0 +1,5 @@ +setTimeout(() => { + import(/* webpackPrefetch: 10, webpackChunkName: "inner" */"./inner"); + import(/* webpackPrefetch: 20, webpackChunkName: "inner2" */"./inner2"); + import(/* webpackChunkName: "inner2" */"./inner3"); +}, 5000); diff --git a/test/statsCases/prefetch/prefetched2.js b/test/statsCases/prefetch/prefetched2.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/statsCases/prefetch/prefetched3.js b/test/statsCases/prefetch/prefetched3.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/statsCases/prefetch/webpack.config.js b/test/statsCases/prefetch/webpack.config.js new file mode 100644 index 00000000000..17dba56dbc3 --- /dev/null +++ b/test/statsCases/prefetch/webpack.config.js @@ -0,0 +1,10 @@ +module.exports = { + mode: "production", + entry: "./index", + stats: { + all: false, + assets: true, + entrypoints: true, + chunks: true + } +}; diff --git a/test/statsCases/prefetch/with-nested.js b/test/statsCases/prefetch/with-nested.js new file mode 100644 index 00000000000..0720ce6e7e0 --- /dev/null +++ b/test/statsCases/prefetch/with-nested.js @@ -0,0 +1,3 @@ +import(/* webpackPrefetch: -20, webpackChunkName: "prefetched2" */"./prefetched2"); +import(/* webpackPrefetch: 3, webpackChunkName: "prefetched2" */"./prefetched2"); +import(/* webpackPrefetch: -10, webpackChunkName: "prefetched3" */"./prefetched3"); diff --git a/test/statsCases/preload/index.js b/test/statsCases/preload/index.js new file mode 100644 index 00000000000..2578b3824ab --- /dev/null +++ b/test/statsCases/preload/index.js @@ -0,0 +1,5 @@ +import "./with-nested"; +import(/* webpackPreload: 1, webpackChunkName: "preloaded" */ "./preloaded"); +setTimeout(() => { + import(/* webpackChunkName: "normal" */"./normal"); +}, 500); diff --git a/test/statsCases/preload/inner.js b/test/statsCases/preload/inner.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/statsCases/preload/inner2.js b/test/statsCases/preload/inner2.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/statsCases/preload/inner3.js b/test/statsCases/preload/inner3.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/statsCases/preload/normal.js b/test/statsCases/preload/normal.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/statsCases/preload/preloaded.js b/test/statsCases/preload/preloaded.js new file mode 100644 index 00000000000..02f02b8e86f --- /dev/null +++ b/test/statsCases/preload/preloaded.js @@ -0,0 +1,5 @@ +setTimeout(() => { + import(/* webpackPreload: 10, webpackChunkName: "inner" */"./inner"); + import(/* webpackPreload: 20, webpackChunkName: "inner2" */"./inner2"); + import(/* webpackChunkName: "inner2" */"./inner3"); +}, 5000); diff --git a/test/statsCases/preload/preloaded2.js b/test/statsCases/preload/preloaded2.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/statsCases/preload/preloaded3.js b/test/statsCases/preload/preloaded3.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/statsCases/preload/webpack.config.js b/test/statsCases/preload/webpack.config.js new file mode 100644 index 00000000000..17dba56dbc3 --- /dev/null +++ b/test/statsCases/preload/webpack.config.js @@ -0,0 +1,10 @@ +module.exports = { + mode: "production", + entry: "./index", + stats: { + all: false, + assets: true, + entrypoints: true, + chunks: true + } +}; diff --git a/test/statsCases/preload/with-nested.js b/test/statsCases/preload/with-nested.js new file mode 100644 index 00000000000..0b7a826e180 --- /dev/null +++ b/test/statsCases/preload/with-nested.js @@ -0,0 +1,3 @@ +import(/* webpackPreload: -20, webpackChunkName: "preloaded2" */"./preloaded2"); +import(/* webpackPreload: 3, webpackChunkName: "preloaded2" */"./preloaded2"); +import(/* webpackPreload: -10, webpackChunkName: "preloaded3" */"./preloaded3"); diff --git a/test/statsCases/preset-detailed/expected.txt b/test/statsCases/preset-detailed/expected.txt deleted file mode 100644 index 809e2d594f7..00000000000 --- a/test/statsCases/preset-detailed/expected.txt +++ /dev/null @@ -1,29 +0,0 @@ -Hash: a181afd92c30187a0eba -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - 0.js 152 bytes 0 [emitted] - 1.js 289 bytes 1 [emitted] -main.js 7.01 KiB 2 [emitted] main - 3.js 227 bytes 3 [emitted] -Entrypoint main = main.js -chunk {0} 0.js 22 bytes <{2}> [rendered] - > ./b [4] ./index.js 2:0-16 -chunk {1} 1.js 54 bytes <{2}> >{3}< [rendered] - > ./c [4] ./index.js 3:0-16 -chunk {2} main.js (main) 73 bytes >{0}< >{1}< [entry] [rendered] - > ./index main -chunk {3} 3.js 44 bytes <{1}> [rendered] - > [3] ./c.js 1:0-52 -[0] ./d.js 22 bytes {3} [depth 2] [built] - ModuleConcatenation bailout: Module is not an ECMAScript module -[1] ./e.js 22 bytes {3} [depth 2] [built] - ModuleConcatenation bailout: Module is not an ECMAScript module -[2] ./b.js 22 bytes {0} [depth 1] [built] - ModuleConcatenation bailout: Module is not an ECMAScript module -[3] ./c.js 54 bytes {1} [depth 1] [built] - ModuleConcatenation bailout: Module is not an ECMAScript module -[4] ./index.js 51 bytes {2} [depth 0] [built] - ModuleConcatenation bailout: Module is not an ECMAScript module -[5] ./a.js 22 bytes {2} [depth 1] [built] - ModuleConcatenation bailout: Module is not an ECMAScript module \ No newline at end of file diff --git a/test/statsCases/preset-errors-only-error/expected.txt b/test/statsCases/preset-errors-only-error/expected.txt deleted file mode 100644 index 3ad717ffe62..00000000000 --- a/test/statsCases/preset-errors-only-error/expected.txt +++ /dev/null @@ -1,4 +0,0 @@ - -ERROR in ./index.js -Module not found: Error: Can't resolve 'does-not-exist' in 'Xdir/preset-errors-only-error' - @ ./index.js 1:0-25 \ No newline at end of file diff --git a/test/statsCases/preset-minimal-simple/expected.txt b/test/statsCases/preset-minimal-simple/expected.txt deleted file mode 100644 index 2ba6dec1300..00000000000 --- a/test/statsCases/preset-minimal-simple/expected.txt +++ /dev/null @@ -1 +0,0 @@ - 1 module \ No newline at end of file diff --git a/test/statsCases/preset-minimal/expected.txt b/test/statsCases/preset-minimal/expected.txt deleted file mode 100644 index fb8d2244ffb..00000000000 --- a/test/statsCases/preset-minimal/expected.txt +++ /dev/null @@ -1 +0,0 @@ - 6 modules \ No newline at end of file diff --git a/test/statsCases/preset-mixed-array/expected.txt b/test/statsCases/preset-mixed-array/expected.txt deleted file mode 100644 index 119f7a1be01..00000000000 --- a/test/statsCases/preset-mixed-array/expected.txt +++ /dev/null @@ -1,5 +0,0 @@ -Child minimal: - 1 module -Child verbose: - Entrypoint main = main.js - [0] ./index.js 8 bytes {0} [built] \ No newline at end of file diff --git a/test/statsCases/preset-normal-performance-ensure-filter-sourcemaps/expected.txt b/test/statsCases/preset-normal-performance-ensure-filter-sourcemaps/expected.txt deleted file mode 100644 index a3ff9d55512..00000000000 --- a/test/statsCases/preset-normal-performance-ensure-filter-sourcemaps/expected.txt +++ /dev/null @@ -1,29 +0,0 @@ -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - 0.js 182 bytes 0 [emitted] - 1.js 319 bytes 1 [emitted] - main.js 300 KiB 2 [emitted] [big] main - 3.js 257 bytes 3 [emitted] - 0.js.map 156 bytes 0 [emitted] - 1.js.map 197 bytes 1 [emitted] -main.js.map 1.72 MiB 2 [emitted] main - 3.js.map 214 bytes 3 [emitted] -Entrypoint main [big] = main.js main.js.map -[0] ./d.js 22 bytes {3} [built] -[1] ./e.js 22 bytes {3} [built] -[2] ./b.js 22 bytes {0} [built] -[3] ./c.js 54 bytes {1} [built] -[4] ./index.js 52 bytes {2} [built] -[5] ./a.js 293 KiB {2} [built] - -WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB). -This can impact web performance. -Assets: - main.js (300 KiB) - -WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance. -Entrypoints: - main (300 KiB) - main.js - \ No newline at end of file diff --git a/test/statsCases/preset-normal-performance/expected.txt b/test/statsCases/preset-normal-performance/expected.txt deleted file mode 100644 index 3054babb369..00000000000 --- a/test/statsCases/preset-normal-performance/expected.txt +++ /dev/null @@ -1,25 +0,0 @@ -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - 0.js 152 bytes 0 [emitted] - 1.js 289 bytes 1 [emitted] -main.js 300 KiB 2 [emitted] [big] main - 3.js 227 bytes 3 [emitted] -Entrypoint main [big] = main.js -[0] ./d.js 22 bytes {3} [built] -[1] ./e.js 22 bytes {3} [built] -[2] ./b.js 22 bytes {0} [built] -[3] ./c.js 54 bytes {1} [built] -[4] ./index.js 52 bytes {2} [built] -[5] ./a.js 293 KiB {2} [built] - -WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB). -This can impact web performance. -Assets: - main.js (300 KiB) - -WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance. -Entrypoints: - main (300 KiB) - main.js - \ No newline at end of file diff --git a/test/statsCases/preset-normal/expected.txt b/test/statsCases/preset-normal/expected.txt deleted file mode 100644 index 1fafbce3e56..00000000000 --- a/test/statsCases/preset-normal/expected.txt +++ /dev/null @@ -1,15 +0,0 @@ -Hash: a181afd92c30187a0eba -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - 0.js 152 bytes 0 [emitted] - 1.js 289 bytes 1 [emitted] -main.js 7.01 KiB 2 [emitted] main - 3.js 227 bytes 3 [emitted] -Entrypoint main = main.js -[0] ./d.js 22 bytes {3} [built] -[1] ./e.js 22 bytes {3} [built] -[2] ./b.js 22 bytes {0} [built] -[3] ./c.js 54 bytes {1} [built] -[4] ./index.js 51 bytes {2} [built] -[5] ./a.js 22 bytes {2} [built] \ No newline at end of file diff --git a/test/statsCases/preset-verbose/expected.txt b/test/statsCases/preset-verbose/expected.txt deleted file mode 100644 index a013e663b2a..00000000000 --- a/test/statsCases/preset-verbose/expected.txt +++ /dev/null @@ -1,41 +0,0 @@ -Hash: a181afd92c30187a0eba -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names - 0.js 152 bytes 0 [emitted] - 1.js 289 bytes 1 [emitted] -main.js 7.01 KiB 2 [emitted] main - 3.js 227 bytes 3 [emitted] -Entrypoint main = main.js -chunk {0} 0.js 22 bytes <{2}> [rendered] - > ./b [4] ./index.js 2:0-16 - [2] ./b.js 22 bytes {0} [depth 1] [built] - ModuleConcatenation bailout: Module is not an ECMAScript module - amd require ./b [4] ./index.js 2:0-16 - [4] Xms -> factory:Xms building:Xms = Xms -chunk {1} 1.js 54 bytes <{2}> >{3}< [rendered] - > ./c [4] ./index.js 3:0-16 - [3] ./c.js 54 bytes {1} [depth 1] [built] - ModuleConcatenation bailout: Module is not an ECMAScript module - amd require ./c [4] ./index.js 3:0-16 - [4] Xms -> factory:Xms building:Xms = Xms -chunk {2} main.js (main) 73 bytes >{0}< >{1}< [entry] [rendered] - > ./index main - [4] ./index.js 51 bytes {2} [depth 0] [built] - ModuleConcatenation bailout: Module is not an ECMAScript module - single entry ./index main - factory:Xms building:Xms = Xms - [5] ./a.js 22 bytes {2} [depth 1] [built] - ModuleConcatenation bailout: Module is not an ECMAScript module - cjs require ./a [4] ./index.js 1:0-14 - [4] Xms -> factory:Xms building:Xms = Xms -chunk {3} 3.js 44 bytes <{1}> [rendered] - > [3] ./c.js 1:0-52 - [0] ./d.js 22 bytes {3} [depth 2] [built] - ModuleConcatenation bailout: Module is not an ECMAScript module - require.ensure item ./d [3] ./c.js 1:0-52 - [4] Xms -> [3] Xms -> factory:Xms building:Xms = Xms - [1] ./e.js 22 bytes {3} [depth 2] [built] - ModuleConcatenation bailout: Module is not an ECMAScript module - require.ensure item ./e [3] ./c.js 1:0-52 - [4] Xms -> [3] Xms -> factory:Xms building:Xms = Xms \ No newline at end of file diff --git a/test/statsCases/resolve-plugin-context/expected.txt b/test/statsCases/resolve-plugin-context/expected.txt deleted file mode 100644 index ee27654fc99..00000000000 --- a/test/statsCases/resolve-plugin-context/expected.txt +++ /dev/null @@ -1,11 +0,0 @@ -Hash: 47eae06ebcb26f6b883a -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names -bundle.js 3.01 KiB 0 [emitted] main -Entrypoint main = bundle.js -[0] ./node_modules/xyz/index.js 0 bytes {0} [built] -[1] ./index.js 48 bytes {0} [built] -[2] ./node_modules/abc/index.js 16 bytes {0} [built] -[3] ./node_modules/def/index.js 16 bytes {0} [built] -[4] ./node_modules/def/node_modules/xyz/index.js 0 bytes {0} [built] \ No newline at end of file diff --git a/test/statsCases/reverse-sort-modules/expected.txt b/test/statsCases/reverse-sort-modules/expected.txt deleted file mode 100644 index 4eb744a13ce..00000000000 --- a/test/statsCases/reverse-sort-modules/expected.txt +++ /dev/null @@ -1,27 +0,0 @@ -Hash: c5cf5ab0cc0a404f1acf -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names -main.js 5.85 KiB 0 [emitted] main -Entrypoint main = main.js -[29] ./c.js?10 33 bytes {0} [built] -[27] ./c.js?9 33 bytes {0} [built] -[25] ./c.js?8 33 bytes {0} [built] -[23] ./c.js?7 33 bytes {0} [built] -[19] ./c.js?5 33 bytes {0} [built] -[17] ./c.js?4 33 bytes {0} [built] -[15] ./c.js?3 33 bytes {0} [built] -[13] ./c.js?2 33 bytes {0} [built] -[11] ./c.js?1 33 bytes {0} [built] -[10] ./index.js 181 bytes {0} [built] - [9] ./a.js?10 33 bytes {0} [built] - [8] ./a.js?9 33 bytes {0} [built] - [7] ./a.js?8 33 bytes {0} [built] - [6] ./a.js?7 33 bytes {0} [built] - [5] ./a.js?6 33 bytes {0} [built] - [4] ./a.js?5 33 bytes {0} [built] - [3] ./a.js?4 33 bytes {0} [built] - [2] ./a.js?3 33 bytes {0} [built] - [1] ./a.js?2 33 bytes {0} [built] - [0] ./a.js?1 33 bytes {0} [built] - + 11 hidden modules \ No newline at end of file diff --git a/test/statsCases/runtime-chunk-integration/b.js b/test/statsCases/runtime-chunk-integration/b.js new file mode 100644 index 00000000000..eff703ff465 --- /dev/null +++ b/test/statsCases/runtime-chunk-integration/b.js @@ -0,0 +1 @@ +export default "b"; diff --git a/test/statsCases/runtime-chunk-integration/c.js b/test/statsCases/runtime-chunk-integration/c.js new file mode 100644 index 00000000000..5d50db5bc15 --- /dev/null +++ b/test/statsCases/runtime-chunk-integration/c.js @@ -0,0 +1 @@ +export default "c"; diff --git a/test/statsCases/runtime-chunk-integration/d.js b/test/statsCases/runtime-chunk-integration/d.js new file mode 100644 index 00000000000..987d6d7e401 --- /dev/null +++ b/test/statsCases/runtime-chunk-integration/d.js @@ -0,0 +1 @@ +export default "d"; diff --git a/test/statsCases/runtime-chunk-integration/f.js b/test/statsCases/runtime-chunk-integration/f.js new file mode 100644 index 00000000000..657d4dee8a8 --- /dev/null +++ b/test/statsCases/runtime-chunk-integration/f.js @@ -0,0 +1 @@ +export default "f"; diff --git a/test/statsCases/runtime-chunk-integration/main1.js b/test/statsCases/runtime-chunk-integration/main1.js new file mode 100644 index 00000000000..5029ffe6396 --- /dev/null +++ b/test/statsCases/runtime-chunk-integration/main1.js @@ -0,0 +1,5 @@ +import("./b"); +import("./c"); +import("./d"); + +export default "a"; diff --git a/test/statsCases/runtime-chunk-integration/webpack.config.js b/test/statsCases/runtime-chunk-integration/webpack.config.js new file mode 100644 index 00000000000..6ee9324a2f6 --- /dev/null +++ b/test/statsCases/runtime-chunk-integration/webpack.config.js @@ -0,0 +1,44 @@ +const MinChunkSizePlugin = require("../../../lib/optimize/MinChunkSizePlugin"); + +const baseConfig = { + mode: "production", + target: "web", + output: { + filename: "[name].js" + }, + stats: { + hash: false, + timings: false, + builtAt: false + }, + plugins: [ + new MinChunkSizePlugin({ + minChunkSize: 1000 + }) + ] +}; + +const withoutNamedEntry = Object.assign({}, baseConfig, { + name: "base", + entry: { + main1: "./main1" + }, + optimization: { + runtimeChunk: "single" + } +}); + +const withNamedEntry = Object.assign({}, baseConfig, { + name: "manifest is named entry", + entry: { + main1: "./main1", + manifest: "./f" + }, + optimization: { + runtimeChunk: { + name: "manifest" + } + } +}); + +module.exports = [withoutNamedEntry, withNamedEntry]; diff --git a/test/statsCases/runtime-chunk-issue-7382/e1.js b/test/statsCases/runtime-chunk-issue-7382/e1.js new file mode 100644 index 00000000000..d8e371ad463 --- /dev/null +++ b/test/statsCases/runtime-chunk-issue-7382/e1.js @@ -0,0 +1 @@ +module.exports = "entry1"; diff --git a/test/statsCases/runtime-chunk-issue-7382/e2.js b/test/statsCases/runtime-chunk-issue-7382/e2.js new file mode 100644 index 00000000000..a5a3b0d8841 --- /dev/null +++ b/test/statsCases/runtime-chunk-issue-7382/e2.js @@ -0,0 +1 @@ +module.exports = "entry2"; diff --git a/test/statsCases/runtime-chunk-issue-7382/webpack.config.js b/test/statsCases/runtime-chunk-issue-7382/webpack.config.js new file mode 100644 index 00000000000..ba14189a142 --- /dev/null +++ b/test/statsCases/runtime-chunk-issue-7382/webpack.config.js @@ -0,0 +1,31 @@ +module.exports = { + mode: "development", + entry: { + e1: "./e1", + e2: "./e2" + }, + output: { + filename: "[name].js" + }, + stats: { + hash: false, + timings: false, + builtAt: false, + assets: false, + modules: false, + reasons: true + }, + optimization: { + runtimeChunk: "single", + splitChunks: { + cacheGroups: { + all: { + test: /./, + name: "all", + minSize: 0, + chunks: "initial" + } + } + } + } +}; diff --git a/test/statsCases/runtime-chunk-single/expected.txt b/test/statsCases/runtime-chunk-single/expected.txt deleted file mode 100644 index 77f5b82969a..00000000000 --- a/test/statsCases/runtime-chunk-single/expected.txt +++ /dev/null @@ -1,2 +0,0 @@ -Entrypoint e1 = runtime.js e1.js -Entrypoint e2 = runtime.js e2.js \ No newline at end of file diff --git a/test/statsCases/runtime-chunk/expected.txt b/test/statsCases/runtime-chunk/expected.txt deleted file mode 100644 index 0eb0020bcbb..00000000000 --- a/test/statsCases/runtime-chunk/expected.txt +++ /dev/null @@ -1,2 +0,0 @@ -Entrypoint e1 = runtime~e1.js e1.js -Entrypoint e2 = runtime~e2.js e2.js \ No newline at end of file diff --git a/test/statsCases/scope-hoisting-bailouts/expected.txt b/test/statsCases/scope-hoisting-bailouts/expected.txt deleted file mode 100644 index 464871507c8..00000000000 --- a/test/statsCases/scope-hoisting-bailouts/expected.txt +++ /dev/null @@ -1,29 +0,0 @@ -Hash: 123228577e0595ae0a8e -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT -Entrypoint index = index.js -Entrypoint entry = entry.js -[0] ./entry.js 32 bytes {1} {2} [built] - ModuleConcatenation bailout: Module is an entry point -[1] ./ref-from-cjs.js 45 bytes {1} [built] - ModuleConcatenation bailout: Module is referenced from these modules with unsupported syntax: ./cjs.js (referenced with cjs require) -[2] external "external" 42 bytes {1} [built] - ModuleConcatenation bailout: Module is not an ECMAScript module -[3] ./concatenated.js + 2 modules 116 bytes {0} [built] - ModuleConcatenation bailout: Cannot concat with external "external" (<- Module is not an ECMAScript module) - | ./concatenated.js 26 bytes [built] - | ModuleConcatenation bailout: Module is referenced from these modules with unsupported syntax: ./index.js (referenced with import()) - | ./concatenated1.js 37 bytes [built] - | ./concatenated2.js 48 bytes [built] -[4] ./index.js 176 bytes {1} [built] - ModuleConcatenation bailout: Module is an entry point -[5] ./cjs.js 59 bytes {1} [built] - ModuleConcatenation bailout: Module is not an ECMAScript module -[6] ./eval.js 35 bytes {1} [built] - ModuleConcatenation bailout: Module uses eval() -[7] ./injected-vars.js 40 bytes {1} [built] - ModuleConcatenation bailout: Module uses injected variables (__dirname, __filename) -[8] ./module-id.js 26 bytes {1} [built] - ModuleConcatenation bailout: Module uses module.id -[9] ./module-loaded.js 30 bytes {1} [built] - ModuleConcatenation bailout: Module uses module.loaded \ No newline at end of file diff --git a/test/statsCases/scope-hoisting-multi/expected.txt b/test/statsCases/scope-hoisting-multi/expected.txt deleted file mode 100644 index 14805f6243c..00000000000 --- a/test/statsCases/scope-hoisting-multi/expected.txt +++ /dev/null @@ -1,44 +0,0 @@ -Hash: 1e05cb63c83229a31d7fe3bbe6aa8fb8e8ec3bd9 -Child - Hash: 1e05cb63c83229a31d7f - Time: Xms - Built at: Thu Jan 01 1970 00:00:00 GMT - Entrypoint first = vendor.js first.js - Entrypoint second = vendor.js second.js - [0] ./common_lazy_shared.js 25 bytes {0} {1} {2} [built] - [1] ./common2.js 25 bytes {4} {5} [built] - [2] ./common_lazy.js 25 bytes {1} {2} [built] - [3] ./common.js 37 bytes {4} {5} [built] - [4] ./lazy_shared.js 31 bytes {0} [built] - [5] ./vendor.js 25 bytes {3} [built] - [6] ./lazy_first.js 55 bytes {2} [built] - [7] ./lazy_second.js 55 bytes {1} [built] - [8] ./first.js 207 bytes {4} [built] - [9] ./module_first.js 31 bytes {4} [built] - [10] ./second.js 177 bytes {5} [built] -Child - Hash: e3bbe6aa8fb8e8ec3bd9 - Time: Xms - Built at: Thu Jan 01 1970 00:00:00 GMT - Entrypoint first = vendor.js first.js - Entrypoint second = vendor.js second.js - [0] ./common_lazy_shared.js 25 bytes {0} {1} {2} [built] - [1] ./common_lazy.js 25 bytes {1} {2} [built] - [2] ./common.js + 1 modules 62 bytes {4} {5} [built] - | ./common.js 37 bytes [built] - | ./common2.js 25 bytes [built] - [3] ./vendor.js 25 bytes {3} [built] - [4] ./lazy_shared.js 31 bytes {0} [built] - ModuleConcatenation bailout: Module is referenced from these modules with unsupported syntax: ./first.js (referenced with import()), ./second.js (referenced with import()) - [5] ./lazy_second.js 55 bytes {1} [built] - ModuleConcatenation bailout: Module is referenced from these modules with unsupported syntax: ./second.js (referenced with import()) - [6] ./second.js 177 bytes {5} [built] - ModuleConcatenation bailout: Module is an entry point - [7] ./first.js + 1 modules 248 bytes {4} [built] - ModuleConcatenation bailout: Cannot concat with ./common.js - ModuleConcatenation bailout: Cannot concat with ./vendor.js - | ./first.js 207 bytes [built] - | ModuleConcatenation bailout: Module is an entry point - | ./module_first.js 31 bytes [built] - [8] ./lazy_first.js 55 bytes {2} [built] - ModuleConcatenation bailout: Module is referenced from these modules with unsupported syntax: ./first.js (referenced with import()) \ No newline at end of file diff --git a/test/statsCases/side-effects-issue-7428/components/package.json b/test/statsCases/side-effects-issue-7428/components/package.json new file mode 100644 index 00000000000..c4b4308da0e --- /dev/null +++ b/test/statsCases/side-effects-issue-7428/components/package.json @@ -0,0 +1,6 @@ +{ + "name": "components", + "version": "1.0.0", + "main": "src/index.js", + "sideEffects": false +} diff --git a/test/statsCases/side-effects-issue-7428/components/src/CompAB/CompA.js b/test/statsCases/side-effects-issue-7428/components/src/CompAB/CompA.js new file mode 100644 index 00000000000..27806ec4fef --- /dev/null +++ b/test/statsCases/side-effects-issue-7428/components/src/CompAB/CompA.js @@ -0,0 +1,6 @@ +import * as methods from './utils'; + +export default { + name: 'CompA', + ...methods, +}; \ No newline at end of file diff --git a/test/statsCases/side-effects-issue-7428/components/src/CompAB/CompB.js b/test/statsCases/side-effects-issue-7428/components/src/CompAB/CompB.js new file mode 100644 index 00000000000..1a34e6da979 --- /dev/null +++ b/test/statsCases/side-effects-issue-7428/components/src/CompAB/CompB.js @@ -0,0 +1,6 @@ +import { fnB } from './utils'; + +export default { + name: 'CompB', + fnB, +}; \ No newline at end of file diff --git a/test/statsCases/side-effects-issue-7428/components/src/CompAB/index.js b/test/statsCases/side-effects-issue-7428/components/src/CompAB/index.js new file mode 100644 index 00000000000..72412e2993e --- /dev/null +++ b/test/statsCases/side-effects-issue-7428/components/src/CompAB/index.js @@ -0,0 +1,2 @@ +export { default as CompA } from './CompA'; +export { default as CompB } from './CompB'; \ No newline at end of file diff --git a/test/statsCases/side-effects-issue-7428/components/src/CompAB/utils.js b/test/statsCases/side-effects-issue-7428/components/src/CompAB/utils.js new file mode 100644 index 00000000000..1534793136f --- /dev/null +++ b/test/statsCases/side-effects-issue-7428/components/src/CompAB/utils.js @@ -0,0 +1,2 @@ +export const fnA = () => { console.log('fnA') }; +export const fnB = () => { console.log('fnB') }; \ No newline at end of file diff --git a/test/statsCases/side-effects-issue-7428/components/src/CompC/CompC.js b/test/statsCases/side-effects-issue-7428/components/src/CompC/CompC.js new file mode 100644 index 00000000000..7f00f59f63d --- /dev/null +++ b/test/statsCases/side-effects-issue-7428/components/src/CompC/CompC.js @@ -0,0 +1 @@ +export default { name: 'CompC' }; \ No newline at end of file diff --git a/test/statsCases/side-effects-issue-7428/components/src/CompC/index.js b/test/statsCases/side-effects-issue-7428/components/src/CompC/index.js new file mode 100644 index 00000000000..28a32e34804 --- /dev/null +++ b/test/statsCases/side-effects-issue-7428/components/src/CompC/index.js @@ -0,0 +1 @@ +export { default } from './CompC'; \ No newline at end of file diff --git a/test/statsCases/side-effects-issue-7428/components/src/index.js b/test/statsCases/side-effects-issue-7428/components/src/index.js new file mode 100644 index 00000000000..d0c5e9b6fd0 --- /dev/null +++ b/test/statsCases/side-effects-issue-7428/components/src/index.js @@ -0,0 +1,2 @@ +export { CompA, CompB } from './CompAB'; +export { default as CompC } from './CompC'; \ No newline at end of file diff --git a/test/statsCases/side-effects-issue-7428/foo.js b/test/statsCases/side-effects-issue-7428/foo.js new file mode 100644 index 00000000000..f89ee347714 --- /dev/null +++ b/test/statsCases/side-effects-issue-7428/foo.js @@ -0,0 +1,3 @@ +import { CompA } from './components'; + +export default { ...CompA, fnB: () => { console.log('hi') } } diff --git a/test/statsCases/side-effects-issue-7428/main.js b/test/statsCases/side-effects-issue-7428/main.js new file mode 100644 index 00000000000..5f419052fea --- /dev/null +++ b/test/statsCases/side-effects-issue-7428/main.js @@ -0,0 +1,8 @@ +import { CompA, CompB } from './components'; + +window.CompA = CompA; +window.CompB = CompB; + +import('./foo').then((m) => { + m.default.fnB(); +}); diff --git a/test/statsCases/side-effects-issue-7428/webpack.config.js b/test/statsCases/side-effects-issue-7428/webpack.config.js new file mode 100644 index 00000000000..5d0abd9e3cd --- /dev/null +++ b/test/statsCases/side-effects-issue-7428/webpack.config.js @@ -0,0 +1,14 @@ +module.exports = { + mode: "none", + entry: "./main.js", + optimization: { + usedExports: true, + sideEffects: true, + concatenateModules: true + }, + stats: { + nestedModules: true, + usedExports: true, + reasons: true + } +}; diff --git a/test/statsCases/side-effects-simple-unused/index.js b/test/statsCases/side-effects-simple-unused/index.js new file mode 100644 index 00000000000..96f94da8d32 --- /dev/null +++ b/test/statsCases/side-effects-simple-unused/index.js @@ -0,0 +1,3 @@ +import def, { z } from "pmodule"; + +console.log(def, z); \ No newline at end of file diff --git a/test/statsCases/side-effects-simple-unused/node_modules/pmodule/a.js b/test/statsCases/side-effects-simple-unused/node_modules/pmodule/a.js new file mode 100644 index 00000000000..af715307e06 --- /dev/null +++ b/test/statsCases/side-effects-simple-unused/node_modules/pmodule/a.js @@ -0,0 +1,5 @@ +var a = "a"; +var b = "b"; +var c = "c"; + +export { a, b, c }; diff --git a/test/statsCases/side-effects-simple-unused/node_modules/pmodule/b.js b/test/statsCases/side-effects-simple-unused/node_modules/pmodule/b.js new file mode 100644 index 00000000000..1b982e25d2b --- /dev/null +++ b/test/statsCases/side-effects-simple-unused/node_modules/pmodule/b.js @@ -0,0 +1,5 @@ +var x = "x"; +var y = "y"; + +export { x, y }; +export { z } from "./c"; diff --git a/test/statsCases/side-effects-simple-unused/node_modules/pmodule/c.js b/test/statsCases/side-effects-simple-unused/node_modules/pmodule/c.js new file mode 100644 index 00000000000..dab1b4426c4 --- /dev/null +++ b/test/statsCases/side-effects-simple-unused/node_modules/pmodule/c.js @@ -0,0 +1,3 @@ +var z = "z"; + +export { z }; diff --git a/test/statsCases/side-effects-simple-unused/node_modules/pmodule/index.js b/test/statsCases/side-effects-simple-unused/node_modules/pmodule/index.js new file mode 100644 index 00000000000..8048908d587 --- /dev/null +++ b/test/statsCases/side-effects-simple-unused/node_modules/pmodule/index.js @@ -0,0 +1,4 @@ +export * from "./a"; +export { x, y, z } from "./b"; + +export default "def"; diff --git a/test/statsCases/side-effects-simple-unused/node_modules/pmodule/package.json b/test/statsCases/side-effects-simple-unused/node_modules/pmodule/package.json new file mode 100644 index 00000000000..43c38c1bb03 --- /dev/null +++ b/test/statsCases/side-effects-simple-unused/node_modules/pmodule/package.json @@ -0,0 +1,3 @@ +{ + "sideEffects": false +} diff --git a/test/statsCases/side-effects-simple-unused/webpack.config.js b/test/statsCases/side-effects-simple-unused/webpack.config.js new file mode 100644 index 00000000000..d0c6c9883d9 --- /dev/null +++ b/test/statsCases/side-effects-simple-unused/webpack.config.js @@ -0,0 +1,8 @@ +module.exports = { + mode: "production", + entry: "./index", + stats: { + nestedModules: true, + usedExports: true + } +}; diff --git a/test/statsCases/simple-more-info/expected.txt b/test/statsCases/simple-more-info/expected.txt deleted file mode 100644 index 49e2bef321a..00000000000 --- a/test/statsCases/simple-more-info/expected.txt +++ /dev/null @@ -1,9 +0,0 @@ -Hash: ee367da3e170c28a39bf -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names -bundle.js 2.61 KiB 0 [emitted] main -Entrypoint main = bundle.js -[0] ./index.js 0 bytes {0} [built] - single entry ./index main - factory:Xms building:Xms = Xms \ No newline at end of file diff --git a/test/statsCases/simple/expected.txt b/test/statsCases/simple/expected.txt deleted file mode 100644 index e48aa187f38..00000000000 --- a/test/statsCases/simple/expected.txt +++ /dev/null @@ -1,7 +0,0 @@ -Hash: 18342b523b0aca4784a6 -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names -bundle.js 2.78 KiB main [emitted] main -Entrypoint main = bundle.js -[./index.js] 0 bytes {main} [built] \ No newline at end of file diff --git a/test/statsCases/split-chunks-combinations/expected.txt b/test/statsCases/split-chunks-combinations/expected.txt deleted file mode 100644 index 2debb721430..00000000000 --- a/test/statsCases/split-chunks-combinations/expected.txt +++ /dev/null @@ -1,35 +0,0 @@ -Entrypoint main = main.js -chunk {0} async-a~async-b.js (async-a~async-b) 134 bytes <{8}> ={1}= ={2}= [rendered] split chunk (cache group: default) (name: async-a~async-b) - > ./a [9] ./index.js 1:0-47 - > ./b [9] ./index.js 2:0-47 - [0] ./x.js 67 bytes {0} {3} {4} {5} {6} {7} [built] - [1] ./y.js 67 bytes {0} [built] -chunk {1} async-a.js (async-a) 48 bytes <{8}> ={0}= [rendered] - > ./a [9] ./index.js 1:0-47 - [2] ./a.js 48 bytes {1} [built] -chunk {2} async-b.js (async-b) 48 bytes <{8}> ={0}= [rendered] - > ./b [9] ./index.js 2:0-47 - [3] ./b.js 48 bytes {2} [built] -chunk {3} async-c.js (async-c) 101 bytes <{8}> [rendered] - > ./c [9] ./index.js 3:0-47 - [0] ./x.js 67 bytes {0} {3} {4} {5} {6} {7} [built] - [4] ./c.js 34 bytes {3} [built] -chunk {4} async-d.js (async-d) 101 bytes <{8}> [rendered] - > ./d [9] ./index.js 4:0-47 - [0] ./x.js 67 bytes {0} {3} {4} {5} {6} {7} [built] - [5] ./d.js 34 bytes {4} [built] -chunk {5} async-e.js (async-e) 101 bytes <{8}> [rendered] - > ./e [9] ./index.js 5:0-47 - [0] ./x.js 67 bytes {0} {3} {4} {5} {6} {7} [built] - [6] ./e.js 34 bytes {5} [built] -chunk {6} async-f.js (async-f) 101 bytes <{8}> [rendered] - > ./f [9] ./index.js 6:0-47 - [0] ./x.js 67 bytes {0} {3} {4} {5} {6} {7} [built] - [7] ./f.js 34 bytes {6} [built] -chunk {7} async-g.js (async-g) 101 bytes <{8}> [rendered] - > ./g [9] ./index.js 7:0-47 - [0] ./x.js 67 bytes {0} {3} {4} {5} {6} {7} [built] - [8] ./g.js 34 bytes {7} [built] -chunk {8} main.js (main) 343 bytes >{0}< >{1}< >{2}< >{3}< >{4}< >{5}< >{6}< >{7}< [entry] [rendered] - > ./ main - [9] ./index.js 343 bytes {8} [built] \ No newline at end of file diff --git a/test/statsCases/split-chunks-issue-6413/expected.txt b/test/statsCases/split-chunks-issue-6413/expected.txt deleted file mode 100644 index c97025236d8..00000000000 --- a/test/statsCases/split-chunks-issue-6413/expected.txt +++ /dev/null @@ -1,23 +0,0 @@ -Entrypoint main = main.js -chunk {0} vendors~async-a~async-b~async-c.js (vendors~async-a~async-b~async-c) 20 bytes <{5}> ={1}= ={2}= ={3}= ={4}= [rendered] split chunk (cache group: vendors) (name: vendors~async-a~async-b~async-c) - > ./a [5] ./index.js 1:0-47 - > ./b [5] ./index.js 2:0-47 - > ./c [5] ./index.js 3:0-47 - [1] ./node_modules/x.js 20 bytes {0} [built] -chunk {1} async-a~async-b~async-c.js (async-a~async-b~async-c) 11 bytes <{5}> ={0}= ={2}= ={3}= ={4}= [rendered] split chunk (cache group: default) (name: async-a~async-b~async-c) - > ./a [5] ./index.js 1:0-47 - > ./b [5] ./index.js 2:0-47 - > ./c [5] ./index.js 3:0-47 - [0] ./common.js 11 bytes {1} [built] -chunk {2} async-a.js (async-a) 19 bytes <{5}> ={0}= ={1}= [rendered] - > ./a [5] ./index.js 1:0-47 - [2] ./a.js 19 bytes {2} [built] -chunk {3} async-b.js (async-b) 19 bytes <{5}> ={0}= ={1}= [rendered] - > ./b [5] ./index.js 2:0-47 - [3] ./b.js 19 bytes {3} [built] -chunk {4} async-c.js (async-c) 19 bytes <{5}> ={0}= ={1}= [rendered] - > ./c [5] ./index.js 3:0-47 - [4] ./c.js 19 bytes {4} [built] -chunk {5} main.js (main) 147 bytes >{0}< >{1}< >{2}< >{3}< >{4}< [entry] [rendered] - > ./ main - [5] ./index.js 147 bytes {5} [built] \ No newline at end of file diff --git a/test/statsCases/split-chunks-issue-6696/expected.txt b/test/statsCases/split-chunks-issue-6696/expected.txt deleted file mode 100644 index 6f6eb840dd0..00000000000 --- a/test/statsCases/split-chunks-issue-6696/expected.txt +++ /dev/null @@ -1,15 +0,0 @@ -Entrypoint main = vendors.js main.js -chunk {0} async-a.js (async-a) 32 bytes <{2}> <{3}> [rendered] - > ./a [3] ./index.js 2:0-47 - [0] ./node_modules/x.js 20 bytes {0} {1} [built] - [1] ./a.js 12 bytes {0} [built] -chunk {1} async-b.js (async-b) 32 bytes <{2}> <{3}> [rendered] - > ./b [3] ./index.js 3:0-47 - [0] ./node_modules/x.js 20 bytes {0} {1} [built] - [2] ./b.js 12 bytes {1} [built] -chunk {2} main.js (main) 110 bytes ={3}= >{0}< >{1}< [entry] [rendered] - > ./ main - [3] ./index.js 110 bytes {2} [built] -chunk {3} vendors.js (vendors) 20 bytes ={2}= >{0}< >{1}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors) - > ./ main - [4] ./node_modules/y.js 20 bytes {3} [built] \ No newline at end of file diff --git a/test/statsCases/split-chunks-issue-7401/a.js b/test/statsCases/split-chunks-issue-7401/a.js new file mode 100644 index 00000000000..856f26b34c3 --- /dev/null +++ b/test/statsCases/split-chunks-issue-7401/a.js @@ -0,0 +1 @@ +import "x"; diff --git a/test/statsCases/split-chunks-issue-7401/b.js b/test/statsCases/split-chunks-issue-7401/b.js new file mode 100644 index 00000000000..eb6c54baa81 --- /dev/null +++ b/test/statsCases/split-chunks-issue-7401/b.js @@ -0,0 +1 @@ +import(/* webpackChunkName: "c" */ "./c"); diff --git a/test/statsCases/split-chunks-issue-7401/c.js b/test/statsCases/split-chunks-issue-7401/c.js new file mode 100644 index 00000000000..856f26b34c3 --- /dev/null +++ b/test/statsCases/split-chunks-issue-7401/c.js @@ -0,0 +1 @@ +import "x"; diff --git a/test/statsCases/split-chunks-issue-7401/node_modules/x.js b/test/statsCases/split-chunks-issue-7401/node_modules/x.js new file mode 100644 index 00000000000..3fd5ecc7a40 --- /dev/null +++ b/test/statsCases/split-chunks-issue-7401/node_modules/x.js @@ -0,0 +1 @@ +export default "x"; diff --git a/test/statsCases/split-chunks-issue-7401/webpack.config.js b/test/statsCases/split-chunks-issue-7401/webpack.config.js new file mode 100644 index 00000000000..d4af1cb20b5 --- /dev/null +++ b/test/statsCases/split-chunks-issue-7401/webpack.config.js @@ -0,0 +1,29 @@ +const stats = { + hash: false, + timings: false, + builtAt: false, + assets: false, + chunks: true, + chunkOrigins: true, + entrypoints: true, + chunkGroups: true, + modules: false +}; +module.exports = { + name: "default", + mode: "production", + entry: { + a: "./a", + b: "./b" + }, + output: { + filename: "[name].js" + }, + optimization: { + splitChunks: { + minSize: 0, // enforce all + chunks: "all" + } + }, + stats +}; diff --git a/test/statsCases/split-chunks-prefer-bigger-splits/expected.txt b/test/statsCases/split-chunks-prefer-bigger-splits/expected.txt deleted file mode 100644 index 4d49ccaae53..00000000000 --- a/test/statsCases/split-chunks-prefer-bigger-splits/expected.txt +++ /dev/null @@ -1,21 +0,0 @@ -Entrypoint main = default/main.js -chunk {0} default/async-b~async-c.js (async-b~async-c) 110 bytes <{4}> ={2}= ={3}= [rendered] split chunk (cache group: default) (name: async-b~async-c) - > ./b [6] ./index.js 2:0-47 - > ./c [6] ./index.js 3:0-47 - [0] ./d.js 43 bytes {0} {1} [built] - [2] ./f.js 67 bytes {0} [built] -chunk {1} default/async-a.js (async-a) 134 bytes <{4}> [rendered] - > ./a [6] ./index.js 1:0-47 - [0] ./d.js 43 bytes {0} {1} [built] - [1] ./e.js 43 bytes {1} {2} [built] - [3] ./a.js 48 bytes {1} [built] -chunk {2} default/async-b.js (async-b) 105 bytes <{4}> ={0}= [rendered] - > ./b [6] ./index.js 2:0-47 - [1] ./e.js 43 bytes {1} {2} [built] - [4] ./b.js 62 bytes {2} [built] -chunk {3} default/async-c.js (async-c) 48 bytes <{4}> ={0}= [rendered] - > ./c [6] ./index.js 3:0-47 - [5] ./c.js 48 bytes {3} [built] -chunk {4} default/main.js (main) 147 bytes >{0}< >{1}< >{2}< >{3}< [entry] [rendered] - > ./ main - [6] ./index.js 147 bytes {4} [built] \ No newline at end of file diff --git a/test/statsCases/split-chunks/expected.txt b/test/statsCases/split-chunks/expected.txt deleted file mode 100644 index 154a23943e0..00000000000 --- a/test/statsCases/split-chunks/expected.txt +++ /dev/null @@ -1,385 +0,0 @@ -Child default: - Entrypoint main = default/main.js - Entrypoint a = default/a.js - Entrypoint b = default/b.js - Entrypoint c = default/c.js - chunk {0} default/vendors~async-a~async-b~async-c.js (vendors~async-a~async-b~async-c) 20 bytes <{9}> ={1}= ={2}= ={3}= ={5}= ={6}= ={7}= ={8}= >{2}< >{4}< [rendered] split chunk (cache group: vendors) (name: vendors~async-a~async-b~async-c) - > ./a [8] ./index.js 1:0-47 - > ./b [8] ./index.js 2:0-47 - > ./c [8] ./index.js 3:0-47 - [1] ./node_modules/x.js 20 bytes {0} {10} {11} {12} [built] - chunk {1} default/async-a~async-b~async-c.js (async-a~async-b~async-c) 20 bytes <{9}> ={0}= ={2}= ={3}= ={5}= ={6}= ={7}= ={8}= >{2}< >{4}< [rendered] split chunk (cache group: default) (name: async-a~async-b~async-c) - > ./a [8] ./index.js 1:0-47 - > ./b [8] ./index.js 2:0-47 - > ./c [8] ./index.js 3:0-47 - [0] ./d.js 20 bytes {1} {10} {11} {12} [built] - chunk {2} default/async-b~async-c~async-g.js (async-b~async-c~async-g) 20 bytes <{0}> <{1}> <{10}> <{3}> <{5}> <{9}> ={0}= ={1}= ={3}= ={4}= ={6}= ={7}= ={8}= [rendered] split chunk (cache group: default) (name: async-b~async-c~async-g) - > ./g [] 6:0-47 - > ./g [] 6:0-47 - > ./b [8] ./index.js 2:0-47 - > ./c [8] ./index.js 3:0-47 - [2] ./f.js 20 bytes {2} {11} {12} [built] - chunk {3} default/vendors~async-a~async-b.js (vendors~async-a~async-b) 20 bytes <{9}> ={0}= ={1}= ={2}= ={5}= ={6}= >{2}< >{4}< [rendered] split chunk (cache group: vendors) (name: vendors~async-a~async-b) - > ./a [8] ./index.js 1:0-47 - > ./b [8] ./index.js 2:0-47 - [3] ./node_modules/y.js 20 bytes {3} {10} {11} [built] - chunk {4} default/async-g.js (async-g) 34 bytes <{0}> <{1}> <{10}> <{3}> <{5}> ={2}= [rendered] - > ./g [] 6:0-47 - > ./g [] 6:0-47 - [9] ./g.js 34 bytes {4} [built] - chunk {5} default/async-a.js (async-a) 156 bytes <{9}> ={0}= ={1}= ={3}= >{2}< >{4}< [rendered] - > ./a [8] ./index.js 1:0-47 - [7] ./a.js + 1 modules 156 bytes {5} {10} [built] - | ./a.js 121 bytes [built] - | ./e.js 20 bytes [built] - chunk {6} default/async-b.js (async-b) 72 bytes <{9}> ={0}= ={1}= ={2}= ={3}= [rendered] - > ./b [8] ./index.js 2:0-47 - [5] ./b.js 72 bytes {6} {11} [built] - chunk {7} default/async-c.js (async-c) 72 bytes <{9}> ={0}= ={1}= ={2}= ={8}= [rendered] - > ./c [8] ./index.js 3:0-47 - [6] ./c.js 72 bytes {7} {12} [built] - chunk {8} default/vendors~async-c.js (vendors~async-c) 20 bytes <{9}> ={0}= ={1}= ={2}= ={7}= [rendered] split chunk (cache group: vendors) (name: vendors~async-c) - > ./c [8] ./index.js 3:0-47 - [4] ./node_modules/z.js 20 bytes {8} {12} [built] - chunk {9} default/main.js (main) 147 bytes >{0}< >{1}< >{2}< >{3}< >{5}< >{6}< >{7}< >{8}< [entry] [rendered] - > ./ main - [8] ./index.js 147 bytes {9} [built] - chunk {10} default/a.js (a) 216 bytes >{2}< >{4}< [entry] [rendered] - > ./a a - [0] ./d.js 20 bytes {1} {10} {11} {12} [built] - [1] ./node_modules/x.js 20 bytes {0} {10} {11} {12} [built] - [3] ./node_modules/y.js 20 bytes {3} {10} {11} [built] - [7] ./a.js + 1 modules 156 bytes {5} {10} [built] - | ./a.js 121 bytes [built] - | ./e.js 20 bytes [built] - chunk {11} default/b.js (b) 152 bytes [entry] [rendered] - > ./b b - [0] ./d.js 20 bytes {1} {10} {11} {12} [built] - [1] ./node_modules/x.js 20 bytes {0} {10} {11} {12} [built] - [2] ./f.js 20 bytes {2} {11} {12} [built] - [3] ./node_modules/y.js 20 bytes {3} {10} {11} [built] - [5] ./b.js 72 bytes {6} {11} [built] - chunk {12} default/c.js (c) 152 bytes [entry] [rendered] - > ./c c - [0] ./d.js 20 bytes {1} {10} {11} {12} [built] - [1] ./node_modules/x.js 20 bytes {0} {10} {11} {12} [built] - [2] ./f.js 20 bytes {2} {11} {12} [built] - [4] ./node_modules/z.js 20 bytes {8} {12} [built] - [6] ./c.js 72 bytes {7} {12} [built] -Child all-chunks: - Entrypoint main = default/main.js - Entrypoint a = default/vendors~a~async-a~async-b~async-c~b~c.js default/vendors~a~async-a~async-b~b.js default/a.js - Entrypoint b = default/vendors~a~async-a~async-b~async-c~b~c.js default/vendors~a~async-a~async-b~b.js default/b.js - Entrypoint c = default/vendors~a~async-a~async-b~async-c~b~c.js default/vendors~async-c~c.js default/c.js - chunk {0} default/vendors~a~async-a~async-b~async-c~b~c.js (vendors~a~async-a~async-b~async-c~b~c) 20 bytes <{9}> ={1}= ={10}= ={11}= ={12}= ={2}= ={3}= ={4}= ={6}= ={7}= ={8}= >{2}< >{5}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~a~async-a~async-b~async-c~b~c) - > ./a a - > ./b b - > ./c c - > ./a [8] ./index.js 1:0-47 - > ./b [8] ./index.js 2:0-47 - > ./c [8] ./index.js 3:0-47 - [2] ./node_modules/x.js 20 bytes {0} [built] - chunk {1} default/a~async-a~async-b~async-c~b~c.js (a~async-a~async-b~async-c~b~c) 20 bytes <{9}> ={0}= ={2}= ={3}= ={4}= ={6}= ={7}= ={8}= >{2}< >{5}< [rendered] split chunk (cache group: default) (name: a~async-a~async-b~async-c~b~c) - > ./a [8] ./index.js 1:0-47 - > ./b [8] ./index.js 2:0-47 - > ./c [8] ./index.js 3:0-47 - [0] ./d.js 20 bytes {1} {10} {11} {12} [built] - chunk {2} default/async-b~async-c~async-g~b~c.js (async-b~async-c~async-g~b~c) 20 bytes <{0}> <{1}> <{10}> <{3}> <{8}> <{9}> ={0}= ={1}= ={3}= ={4}= ={5}= ={6}= ={7}= [rendered] split chunk (cache group: default) (name: async-b~async-c~async-g~b~c) - > ./g [] 6:0-47 - > ./g [] 6:0-47 - > ./b [8] ./index.js 2:0-47 - > ./c [8] ./index.js 3:0-47 - [1] ./f.js 20 bytes {2} {11} {12} [built] - chunk {3} default/vendors~a~async-a~async-b~b.js (vendors~a~async-a~async-b~b) 20 bytes <{9}> ={0}= ={1}= ={10}= ={11}= ={2}= ={6}= ={8}= >{2}< >{5}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~a~async-a~async-b~b) - > ./a a - > ./b b - > ./a [8] ./index.js 1:0-47 - > ./b [8] ./index.js 2:0-47 - [3] ./node_modules/y.js 20 bytes {3} [built] - chunk {4} default/vendors~async-c~c.js (vendors~async-c~c) 20 bytes <{9}> ={0}= ={1}= ={12}= ={2}= ={7}= [initial] [rendered] split chunk (cache group: vendors) (name: vendors~async-c~c) - > ./c c - > ./c [8] ./index.js 3:0-47 - [7] ./node_modules/z.js 20 bytes {4} [built] - chunk {5} default/async-g.js (async-g) 34 bytes <{0}> <{1}> <{10}> <{3}> <{8}> ={2}= [rendered] - > ./g [] 6:0-47 - > ./g [] 6:0-47 - [9] ./g.js 34 bytes {5} [built] - chunk {6} default/async-b.js (async-b) 72 bytes <{9}> ={0}= ={1}= ={2}= ={3}= [rendered] - > ./b [8] ./index.js 2:0-47 - [4] ./b.js 72 bytes {6} {11} [built] - chunk {7} default/async-c.js (async-c) 72 bytes <{9}> ={0}= ={1}= ={2}= ={4}= [rendered] - > ./c [8] ./index.js 3:0-47 - [5] ./c.js 72 bytes {7} {12} [built] - chunk {8} default/a~async-a.js (a~async-a) 156 bytes <{9}> ={0}= ={1}= ={3}= >{2}< >{5}< [rendered] split chunk (cache group: default) (name: a~async-a) - > ./a [8] ./index.js 1:0-47 - [6] ./a.js + 1 modules 156 bytes {8} {10} [built] - | ./a.js 121 bytes [built] - | ./e.js 20 bytes [built] - chunk {9} default/main.js (main) 147 bytes >{0}< >{1}< >{2}< >{3}< >{4}< >{6}< >{7}< >{8}< [entry] [rendered] - > ./ main - [8] ./index.js 147 bytes {9} [built] - chunk {10} default/a.js (a) 176 bytes ={0}= ={3}= >{2}< >{5}< [entry] [rendered] - > ./a a - [0] ./d.js 20 bytes {1} {10} {11} {12} [built] - [6] ./a.js + 1 modules 156 bytes {8} {10} [built] - | ./a.js 121 bytes [built] - | ./e.js 20 bytes [built] - chunk {11} default/b.js (b) 112 bytes ={0}= ={3}= [entry] [rendered] - > ./b b - [0] ./d.js 20 bytes {1} {10} {11} {12} [built] - [1] ./f.js 20 bytes {2} {11} {12} [built] - [4] ./b.js 72 bytes {6} {11} [built] - chunk {12} default/c.js (c) 112 bytes ={0}= ={4}= [entry] [rendered] - > ./c c - [0] ./d.js 20 bytes {1} {10} {11} {12} [built] - [1] ./f.js 20 bytes {2} {11} {12} [built] - [5] ./c.js 72 bytes {7} {12} [built] -Child manual: - Entrypoint main = default/main.js - Entrypoint a = default/vendors.js default/a.js - Entrypoint b = default/vendors.js default/b.js - Entrypoint c = default/vendors.js default/c.js - chunk {0} default/vendors.js (vendors) 112 bytes <{5}> ={2}= ={3}= ={4}= ={6}= ={7}= ={8}= >{1}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors) - > ./a a - > ./b b - > ./c c - > ./a [8] ./index.js 1:0-47 - > ./b [8] ./index.js 2:0-47 - > ./c [8] ./index.js 3:0-47 - [2] ./node_modules/x.js 20 bytes {0} [built] - [3] ./node_modules/y.js 20 bytes {0} [built] - [6] ./node_modules/z.js 20 bytes {0} [built] - [10] multi x y z 52 bytes {0} [built] - chunk {1} default/async-g.js (async-g) 54 bytes <{0}> <{2}> <{6}> [rendered] - > ./g [] 6:0-47 - > ./g [] 6:0-47 - [1] ./f.js 20 bytes {1} {3} {4} {7} {8} [built] - [9] ./g.js 34 bytes {1} [built] - chunk {2} default/async-a.js (async-a) 176 bytes <{5}> ={0}= >{1}< [rendered] - > ./a [8] ./index.js 1:0-47 - [0] ./d.js 20 bytes {2} {3} {4} {6} {7} {8} [built] - [7] ./a.js + 1 modules 156 bytes {2} {6} [built] - | ./a.js 121 bytes [built] - | ./e.js 20 bytes [built] - chunk {3} default/async-b.js (async-b) 112 bytes <{5}> ={0}= [rendered] - > ./b [8] ./index.js 2:0-47 - [0] ./d.js 20 bytes {2} {3} {4} {6} {7} {8} [built] - [1] ./f.js 20 bytes {1} {3} {4} {7} {8} [built] - [4] ./b.js 72 bytes {3} {7} [built] - chunk {4} default/async-c.js (async-c) 112 bytes <{5}> ={0}= [rendered] - > ./c [8] ./index.js 3:0-47 - [0] ./d.js 20 bytes {2} {3} {4} {6} {7} {8} [built] - [1] ./f.js 20 bytes {1} {3} {4} {7} {8} [built] - [5] ./c.js 72 bytes {4} {8} [built] - chunk {5} default/main.js (main) 147 bytes >{0}< >{2}< >{3}< >{4}< [entry] [rendered] - > ./ main - [8] ./index.js 147 bytes {5} [built] - chunk {6} default/a.js (a) 176 bytes ={0}= >{1}< [entry] [rendered] - > ./a a - [0] ./d.js 20 bytes {2} {3} {4} {6} {7} {8} [built] - [7] ./a.js + 1 modules 156 bytes {2} {6} [built] - | ./a.js 121 bytes [built] - | ./e.js 20 bytes [built] - chunk {7} default/b.js (b) 112 bytes ={0}= [entry] [rendered] - > ./b b - [0] ./d.js 20 bytes {2} {3} {4} {6} {7} {8} [built] - [1] ./f.js 20 bytes {1} {3} {4} {7} {8} [built] - [4] ./b.js 72 bytes {3} {7} [built] - chunk {8} default/c.js (c) 112 bytes ={0}= [entry] [rendered] - > ./c c - [0] ./d.js 20 bytes {2} {3} {4} {6} {7} {8} [built] - [1] ./f.js 20 bytes {1} {3} {4} {7} {8} [built] - [5] ./c.js 72 bytes {4} {8} [built] -Child name-too-long: - Entrypoint main = main.js - Entrypoint aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccc~50ebc41f.js vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.js aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.js - Entrypoint bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb = vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccc~50ebc41f.js vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.js bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.js - Entrypoint cccccccccccccccccccccccccccccc = vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccc~50ebc41f.js vendors~async-c~cccccccccccccccccccccccccccccc.js cccccccccccccccccccccccccccccc.js - chunk {0} vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccc~50ebc41f.js (vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccc~50ebc41f) 20 bytes <{9}> ={1}= ={10}= ={11}= ={12}= ={2}= ={3}= ={4}= ={6}= ={7}= ={8}= >{2}< >{5}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccc~50ebc41f) - > ./a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - > ./b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb - > ./c cccccccccccccccccccccccccccccc - > ./a [8] ./index.js 1:0-47 - > ./b [8] ./index.js 2:0-47 - > ./c [8] ./index.js 3:0-47 - [2] ./node_modules/x.js 20 bytes {0} [built] - chunk {1} aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccccccccccc~18066793.js (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccccccccccc~18066793) 20 bytes <{9}> ={0}= ={2}= ={3}= ={4}= ={6}= ={7}= ={8}= >{2}< >{5}< [rendered] split chunk (cache group: default) (name: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccccccccccc~18066793) - > ./a [8] ./index.js 1:0-47 - > ./b [8] ./index.js 2:0-47 - > ./c [8] ./index.js 3:0-47 - [0] ./d.js 20 bytes {1} {10} {11} {12} [built] - chunk {2} async-b~async-c~async-g~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccccccccccccccccccccccccccc.js (async-b~async-c~async-g~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccccccccccccccccccccccccccc) 20 bytes <{0}> <{1}> <{10}> <{3}> <{8}> <{9}> ={0}= ={1}= ={3}= ={4}= ={5}= ={6}= ={7}= [rendered] split chunk (cache group: default) (name: async-b~async-c~async-g~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccccccccccccccccccccccccccc) - > ./g [] 6:0-47 - > ./g [] 6:0-47 - > ./b [8] ./index.js 2:0-47 - > ./c [8] ./index.js 3:0-47 - [1] ./f.js 20 bytes {2} {11} {12} [built] - chunk {3} vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.js (vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb) 20 bytes <{9}> ={0}= ={1}= ={10}= ={11}= ={2}= ={6}= ={8}= >{2}< >{5}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb) - > ./a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - > ./b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb - > ./a [8] ./index.js 1:0-47 - > ./b [8] ./index.js 2:0-47 - [3] ./node_modules/y.js 20 bytes {3} [built] - chunk {4} vendors~async-c~cccccccccccccccccccccccccccccc.js (vendors~async-c~cccccccccccccccccccccccccccccc) 20 bytes <{9}> ={0}= ={1}= ={12}= ={2}= ={7}= [initial] [rendered] split chunk (cache group: vendors) (name: vendors~async-c~cccccccccccccccccccccccccccccc) - > ./c cccccccccccccccccccccccccccccc - > ./c [8] ./index.js 3:0-47 - [7] ./node_modules/z.js 20 bytes {4} [built] - chunk {5} async-g.js (async-g) 34 bytes <{0}> <{1}> <{10}> <{3}> <{8}> ={2}= [rendered] - > ./g [] 6:0-47 - > ./g [] 6:0-47 - [9] ./g.js 34 bytes {5} [built] - chunk {6} async-b.js (async-b) 72 bytes <{9}> ={0}= ={1}= ={2}= ={3}= [rendered] - > ./b [8] ./index.js 2:0-47 - [4] ./b.js 72 bytes {6} {11} [built] - chunk {7} async-c.js (async-c) 72 bytes <{9}> ={0}= ={1}= ={2}= ={4}= [rendered] - > ./c [8] ./index.js 3:0-47 - [5] ./c.js 72 bytes {7} {12} [built] - chunk {8} aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a.js (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a) 156 bytes <{9}> ={0}= ={1}= ={3}= >{2}< >{5}< [rendered] split chunk (cache group: default) (name: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a) - > ./a [8] ./index.js 1:0-47 - [6] ./a.js + 1 modules 156 bytes {8} {10} [built] - | ./a.js 121 bytes [built] - | ./e.js 20 bytes [built] - chunk {9} main.js (main) 147 bytes >{0}< >{1}< >{2}< >{3}< >{4}< >{6}< >{7}< >{8}< [entry] [rendered] - > ./ main - [8] ./index.js 147 bytes {9} [built] - chunk {10} aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.js (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) 176 bytes ={0}= ={3}= >{2}< >{5}< [entry] [rendered] - > ./a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - [0] ./d.js 20 bytes {1} {10} {11} {12} [built] - [6] ./a.js + 1 modules 156 bytes {8} {10} [built] - | ./a.js 121 bytes [built] - | ./e.js 20 bytes [built] - chunk {11} bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.js (bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb) 112 bytes ={0}= ={3}= [entry] [rendered] - > ./b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb - [0] ./d.js 20 bytes {1} {10} {11} {12} [built] - [1] ./f.js 20 bytes {2} {11} {12} [built] - [4] ./b.js 72 bytes {6} {11} [built] - chunk {12} cccccccccccccccccccccccccccccc.js (cccccccccccccccccccccccccccccc) 112 bytes ={0}= ={4}= [entry] [rendered] - > ./c cccccccccccccccccccccccccccccc - [0] ./d.js 20 bytes {1} {10} {11} {12} [built] - [1] ./f.js 20 bytes {2} {11} {12} [built] - [5] ./c.js 72 bytes {7} {12} [built] -Child custom-chunks-filter: - Entrypoint main = default/main.js - Entrypoint a = default/a.js - Entrypoint b = default/vendors~async-a~async-b~async-c~b~c.js default/vendors~async-a~async-b~b.js default/b.js - Entrypoint c = default/vendors~async-a~async-b~async-c~b~c.js default/vendors~async-c~c.js default/c.js - chunk {0} default/vendors~async-a~async-b~async-c~b~c.js (vendors~async-a~async-b~async-c~b~c) 20 bytes <{9}> ={1}= ={11}= ={12}= ={2}= ={3}= ={4}= ={6}= ={7}= ={8}= >{2}< >{5}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~async-a~async-b~async-c~b~c) - > ./b b - > ./c c - > ./a [8] ./index.js 1:0-47 - > ./b [8] ./index.js 2:0-47 - > ./c [8] ./index.js 3:0-47 - [2] ./node_modules/x.js 20 bytes {0} {10} [built] - chunk {1} default/async-a~async-b~async-c~b~c.js (async-a~async-b~async-c~b~c) 20 bytes <{9}> ={0}= ={2}= ={3}= ={4}= ={6}= ={7}= ={8}= >{2}< >{5}< [rendered] split chunk (cache group: default) (name: async-a~async-b~async-c~b~c) - > ./a [8] ./index.js 1:0-47 - > ./b [8] ./index.js 2:0-47 - > ./c [8] ./index.js 3:0-47 - [0] ./d.js 20 bytes {1} {10} {11} {12} [built] - chunk {2} default/async-b~async-c~async-g~b~c.js (async-b~async-c~async-g~b~c) 20 bytes <{0}> <{1}> <{10}> <{3}> <{6}> <{9}> ={0}= ={1}= ={3}= ={4}= ={5}= ={7}= ={8}= [rendered] split chunk (cache group: default) (name: async-b~async-c~async-g~b~c) - > ./g [] 6:0-47 - > ./g [] 6:0-47 - > ./b [8] ./index.js 2:0-47 - > ./c [8] ./index.js 3:0-47 - [1] ./f.js 20 bytes {2} {11} {12} [built] - chunk {3} default/vendors~async-a~async-b~b.js (vendors~async-a~async-b~b) 20 bytes <{9}> ={0}= ={1}= ={11}= ={2}= ={6}= ={7}= >{2}< >{5}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~async-a~async-b~b) - > ./b b - > ./a [8] ./index.js 1:0-47 - > ./b [8] ./index.js 2:0-47 - [3] ./node_modules/y.js 20 bytes {3} {10} [built] - chunk {4} default/vendors~async-c~c.js (vendors~async-c~c) 20 bytes <{9}> ={0}= ={1}= ={12}= ={2}= ={8}= [initial] [rendered] split chunk (cache group: vendors) (name: vendors~async-c~c) - > ./c c - > ./c [8] ./index.js 3:0-47 - [7] ./node_modules/z.js 20 bytes {4} [built] - chunk {5} default/async-g.js (async-g) 34 bytes <{0}> <{1}> <{10}> <{3}> <{6}> ={2}= [rendered] - > ./g [] 6:0-47 - > ./g [] 6:0-47 - [9] ./g.js 34 bytes {5} [built] - chunk {6} default/async-a.js (async-a) 156 bytes <{9}> ={0}= ={1}= ={3}= >{2}< >{5}< [rendered] - > ./a [8] ./index.js 1:0-47 - [6] ./a.js + 1 modules 156 bytes {6} {10} [built] - | ./a.js 121 bytes [built] - | ./e.js 20 bytes [built] - chunk {7} default/async-b.js (async-b) 72 bytes <{9}> ={0}= ={1}= ={2}= ={3}= [rendered] - > ./b [8] ./index.js 2:0-47 - [4] ./b.js 72 bytes {7} {11} [built] - chunk {8} default/async-c.js (async-c) 72 bytes <{9}> ={0}= ={1}= ={2}= ={4}= [rendered] - > ./c [8] ./index.js 3:0-47 - [5] ./c.js 72 bytes {8} {12} [built] - chunk {9} default/main.js (main) 147 bytes >{0}< >{1}< >{2}< >{3}< >{4}< >{6}< >{7}< >{8}< [entry] [rendered] - > ./ main - [8] ./index.js 147 bytes {9} [built] - chunk {10} default/a.js (a) 216 bytes >{2}< >{5}< [entry] [rendered] - > ./a a - [0] ./d.js 20 bytes {1} {10} {11} {12} [built] - [2] ./node_modules/x.js 20 bytes {0} {10} [built] - [3] ./node_modules/y.js 20 bytes {3} {10} [built] - [6] ./a.js + 1 modules 156 bytes {6} {10} [built] - | ./a.js 121 bytes [built] - | ./e.js 20 bytes [built] - chunk {11} default/b.js (b) 112 bytes ={0}= ={3}= [entry] [rendered] - > ./b b - [0] ./d.js 20 bytes {1} {10} {11} {12} [built] - [1] ./f.js 20 bytes {2} {11} {12} [built] - [4] ./b.js 72 bytes {7} {11} [built] - chunk {12} default/c.js (c) 112 bytes ={0}= ={4}= [entry] [rendered] - > ./c c - [0] ./d.js 20 bytes {1} {10} {11} {12} [built] - [1] ./f.js 20 bytes {2} {11} {12} [built] - [5] ./c.js 72 bytes {8} {12} [built] -Child custom-chunks-filter-in-cache-groups: - Entrypoint main = default/main.js - Entrypoint a = default/a.js - Entrypoint b = default/vendors.js default/b.js - Entrypoint c = default/vendors.js default/c.js - chunk {0} default/vendors.js (vendors) 112 bytes <{5}> ={2}= ={3}= ={4}= ={7}= ={8}= >{1}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors) - > ./b b - > ./c c - > ./a [8] ./index.js 1:0-47 - > ./b [8] ./index.js 2:0-47 - > ./c [8] ./index.js 3:0-47 - [2] ./node_modules/x.js 20 bytes {0} {6} [built] - [3] ./node_modules/y.js 20 bytes {0} {6} [built] - [6] ./node_modules/z.js 20 bytes {0} [built] - [10] multi x y z 52 bytes {0} [built] - chunk {1} default/async-g.js (async-g) 54 bytes <{0}> <{2}> <{6}> [rendered] - > ./g [] 6:0-47 - > ./g [] 6:0-47 - [1] ./f.js 20 bytes {1} {3} {4} {7} {8} [built] - [9] ./g.js 34 bytes {1} [built] - chunk {2} default/async-a.js (async-a) 176 bytes <{5}> ={0}= >{1}< [rendered] - > ./a [8] ./index.js 1:0-47 - [0] ./d.js 20 bytes {2} {3} {4} {6} {7} {8} [built] - [7] ./a.js + 1 modules 156 bytes {2} {6} [built] - | ./a.js 121 bytes [built] - | ./e.js 20 bytes [built] - chunk {3} default/async-b.js (async-b) 112 bytes <{5}> ={0}= [rendered] - > ./b [8] ./index.js 2:0-47 - [0] ./d.js 20 bytes {2} {3} {4} {6} {7} {8} [built] - [1] ./f.js 20 bytes {1} {3} {4} {7} {8} [built] - [4] ./b.js 72 bytes {3} {7} [built] - chunk {4} default/async-c.js (async-c) 112 bytes <{5}> ={0}= [rendered] - > ./c [8] ./index.js 3:0-47 - [0] ./d.js 20 bytes {2} {3} {4} {6} {7} {8} [built] - [1] ./f.js 20 bytes {1} {3} {4} {7} {8} [built] - [5] ./c.js 72 bytes {4} {8} [built] - chunk {5} default/main.js (main) 147 bytes >{0}< >{2}< >{3}< >{4}< [entry] [rendered] - > ./ main - [8] ./index.js 147 bytes {5} [built] - chunk {6} default/a.js (a) 216 bytes >{1}< [entry] [rendered] - > ./a a - [0] ./d.js 20 bytes {2} {3} {4} {6} {7} {8} [built] - [2] ./node_modules/x.js 20 bytes {0} {6} [built] - [3] ./node_modules/y.js 20 bytes {0} {6} [built] - [7] ./a.js + 1 modules 156 bytes {2} {6} [built] - | ./a.js 121 bytes [built] - | ./e.js 20 bytes [built] - chunk {7} default/b.js (b) 112 bytes ={0}= [entry] [rendered] - > ./b b - [0] ./d.js 20 bytes {2} {3} {4} {6} {7} {8} [built] - [1] ./f.js 20 bytes {1} {3} {4} {7} {8} [built] - [4] ./b.js 72 bytes {3} {7} [built] - chunk {8} default/c.js (c) 112 bytes ={0}= [entry] [rendered] - > ./c c - [0] ./d.js 20 bytes {2} {3} {4} {6} {7} {8} [built] - [1] ./f.js 20 bytes {1} {3} {4} {7} {8} [built] - [5] ./c.js 72 bytes {4} {8} [built] \ No newline at end of file diff --git a/test/statsCases/split-chunks/webpack.config.js b/test/statsCases/split-chunks/webpack.config.js index f69088f4c98..5172e72b58f 100644 --- a/test/statsCases/split-chunks/webpack.config.js +++ b/test/statsCases/split-chunks/webpack.config.js @@ -94,6 +94,7 @@ module.exports = [ optimization: { splitChunks: { minSize: 0, + maxInitialRequests: Infinity, chunks: "all" } }, diff --git a/test/statsCases/tree-shaking/expected.txt b/test/statsCases/tree-shaking/expected.txt deleted file mode 100644 index 8e593d527c8..00000000000 --- a/test/statsCases/tree-shaking/expected.txt +++ /dev/null @@ -1,34 +0,0 @@ -Hash: 6877ac726b04eb5d7985 -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names -bundle.js 7.27 KiB 0 [emitted] main -Entrypoint main = bundle.js - [0] ./a.js 13 bytes {0} [built] - [exports: a] - [all exports used] - [1] ./b.js 13 bytes {0} [built] - [exports: b] - [no exports used] - [2] ./unknown.js 0 bytes {0} [built] - [only some exports used: c] - [3] ./unknown2.js 0 bytes {0} [built] - [only some exports used: y] - [4] ./index.js 315 bytes {0} [built] - [no exports] - [5] ./require.include.js 36 bytes {0} [built] - [exports: a, default] - [no exports used] - [6] ./reexport-known.js 49 bytes {0} [built] - [exports: a, b] - [only some exports used: a] - [7] ./reexport-star-known.js 41 bytes {0} [built] - [exports: a, b] - [only some exports used: a] - [8] ./edge.js 45 bytes {0} [built] - [only some exports used: y] - [9] ./reexport-unknown.js 83 bytes {0} [built] - [exports: a, b, c, d] - [only some exports used: a, c] -[10] ./reexport-star-unknown.js 68 bytes {0} [built] - [only some exports used: a, c] \ No newline at end of file diff --git a/test/statsCases/warnings-uglifyjs/expected.txt b/test/statsCases/warnings-uglifyjs/expected.txt deleted file mode 100644 index 41e24319dfc..00000000000 --- a/test/statsCases/warnings-uglifyjs/expected.txt +++ /dev/null @@ -1,16 +0,0 @@ -Hash: 5f08c421d55ae2ad3d0e -Time: Xms -Built at: Thu Jan 01 1970 00:00:00 GMT - Asset Size Chunks Chunk Names -bundle.js 2.19 KiB 0 [emitted] main -Entrypoint main = bundle.js -[0] ./index.js 299 bytes {0} [built] -[1] ./a.js 249 bytes {0} [built] -[2] (webpack)/buildin/module.js 497 bytes {0} [built] - -WARNING in bundle.js from UglifyJs -Dropping unused function someUnRemoteUsedFunction1 [./a.js:3,0] -Dropping unused function someUnRemoteUsedFunction2 [./a.js:4,0] -Dropping unused function someUnRemoteUsedFunction3 [./a.js:5,0] -Dropping unused function someUnRemoteUsedFunction4 [./a.js:6,0] -Dropping unused function someUnRemoteUsedFunction5 [./a.js:7,0] \ No newline at end of file diff --git a/test/watchCases/cache/child-compilation-cache/0/index.js b/test/watchCases/cache/child-compilation-cache/0/index.js index ff83fe133be..20702978cd2 100644 --- a/test/watchCases/cache/child-compilation-cache/0/index.js +++ b/test/watchCases/cache/child-compilation-cache/0/index.js @@ -2,13 +2,13 @@ it("should use correct caches in compilation and child compilations", function() var x = require("./report-cache-counters-loader!./changing-file"); switch(WATCH_STEP) { case "0": - x.should.be.eql([1, 1]); + expect(x).toEqual([1, 1]); break; case "1": - x.should.be.eql([2, 1]); + expect(x).toEqual([2, 1]); break; case "2": - x.should.be.eql([3, 2]); + expect(x).toEqual([3, 2]); break; default: throw new Error("Not handled step"); diff --git a/test/watchCases/context/delete-in-context/0/index.js b/test/watchCases/context/delete-in-context/0/index.js index c6636e73659..329d5b1af9e 100644 --- a/test/watchCases/context/delete-in-context/0/index.js +++ b/test/watchCases/context/delete-in-context/0/index.js @@ -1,4 +1,4 @@ it("should detect changes in a context", function() { var context = require.context("./directory"); - context.keys().length.should.be.eql((+WATCH_STEP) % 3 * 2); + expect(context.keys().length).toBe((+WATCH_STEP) % 3 * 2); }); diff --git a/test/watchCases/parsing/caching-harmony/0/index.js b/test/watchCases/parsing/caching-harmony/0/index.js index d14e2bd24d7..b03dc33d8b1 100644 --- a/test/watchCases/parsing/caching-harmony/0/index.js +++ b/test/watchCases/parsing/caching-harmony/0/index.js @@ -2,13 +2,13 @@ import m from "./module"; import cm from "./changing-module"; it("should flag harmony modules correctly", function() { - m.should.be.eql("module" + WATCH_STEP); + expect(m).toBe("module" + WATCH_STEP); switch(WATCH_STEP) { case "0": - cm.should.be.eql("original"); + expect(cm).toBe("original"); break; case "1": - cm.should.be.eql("change"); + expect(cm).toBe("change"); break; } }); diff --git a/test/watchCases/parsing/switching-harmony/0/index.js b/test/watchCases/parsing/switching-harmony/0/index.js index 757a543f778..fedfe818ba5 100644 --- a/test/watchCases/parsing/switching-harmony/0/index.js +++ b/test/watchCases/parsing/switching-harmony/0/index.js @@ -4,20 +4,20 @@ import ch from "./ch"; import cc from "./cc"; it("should flag modules correctly", function() { - hh.should.be.eql("hh" + WATCH_STEP); - cc.should.be.eql("cc" + WATCH_STEP); - hc.should.be.eql("hc" + WATCH_STEP); - ch.should.be.eql("ch" + WATCH_STEP); - require("./hh").default.should.be.eql("hh" + WATCH_STEP); - require("./cc").should.be.eql("cc" + WATCH_STEP); + expect(hh).toBe("hh" + WATCH_STEP); + expect(cc).toBe("cc" + WATCH_STEP); + expect(hc).toBe("hc" + WATCH_STEP); + expect(ch).toBe("ch" + WATCH_STEP); + expect(require("./hh").default).toBe("hh" + WATCH_STEP); + expect(require("./cc")).toBe("cc" + WATCH_STEP); switch(WATCH_STEP) { case "0": - require("./hc").default.should.be.eql("hc0"); - require("./ch").should.be.eql("ch0"); + expect(require("./hc").default).toBe("hc0"); + expect(require("./ch")).toBe("ch0"); break; case "1": - require("./hc").should.be.eql("hc1"); - require("./ch").default.should.be.eql("ch1"); + expect(require("./hc")).toBe("hc1"); + expect(require("./ch").default).toBe("ch1"); break; } }); diff --git a/test/watchCases/plugins/automatic-prefetch-plugin/0/index.js b/test/watchCases/plugins/automatic-prefetch-plugin/0/index.js index 37be56141da..1af08ab64ad 100644 --- a/test/watchCases/plugins/automatic-prefetch-plugin/0/index.js +++ b/test/watchCases/plugins/automatic-prefetch-plugin/0/index.js @@ -1,7 +1,7 @@ it("should watch for changes", function() { - require("./foo/" + WATCH_STEP).should.be.eql('This is only a test.' + WATCH_STEP); + expect(require("./foo/" + WATCH_STEP)).toBe('This is only a test.' + WATCH_STEP); if(+WATCH_STEP > 0) { for(var m of STATS_JSON.modules.filter(m => /(a|b|c)\.js$/.test(m.identifier))) - m.prefetched.should.be.true(); + expect(m.prefetched).toBe(true); } }); diff --git a/test/watchCases/plugins/dll-reference-plugin/1/index.js b/test/watchCases/plugins/dll-reference-plugin/1/index.js index 4f865d5f49e..2bbc3fd550b 100644 --- a/test/watchCases/plugins/dll-reference-plugin/1/index.js +++ b/test/watchCases/plugins/dll-reference-plugin/1/index.js @@ -1,5 +1,5 @@ import value from "dll/module"; it("should have the correct default export", function() { - value.should.be.eql("ok"); + expect(value).toBe("ok"); }); diff --git a/test/watchCases/plugins/dll-reference-plugin/2/index.js b/test/watchCases/plugins/dll-reference-plugin/2/index.js index 0b849002c78..518aca8e325 100644 --- a/test/watchCases/plugins/dll-reference-plugin/2/index.js +++ b/test/watchCases/plugins/dll-reference-plugin/2/index.js @@ -1,5 +1,5 @@ import value from "dll/module"; it("should have still the correct default export", function() { - value.should.be.eql("ok"); + expect(value).toBe("ok"); }); diff --git a/test/watchCases/plugins/module-concatenation-plugin/0/index.js b/test/watchCases/plugins/module-concatenation-plugin/0/index.js index 0f584966674..43d5e57af72 100644 --- a/test/watchCases/plugins/module-concatenation-plugin/0/index.js +++ b/test/watchCases/plugins/module-concatenation-plugin/0/index.js @@ -1,13 +1,13 @@ it("should watch for changes", function() { if(WATCH_STEP === '0') { - require("./foo/" + WATCH_STEP).should.be.eql('This is only a test.' + WATCH_STEP); + expect(require("./foo/" + WATCH_STEP)).toBe('This is only a test.' + WATCH_STEP); } else if(WATCH_STEP === '1') { - require("./foo/" + WATCH_STEP).should.be.eql('This should be a test.' + WATCH_STEP); + expect(require("./foo/" + WATCH_STEP)).toBe('This should be a test.' + WATCH_STEP); } else if(WATCH_STEP === '2') { - require("./foo/" + WATCH_STEP).should.be.eql('This should be working.' + WATCH_STEP); + expect(require("./foo/" + WATCH_STEP)).toBe('This should be working.' + WATCH_STEP); } - STATS_JSON.modules.length.should.equal(4 + Number(WATCH_STEP)); + expect(STATS_JSON.modules.length).toBe(4 + Number(WATCH_STEP)); }); diff --git a/test/watchCases/plugins/watch-ignore-plugin/0/index.js b/test/watchCases/plugins/watch-ignore-plugin/0/index.js index 4de0349c5f9..d110535210d 100644 --- a/test/watchCases/plugins/watch-ignore-plugin/0/index.js +++ b/test/watchCases/plugins/watch-ignore-plugin/0/index.js @@ -2,7 +2,7 @@ import value from "./file" import a from "./a" const req = require.context("./foo", false, /^.*\.js$/); it("should ignore change to file and directory", function() { - a.should.be.eql(+WATCH_STEP); - req.keys().should.be.deepEqual(["./0.js"]) - value.should.be.eql(1); + expect(a).toBe(+WATCH_STEP); + expect(req.keys()).toEqual(["./0.js"]) + expect(value).toBe(1); }); diff --git a/test/watchCases/recover-from-error/missing-module/0/index.js b/test/watchCases/recover-from-error/missing-module/0/index.js index 43b4f56503b..7b32c665c17 100644 --- a/test/watchCases/recover-from-error/missing-module/0/index.js +++ b/test/watchCases/recover-from-error/missing-module/0/index.js @@ -1,12 +1,12 @@ it("should recover from missing module", function() { switch(WATCH_STEP) { case "0": - (function() { + expect(function() { require("some-module"); - }).should.throw(); + }).toThrow(); break; case "1": - require("some-module").should.be.eql("ok"); + expect(require("some-module")).toBe("ok"); break; } }); diff --git a/test/watchCases/runtime/dynamic-import/0/index.js b/test/watchCases/runtime/dynamic-import/0/index.js index 094d2819276..390ef4b3b9d 100644 --- a/test/watchCases/runtime/dynamic-import/0/index.js +++ b/test/watchCases/runtime/dynamic-import/0/index.js @@ -1,12 +1,12 @@ it("should change chunkhash of main chunk", function () { const mainChunk = STATS_JSON.chunks.find((chunk) => chunk.names.indexOf("main") !== -1); - (!mainChunk).should.be.false("Main chunk not found"); + expect(mainChunk).toBeDefined(); switch (WATCH_STEP) { case "0": STATE.hash = mainChunk.hash; break; case "1": - mainChunk.hash.should.be.not.eql(STATE.hash); + expect(mainChunk.hash).not.toBe(STATE.hash); break; } }); @@ -17,10 +17,10 @@ it("should load additional chunk", function() { .then((dynamic) => { switch (step) { case "0": - dynamic.default.should.be.eql("Normal"); + expect(dynamic.default).toBe("Normal"); break; case "1": - dynamic.default.should.be.eql("Changed"); + expect(dynamic.default).toBe("Changed"); break; } }); diff --git a/test/watchCases/runtime/static-import/0/index.js b/test/watchCases/runtime/static-import/0/index.js index da9c2eeeac6..8c54dc79808 100644 --- a/test/watchCases/runtime/static-import/0/index.js +++ b/test/watchCases/runtime/static-import/0/index.js @@ -1,26 +1,24 @@ -require("should"); - import * as both from './dynamic-and-static' import * as staticModule from './static' it("should not change chunkhash of manifest chunk", function () { const manifestChunk = STATS_JSON.chunks.find((chunk) => chunk.names.indexOf("runtime~main") !== -1); - (!manifestChunk).should.be.false("Main chunk not found"); + expect(!manifestChunk).toBe(false); switch (WATCH_STEP) { case "0": STATE.hash = manifestChunk.hash; - staticModule.should.be.eql("Normal"); - both.should.be.eql("Normal"); + expect(staticModule).toBe("Normal"); + expect(both).toBe("Normal"); break; case "1": - manifestChunk.hash.should.be.eql(STATE.hash); - staticModule.should.be.eql("Changed"); - both.should.be.eql("Normal"); + expect(manifestChunk.hash).toBe(STATE.hash); + expect(staticModule).toBe("Changed"); + expect(both).toBe("Normal"); break; case "2": - manifestChunk.hash.should.be.eql(STATE.hash); - staticModule.should.be.eql("Changed"); - both.should.be.eql("Changed"); + expect(manifestChunk.hash).toBe(STATE.hash); + expect(staticModule).toBe("Changed"); + expect(both).toBe("Changed"); break; } }); @@ -32,10 +30,10 @@ it("should load additional chunk", function() { switch (step) { case "0": case "1": - dynamic.default.should.be.eql("Normal"); + expect(dynamic.default).toBe("Normal"); break; case "2": - dynamic.default.should.be.eql("Changed"); + expect(dynamic.default).toBe("Changed"); break; } }); diff --git a/test/watchCases/scope-hoisting/caching-inner-source/0/index.js b/test/watchCases/scope-hoisting/caching-inner-source/0/index.js new file mode 100644 index 00000000000..38f90e9d0c7 --- /dev/null +++ b/test/watchCases/scope-hoisting/caching-inner-source/0/index.js @@ -0,0 +1,3 @@ +it("should not crash when scope-hoisted modules change", function() { + expect(require("./module").default).toBe(WATCH_STEP); +}); diff --git a/test/watchCases/scope-hoisting/caching-inner-source/0/inner.js b/test/watchCases/scope-hoisting/caching-inner-source/0/inner.js new file mode 100644 index 00000000000..42a6611012c --- /dev/null +++ b/test/watchCases/scope-hoisting/caching-inner-source/0/inner.js @@ -0,0 +1 @@ +export { x } from "./inner1"; diff --git a/test/watchCases/scope-hoisting/caching-inner-source/0/inner1.js b/test/watchCases/scope-hoisting/caching-inner-source/0/inner1.js new file mode 100644 index 00000000000..8effc5eb55c --- /dev/null +++ b/test/watchCases/scope-hoisting/caching-inner-source/0/inner1.js @@ -0,0 +1 @@ +export { x } from "./inner2"; diff --git a/test/watchCases/scope-hoisting/caching-inner-source/0/inner2.js b/test/watchCases/scope-hoisting/caching-inner-source/0/inner2.js new file mode 100644 index 00000000000..08a631832af --- /dev/null +++ b/test/watchCases/scope-hoisting/caching-inner-source/0/inner2.js @@ -0,0 +1 @@ +export var x = "0"; diff --git a/test/watchCases/scope-hoisting/caching-inner-source/0/module.js b/test/watchCases/scope-hoisting/caching-inner-source/0/module.js new file mode 100644 index 00000000000..77e0f5e7392 --- /dev/null +++ b/test/watchCases/scope-hoisting/caching-inner-source/0/module.js @@ -0,0 +1,3 @@ +import { x } from "./inner"; + +export default x; diff --git a/test/watchCases/scope-hoisting/caching-inner-source/1/inner1.js b/test/watchCases/scope-hoisting/caching-inner-source/1/inner1.js new file mode 100644 index 00000000000..6ac155423ea --- /dev/null +++ b/test/watchCases/scope-hoisting/caching-inner-source/1/inner1.js @@ -0,0 +1 @@ +export var x = "1"; diff --git a/test/watchCases/scope-hoisting/caching-inner-source/webpack.config.js b/test/watchCases/scope-hoisting/caching-inner-source/webpack.config.js new file mode 100644 index 00000000000..59e948b1212 --- /dev/null +++ b/test/watchCases/scope-hoisting/caching-inner-source/webpack.config.js @@ -0,0 +1,5 @@ +module.exports = { + optimization: { + concatenateModules: true + } +}; diff --git a/test/watchCases/side-effects/issue-7400/0/index.js b/test/watchCases/side-effects/issue-7400/0/index.js new file mode 100644 index 00000000000..d8337fc74ad --- /dev/null +++ b/test/watchCases/side-effects/issue-7400/0/index.js @@ -0,0 +1,6 @@ +import { doStuff } from "./require-me"; + +it("should compile correctly", () => { + expect(doStuff()).toEqual(42); + expect(WATCH_STEP).toEqual("0"); +}); \ No newline at end of file diff --git a/test/watchCases/side-effects/issue-7400/0/my-module/index.js b/test/watchCases/side-effects/issue-7400/0/my-module/index.js new file mode 100644 index 00000000000..f4cbd0d4ca1 --- /dev/null +++ b/test/watchCases/side-effects/issue-7400/0/my-module/index.js @@ -0,0 +1 @@ +export { default as myFunction } from './myFunction' diff --git a/test/watchCases/side-effects/issue-7400/0/my-module/myFunction.js b/test/watchCases/side-effects/issue-7400/0/my-module/myFunction.js new file mode 100644 index 00000000000..2433d166ffa --- /dev/null +++ b/test/watchCases/side-effects/issue-7400/0/my-module/myFunction.js @@ -0,0 +1,3 @@ +export default function myFunction() { + return 42; +} diff --git a/test/watchCases/side-effects/issue-7400/0/my-module/package.json b/test/watchCases/side-effects/issue-7400/0/my-module/package.json new file mode 100644 index 00000000000..6cb57d98708 --- /dev/null +++ b/test/watchCases/side-effects/issue-7400/0/my-module/package.json @@ -0,0 +1,4 @@ +{ + "module": "index.js", + "sideEffects": false +} diff --git a/test/watchCases/side-effects/issue-7400/0/require-me.js b/test/watchCases/side-effects/issue-7400/0/require-me.js new file mode 100644 index 00000000000..b2eaf2c6b3d --- /dev/null +++ b/test/watchCases/side-effects/issue-7400/0/require-me.js @@ -0,0 +1,5 @@ +import { myFunction } from "./my-module"; + +export function doStuff() { + return myFunction(); +} diff --git a/test/watchCases/side-effects/issue-7400/1/index.js b/test/watchCases/side-effects/issue-7400/1/index.js new file mode 100644 index 00000000000..080df54a9c0 --- /dev/null +++ b/test/watchCases/side-effects/issue-7400/1/index.js @@ -0,0 +1,6 @@ +import { doStuff } from "./require-me"; + +it("should compile correctly", () => { + expect(doStuff()).toEqual(42); + expect(WATCH_STEP).toEqual("1"); +}); \ No newline at end of file diff --git a/test/watchCases/side-effects/issue-7400/webpack.config.js b/test/watchCases/side-effects/issue-7400/webpack.config.js new file mode 100644 index 00000000000..2bd35aa7c7e --- /dev/null +++ b/test/watchCases/side-effects/issue-7400/webpack.config.js @@ -0,0 +1,5 @@ +module.exports = { + optimization: { + sideEffects: true + } +}; diff --git a/test/watchCases/simple/multi-compiler/0/index.js b/test/watchCases/simple/multi-compiler/0/index.js index c156142d16c..97de35344db 100644 --- a/test/watchCases/simple/multi-compiler/0/index.js +++ b/test/watchCases/simple/multi-compiler/0/index.js @@ -2,10 +2,10 @@ require("./changing-file") it("should watch for changes", function() { switch(WATCH_STEP) { case "0": - STATS_JSON.children.should.have.size(2); + expect(STATS_JSON.children).toHaveLength(2); break; case "1": - STATS_JSON.children.should.have.size(1); + expect(STATS_JSON.children).toHaveLength(1); break; } }) diff --git a/test/watchCases/simple/simple/0/index.js b/test/watchCases/simple/simple/0/index.js index 3069c8ecb36..3f40c870cd0 100644 --- a/test/watchCases/simple/simple/0/index.js +++ b/test/watchCases/simple/simple/0/index.js @@ -1,3 +1,3 @@ it("should watch for changes", function() { - require("./changing-file").should.be.eql(WATCH_STEP); + expect(require("./changing-file")).toBe(WATCH_STEP); }) diff --git a/test/watchCases/warnings/warnings-contribute-to-hash/0/index.js b/test/watchCases/warnings/warnings-contribute-to-hash/0/index.js index 3dc8434b961..b79d0891b2d 100644 --- a/test/watchCases/warnings/warnings-contribute-to-hash/0/index.js +++ b/test/watchCases/warnings/warnings-contribute-to-hash/0/index.js @@ -6,7 +6,7 @@ it("should detect a change on warnings change", function() { STATE.hash = STATS_JSON.hash; break; case "1": - STATS_JSON.hash.should.be.not.eql(STATE.hash); + expect(STATS_JSON.hash).not.toBe(STATE.hash); break; } }); diff --git a/test/watchCases/wasm/caching/0/index.js b/test/watchCases/wasm/caching/0/index.js new file mode 100644 index 00000000000..21268193d5d --- /dev/null +++ b/test/watchCases/wasm/caching/0/index.js @@ -0,0 +1,18 @@ +it("should allow to run a WebAssembly module with imports", function() { + return import("./wasm.wasm").then(function(wasm) { + const result = wasm.get(); + switch(WATCH_STEP) { + case "0": + expect(result).toEqual(9); + break; + case "1": + expect(result).toEqual(10); + break; + case "2": + expect(result).toEqual(42); + break; + default: + throw new Error("should not happen"); + } + }); +}); diff --git a/test/watchCases/wasm/caching/0/module.js b/test/watchCases/wasm/caching/0/module.js new file mode 100644 index 00000000000..7eaa835a37c --- /dev/null +++ b/test/watchCases/wasm/caching/0/module.js @@ -0,0 +1,3 @@ +export function getNumber() { + return 8; +} diff --git a/test/watchCases/wasm/caching/0/wasm.wasm b/test/watchCases/wasm/caching/0/wasm.wasm new file mode 100644 index 00000000000..2ff39aa41da Binary files /dev/null and b/test/watchCases/wasm/caching/0/wasm.wasm differ diff --git a/test/watchCases/wasm/caching/1/wasm.wasm b/test/watchCases/wasm/caching/1/wasm.wasm new file mode 100644 index 00000000000..01620183155 Binary files /dev/null and b/test/watchCases/wasm/caching/1/wasm.wasm differ diff --git a/test/watchCases/wasm/caching/2/module.js b/test/watchCases/wasm/caching/2/module.js new file mode 100644 index 00000000000..bc5c5b2f2dd --- /dev/null +++ b/test/watchCases/wasm/caching/2/module.js @@ -0,0 +1,3 @@ +export function getNumber() { + return 40; +} diff --git a/test/watchCases/wasm/caching/test.filter.js b/test/watchCases/wasm/caching/test.filter.js new file mode 100644 index 00000000000..23177349638 --- /dev/null +++ b/test/watchCases/wasm/caching/test.filter.js @@ -0,0 +1,5 @@ +var supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); + +module.exports = function(config) { + return supportsWebAssembly(); +}; diff --git a/tsconfig.json b/tsconfig.json index 7b8aa3fe974..c55aa8145a3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,7 @@ /* Basic Options */ "target": "ES2017", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "lib": ["es2017", "dom"], /* Specify library files to be included in the compilation. */ + "lib": ["es2017", "dom"], /* Specify library files to be included in the compilation. */ "allowJs": true, /* Allow javascript files to be compiled. */ "checkJs": true, /* Report errors in .js files. */ // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ @@ -22,10 +22,10 @@ "strict": false, /* Enable all strict type-checking options. */ // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + "strictFunctionTypes": true, /* Enable strict checking of function types. */ // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ /* Additional Checks */ // "noUnusedLocals": true, /* Report errors on unused locals. */ diff --git a/yarn.lock b/yarn.lock index 36e26be25b9..6ba485decb3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,13 +2,177 @@ # yarn lockfile v1 +"@babel/code-frame@^7.0.0-beta.35": + version "7.0.0-beta.47" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.47.tgz#d18c2f4c4ba8d093a2bcfab5616593bfe2441a27" + dependencies: + "@babel/highlight" "7.0.0-beta.47" + +"@babel/highlight@7.0.0-beta.47": + version "7.0.0-beta.47" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-beta.47.tgz#8fbc83fb2a21f0bd2b95cdbeb238cf9689cad494" + dependencies: + chalk "^2.0.0" + esutils "^2.0.2" + js-tokens "^3.0.0" + +"@types/babel-types@*", "@types/babel-types@^7.0.0": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@types/babel-types/-/babel-types-7.0.2.tgz#63dc3e5e7f6367e1819d2bba5213783cd926c5d5" + +"@types/babylon@^6.16.2": + version "6.16.2" + resolved "https://registry.yarnpkg.com/@types/babylon/-/babylon-6.16.2.tgz#062ce63b693d9af1c246f5aedf928bc9c30589c8" + dependencies: + "@types/babel-types" "*" + "@types/node@^9.6.4": - version "9.6.4" - resolved "https://registry.yarnpkg.com/@types/node/-/node-9.6.4.tgz#0ef7b4cfc3499881c81e0ea1ce61a23f6f4f5b42" + version "9.6.6" + resolved "https://registry.yarnpkg.com/@types/node/-/node-9.6.6.tgz#439b91f9caf3983cad2eef1e11f6bedcbf9431d2" "@types/tapable@^1.0.1": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@types/tapable/-/tapable-1.0.1.tgz#938bfcc018eda2f386c34e37f084e6e961c08ca6" + version "1.0.2" + resolved "https://registry.yarnpkg.com/@types/tapable/-/tapable-1.0.2.tgz#e13182e1b69871a422d7863e11a4a6f5b814a4bd" + +"@webassemblyjs/ast@1.5.12": + version "1.5.12" + resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.5.12.tgz#a9acbcb3f25333c4edfa1fdf3186b1ccf64e6664" + dependencies: + "@webassemblyjs/helper-module-context" "1.5.12" + "@webassemblyjs/helper-wasm-bytecode" "1.5.12" + "@webassemblyjs/wast-parser" "1.5.12" + debug "^3.1.0" + mamacro "^0.0.3" + +"@webassemblyjs/floating-point-hex-parser@1.5.12": + version "1.5.12" + resolved "https://registry.yarnpkg.com/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.5.12.tgz#0f36044ffe9652468ce7ae5a08716a4eeff9cd9c" + +"@webassemblyjs/helper-api-error@1.5.12": + version "1.5.12" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-api-error/-/helper-api-error-1.5.12.tgz#05466833ff2f9d8953a1a327746e1d112ea62aaf" + +"@webassemblyjs/helper-buffer@1.5.12": + version "1.5.12" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-buffer/-/helper-buffer-1.5.12.tgz#1f0de5aaabefef89aec314f7f970009cd159c73d" + dependencies: + debug "^3.1.0" + +"@webassemblyjs/helper-code-frame@1.5.12": + version "1.5.12" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.5.12.tgz#3cdc1953093760d1c0f0caf745ccd62bdb6627c7" + dependencies: + "@webassemblyjs/wast-printer" "1.5.12" + +"@webassemblyjs/helper-fsm@1.5.12": + version "1.5.12" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-fsm/-/helper-fsm-1.5.12.tgz#6bc1442b037f8e30f2e57b987cee5c806dd15027" + +"@webassemblyjs/helper-module-context@1.5.12": + version "1.5.12" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-module-context/-/helper-module-context-1.5.12.tgz#b5588ca78b33b8a0da75f9ab8c769a3707baa861" + dependencies: + debug "^3.1.0" + mamacro "^0.0.3" + +"@webassemblyjs/helper-wasm-bytecode@1.5.12": + version "1.5.12" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.5.12.tgz#d12a3859db882a448891a866a05d0be63785b616" + +"@webassemblyjs/helper-wasm-section@1.5.12": + version "1.5.12" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.5.12.tgz#ff9fe1507d368ad437e7969d25e8c1693dac1884" + dependencies: + "@webassemblyjs/ast" "1.5.12" + "@webassemblyjs/helper-buffer" "1.5.12" + "@webassemblyjs/helper-wasm-bytecode" "1.5.12" + "@webassemblyjs/wasm-gen" "1.5.12" + debug "^3.1.0" + +"@webassemblyjs/ieee754@1.5.12": + version "1.5.12" + resolved "https://registry.yarnpkg.com/@webassemblyjs/ieee754/-/ieee754-1.5.12.tgz#ee9574bc558888f13097ce3e7900dff234ea19a4" + dependencies: + ieee754 "^1.1.11" + +"@webassemblyjs/leb128@1.5.12": + version "1.5.12" + resolved "https://registry.yarnpkg.com/@webassemblyjs/leb128/-/leb128-1.5.12.tgz#0308eec652765ee567d8a5fa108b4f0b25b458e1" + dependencies: + leb "^0.3.0" + +"@webassemblyjs/utf8@1.5.12": + version "1.5.12" + resolved "https://registry.yarnpkg.com/@webassemblyjs/utf8/-/utf8-1.5.12.tgz#d5916222ef314bf60d6806ed5ac045989bfd92ce" + +"@webassemblyjs/wasm-edit@1.5.12": + version "1.5.12" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.5.12.tgz#821c9358e644a166f2c910e5af1b46ce795a17aa" + dependencies: + "@webassemblyjs/ast" "1.5.12" + "@webassemblyjs/helper-buffer" "1.5.12" + "@webassemblyjs/helper-wasm-bytecode" "1.5.12" + "@webassemblyjs/helper-wasm-section" "1.5.12" + "@webassemblyjs/wasm-gen" "1.5.12" + "@webassemblyjs/wasm-opt" "1.5.12" + "@webassemblyjs/wasm-parser" "1.5.12" + "@webassemblyjs/wast-printer" "1.5.12" + debug "^3.1.0" + +"@webassemblyjs/wasm-gen@1.5.12": + version "1.5.12" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.5.12.tgz#0b7ccfdb93dab902cc0251014e2e18bae3139bcb" + dependencies: + "@webassemblyjs/ast" "1.5.12" + "@webassemblyjs/helper-wasm-bytecode" "1.5.12" + "@webassemblyjs/ieee754" "1.5.12" + "@webassemblyjs/leb128" "1.5.12" + "@webassemblyjs/utf8" "1.5.12" + +"@webassemblyjs/wasm-opt@1.5.12": + version "1.5.12" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.5.12.tgz#bd758a8bc670f585ff1ae85f84095a9e0229cbc9" + dependencies: + "@webassemblyjs/ast" "1.5.12" + "@webassemblyjs/helper-buffer" "1.5.12" + "@webassemblyjs/wasm-gen" "1.5.12" + "@webassemblyjs/wasm-parser" "1.5.12" + debug "^3.1.0" + +"@webassemblyjs/wasm-parser@1.5.12": + version "1.5.12" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-parser/-/wasm-parser-1.5.12.tgz#7b10b4388ecf98bd7a22e702aa62ec2f46d0c75e" + dependencies: + "@webassemblyjs/ast" "1.5.12" + "@webassemblyjs/helper-api-error" "1.5.12" + "@webassemblyjs/helper-wasm-bytecode" "1.5.12" + "@webassemblyjs/ieee754" "1.5.12" + "@webassemblyjs/leb128" "1.5.12" + "@webassemblyjs/utf8" "1.5.12" + +"@webassemblyjs/wast-parser@1.5.12": + version "1.5.12" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-parser/-/wast-parser-1.5.12.tgz#9cf5ae600ecae0640437b5d4de5dd6b6088d0d8b" + dependencies: + "@webassemblyjs/ast" "1.5.12" + "@webassemblyjs/floating-point-hex-parser" "1.5.12" + "@webassemblyjs/helper-api-error" "1.5.12" + "@webassemblyjs/helper-code-frame" "1.5.12" + "@webassemblyjs/helper-fsm" "1.5.12" + long "^3.2.0" + mamacro "^0.0.3" + +"@webassemblyjs/wast-printer@1.5.12": + version "1.5.12" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-printer/-/wast-printer-1.5.12.tgz#563ca4d01b22d21640b2463dc5e3d7f7d9dac520" + dependencies: + "@webassemblyjs/ast" "1.5.12" + "@webassemblyjs/wast-parser" "1.5.12" + long "^3.2.0" + +abab@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/abab/-/abab-1.0.4.tgz#5faad9c2c07f60dd76770f71cf025b62a63cfd4e" abbrev@1: version "1.1.1" @@ -37,6 +201,18 @@ acorn-globals@^1.0.3: dependencies: acorn "^2.1.0" +acorn-globals@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-3.1.0.tgz#fd8270f71fbb4996b004fa880ee5d46573a731bf" + dependencies: + acorn "^4.0.4" + +acorn-globals@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-4.1.0.tgz#ab716025dbe17c54d3ef81d32ece2b2d99fe2538" + dependencies: + acorn "^5.0.0" + acorn-jsx@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b" @@ -51,17 +227,17 @@ acorn@^2.1.0: version "2.7.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-2.7.0.tgz#ab6e7d9d886aaca8b085bc3312b79a198433f0e7" -acorn@^3.0.4: +acorn@^3.0.4, acorn@^3.1.0: version "3.3.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" -acorn@^5.0.0: - version "5.4.1" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.4.1.tgz#fdc58d9d17f4a4e98d102ded826a9b9759125102" +acorn@^4.0.4, acorn@~4.0.2: + version "4.0.13" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787" -acorn@^5.5.0: - version "5.5.3" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.5.3.tgz#f473dd47e0277a08e28e9bec5aeeb04751f0b8c9" +acorn@^5.0.0, acorn@^5.3.0, acorn@^5.5.0, acorn@^5.6.2: + version "5.6.2" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.6.2.tgz#b1da1d7be2ac1b4a327fb9eab851702c5045b4e7" ajv-keywords@^2.1.0: version "2.1.1" @@ -78,16 +254,7 @@ ajv@^4.9.1: co "^4.6.0" json-stable-stringify "^1.0.1" -ajv@^5.0.0: - version "5.2.2" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.2.2.tgz#47c68d69e86f5d953103b0074a9430dc63da5e39" - dependencies: - co "^4.6.0" - fast-deep-equal "^1.0.0" - json-schema-traverse "^0.3.0" - json-stable-stringify "^1.0.1" - -ajv@^5.1.0, ajv@^5.2.3, ajv@^5.3.0: +ajv@^5.0.0, ajv@^5.1.0, ajv@^5.2.3, ajv@^5.3.0: version "5.5.2" resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.2.tgz#73b5eeca3fab653e3d3f9422b341ad42205dc965" dependencies: @@ -97,12 +264,13 @@ ajv@^5.1.0, ajv@^5.2.3, ajv@^5.3.0: json-schema-traverse "^0.3.0" ajv@^6.1.0: - version "6.1.1" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.1.1.tgz#978d597fbc2b7d0e5a5c3ddeb149a682f2abfa0e" + version "6.4.0" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.4.0.tgz#d3aff78e9277549771daf0164cff48482b754fc6" dependencies: fast-deep-equal "^1.0.0" fast-json-stable-stringify "^2.0.0" json-schema-traverse "^0.3.0" + uri-js "^3.0.2" align-text@^0.1.1, align-text@^0.1.3: version "0.1.4" @@ -121,8 +289,8 @@ amdefine@>=0.0.4: resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" ansi-escapes@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.0.0.tgz#ec3e8b4e9f8064fc02c3ac9b65f1c275bda8ef92" + version "3.1.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.1.0.tgz#f73207bb81207d75fd6c83f125af26eea378ca30" ansi-regex@^2.0.0: version "2.1.1" @@ -136,9 +304,9 @@ ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" -ansi-styles@^3.1.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.0.tgz#c159b8d5be0f9e5a6f346dab94f16ce022161b88" +ansi-styles@^3.1.0, ansi-styles@^3.2.0, ansi-styles@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" dependencies: color-convert "^1.9.0" @@ -149,6 +317,12 @@ anymatch@^2.0.0: micromatch "^3.1.4" normalize-path "^2.1.1" +append-transform@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/append-transform/-/append-transform-0.4.0.tgz#d76ebf8ca94d276e247a36bad44a4b74ab611991" + dependencies: + default-require-extensions "^1.0.0" + aproba@^1.0.3, aproba@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" @@ -161,16 +335,22 @@ are-we-there-yet@~1.1.2: readable-stream "^2.0.6" argparse@^1.0.7: - version "1.0.9" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.9.tgz#73d83bc263f86e97f8cc4f6bae1b0e90a7d22c86" + version "1.0.10" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" dependencies: sprintf-js "~1.0.2" +arr-diff@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf" + dependencies: + arr-flatten "^1.0.1" + arr-diff@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" -arr-flatten@^1.1.0: +arr-flatten@^1.0.1, arr-flatten@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" @@ -178,6 +358,10 @@ arr-union@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" +array-equal@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93" + array-flatten@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" @@ -192,11 +376,15 @@ array-uniq@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" +array-unique@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53" + array-unique@^0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" -arrify@^1.0.0: +arrify@^1.0.0, arrify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" @@ -209,8 +397,8 @@ asap@~2.0.3: resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" asn1.js@^4.0.0: - version "4.9.2" - resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-4.9.2.tgz#8117ef4f7ed87cd8f89044b5bff97ac243a16c9a" + version "4.10.1" + resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-4.10.1.tgz#b9c2bf5805f1e64aadeed6df3a2bfafb5a73f5a0" dependencies: bn.js "^4.0.0" inherits "^2.0.1" @@ -238,21 +426,35 @@ assign-symbols@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" +astral-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" + async-each@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d" +async-limiter@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.0.tgz#78faed8c3d074ab81f22b4e985d79e8738f720f8" + async@1.x, async@^1.4.0: version "1.5.2" resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" +async@^2.1.4: + version "2.6.0" + resolved "https://registry.yarnpkg.com/async/-/async-2.6.0.tgz#61a29abb6fcc026fea77e56d1c6ec53a795951f4" + dependencies: + lodash "^4.14.0" + asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" -atob@^2.0.0: - version "2.0.3" - resolved "https://registry.yarnpkg.com/atob/-/atob-2.0.3.tgz#19c7a760473774468f20b2d2d03372ad7d4cbf5d" +atob@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.1.tgz#ae2d5a729477f289d60dd7f96a6314a22dd6c22a" autoprefixer@^6.3.1: version "6.7.7" @@ -274,10 +476,10 @@ aws-sign2@~0.7.0: resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" aws4@^1.2.1, aws4@^1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e" + version "1.7.0" + resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.7.0.tgz#d4d0e9b9dbfca77bf08eeb0a8a471550fe39e289" -babel-code-frame@^6.11.0, babel-code-frame@^6.22.0: +babel-code-frame@^6.22.0, babel-code-frame@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" dependencies: @@ -285,6 +487,143 @@ babel-code-frame@^6.11.0, babel-code-frame@^6.22.0: esutils "^2.0.2" js-tokens "^3.0.2" +babel-core@^6.0.0, babel-core@^6.26.0: + version "6.26.3" + resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.26.3.tgz#b2e2f09e342d0f0c88e2f02e067794125e75c207" + dependencies: + babel-code-frame "^6.26.0" + babel-generator "^6.26.0" + babel-helpers "^6.24.1" + babel-messages "^6.23.0" + babel-register "^6.26.0" + babel-runtime "^6.26.0" + babel-template "^6.26.0" + babel-traverse "^6.26.0" + babel-types "^6.26.0" + babylon "^6.18.0" + convert-source-map "^1.5.1" + debug "^2.6.9" + json5 "^0.5.1" + lodash "^4.17.4" + minimatch "^3.0.4" + path-is-absolute "^1.0.1" + private "^0.1.8" + slash "^1.0.0" + source-map "^0.5.7" + +babel-generator@^6.18.0, babel-generator@^6.26.0: + version "6.26.1" + resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.26.1.tgz#1844408d3b8f0d35a404ea7ac180f087a601bd90" + dependencies: + babel-messages "^6.23.0" + babel-runtime "^6.26.0" + babel-types "^6.26.0" + detect-indent "^4.0.0" + jsesc "^1.3.0" + lodash "^4.17.4" + source-map "^0.5.7" + trim-right "^1.0.1" + +babel-helpers@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-helpers/-/babel-helpers-6.24.1.tgz#3471de9caec388e5c850e597e58a26ddf37602b2" + dependencies: + babel-runtime "^6.22.0" + babel-template "^6.24.1" + +babel-jest@^23.0.1: + version "23.0.1" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-23.0.1.tgz#bbad3bf523fb202da05ed0a6540b48c84eed13a6" + dependencies: + babel-plugin-istanbul "^4.1.6" + babel-preset-jest "^23.0.1" + +babel-messages@^6.23.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-istanbul@^4.1.6: + version "4.1.6" + resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.6.tgz#36c59b2192efce81c5b378321b74175add1c9a45" + dependencies: + babel-plugin-syntax-object-rest-spread "^6.13.0" + find-up "^2.1.0" + istanbul-lib-instrument "^1.10.1" + test-exclude "^4.2.1" + +babel-plugin-jest-hoist@^23.0.1: + version "23.0.1" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-23.0.1.tgz#eaa11c964563aea9c21becef2bdf7853f7f3c148" + +babel-plugin-syntax-object-rest-spread@^6.13.0: + version "6.13.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz#fd6536f2bce13836ffa3a5458c4903a597bb3bf5" + +babel-preset-jest@^23.0.1: + version "23.0.1" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-23.0.1.tgz#631cc545c6cf021943013bcaf22f45d87fe62198" + dependencies: + babel-plugin-jest-hoist "^23.0.1" + babel-plugin-syntax-object-rest-spread "^6.13.0" + +babel-register@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-register/-/babel-register-6.26.0.tgz#6ed021173e2fcb486d7acb45c6009a856f647071" + dependencies: + babel-core "^6.26.0" + babel-runtime "^6.26.0" + core-js "^2.5.0" + home-or-tmp "^2.0.0" + lodash "^4.17.4" + mkdirp "^0.5.1" + source-map-support "^0.4.15" + +babel-runtime@^6.22.0, babel-runtime@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" + dependencies: + core-js "^2.4.0" + regenerator-runtime "^0.11.0" + +babel-template@^6.16.0, babel-template@^6.24.1, babel-template@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.26.0.tgz#de03e2d16396b069f46dd9fff8521fb1a0e35e02" + dependencies: + babel-runtime "^6.26.0" + babel-traverse "^6.26.0" + babel-types "^6.26.0" + babylon "^6.18.0" + lodash "^4.17.4" + +babel-traverse@^6.18.0, babel-traverse@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.26.0.tgz#46a9cbd7edcc62c8e5c064e2d2d8d0f4035766ee" + dependencies: + babel-code-frame "^6.26.0" + babel-messages "^6.23.0" + babel-runtime "^6.26.0" + babel-types "^6.26.0" + babylon "^6.18.0" + debug "^2.6.8" + globals "^9.18.0" + invariant "^2.2.2" + lodash "^4.17.4" + +babel-types@^6.18.0, babel-types@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.26.0.tgz#a3b073f94ab49eb6fa55cd65227a334380632497" + dependencies: + babel-runtime "^6.26.0" + esutils "^2.0.2" + lodash "^4.17.4" + to-fast-properties "^1.0.3" + +babylon@^6.18.0: + version "6.18.0" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.18.0.tgz#af2f3b88fa6f5c1e4c634d1a0f8eac4f55b395e3" + balanced-match@^0.4.2: version "0.4.2" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-0.4.2.tgz#cb3f3e3c732dc0f01ee70b403f302e61d7709838" @@ -294,8 +633,8 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" base64-js@^1.0.2: - version "1.2.1" - resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.2.1.tgz#a91947da1f4a516ea38e5b4ec0ec3773675e0886" + version "1.3.0" + resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.0.tgz#cab1e6118f051095e58b5281aea8c1cd22bfc0e3" base@^0.11.1: version "0.11.2" @@ -330,17 +669,7 @@ binary-extensions@^1.0.0: version "1.11.0" resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.11.0.tgz#46aa1751fb6a2f93ee5e689bb1087d4b14c6c205" -block-stream@*: - version "0.0.9" - resolved "https://registry.yarnpkg.com/block-stream/-/block-stream-0.0.9.tgz#13ebfe778a03205cfe03751481ebb4b3300c126a" - dependencies: - inherits "~2.0.0" - -bluebird@^2.3, bluebird@^2.9.x: - version "2.11.0" - resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-2.11.0.tgz#534b9033c022c9579c56ba3b3e5a5caafbb650e1" - -bluebird@^3.5.1: +bluebird@^3.5.0, bluebird@^3.5.1, bluebird@^3.5.x: version "3.5.1" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.1.tgz#d9551f9de98f1fcda1e683d17ee91a0602ee2eb9" @@ -367,23 +696,29 @@ boom@5.x.x: hoek "4.x.x" brace-expansion@^1.1.7: - version "1.1.8" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292" + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" dependencies: balanced-match "^1.0.0" concat-map "0.0.1" +braces@^1.8.2: + version "1.8.5" + resolved "https://registry.yarnpkg.com/braces/-/braces-1.8.5.tgz#ba77962e12dff969d6b76711e914b737857bf6a7" + dependencies: + expand-range "^1.8.1" + preserve "^0.2.0" + repeat-element "^1.1.2" + braces@^2.3.0, braces@^2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.1.tgz#7086c913b4e5a08dbe37ac0ee6a2500c4ba691bb" + version "2.3.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" dependencies: arr-flatten "^1.1.0" array-unique "^0.3.2" - define-property "^1.0.0" extend-shallow "^2.0.1" fill-range "^4.0.0" isobject "^3.0.1" - kind-of "^6.0.2" repeat-element "^1.1.2" snapdragon "^0.8.1" snapdragon-node "^2.0.1" @@ -394,13 +729,19 @@ brorand@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" -browser-stdout@1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.0.tgz#f351d32969d32fa5d7a5567154263d928ae3bd1f" +browser-process-hrtime@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-0.1.2.tgz#425d68a58d3447f02a04aa894187fce8af8b7b8e" + +browser-resolve@^1.11.2: + version "1.11.2" + resolved "https://registry.yarnpkg.com/browser-resolve/-/browser-resolve-1.11.2.tgz#8ff09b0a2c421718a1051c260b32e48f442938ce" + dependencies: + resolve "1.1.7" browserify-aes@^1.0.0, browserify-aes@^1.0.4: - version "1.1.1" - resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.1.1.tgz#38b7ab55edb806ff2dcda1a7f1620773a477c49f" + version "1.2.0" + resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.2.0.tgz#326734642f403dabc3003209853bb70ad428ef48" dependencies: buffer-xor "^1.0.3" cipher-base "^1.0.0" @@ -410,16 +751,16 @@ browserify-aes@^1.0.0, browserify-aes@^1.0.4: safe-buffer "^5.0.1" browserify-cipher@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/browserify-cipher/-/browserify-cipher-1.0.0.tgz#9988244874bf5ed4e28da95666dcd66ac8fc363a" + version "1.0.1" + resolved "https://registry.yarnpkg.com/browserify-cipher/-/browserify-cipher-1.0.1.tgz#8d6474c1b870bfdabcd3bcfcc1934a10e94f15f0" dependencies: browserify-aes "^1.0.4" browserify-des "^1.0.0" evp_bytestokey "^1.0.0" browserify-des@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/browserify-des/-/browserify-des-1.0.0.tgz#daa277717470922ed2fe18594118a175439721dd" + version "1.0.1" + resolved "https://registry.yarnpkg.com/browserify-des/-/browserify-des-1.0.1.tgz#3343124db6d7ad53e26a8826318712bdc8450f9c" dependencies: cipher-base "^1.0.1" des.js "^1.0.0" @@ -457,6 +798,16 @@ browserslist@^1.3.6, browserslist@^1.5.2, browserslist@^1.7.6: caniuse-db "^1.0.30000639" electron-to-chromium "^1.2.7" +bser@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/bser/-/bser-2.0.0.tgz#9ac78d3ed5d915804fd87acb158bc797147a1719" + dependencies: + node-int64 "^0.4.0" + +buffer-from@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.0.0.tgz#4cb8832d23612589b0406e9e2956c17f06fdf531" + buffer-xor@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" @@ -469,15 +820,19 @@ buffer@^4.3.0: ieee754 "^1.1.4" isarray "^1.0.0" +builtin-modules@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" + builtin-status-codes@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8" bundle-loader@~0.5.0: - version "0.5.5" - resolved "https://registry.yarnpkg.com/bundle-loader/-/bundle-loader-0.5.5.tgz#11fd7b08edf86a1d708efcb1eca62ca51f6c368a" + version "0.5.6" + resolved "https://registry.yarnpkg.com/bundle-loader/-/bundle-loader-0.5.6.tgz#6c9042e62f1c89941458805a3a479d10f34c71fd" dependencies: - loader-utils "^1.0.2" + loader-utils "^1.1.0" cacache@^10.0.4: version "10.0.4" @@ -521,10 +876,18 @@ callsites@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" +callsites@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-2.0.0.tgz#06eb84f00eea413da86affefacbffb36093b3c50" + camelcase@^1.0.2: version "1.2.1" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39" +camelcase@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" + caniuse-api@^1.5.2: version "1.6.1" resolved "https://registry.yarnpkg.com/caniuse-api/-/caniuse-api-1.6.1.tgz#b534e7c734c4f81ec5fbe8aca2ad24354b962c6c" @@ -535,8 +898,14 @@ caniuse-api@^1.5.2: lodash.uniq "^4.5.0" caniuse-db@^1.0.30000529, caniuse-db@^1.0.30000634, caniuse-db@^1.0.30000639: - version "1.0.30000787" - resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000787.tgz#ca07a281be536a88bd7fac96ba895f3cf53f811b" + version "1.0.30000830" + resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000830.tgz#6e45255b345649fd15ff59072da1e12bb3de2f13" + +capture-exit@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/capture-exit/-/capture-exit-1.2.0.tgz#1c5fcc489fd0ab00d4f1ac7ae1072e3173fbab6f" + dependencies: + rsvp "^3.3.3" caseless@~0.11.0: version "0.11.0" @@ -553,7 +922,7 @@ center-align@^0.1.1: align-text "^0.1.3" lazy-cache "^1.0.3" -chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3: +chalk@^1.1.1, chalk@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" dependencies: @@ -563,7 +932,15 @@ chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" -chalk@^2.0.0, chalk@^2.1.0, chalk@^2.3.0: +chalk@^2.0.0, chalk@^2.0.1, chalk@^2.3.2: + version "2.4.1" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e" + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + +chalk@^2.1.0: version "2.3.0" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.0.tgz#b5ea48efc9c1793dccc9b4767c93914d3f2d52ba" dependencies: @@ -571,17 +948,31 @@ chalk@^2.0.0, chalk@^2.1.0, chalk@^2.3.0: escape-string-regexp "^1.0.5" supports-color "^4.0.0" +chalk@^2.3.1: + version "2.3.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.2.tgz#250dc96b07491bfd601e648d66ddf5f60c7a5c65" + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + character-parser@1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/character-parser/-/character-parser-1.2.1.tgz#c0dde4ab182713b919b970959a123ecc1a30fcd6" +character-parser@^2.1.1: + version "2.2.0" + resolved "https://registry.yarnpkg.com/character-parser/-/character-parser-2.2.0.tgz#c7ce28f36d4bcd9744e5ffc2c5fcde1c73261fc0" + dependencies: + is-regex "^1.0.3" + chardet@^0.4.0: version "0.4.2" resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2" chokidar@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.0.2.tgz#4dc65139eeb2714977735b6a35d06e97b494dfd7" + version "2.0.3" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.0.3.tgz#dcbd4f6cbb2a55b4799ba8a840ac527e5f4b1176" dependencies: anymatch "^2.0.0" async-each "^1.0.0" @@ -595,15 +986,21 @@ chokidar@^2.0.2: readdirp "^2.0.0" upath "^1.0.0" optionalDependencies: - fsevents "^1.0.0" + fsevents "^1.1.2" chownr@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.0.1.tgz#e2a75042a9551908bebd25b8523d5f9769d79181" -chrome-trace-event@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-0.1.1.tgz#651f4d115902160b0b33aca136574b17d1519c98" +chrome-trace-event@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.0.tgz#45a91bd2c20c9411f0963b5aaeb9a1b95e09cc48" + dependencies: + tslib "^1.9.0" + +ci-info@^1.0.0: + version "1.1.3" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.1.3.tgz#710193264bb05c77b8c90d02f5aaf22216a667b2" cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: version "1.0.4" @@ -638,6 +1035,12 @@ clean-css@^3.1.9: commander "2.8.x" source-map "0.4.x" +clean-css@^4.1.11: + version "4.1.11" + resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-4.1.11.tgz#2ecdf145aba38f54740f26cefd0ff3e03e125d6a" + dependencies: + source-map "0.5.x" + cli-cursor@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" @@ -656,13 +1059,21 @@ cliui@^2.1.0: right-align "^0.1.1" wordwrap "0.0.2" +cliui@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-4.1.0.tgz#348422dbe82d800b3022eef4f6ac10bf2e4d1b49" + dependencies: + string-width "^2.1.1" + strip-ansi "^4.0.0" + wrap-ansi "^2.0.0" + clone@^1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.3.tgz#298d7e2231660f40c003c2ed3140decf3f53085f" + version "1.0.4" + resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" clone@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.1.tgz#d217d1e961118e3ac9a4b8bba3285553bf647cdb" + version "2.1.2" + resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.2.tgz#1b7f4b9f591f1e8f83670401600345a02887435f" co@^4.6.0: version "4.6.0" @@ -675,16 +1086,17 @@ coa@~1.0.1: q "^1.1.2" codacy-coverage@^2.0.1: - version "2.0.3" - resolved "https://registry.yarnpkg.com/codacy-coverage/-/codacy-coverage-2.0.3.tgz#5635af71391d2f55c3fc284f72a13c2250c47c76" + version "2.1.1" + resolved "https://registry.yarnpkg.com/codacy-coverage/-/codacy-coverage-2.1.1.tgz#8d22a58ef6858602d01de2ff2563be06c57e29a3" dependencies: - bluebird "^2.9.x" + bluebird "^3.5.x" commander "^2.x" - joi "^6.4.x" - lcov-parse "0.x" + joi "^12.x" + lcov-parse "^1.x" lodash "^4.17.4" log-driver "^1.x" - request-promise "^0.x" + request "^2.83.0" + request-promise "^4.x" code-point-at@^1.0.0: version "1.1.0" @@ -743,9 +1155,9 @@ colors@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/colors/-/colors-1.1.2.tgz#168a4701756b6a7f51a12ce0c97bfa28c084ed63" -combined-stream@^1.0.5, combined-stream@~1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.5.tgz#938370a57b4a51dea2c77c15d5c5fdf895164009" +combined-stream@1.0.6, combined-stream@^1.0.5, combined-stream@~1.0.5: + version "1.0.6" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.6.tgz#723e7df6e801ac5613113a7e445a9b69cb632818" dependencies: delayed-stream "~1.0.0" @@ -755,15 +1167,9 @@ commander@2.8.x: dependencies: graceful-readlink ">= 1.0.0" -commander@2.9.0: - version "2.9.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" - dependencies: - graceful-readlink ">= 1.0.0" - commander@^2.9.0, commander@^2.x: - version "2.12.2" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.12.2.tgz#0f5946c427ed9ec0d91a46bb9def53e54650e555" + version "2.15.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.15.1.tgz#df46e867d0fc2aec66a34662b406a9ccafff5b0f" commander@~2.13.0: version "2.13.0" @@ -777,6 +1183,10 @@ commondir@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" +compare-versions@^3.1.0: + version "3.2.1" + resolved "https://registry.yarnpkg.com/compare-versions/-/compare-versions-3.2.1.tgz#a49eb7689d4caaf0b6db5220173fd279614000f7" + component-emitter@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.2.1.tgz#137918d6d78283f7df7a6b7c5a63e140e69425e6" @@ -786,9 +1196,10 @@ concat-map@0.0.1: resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" concat-stream@^1.5.0, concat-stream@^1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7" + version "1.6.2" + resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.2.tgz#904bdf194cd3122fc675c77fc4ac3d4ff0fd1a34" dependencies: + buffer-from "^1.0.0" inherits "^2.0.3" readable-stream "^2.2.2" typedarray "^0.0.6" @@ -803,6 +1214,15 @@ console-control-strings@^1.0.0, console-control-strings@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" +constantinople@^3.0.1: + version "3.1.2" + resolved "https://registry.yarnpkg.com/constantinople/-/constantinople-3.1.2.tgz#d45ed724f57d3d10500017a7d3a889c1381ae647" + dependencies: + "@types/babel-types" "^7.0.0" + "@types/babylon" "^6.16.2" + babel-types "^6.26.0" + babylon "^6.18.0" + constantinople@~3.0.1: version "3.0.2" resolved "https://registry.yarnpkg.com/constantinople/-/constantinople-3.0.2.tgz#4b945d9937907bcd98ee575122c3817516544141" @@ -821,6 +1241,10 @@ content-type@~1.0.1: version "1.0.4" resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b" +convert-source-map@^1.4.0, convert-source-map@^1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.1.tgz#b8278097b9bc229365de5c62cf5fcaed8b5599e5" + cookie-signature@1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" @@ -848,6 +1272,10 @@ core-js@^1.0.0: version "1.2.7" resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636" +core-js@^2.4.0, core-js@^2.5.0: + version "2.5.6" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.6.tgz#0fe6d45bf3cac3ac364a9d72de7576f4eb221b9d" + core-util-is@1.0.2, core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" @@ -863,24 +1291,25 @@ coveralls@^2.11.2: request "2.79.0" create-ecdh@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.0.tgz#888c723596cdf7612f6498233eebd7a35301737d" + version "4.0.1" + resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.1.tgz#44223dfed533193ba5ba54e0df5709b89acf1f82" dependencies: bn.js "^4.1.0" elliptic "^6.0.0" create-hash@^1.1.0, create-hash@^1.1.2: - version "1.1.3" - resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.1.3.tgz#606042ac8b9262750f483caddab0f5819172d8fd" + version "1.2.0" + resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" dependencies: cipher-base "^1.0.1" inherits "^2.0.1" - ripemd160 "^2.0.0" + md5.js "^1.3.4" + ripemd160 "^2.0.1" sha.js "^2.4.0" create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4: - version "1.1.6" - resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.6.tgz#acb9e221a4e17bdb076e90657c42b93e3726cf06" + version "1.1.7" + resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.7.tgz#69170c78b3ab957147b2b8b04572e47ead2243ff" dependencies: cipher-base "^1.0.3" create-hash "^1.1.0" @@ -890,14 +1319,14 @@ create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4: sha.js "^2.4.8" create-react-class@^15.6.0: - version "15.6.2" - resolved "https://registry.yarnpkg.com/create-react-class/-/create-react-class-15.6.2.tgz#cf1ed15f12aad7f14ef5f2dfe05e6c42f91ef02a" + version "15.6.3" + resolved "https://registry.yarnpkg.com/create-react-class/-/create-react-class-15.6.3.tgz#2d73237fb3f970ae6ebe011a9e66f46dbca80036" dependencies: fbjs "^0.8.9" loose-envify "^1.3.1" object-assign "^4.1.1" -cross-spawn@^5.1.0: +cross-spawn@^5.0.1, cross-spawn@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" dependencies: @@ -938,21 +1367,21 @@ css-color-names@0.0.4: resolved "https://registry.yarnpkg.com/css-color-names/-/css-color-names-0.0.4.tgz#808adc2e79cf84738069b646cb20ec27beb629e0" css-loader@^0.28.3: - version "0.28.7" - resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-0.28.7.tgz#5f2ee989dd32edd907717f953317656160999c1b" + version "0.28.11" + resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-0.28.11.tgz#c3f9864a700be2711bb5a2462b2389b1a392dab7" dependencies: - babel-code-frame "^6.11.0" + babel-code-frame "^6.26.0" css-selector-tokenizer "^0.7.0" - cssnano ">=2.6.1 <4" + cssnano "^3.10.0" icss-utils "^2.1.0" loader-utils "^1.0.2" lodash.camelcase "^4.3.0" - object-assign "^4.0.1" + object-assign "^4.1.1" postcss "^5.0.6" - postcss-modules-extract-imports "^1.0.0" - postcss-modules-local-by-default "^1.0.1" - postcss-modules-scope "^1.0.0" - postcss-modules-values "^1.1.0" + postcss-modules-extract-imports "^1.2.0" + postcss-modules-local-by-default "^1.2.0" + postcss-modules-scope "^1.1.0" + postcss-modules-values "^1.3.0" postcss-value-parser "^3.3.0" source-list-map "^2.0.0" @@ -983,7 +1412,7 @@ cssesc@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-0.1.0.tgz#c814903e45623371a0477b40109aaafbeeaddbb4" -"cssnano@>=2.6.1 <4": +cssnano@^3.10.0: version "3.10.0" resolved "https://registry.yarnpkg.com/cssnano/-/cssnano-3.10.0.tgz#4f38f6cea2b9b17fa01490f23f1dc68ea65c1c38" dependencies: @@ -1027,7 +1456,17 @@ csso@~2.3.1: clap "^1.0.9" source-map "^0.5.3" -cuint@latest: +cssom@0.3.x, "cssom@>= 0.3.2 < 0.4.0": + version "0.3.2" + resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.2.tgz#b8036170c79f07a90ff2f16e22284027a243848b" + +"cssstyle@>= 0.2.37 < 0.3.0": + version "0.2.37" + resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-0.2.37.tgz#541097234cb2513c83ceed3acddc27ff27987d54" + dependencies: + cssom "0.3.x" + +cuint@^0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/cuint/-/cuint-0.2.2.tgz#408086d409550c2631155619e9fa7bcadc3b991b" @@ -1041,17 +1480,19 @@ dashdash@^1.12.0: dependencies: assert-plus "^1.0.0" +data-urls@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-1.0.0.tgz#24802de4e81c298ea8a9388bb0d8e461c774684f" + dependencies: + abab "^1.0.4" + whatwg-mimetype "^2.0.0" + whatwg-url "^6.4.0" + date-now@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b" -debug@2.6.8: - version "2.6.8" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc" - dependencies: - ms "2.0.0" - -debug@^2.2.0, debug@^2.3.3: +debug@^2.1.2, debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" dependencies: @@ -1069,7 +1510,7 @@ debug@~2.2.0: dependencies: ms "0.7.1" -decamelize@^1.0.0, decamelize@^1.1.2: +decamelize@^1.0.0, decamelize@^1.1.1, decamelize@^1.1.2: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" @@ -1077,14 +1518,27 @@ decode-uri-component@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" -deep-extend@~0.4.0: - version "0.4.2" - resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.4.2.tgz#48b699c27e334bf89f10892be432f6e4c7d34a7f" +deep-extend@^0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.5.1.tgz#b894a9dd90d3023fbf1c55a394fb858eb2066f1f" deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" +default-require-extensions@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/default-require-extensions/-/default-require-extensions-1.0.0.tgz#f37ea15d3e13ffd9b437d33e1a75b5fb97874cb8" + dependencies: + strip-bom "^2.0.0" + +define-properties@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94" + dependencies: + foreach "^2.0.5" + object-keys "^1.0.8" + define-property@^0.2.5: version "0.2.5" resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" @@ -1129,8 +1583,8 @@ delegates@^1.0.0: resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" depd@~1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.1.tgz#5783b4e1c459f06fa5ca27f991f3d06e7a310359" + version "1.1.2" + resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" des.js@^1.0.0: version "1.0.0" @@ -1143,21 +1597,27 @@ destroy@~1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.0.4.tgz#978857442c44749e4206613e37946205826abd80" +detect-indent@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-4.0.0.tgz#f76d064352cdf43a1cb6ce619c4ee3a9475de208" + dependencies: + repeating "^2.0.0" + detect-libc@^1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" -diff@3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/diff/-/diff-3.2.0.tgz#c9ce393a4b7cbd0b058a725c93df299027868ff9" +detect-newline@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-2.1.0.tgz#f41f1c10be4b00e87b5f13da680759f2c5bfd3e2" -diff@^3.1.0: - version "3.4.0" - resolved "https://registry.yarnpkg.com/diff/-/diff-3.4.0.tgz#b1d85507daf3964828de54b37d0d73ba67dda56c" +diff@^3.2.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12" diffie-hellman@^5.0.0: - version "5.0.2" - resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.2.tgz#b5835739270cfe26acf632099fded2a07f209e5e" + version "5.0.3" + resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875" dependencies: bn.js "^4.1.0" miller-rabin "^4.0.0" @@ -1169,13 +1629,23 @@ doctrine@^2.1.0: dependencies: esutils "^2.0.2" +doctypes@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/doctypes/-/doctypes-1.1.0.tgz#ea80b106a87538774e8a3a4a5afe293de489e0a9" + domain-browser@^1.1.1: - version "1.1.7" - resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.1.7.tgz#867aa4b093faa05f1de08c06f4d7b21fdf8698bc" + version "1.2.0" + resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.2.0.tgz#3d31f50191a6749dd1375a7f522e823d42e54eda" -duplexify@^3.1.2, duplexify@^3.4.2: - version "3.5.1" - resolved "https://registry.yarnpkg.com/duplexify/-/duplexify-3.5.1.tgz#4e1516be68838bc90a49994f0b39a6e5960befcd" +domexception@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/domexception/-/domexception-1.0.1.tgz#937442644ca6a31261ef36e3ec677fe805582c90" + dependencies: + webidl-conversions "^4.0.2" + +duplexify@^3.4.2, duplexify@^3.5.3: + version "3.5.4" + resolved "https://registry.yarnpkg.com/duplexify/-/duplexify-3.5.4.tgz#4bb46c1796eabebeec4ca9a2e66b808cb7a3d8b4" dependencies: end-of-stream "^1.0.0" inherits "^2.0.1" @@ -1192,15 +1662,9 @@ ee-first@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" -electron-releases@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/electron-releases/-/electron-releases-2.1.0.tgz#c5614bf811f176ce3c836e368a0625782341fd4e" - electron-to-chromium@^1.2.7: - version "1.3.30" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.30.tgz#9666f532a64586651fc56a72513692e820d06a80" - dependencies: - electron-releases "^2.1.0" + version "1.3.42" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.42.tgz#95c33bf01d0cc405556aec899fe61fd4d76ea0f9" elliptic@^6.0.0: version "6.4.0" @@ -1225,8 +1689,8 @@ encoding@^0.1.11: iconv-lite "~0.4.13" end-of-stream@^1.0.0, end-of-stream@^1.1.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.0.tgz#7a90d833efda6cfa6eac0f4949dbb0fad3a63206" + version "1.4.1" + resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.1.tgz#ed29634d19baba463b6ce6b80a37213eab71ec43" dependencies: once "^1.4.0" @@ -1238,18 +1702,36 @@ enhanced-resolve@^4.0.0: memory-fs "^0.4.0" tapable "^1.0.0" -errno@^0.1.1, errno@^0.1.3: - version "0.1.6" - resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.6.tgz#c386ce8a6283f14fc09563b71560908c9bf53026" - dependencies: - prr "~1.0.1" - -errno@~0.1.7: +errno@^0.1.1, errno@^0.1.3, errno@~0.1.7: version "0.1.7" resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.7.tgz#4684d71779ad39af177e3f007996f7c67c852618" dependencies: prr "~1.0.1" +error-ex@^1.2.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.1.tgz#f855a86ce61adc4e8621c3cda21e7a7612c3a8dc" + dependencies: + is-arrayish "^0.2.1" + +es-abstract@^1.5.1: + version "1.11.0" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.11.0.tgz#cce87d518f0496893b1a30cd8461835535480681" + dependencies: + es-to-primitive "^1.1.1" + function-bind "^1.1.1" + has "^1.0.1" + is-callable "^1.1.3" + is-regex "^1.0.4" + +es-to-primitive@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.1.1.tgz#45355248a88979034b6792e19bb81f2b7975dd0d" + dependencies: + is-callable "^1.1.1" + is-date-object "^1.0.1" + is-symbol "^1.0.1" + es6-promise-polyfill@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/es6-promise-polyfill/-/es6-promise-polyfill-1.2.0.tgz#f38925f23cb3e3e8ce6cda8ff774fcebbb090cde" @@ -1258,7 +1740,7 @@ escape-html@~1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" -escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: +escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -1273,12 +1755,27 @@ escodegen@1.8.x: optionalDependencies: source-map "~0.2.0" +escodegen@^1.9.0: + version "1.9.1" + resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.9.1.tgz#dbae17ef96c8e4bedb1356f4504fa4cc2f7cb7e2" + dependencies: + esprima "^3.1.3" + estraverse "^4.2.0" + esutils "^2.0.2" + optionator "^0.8.1" + optionalDependencies: + source-map "~0.6.1" + eslint-config-prettier@^2.9.0: version "2.9.0" resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-2.9.0.tgz#5ecd65174d486c22dff389fe036febf502d468a3" dependencies: get-stdin "^5.0.1" +eslint-plugin-jest@^21.17.0: + version "21.17.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-21.17.0.tgz#fdb00e2f9ff16987d6ebcf2c75c7add105760bbb" + eslint-plugin-node@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-6.0.1.tgz#bf19642298064379315d7a4b2a75937376fa05e4" @@ -1360,28 +1857,31 @@ esprima@2.7.x, esprima@^2.6.0, esprima@^2.7.1: version "2.7.3" resolved "https://registry.yarnpkg.com/esprima/-/esprima-2.7.3.tgz#96e3b70d5779f6ad49cd032673d1c312767ba581" +esprima@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633" + esprima@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804" esquery@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.0.tgz#cfba8b57d7fba93f17298a8a006a04cda13d80fa" + version "1.0.1" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.1.tgz#406c51658b1f5991a5f9b62b1dc25b00e3e5c708" dependencies: estraverse "^4.0.0" esrecurse@^4.1.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.0.tgz#fa9568d98d3823f9a41d91e902dcab9ea6e5b163" + version "4.2.1" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf" dependencies: estraverse "^4.1.0" - object-assign "^4.0.1" estraverse@^1.9.1: version "1.9.3" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-1.9.3.tgz#af67f2dc922582415950926091a4005d29c9bb44" -estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1: +estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" @@ -1404,6 +1904,34 @@ evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3: md5.js "^1.3.4" safe-buffer "^5.1.1" +exec-sh@^0.2.0: + version "0.2.1" + resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.2.1.tgz#163b98a6e89e6b65b47c2a28d215bc1f63989c38" + dependencies: + merge "^1.1.3" + +execa@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777" + dependencies: + cross-spawn "^5.0.1" + get-stream "^3.0.0" + is-stream "^1.1.0" + npm-run-path "^2.0.0" + p-finally "^1.0.0" + signal-exit "^3.0.0" + strip-eof "^1.0.0" + +exit@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" + +expand-brackets@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b" + dependencies: + is-posix-bracket "^0.1.0" + expand-brackets@^2.1.4: version "2.1.4" resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" @@ -1416,6 +1944,23 @@ expand-brackets@^2.1.4: snapdragon "^0.8.1" to-regex "^3.0.1" +expand-range@^1.8.1: + version "1.8.2" + resolved "https://registry.yarnpkg.com/expand-range/-/expand-range-1.8.2.tgz#a299effd335fe2721ebae8e257ec79644fc85337" + dependencies: + fill-range "^2.1.0" + +expect@^23.0.1: + version "23.0.1" + resolved "https://registry.yarnpkg.com/expect/-/expect-23.0.1.tgz#99131f2fd9115595f8cc3697401e7f0734d45fef" + dependencies: + ansi-styles "^3.2.0" + jest-diff "^23.0.1" + jest-get-type "^22.1.0" + jest-matcher-utils "^23.0.1" + jest-message-util "^23.0.0" + jest-regex-util "^23.0.0" + express@~4.13.1: version "4.13.4" resolved "https://registry.yarnpkg.com/express/-/express-4.13.4.tgz#3c0b76f3c77590c8345739061ec0bd3ba067ec24" @@ -1464,13 +2009,19 @@ extend@~3.0.0, extend@~3.0.1: resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444" external-editor@^2.0.4: - version "2.1.0" - resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.1.0.tgz#3d026a21b7f95b5726387d4200ac160d372c3b48" + version "2.2.0" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.2.0.tgz#045511cfd8d133f3846673d1047c154e214ad3d5" dependencies: chardet "^0.4.0" iconv-lite "^0.4.17" tmp "^0.0.33" +extglob@^0.3.1: + version "0.3.2" + resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1" + dependencies: + is-extglob "^1.0.0" + extglob@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" @@ -1493,8 +2044,8 @@ extsprintf@^1.2.0: resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" fast-deep-equal@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz#96256a3bc975595eb36d82e9929d060d893439ff" + version "1.1.0" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz#c053477817c86b51daa853c81e059b733d023614" fast-diff@^1.1.1: version "1.1.2" @@ -1512,6 +2063,12 @@ fastparse@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/fastparse/-/fastparse-1.1.1.tgz#d1e2643b38a94d7583b479060e6c4affc94071f8" +fb-watchman@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.0.tgz#54e9abf7dfa2f26cd9b1636c588c1afc05de5d58" + dependencies: + bser "^2.0.0" + fbjs@^0.8.16, fbjs@^0.8.9: version "0.8.16" resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.16.tgz#5e67432f550dc41b572bf55847b8aca64e5337db" @@ -1538,11 +2095,32 @@ file-entry-cache@^2.0.0: object-assign "^4.0.1" file-loader@^1.1.6: - version "1.1.6" - resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-1.1.6.tgz#7b9a8f2c58f00a77fddf49e940f7ac978a3ea0e8" + version "1.1.11" + resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-1.1.11.tgz#6fe886449b0f2a936e43cabaac0cdbfb369506f8" dependencies: loader-utils "^1.0.2" - schema-utils "^0.3.0" + schema-utils "^0.4.5" + +filename-regex@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26" + +fileset@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/fileset/-/fileset-2.0.3.tgz#8e7548a96d3cc2327ee5e674168723a333bba2a0" + dependencies: + glob "^7.0.3" + minimatch "^3.0.3" + +fill-range@^2.1.0: + version "2.2.4" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.4.tgz#eb1e773abb056dcd8df2bfdf6af59b8b3a936565" + dependencies: + is-number "^2.1.0" + isobject "^2.0.0" + randomatic "^3.0.0" + repeat-element "^1.1.2" + repeat-string "^1.5.2" fill-range@^4.0.0: version "4.0.0" @@ -1570,6 +2148,13 @@ find-cache-dir@^1.0.0: make-dir "^1.0.0" pkg-dir "^2.0.0" +find-up@^1.0.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" + dependencies: + path-exists "^2.0.0" + pinkie-promise "^2.0.0" + find-up@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" @@ -1590,16 +2175,26 @@ flatten@^1.0.2: resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.2.tgz#dae46a9d78fbe25292258cc1e780a41d95c03782" flush-write-stream@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/flush-write-stream/-/flush-write-stream-1.0.2.tgz#c81b90d8746766f1a609a46809946c45dd8ae417" + version "1.0.3" + resolved "https://registry.yarnpkg.com/flush-write-stream/-/flush-write-stream-1.0.3.tgz#c5d586ef38af6097650b49bc41b55fabb19f35bd" dependencies: inherits "^2.0.1" readable-stream "^2.0.4" -for-in@^1.0.2: +for-in@^1.0.1, for-in@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" +for-own@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/for-own/-/for-own-0.1.5.tgz#5265c681a4f294dabbf17c9509b6763aa84510ce" + dependencies: + for-in "^1.0.1" + +foreach@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99" + forever-agent@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" @@ -1613,19 +2208,13 @@ form-data@~2.1.1: mime-types "^2.1.12" form-data@~2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.1.tgz#6fb94fbd71885306d73d15cc497fe4cc4ecd44bf" + version "2.3.2" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.2.tgz#4970498be604c20c005d4f5c23aecd21d6b49099" dependencies: asynckit "^0.4.0" - combined-stream "^1.0.5" + combined-stream "1.0.6" mime-types "^2.1.12" -formatio@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/formatio/-/formatio-1.2.0.tgz#f3b2167d9068c4698a8d51f4f760a39a54d818eb" - dependencies: - samsam "1.x" - forwarded@~0.1.0: version "0.1.2" resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.1.2.tgz#98c23dab1175657b8c0573e8ceccd91b0ff18c84" @@ -1647,6 +2236,12 @@ from2@^2.1.0: inherits "^2.0.1" readable-stream "^2.0.0" +fs-minipass@^1.2.5: + version "1.2.5" + resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.5.tgz#06c277218454ec288df77ada54a03b8702aacb9d" + dependencies: + minipass "^2.2.1" + fs-write-stream-atomic@^1.0.8: version "1.0.10" resolved "https://registry.yarnpkg.com/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz#b47df53493ef911df75731e70a9ded0189db40c9" @@ -1660,31 +2255,21 @@ fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" -fsevents@^1.0.0: - version "1.1.3" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.1.3.tgz#11f82318f5fe7bb2cd22965a108e9306208216d8" - dependencies: - nan "^2.3.0" - node-pre-gyp "^0.6.39" - -fstream-ignore@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/fstream-ignore/-/fstream-ignore-1.0.5.tgz#9c31dae34767018fe1d249b24dada67d092da105" +fsevents@^1.1.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.2.tgz#4f598f0f69b273188ef4a62ca4e9e08ace314bbf" dependencies: - fstream "^1.0.0" - inherits "2" - minimatch "^3.0.0" + nan "^2.9.2" + node-pre-gyp "^0.9.0" -fstream@^1.0.0, fstream@^1.0.10, fstream@^1.0.2: - version "1.0.11" - resolved "https://registry.yarnpkg.com/fstream/-/fstream-1.0.11.tgz#5c1fb1f117477114f0632a0eb4b71b3cb0fd3171" +fsevents@^1.2.3: + version "1.2.4" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.4.tgz#f41dcb1af2582af3692da36fc55cbd8e1041c426" dependencies: - graceful-fs "^4.1.2" - inherits "~2.0.0" - mkdirp ">=0.5 0" - rimraf "2" + nan "^2.9.2" + node-pre-gyp "^0.10.0" -function-bind@^1.0.2: +function-bind@^1.0.2, function-bind@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" @@ -1715,10 +2300,18 @@ generate-object-property@^1.1.0: dependencies: is-property "^1.0.0" +get-caller-file@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.2.tgz#f702e63127e7e231c160a80c1554acb70d5047e5" + get-stdin@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-5.0.1.tgz#122e161591e21ff4c52530305693f20e6393a398" +get-stream@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" + get-value@^2.0.3, get-value@^2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" @@ -1729,6 +2322,19 @@ getpass@^0.1.1: dependencies: assert-plus "^1.0.0" +glob-base@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4" + dependencies: + glob-parent "^2.0.0" + is-glob "^2.0.0" + +glob-parent@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-2.0.0.tgz#81383d72db054fcccf5336daa902f182f6edbb28" + dependencies: + is-glob "^2.0.0" + glob-parent@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-3.1.0.tgz#9e6af6299d8d3bd2bd40430832bd113df906c5ae" @@ -1736,17 +2342,6 @@ glob-parent@^3.1.0: is-glob "^3.1.0" path-dirname "^1.0.0" -glob@7.1.1: - version "7.1.1" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8" - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.2" - once "^1.3.0" - path-is-absolute "^1.0.0" - glob@^5.0.15: version "5.0.15" resolved "https://registry.yarnpkg.com/glob/-/glob-5.0.15.tgz#1bc936b9e02f4a603fcc222ecf7633d30b8b93b1" @@ -1757,7 +2352,7 @@ glob@^5.0.15: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.0.3, glob@^7.0.5, glob@^7.1.2: +glob@^7.0.3, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2: version "7.1.2" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" dependencies: @@ -1769,8 +2364,12 @@ glob@^7.0.3, glob@^7.0.5, glob@^7.1.2: path-is-absolute "^1.0.0" globals@^11.0.1: - version "11.1.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-11.1.0.tgz#632644457f5f0e3ae711807183700ebf2e4633e4" + version "11.4.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.4.0.tgz#b85c793349561c16076a3c13549238a27945f1bc" + +globals@^9.18.0: + version "9.18.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" globby@^5.0.0: version "5.0.0" @@ -1791,11 +2390,11 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.2: version "1.0.1" resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725" -growl@1.9.2: - version "1.9.2" - resolved "https://registry.yarnpkg.com/growl/-/growl-1.9.2.tgz#0ea7743715db8d8de2c5ede1775e1b45ac85c02f" +growly@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" -handlebars@^4.0.1: +handlebars@^4.0.1, handlebars@^4.0.3: version "4.0.11" resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.11.tgz#630a35dfe0294bc281edae6ffc5d329fc7982dcc" dependencies: @@ -1850,6 +2449,10 @@ has-flag@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + has-unicode@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" @@ -1887,12 +2490,6 @@ has@^1.0.1: dependencies: function-bind "^1.0.2" -hash-base@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-2.0.2.tgz#66ea1d856db4e8a5470cadf6fce23ae5244ef2e1" - dependencies: - inherits "^2.0.1" - hash-base@^3.0.0: version "3.0.4" resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.0.4.tgz#5fc8686847ecd73499403319a6b0a3f3f6ae4918" @@ -1907,7 +2504,7 @@ hash.js@^1.0.0, hash.js@^1.0.3: inherits "^2.0.3" minimalistic-assert "^1.0.0" -hawk@3.1.3, hawk@~3.1.3: +hawk@~3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/hawk/-/hawk-3.1.3.tgz#078444bd7c1640b0fe540d2c9b73d59678e8e1c4" dependencies: @@ -1925,10 +2522,6 @@ hawk@~6.0.2: hoek "4.x.x" sntp "2.x.x" -he@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" - hmac-drbg@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" @@ -1942,13 +2535,30 @@ hoek@2.x.x: resolved "https://registry.yarnpkg.com/hoek/-/hoek-2.16.3.tgz#20bb7403d3cea398e91dc4710a8ff1b8274a25ed" hoek@4.x.x: - version "4.2.0" - resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.2.0.tgz#72d9d0754f7fe25ca2d01ad8f8f9a9449a89526d" + version "4.2.1" + resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.2.1.tgz#9634502aa12c445dd5a7c5734b572bb8738aacbb" + +home-or-tmp@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-2.0.0.tgz#e36c3f2d2cae7d746a857e38d18d5f32a7882db8" + dependencies: + os-homedir "^1.0.0" + os-tmpdir "^1.0.1" + +hosted-git-info@^2.1.4: + version "2.6.0" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.6.0.tgz#23235b29ab230c576aab0d4f13fc046b0b038222" html-comment-regex@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/html-comment-regex/-/html-comment-regex-1.1.1.tgz#668b93776eaae55ebde8f3ad464b307a4963625e" +html-encoding-sniffer@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz#e70d84b94da53aa375e11fe3a351be6642ca46f8" + dependencies: + whatwg-encoding "^1.0.1" + http-errors@~1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.3.1.tgz#197e22cdebd4198585e8694ef6786197b91ed942" @@ -1980,10 +2590,22 @@ i18n-webpack-plugin@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/i18n-webpack-plugin/-/i18n-webpack-plugin-1.0.0.tgz#0ca12296ec937a4f94325cd0264d08f4e0549831" -iconv-lite@^0.4.17, iconv-lite@~0.4.13: +iconv-lite@0.4.19: version "0.4.19" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b" +iconv-lite@^0.4.17, iconv-lite@~0.4.13: + version "0.4.21" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.21.tgz#c47f8733d02171189ebc4a400f3218d348094798" + dependencies: + safer-buffer "^2.1.0" + +iconv-lite@^0.4.4: + version "0.4.23" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.23.tgz#297871f63be507adcfbfca715d0cd0eed84e9a63" + dependencies: + safer-buffer ">= 2.1.2 < 3" + icss-replace-symbols@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/icss-replace-symbols/-/icss-replace-symbols-1.1.0.tgz#06ea6f83679a7749e386cfe1fe812ae5db223ded" @@ -1994,22 +2616,35 @@ icss-utils@^2.1.0: dependencies: postcss "^6.0.1" -ieee754@^1.1.4: - version "1.1.8" - resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.8.tgz#be33d40ac10ef1926701f6f08a2d86fbfd1ad3e4" +ieee754@^1.1.11, ieee754@^1.1.4: + version "1.1.11" + resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.11.tgz#c16384ffe00f5b7835824e67b6f2bd44a5229455" iferr@^0.1.5: version "0.1.5" resolved "https://registry.yarnpkg.com/iferr/-/iferr-0.1.5.tgz#c60eed69e6d8fdb6b3104a1fcbca1c192dc5b501" +ignore-walk@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.1.tgz#a83e62e7d272ac0e3b551aaa82831a19b69f82f8" + dependencies: + minimatch "^3.0.4" + ignore@^3.3.3, ignore@^3.3.6: - version "3.3.7" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.7.tgz#612289bfb3c220e186a58118618d5be8c1bab021" + version "3.3.8" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.8.tgz#3f8e9c35d38708a3a7e0e9abb6c73e7ee7707b2b" image-size@~0.5.0: version "0.5.5" resolved "https://registry.yarnpkg.com/image-size/-/image-size-0.5.5.tgz#09dfd4ab9d20e29eb1c3e80b8990378df9e3cb9c" +import-local@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/import-local/-/import-local-1.0.0.tgz#5e4ffdc03f4fe6c009c6729beb29631c2f8227bc" + dependencies: + pkg-dir "^2.0.0" + resolve-cwd "^2.0.0" + imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" @@ -2029,7 +2664,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.1, inherits@~2.0.3: +inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.1, inherits@~2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" @@ -2038,8 +2673,8 @@ inherits@2.0.1: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1" ini@~1.3.0: - version "1.3.4" - resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.4.tgz#0537cb79daf59b59a1a517dff706c86ec039162e" + version "1.3.5" + resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" inquirer@^3.0.6: version "3.3.0" @@ -2060,6 +2695,16 @@ inquirer@^3.0.6: strip-ansi "^4.0.0" through "^2.3.6" +invariant@^2.2.2: + version "2.2.4" + resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" + dependencies: + loose-envify "^1.0.0" + +invert-kv@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6" + ipaddr.js@1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.0.5.tgz#5fa78cf301b825c78abc3042d812723049ea23c7" @@ -2080,6 +2725,10 @@ is-accessor-descriptor@^1.0.0: dependencies: kind-of "^6.0.0" +is-arrayish@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + is-binary-path@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898" @@ -2090,6 +2739,22 @@ is-buffer@^1.1.5: version "1.1.6" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" +is-builtin-module@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-1.0.0.tgz#540572d34f7ac3119f8f76c30cbc1b1e037affbe" + dependencies: + builtin-modules "^1.0.0" + +is-callable@^1.1.1, is-callable@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.3.tgz#86eb75392805ddc33af71c92a0eedf74ee7604b2" + +is-ci@^1.0.10: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.1.0.tgz#247e4162e7860cebbdaf30b774d6b0ac7dcfe7a5" + dependencies: + ci-info "^1.0.0" + is-data-descriptor@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" @@ -2102,6 +2767,10 @@ is-data-descriptor@^1.0.0: dependencies: kind-of "^6.0.0" +is-date-object@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16" + is-descriptor@^0.1.0: version "0.1.6" resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" @@ -2118,6 +2787,23 @@ is-descriptor@^1.0.0, is-descriptor@^1.0.2: is-data-descriptor "^1.0.0" kind-of "^6.0.2" +is-dotfile@^1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1" + +is-equal-shallow@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz#2238098fc221de0bcfa5d9eac4c45d638aa1c534" + dependencies: + is-primitive "^2.0.0" + +is-expression@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-expression/-/is-expression-3.0.0.tgz#39acaa6be7fd1f3471dc42c7416e61c24317ac9f" + dependencies: + acorn "~4.0.2" + object-assign "^4.0.1" + is-extendable@^0.1.0, is-extendable@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" @@ -2128,10 +2814,20 @@ is-extendable@^1.0.1: dependencies: is-plain-object "^2.0.4" +is-extglob@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-1.0.0.tgz#ac468177c4943405a092fc8f29760c6ffc6206c0" + is-extglob@^2.1.0, is-extglob@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" +is-finite@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.0.2.tgz#cc6677695602be550ef11e8b4aa6305342b6d0aa" + dependencies: + number-is-nan "^1.0.0" + is-fullwidth-code-point@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" @@ -2142,6 +2838,16 @@ is-fullwidth-code-point@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" +is-generator-fn@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-1.0.0.tgz#969d49e1bb3329f6bb7f09089be26578b2ddd46a" + +is-glob@^2.0.0, is-glob@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863" + dependencies: + is-extglob "^1.0.0" + is-glob@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-3.1.0.tgz#7ba5ae24217804ac70707b96922567486cc3e84a" @@ -2154,15 +2860,26 @@ is-glob@^4.0.0: dependencies: is-extglob "^2.1.1" +is-my-ip-valid@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-my-ip-valid/-/is-my-ip-valid-1.0.0.tgz#7b351b8e8edd4d3995d4d066680e664d94696824" + is-my-json-valid@^2.12.4: - version "2.17.1" - resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.17.1.tgz#3da98914a70a22f0a8563ef1511a246c6fc55471" + version "2.17.2" + resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.17.2.tgz#6b2103a288e94ef3de5cf15d29dd85fc4b78d65c" dependencies: generate-function "^2.0.0" generate-object-property "^1.1.0" + is-my-ip-valid "^1.0.0" jsonpointer "^4.0.0" xtend "^4.0.0" +is-number@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f" + dependencies: + kind-of "^3.0.2" + is-number@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" @@ -2184,8 +2901,8 @@ is-path-cwd@^1.0.0: resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" is-path-in-cwd@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz#6477582b8214d602346094567003be8a9eac04dc" + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz#5ac48b345ef675339bd6c7a48a912110b241cf52" dependencies: is-path-inside "^1.0.0" @@ -2205,6 +2922,14 @@ is-plain-object@^2.0.1, is-plain-object@^2.0.3, is-plain-object@^2.0.4: dependencies: isobject "^3.0.1" +is-posix-bracket@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz#3334dc79774368e92f016e6fbc0a88f5cd6e6bc4" + +is-primitive@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" + is-promise@^2.0.0, is-promise@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" @@ -2217,11 +2942,17 @@ is-property@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84" +is-regex@^1.0.3, is-regex@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" + dependencies: + has "^1.0.1" + is-resolvable@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.0.1.tgz#acca1cd36dbe44b974b924321555a70ba03b1cf4" + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.1.0.tgz#fb18f87ce1feb925169c9a407c19318a3206ed88" -is-stream@^1.0.1: +is-stream@^1.0.1, is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" @@ -2231,25 +2962,31 @@ is-svg@^2.0.0: dependencies: html-comment-regex "^1.1.0" +is-symbol@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.1.tgz#3cc59f00025194b6ab2e38dbae6689256b660572" + is-typedarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" +is-utf8@^0.2.0: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" + is-windows@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" -isarray@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" - isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" -isemail@1.x.x: - version "1.2.0" - resolved "https://registry.yarnpkg.com/isemail/-/isemail-1.2.0.tgz#be03df8cc3e29de4d2c5df6501263f1fa4595e9a" +isemail@3.x.x: + version "3.1.2" + resolved "https://registry.yarnpkg.com/isemail/-/isemail-3.1.2.tgz#937cf919002077999a73ea8b1951d590e84e01dd" + dependencies: + punycode "2.x.x" isexe@^2.0.0: version "2.0.0" @@ -2276,6 +3013,70 @@ isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" +istanbul-api@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/istanbul-api/-/istanbul-api-1.3.1.tgz#4c3b05d18c0016d1022e079b98dc82c40f488954" + dependencies: + async "^2.1.4" + compare-versions "^3.1.0" + fileset "^2.0.2" + istanbul-lib-coverage "^1.2.0" + istanbul-lib-hook "^1.2.0" + istanbul-lib-instrument "^1.10.1" + istanbul-lib-report "^1.1.4" + istanbul-lib-source-maps "^1.2.4" + istanbul-reports "^1.3.0" + js-yaml "^3.7.0" + mkdirp "^0.5.1" + once "^1.4.0" + +istanbul-lib-coverage@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-1.2.0.tgz#f7d8f2e42b97e37fe796114cb0f9d68b5e3a4341" + +istanbul-lib-hook@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/istanbul-lib-hook/-/istanbul-lib-hook-1.2.0.tgz#ae556fd5a41a6e8efa0b1002b1e416dfeaf9816c" + dependencies: + append-transform "^0.4.0" + +istanbul-lib-instrument@^1.10.1: + version "1.10.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-1.10.1.tgz#724b4b6caceba8692d3f1f9d0727e279c401af7b" + dependencies: + babel-generator "^6.18.0" + babel-template "^6.16.0" + babel-traverse "^6.18.0" + babel-types "^6.18.0" + babylon "^6.18.0" + istanbul-lib-coverage "^1.2.0" + semver "^5.3.0" + +istanbul-lib-report@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-1.1.4.tgz#e886cdf505c4ebbd8e099e4396a90d0a28e2acb5" + dependencies: + istanbul-lib-coverage "^1.2.0" + mkdirp "^0.5.1" + path-parse "^1.0.5" + supports-color "^3.1.2" + +istanbul-lib-source-maps@^1.2.4: + version "1.2.4" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.4.tgz#cc7ccad61629f4efff8e2f78adb8c522c9976ec7" + dependencies: + debug "^3.1.0" + istanbul-lib-coverage "^1.2.0" + mkdirp "^0.5.1" + rimraf "^2.6.1" + source-map "^0.5.3" + +istanbul-reports@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-1.3.0.tgz#2f322e81e1d9520767597dca3c20a0cce89a3554" + dependencies: + handlebars "^4.0.3" + istanbul@^0.4.5: version "0.4.5" resolved "https://registry.yarnpkg.com/istanbul/-/istanbul-0.4.5.tgz#65c7d73d4c4da84d4f3ac310b918fb0b8033733b" @@ -2295,43 +3096,325 @@ istanbul@^0.4.5: which "^1.1.1" wordwrap "^1.0.0" -jade-loader@~0.8.0: - version "0.8.0" - resolved "https://registry.yarnpkg.com/jade-loader/-/jade-loader-0.8.0.tgz#d1b09971a9bf90a2b298b0af5b1ad0300d109c2e" +jade-loader@~0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/jade-loader/-/jade-loader-0.8.0.tgz#d1b09971a9bf90a2b298b0af5b1ad0300d109c2e" + dependencies: + loader-utils "~0.2.5" + +jade@^1.11.0: + version "1.11.0" + resolved "https://registry.yarnpkg.com/jade/-/jade-1.11.0.tgz#9c80e538c12d3fb95c8d9bb9559fa0cc040405fd" + dependencies: + character-parser "1.2.1" + clean-css "^3.1.9" + commander "~2.6.0" + constantinople "~3.0.1" + jstransformer "0.0.2" + mkdirp "~0.5.0" + transformers "2.1.0" + uglify-js "^2.4.19" + void-elements "~2.0.1" + with "~4.0.0" + +jest-changed-files@^23.0.1: + version "23.0.1" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-23.0.1.tgz#f79572d0720844ea5df84c2a448e862c2254f60c" + dependencies: + throat "^4.0.0" + +jest-cli@^23.0.1: + version "23.0.1" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-23.0.1.tgz#351a5ba51cf28ecf20336d97a30b970d1f530a56" + dependencies: + ansi-escapes "^3.0.0" + chalk "^2.0.1" + exit "^0.1.2" + glob "^7.1.2" + graceful-fs "^4.1.11" + import-local "^1.0.0" + is-ci "^1.0.10" + istanbul-api "^1.3.1" + istanbul-lib-coverage "^1.2.0" + istanbul-lib-instrument "^1.10.1" + istanbul-lib-source-maps "^1.2.4" + jest-changed-files "^23.0.1" + jest-config "^23.0.1" + jest-environment-jsdom "^23.0.1" + jest-get-type "^22.1.0" + jest-haste-map "^23.0.1" + jest-message-util "^23.0.0" + jest-regex-util "^23.0.0" + jest-resolve-dependencies "^23.0.1" + jest-runner "^23.0.1" + jest-runtime "^23.0.1" + jest-snapshot "^23.0.1" + jest-util "^23.0.1" + jest-validate "^23.0.1" + jest-worker "^23.0.1" + micromatch "^2.3.11" + node-notifier "^5.2.1" + realpath-native "^1.0.0" + rimraf "^2.5.4" + slash "^1.0.0" + string-length "^2.0.0" + strip-ansi "^4.0.0" + which "^1.2.12" + yargs "^11.0.0" + +jest-config@^23.0.1: + version "23.0.1" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-23.0.1.tgz#6798bff1247c7a390b1327193305001582fc58fa" + dependencies: + babel-core "^6.0.0" + babel-jest "^23.0.1" + chalk "^2.0.1" + glob "^7.1.1" + jest-environment-jsdom "^23.0.1" + jest-environment-node "^23.0.1" + jest-get-type "^22.1.0" + jest-jasmine2 "^23.0.1" + jest-regex-util "^23.0.0" + jest-resolve "^23.0.1" + jest-util "^23.0.1" + jest-validate "^23.0.1" + pretty-format "^23.0.1" + +jest-diff@^23.0.1: + version "23.0.1" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-23.0.1.tgz#3d49137cee12c320a4b4d2b4a6fa6e82d491a16a" + dependencies: + chalk "^2.0.1" + diff "^3.2.0" + jest-get-type "^22.1.0" + pretty-format "^23.0.1" + +jest-docblock@^21.0.0: + version "21.2.0" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-21.2.0.tgz#51529c3b30d5fd159da60c27ceedc195faf8d414" + +jest-docblock@^23.0.1: + version "23.0.1" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-23.0.1.tgz#deddd18333be5dc2415260a04ef3fce9276b5725" + dependencies: + detect-newline "^2.1.0" + +jest-each@^23.0.1: + version "23.0.1" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-23.0.1.tgz#a6e5dbf530afc6bf9d74792dde69d8db70f84706" + dependencies: + chalk "^2.0.1" + pretty-format "^23.0.1" + +jest-environment-jsdom@^23.0.1: + version "23.0.1" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-23.0.1.tgz#da689eb9358dc16e5708abb208f4eb26a439575c" + dependencies: + jest-mock "^23.0.1" + jest-util "^23.0.1" + jsdom "^11.5.1" + +jest-environment-node@^23.0.1: + version "23.0.1" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-23.0.1.tgz#676b740e205f1f2be77241969e7812be824ee795" + dependencies: + jest-mock "^23.0.1" + jest-util "^23.0.1" + +jest-get-type@^22.1.0: + version "22.4.3" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-22.4.3.tgz#e3a8504d8479342dd4420236b322869f18900ce4" + +jest-haste-map@^23.0.1: + version "23.0.1" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-23.0.1.tgz#cd89052abfc8cba01f560bbec09d4f36aec25d4f" + dependencies: + fb-watchman "^2.0.0" + graceful-fs "^4.1.11" + jest-docblock "^23.0.1" + jest-serializer "^23.0.1" + jest-worker "^23.0.1" + micromatch "^2.3.11" + sane "^2.0.0" + +jest-jasmine2@^23.0.1: + version "23.0.1" + resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-23.0.1.tgz#16d875356e6360872bba48426f7d31fdc1b0bcea" + dependencies: + chalk "^2.0.1" + co "^4.6.0" + expect "^23.0.1" + is-generator-fn "^1.0.0" + jest-diff "^23.0.1" + jest-each "^23.0.1" + jest-matcher-utils "^23.0.1" + jest-message-util "^23.0.0" + jest-snapshot "^23.0.1" + jest-util "^23.0.1" + pretty-format "^23.0.1" + +jest-leak-detector@^23.0.1: + version "23.0.1" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-23.0.1.tgz#9dba07505ac3495c39d3ec09ac1e564599e861a0" + dependencies: + pretty-format "^23.0.1" + +jest-matcher-utils@^23.0.1: + version "23.0.1" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-23.0.1.tgz#0c6c0daedf9833c2a7f36236069efecb4c3f6e5f" + dependencies: + chalk "^2.0.1" + jest-get-type "^22.1.0" + pretty-format "^23.0.1" + +jest-message-util@^23.0.0: + version "23.0.0" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-23.0.0.tgz#073f3d76c701f7c718a4b9af1eb7f138792c4796" + dependencies: + "@babel/code-frame" "^7.0.0-beta.35" + chalk "^2.0.1" + micromatch "^2.3.11" + slash "^1.0.0" + stack-utils "^1.0.1" + +jest-mock@^23.0.1: + version "23.0.1" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-23.0.1.tgz#1569f477968c668fc728273a17c3767773b46357" + +jest-regex-util@^23.0.0: + version "23.0.0" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-23.0.0.tgz#dd5c1fde0c46f4371314cf10f7a751a23f4e8f76" + +jest-resolve-dependencies@^23.0.1: + version "23.0.1" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-23.0.1.tgz#d01a10ddad9152c4cecdf5eac2b88571c4b6a64d" + dependencies: + jest-regex-util "^23.0.0" + jest-snapshot "^23.0.1" + +jest-resolve@^23.0.1: + version "23.0.1" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-23.0.1.tgz#3f8403462b10a34c2df1d47aab5574c4935bcd24" + dependencies: + browser-resolve "^1.11.2" + chalk "^2.0.1" + realpath-native "^1.0.0" + +jest-runner@^23.0.1: + version "23.0.1" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-23.0.1.tgz#b176ae3ecf9e194aa4b84a7fcf70d1b8db231aa7" + dependencies: + exit "^0.1.2" + graceful-fs "^4.1.11" + jest-config "^23.0.1" + jest-docblock "^23.0.1" + jest-haste-map "^23.0.1" + jest-jasmine2 "^23.0.1" + jest-leak-detector "^23.0.1" + jest-message-util "^23.0.0" + jest-runtime "^23.0.1" + jest-util "^23.0.1" + jest-worker "^23.0.1" + source-map-support "^0.5.6" + throat "^4.0.0" + +jest-runtime@^23.0.1: + version "23.0.1" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-23.0.1.tgz#b1d765fb03fb6d4043805af270676a693f504d57" + dependencies: + babel-core "^6.0.0" + babel-plugin-istanbul "^4.1.6" + chalk "^2.0.1" + convert-source-map "^1.4.0" + exit "^0.1.2" + fast-json-stable-stringify "^2.0.0" + graceful-fs "^4.1.11" + jest-config "^23.0.1" + jest-haste-map "^23.0.1" + jest-message-util "^23.0.0" + jest-regex-util "^23.0.0" + jest-resolve "^23.0.1" + jest-snapshot "^23.0.1" + jest-util "^23.0.1" + jest-validate "^23.0.1" + micromatch "^2.3.11" + realpath-native "^1.0.0" + slash "^1.0.0" + strip-bom "3.0.0" + write-file-atomic "^2.1.0" + yargs "^11.0.0" + +jest-serializer@^23.0.1: + version "23.0.1" + resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-23.0.1.tgz#a3776aeb311e90fe83fab9e533e85102bd164165" + +jest-silent-reporter@^0.0.5: + version "0.0.5" + resolved "https://registry.yarnpkg.com/jest-silent-reporter/-/jest-silent-reporter-0.0.5.tgz#14139b7a991b7bcca880dd8a69c33a91723a8f1f" + dependencies: + chalk "^2.3.1" + jest-util "^23.0.0" + +jest-snapshot@^23.0.1: + version "23.0.1" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-23.0.1.tgz#6674fa19b9eb69a99cabecd415bddc42d6af3e7e" dependencies: - loader-utils "~0.2.5" + chalk "^2.0.1" + jest-diff "^23.0.1" + jest-matcher-utils "^23.0.1" + mkdirp "^0.5.1" + natural-compare "^1.4.0" + pretty-format "^23.0.1" -jade@^1.11.0: - version "1.11.0" - resolved "https://registry.yarnpkg.com/jade/-/jade-1.11.0.tgz#9c80e538c12d3fb95c8d9bb9559fa0cc040405fd" +jest-util@^23.0.0, jest-util@^23.0.1: + version "23.0.1" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-23.0.1.tgz#68ea5bd7edb177d3059f9797259f8e0dacce2f99" dependencies: - character-parser "1.2.1" - clean-css "^3.1.9" - commander "~2.6.0" - constantinople "~3.0.1" - jstransformer "0.0.2" - mkdirp "~0.5.0" - transformers "2.1.0" - uglify-js "^2.4.19" - void-elements "~2.0.1" - with "~4.0.0" + callsites "^2.0.0" + chalk "^2.0.1" + graceful-fs "^4.1.11" + is-ci "^1.0.10" + jest-message-util "^23.0.0" + mkdirp "^0.5.1" + source-map "^0.6.0" -jest-docblock@^21.0.0: - version "21.2.0" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-21.2.0.tgz#51529c3b30d5fd159da60c27ceedc195faf8d414" +jest-validate@^23.0.1: + version "23.0.1" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-23.0.1.tgz#cd9f01a89d26bb885f12a8667715e9c865a5754f" + dependencies: + chalk "^2.0.1" + jest-get-type "^22.1.0" + leven "^2.1.0" + pretty-format "^23.0.1" -joi@^6.4.x: - version "6.10.1" - resolved "https://registry.yarnpkg.com/joi/-/joi-6.10.1.tgz#4d50c318079122000fe5f16af1ff8e1917b77e06" +jest-worker@^23.0.1: + version "23.0.1" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-23.0.1.tgz#9e649dd963ff4046026f91c4017f039a6aa4a7bc" dependencies: - hoek "2.x.x" - isemail "1.x.x" - moment "2.x.x" - topo "1.x.x" + merge-stream "^1.0.1" + +jest@^23.0.1: + version "23.0.1" + resolved "https://registry.yarnpkg.com/jest/-/jest-23.0.1.tgz#0d083290ee4112cecfb780df6ff81332ed373201" + dependencies: + import-local "^1.0.0" + jest-cli "^23.0.1" + +joi@^12.x: + version "12.0.0" + resolved "https://registry.yarnpkg.com/joi/-/joi-12.0.0.tgz#46f55e68f4d9628f01bbb695902c8b307ad8d33a" + dependencies: + hoek "4.x.x" + isemail "3.x.x" + topo "2.x.x" js-base64@^2.1.9: - version "2.4.0" - resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.4.0.tgz#9e566fee624751a1d720c966cd6226d29d4025aa" + version "2.4.3" + resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.4.3.tgz#2e545ec2b0f2957f41356510205214e98fad6582" + +js-stringify@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/js-stringify/-/js-stringify-1.0.2.tgz#1736fddfd9724f28a3682adc6230ae7e4e9679db" js-tokens@^3.0.0, js-tokens@^3.0.2: version "3.0.2" @@ -2344,9 +3427,9 @@ js-yaml@3.6.1: argparse "^1.0.7" esprima "^2.6.0" -js-yaml@3.x, js-yaml@^3.9.1: - version "3.10.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.10.0.tgz#2e78441646bd4682e963f22b6e92823c309c62dc" +js-yaml@3.x, js-yaml@^3.7.0, js-yaml@^3.9.1: + version "3.11.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.11.0.tgz#597c1a8bd57152f26d622ce4117851a51f5ebaef" dependencies: argparse "^1.0.7" esprima "^4.0.0" @@ -2362,6 +3445,41 @@ jsbn@~0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" +jsdom@^11.5.1: + version "11.10.0" + resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-11.10.0.tgz#a42cd54e88895dc765f03f15b807a474962ac3b5" + dependencies: + abab "^1.0.4" + acorn "^5.3.0" + acorn-globals "^4.1.0" + array-equal "^1.0.0" + cssom ">= 0.3.2 < 0.4.0" + cssstyle ">= 0.2.37 < 0.3.0" + data-urls "^1.0.0" + domexception "^1.0.0" + escodegen "^1.9.0" + html-encoding-sniffer "^1.0.2" + left-pad "^1.2.0" + nwmatcher "^1.4.3" + parse5 "4.0.0" + pn "^1.1.0" + request "^2.83.0" + request-promise-native "^1.0.5" + sax "^1.2.4" + symbol-tree "^3.2.2" + tough-cookie "^2.3.3" + w3c-hr-time "^1.0.1" + webidl-conversions "^4.0.2" + whatwg-encoding "^1.0.3" + whatwg-mimetype "^2.1.0" + whatwg-url "^6.4.0" + ws "^4.0.0" + xml-name-validator "^3.0.0" + +jsesc@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-1.3.0.tgz#46c3fec8c1892b12b0833db9bc7622176dbab34b" + jsesc@~0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" @@ -2370,6 +3488,10 @@ json-loader@^0.5.7: version "0.5.7" resolved "https://registry.yarnpkg.com/json-loader/-/json-loader-0.5.7.tgz#dca14a70235ff82f0ac9a3abeb60d337a365185d" +json-parse-better-errors@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" + json-schema-traverse@^0.3.0: version "0.3.1" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340" @@ -2392,11 +3514,7 @@ json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" -json3@3.3.2: - version "3.3.2" - resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.2.tgz#3c0434743df93e2f5c42aee7b19bcb483575f4e1" - -json5@^0.5.0: +json5@^0.5.0, json5@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" @@ -2424,6 +3542,13 @@ jstransformer@0.0.2: is-promise "^2.0.0" promise "^6.0.1" +jstransformer@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/jstransformer/-/jstransformer-1.0.0.tgz#ed8bf0921e2f3f1ed4d5c1a44f68709ed24722c3" + dependencies: + is-promise "^2.0.0" + promise "^7.0.1" + kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: version "3.2.2" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" @@ -2448,23 +3573,35 @@ lazy-cache@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e" -lazy-cache@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-2.0.2.tgz#b9190a4f913354694840859f8a8f7084d8822264" +lcid@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835" dependencies: - set-getter "^0.1.0" + invert-kv "^1.0.0" -lcov-parse@0.0.10, lcov-parse@0.x: +lcov-parse@0.0.10: version "0.0.10" resolved "https://registry.yarnpkg.com/lcov-parse/-/lcov-parse-0.0.10.tgz#1b0b8ff9ac9c7889250582b70b71315d9da6d9a3" +lcov-parse@^1.x: + version "1.0.0" + resolved "https://registry.yarnpkg.com/lcov-parse/-/lcov-parse-1.0.0.tgz#eb0d46b54111ebc561acb4c408ef9363bdc8f7e0" + +leb@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/leb/-/leb-0.3.0.tgz#32bee9fad168328d6aea8522d833f4180eed1da3" + +left-pad@^1.2.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.3.0.tgz#5b8a3a7765dfe001261dde915589e782f8c94d1e" + less-loader@^4.0.3: - version "4.0.5" - resolved "https://registry.yarnpkg.com/less-loader/-/less-loader-4.0.5.tgz#ae155a7406cac6acd293d785587fcff0f478c4dd" + version "4.1.0" + resolved "https://registry.yarnpkg.com/less-loader/-/less-loader-4.1.0.tgz#2c1352c5b09a4f84101490274fd51674de41363e" dependencies: clone "^2.1.1" loader-utils "^1.1.0" - pify "^2.3.0" + pify "^3.0.0" less@^2.5.1: version "2.7.3" @@ -2479,6 +3616,10 @@ less@^2.5.1: request "2.81.0" source-map "^0.5.3" +leven@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/leven/-/leven-2.1.0.tgz#c2e7a9f772094dee9d34202ae8acce4687875580" + levn@^0.3.0, levn@~0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" @@ -2486,6 +3627,16 @@ levn@^0.3.0, levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" +load-json-file@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0" + dependencies: + graceful-fs "^4.1.2" + parse-json "^2.2.0" + pify "^2.0.0" + pinkie-promise "^2.0.0" + strip-bom "^2.0.0" + loader-runner@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.3.0.tgz#f482aea82d543e07921700d5a46ef26fdac6b8a2" @@ -2514,80 +3665,37 @@ locate-path@^2.0.0: p-locate "^2.0.0" path-exists "^3.0.0" -lodash._baseassign@^3.0.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz#8c38a099500f215ad09e59f1722fd0c52bfe0a4e" - dependencies: - lodash._basecopy "^3.0.0" - lodash.keys "^3.0.0" - -lodash._basecopy@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz#8da0e6a876cf344c0ad8a54882111dd3c5c7ca36" - -lodash._basecreate@^3.0.0: - version "3.0.3" - resolved "https://registry.yarnpkg.com/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz#1bc661614daa7fc311b7d03bf16806a0213cf821" - -lodash._getnative@^3.0.0: - version "3.9.1" - resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" - -lodash._isiterateecall@^3.0.0: - version "3.0.9" - resolved "https://registry.yarnpkg.com/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz#5203ad7ba425fae842460e696db9cf3e6aac057c" - lodash.camelcase@^4.3.0: version "4.3.0" resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6" -lodash.create@3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/lodash.create/-/lodash.create-3.1.1.tgz#d7f2849f0dbda7e04682bb8cd72ab022461debe7" - dependencies: - lodash._baseassign "^3.0.0" - lodash._basecreate "^3.0.0" - lodash._isiterateecall "^3.0.0" - -lodash.isarguments@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a" - -lodash.isarray@^3.0.0: - version "3.0.4" - resolved "https://registry.yarnpkg.com/lodash.isarray/-/lodash.isarray-3.0.4.tgz#79e4eb88c36a8122af86f844aa9bcd851b5fbb55" - -lodash.keys@^3.0.0: - version "3.1.2" - resolved "https://registry.yarnpkg.com/lodash.keys/-/lodash.keys-3.1.2.tgz#4dbc0472b156be50a0b286855d1bd0b0c656098a" - dependencies: - lodash._getnative "^3.0.0" - lodash.isarguments "^3.0.0" - lodash.isarray "^3.0.0" - lodash.memoize@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" +lodash.sortby@^4.7.0: + version "4.7.0" + resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" + lodash.uniq@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" -lodash@^3.10.0: - version "3.10.1" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6" - -lodash@^4.17.4, lodash@^4.3.0: - version "4.17.4" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" +lodash@^4.13.1, lodash@^4.14.0, lodash@^4.17.4, lodash@^4.3.0: + version "4.17.10" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7" -log-driver@1.2.5, log-driver@^1.x: +log-driver@1.2.5: version "1.2.5" resolved "https://registry.yarnpkg.com/log-driver/-/log-driver-1.2.5.tgz#7ae4ec257302fd790d557cb10c97100d857b0056" -lolex@^1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/lolex/-/lolex-1.6.0.tgz#3a9a0283452a47d7439e72731b9e07d7386e49f6" +log-driver@^1.x: + version "1.2.7" + resolved "https://registry.yarnpkg.com/log-driver/-/log-driver-1.2.7.tgz#63b95021f0702fedfa2c9bb0a24e7797d71871d8" + +long@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/long/-/long-3.2.0.tgz#d821b7138ca1cb581c172990ef14db200b5c474b" longest@^1.0.1: version "1.0.1" @@ -2599,9 +3707,16 @@ loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.3.1: dependencies: js-tokens "^3.0.0" -lru-cache@^4.0.1, lru-cache@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.1.tgz#622e32e82488b49279114a4f9ecf45e7cd6bba55" +lru-cache@^4.0.1: + version "4.1.3" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.3.tgz#a1175cf3496dfc8436c156c334b4955992bce69c" + dependencies: + pseudomap "^1.0.2" + yallist "^2.1.2" + +lru-cache@^4.1.1: + version "4.1.2" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.2.tgz#45234b2e6e2f2b33da125624c4664929a0224c3f" dependencies: pseudomap "^1.0.2" yallist "^2.1.2" @@ -2611,11 +3726,21 @@ macaddress@^0.2.8: resolved "https://registry.yarnpkg.com/macaddress/-/macaddress-0.2.8.tgz#5904dc537c39ec6dbefeae902327135fa8511f12" make-dir@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-1.1.0.tgz#19b4369fe48c116f53c2af95ad102c0e39e85d51" + version "1.2.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-1.2.0.tgz#6d6a49eead4aae296c53bbf3a1a008bd6c89469b" dependencies: pify "^3.0.0" +makeerror@1.0.x: + version "1.0.11" + resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.11.tgz#e01a5c9109f2af79660e4e8b9587790184f5a96c" + dependencies: + tmpl "1.0.x" + +mamacro@^0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/mamacro/-/mamacro-0.0.3.tgz#ad2c9576197c9f1abf308d0787865bd975a3f3e4" + map-cache@^0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" @@ -2630,6 +3755,10 @@ math-expression-evaluator@^1.2.14: version "1.2.17" resolved "https://registry.yarnpkg.com/math-expression-evaluator/-/math-expression-evaluator-1.2.17.tgz#de819fdbcd84dccd8fae59c6aeb79615b9d266ac" +math-random@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/math-random/-/math-random-1.0.1.tgz#8b3aac588b8a66e4975e3cdea67f7bb329601fac" + md5.js@^1.3.4: version "1.3.4" resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.4.tgz#e9bdbde94a20a5ac18b04340fc5764d5b09d901d" @@ -2641,6 +3770,12 @@ media-typer@0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" +mem@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/mem/-/mem-1.1.0.tgz#5edd52b485ca1d900fe64895505399a0dfa45f76" + dependencies: + mimic-fn "^1.0.0" + memory-fs@^0.4.0, memory-fs@~0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.4.1.tgz#3a9a20b8462523e447cfbc7e8bb80ed667bfc552" @@ -2652,31 +3787,41 @@ merge-descriptors@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" +merge-stream@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-1.0.1.tgz#4041202d508a342ba00174008df0c251b8c135e1" + dependencies: + readable-stream "^2.0.1" + +merge@^1.1.3: + version "1.2.0" + resolved "https://registry.yarnpkg.com/merge/-/merge-1.2.0.tgz#7531e39d4949c281a66b8c5a6e0265e8b05894da" + methods@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" -micromatch@^3.1.4: - version "3.1.9" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.9.tgz#15dc93175ae39e52e93087847096effc73efcf89" - dependencies: - arr-diff "^4.0.0" - array-unique "^0.3.2" - braces "^2.3.1" - define-property "^2.0.2" - extend-shallow "^3.0.2" - extglob "^2.0.4" - fragment-cache "^0.2.1" - kind-of "^6.0.2" - nanomatch "^1.2.9" - object.pick "^1.3.0" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.1" +micromatch@^2.3.11: + version "2.3.11" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565" + dependencies: + arr-diff "^2.0.0" + array-unique "^0.2.1" + braces "^1.8.2" + expand-brackets "^0.1.4" + extglob "^0.3.1" + filename-regex "^2.0.0" + is-extglob "^1.0.0" + is-glob "^2.0.1" + kind-of "^3.0.2" + normalize-path "^2.0.1" + object.omit "^2.0.0" + parse-glob "^3.0.4" + regex-cache "^0.4.2" -micromatch@^3.1.8: - version "3.1.8" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.8.tgz#5c8caa008de588eebb395e8c0ad12c128f25fff1" +micromatch@^3.1.4, micromatch@^3.1.8: + version "3.1.10" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" dependencies: arr-diff "^4.0.0" array-unique "^0.3.2" @@ -2690,7 +3835,7 @@ micromatch@^3.1.8: object.pick "^1.3.0" regex-not "^1.0.0" snapdragon "^0.8.1" - to-regex "^3.0.1" + to-regex "^3.0.2" miller-rabin@^4.0.0: version "4.0.1" @@ -2699,15 +3844,15 @@ miller-rabin@^4.0.0: bn.js "^4.0.0" brorand "^1.0.1" -mime-db@~1.30.0: - version "1.30.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.30.0.tgz#74c643da2dd9d6a45399963465b26d5ca7d71f01" +mime-db@~1.33.0: + version "1.33.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.33.0.tgz#a3492050a5cb9b63450541e39d9788d2272783db" -mime-types@^2.1.12, mime-types@~2.1.15, mime-types@~2.1.17, mime-types@~2.1.6, mime-types@~2.1.7: - version "2.1.17" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.17.tgz#09d7a393f03e995a79f8af857b70a9e0ab16557a" +mime-types@^2.1.12, mime-types@~2.1.17, mime-types@~2.1.18, mime-types@~2.1.6, mime-types@~2.1.7: + version "2.1.18" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.18.tgz#6f323f60a83d11146f831ff11fd66e2fe5503bb8" dependencies: - mime-db "~1.30.0" + mime-db "~1.33.0" mime@1.3.4: version "1.3.4" @@ -2718,18 +3863,18 @@ mime@^1.2.11, mime@^1.4.1, mime@^1.5.0: resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" mimic-fn@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.1.0.tgz#e667783d92e89dbd342818b5230b9d62a672ad18" + version "1.2.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" minimalistic-assert@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.0.tgz#702be2dda6b37f4836bcb3f5db56641b64a1d3d3" + version "1.0.1" + resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" -"minimatch@2 || 3", minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.4: +"minimatch@2 || 3", minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" dependencies: @@ -2739,7 +3884,7 @@ minimist@0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" -minimist@1.2.0, minimist@^1.2.0: +minimist@1.2.0, minimist@^1.1.1, minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" @@ -2747,6 +3892,19 @@ minimist@~0.0.1: version "0.0.10" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" +minipass@^2.2.1, minipass@^2.2.4: + version "2.3.1" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.3.1.tgz#4e872b959131a672837ab3cb554962bc84b1537d" + dependencies: + safe-buffer "^5.1.1" + yallist "^3.0.0" + +minizlib@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.1.0.tgz#11e13658ce46bc3a70a267aac58359d1e0c29ceb" + dependencies: + minipass "^2.2.1" + mississippi@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/mississippi/-/mississippi-2.0.0.tgz#3442a508fafc28500486feea99409676e4ee5a6f" @@ -2769,37 +3927,12 @@ mixin-deep@^1.2.0: for-in "^1.0.2" is-extendable "^1.0.1" -mkdirp@0.5.1, mkdirp@0.5.x, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0, mkdirp@~0.5.1: +mkdirp@0.5.x, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0, mkdirp@~0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" dependencies: minimist "0.0.8" -mocha-lcov-reporter@^1.0.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/mocha-lcov-reporter/-/mocha-lcov-reporter-1.3.0.tgz#469bdef4f8afc9a116056f079df6182d0afb0384" - -mocha@^3.2.0: - version "3.5.3" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-3.5.3.tgz#1e0480fe36d2da5858d1eb6acc38418b26eaa20d" - dependencies: - browser-stdout "1.3.0" - commander "2.9.0" - debug "2.6.8" - diff "3.2.0" - escape-string-regexp "1.0.5" - glob "7.1.1" - growl "1.9.2" - he "1.1.1" - json3 "3.3.2" - lodash.create "3.1.1" - mkdirp "0.5.1" - supports-color "3.1.2" - -moment@2.x.x: - version "2.20.1" - resolved "https://registry.yarnpkg.com/moment/-/moment-2.20.1.tgz#d6eb1a46cbcc14a2b2f9434112c1ff8907f313fd" - move-concurrently@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92" @@ -2823,9 +3956,9 @@ mute-stream@0.0.7: version "0.0.7" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" -nan@^2.3.0: - version "2.8.0" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.8.0.tgz#ed715f3fe9de02b57a5e6252d90a96675e1f085a" +nan@^2.9.2: + version "2.10.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.10.0.tgz#96d0cd610ebd58d4b4de9cc0c6828cda99c7548f" nanomatch@^1.2.9: version "1.2.9" @@ -2844,21 +3977,25 @@ nanomatch@^1.2.9: snapdragon "^0.8.1" to-regex "^3.0.1" -native-promise-only@^0.8.1: - version "0.8.1" - resolved "https://registry.yarnpkg.com/native-promise-only/-/native-promise-only-0.8.1.tgz#20a318c30cb45f71fe7adfbf7b21c99c1472ef11" - natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" +needle@^2.2.0: + version "2.2.1" + resolved "https://registry.yarnpkg.com/needle/-/needle-2.2.1.tgz#b5e325bd3aae8c2678902fa296f729455d1d3a7d" + dependencies: + debug "^2.1.2" + iconv-lite "^0.4.4" + sax "^1.2.4" + negotiator@0.5.3: version "0.5.3" resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.5.3.tgz#269d5c476810ec92edbe7b6c2f28316384f9a7e8" neo-async@^2.5.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.5.0.tgz#76b1c823130cca26acfbaccc8fbaf0a2fa33b18f" + version "2.5.1" + resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.5.1.tgz#acb909e327b1e87ec9ef15f41b8a269512ad41ee" node-fetch@^1.0.1: version "1.7.3" @@ -2867,6 +4004,10 @@ node-fetch@^1.0.1: encoding "^0.1.11" is-stream "^1.0.1" +node-int64@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" + node-libs-browser@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/node-libs-browser/-/node-libs-browser-2.1.0.tgz#5f94263d404f6e44767d726901fff05478d600df" @@ -2895,21 +4036,44 @@ node-libs-browser@^2.0.0: util "^0.10.3" vm-browserify "0.0.4" -node-pre-gyp@^0.6.39: - version "0.6.39" - resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.6.39.tgz#c00e96860b23c0e1420ac7befc5044e1d78d8649" +node-notifier@^5.2.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-5.2.1.tgz#fa313dd08f5517db0e2502e5758d664ac69f9dea" + dependencies: + growly "^1.3.0" + semver "^5.4.1" + shellwords "^0.1.1" + which "^1.3.0" + +node-pre-gyp@^0.10.0: + version "0.10.0" + resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.10.0.tgz#6e4ef5bb5c5203c6552448828c852c40111aac46" dependencies: detect-libc "^1.0.2" - hawk "3.1.3" mkdirp "^0.5.1" + needle "^2.2.0" nopt "^4.0.1" + npm-packlist "^1.1.6" + npmlog "^4.0.2" + rc "^1.1.7" + rimraf "^2.6.1" + semver "^5.3.0" + tar "^4" + +node-pre-gyp@^0.9.0: + version "0.9.1" + resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.9.1.tgz#f11c07516dd92f87199dbc7e1838eab7cd56c9e0" + dependencies: + detect-libc "^1.0.2" + mkdirp "^0.5.1" + needle "^2.2.0" + nopt "^4.0.1" + npm-packlist "^1.1.6" npmlog "^4.0.2" rc "^1.1.7" - request "2.81.0" rimraf "^2.6.1" semver "^5.3.0" - tar "^2.2.1" - tar-pack "^3.4.0" + tar "^4" nopt@3.x: version "3.0.6" @@ -2924,7 +4088,16 @@ nopt@^4.0.1: abbrev "1" osenv "^0.1.4" -normalize-path@^2.1.1: +normalize-package-data@^2.3.2: + version "2.4.0" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.4.0.tgz#12f95a307d58352075a04907b84ac8be98ac012f" + dependencies: + hosted-git-info "^2.1.4" + is-builtin-module "^1.0.0" + semver "2 || 3 || 4 || 5" + validate-npm-package-license "^3.0.1" + +normalize-path@^2.0.1, normalize-path@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" dependencies: @@ -2943,6 +4116,23 @@ normalize-url@^1.4.0: query-string "^4.1.0" sort-keys "^1.0.0" +npm-bundled@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.0.3.tgz#7e71703d973af3370a9591bafe3a63aca0be2308" + +npm-packlist@^1.1.6: + version "1.1.10" + resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-1.1.10.tgz#1039db9e985727e464df066f4cf0ab6ef85c398a" + dependencies: + ignore-walk "^3.0.1" + npm-bundled "^1.0.1" + +npm-run-path@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" + dependencies: + path-key "^2.0.0" + npmlog@^4.0.2: version "4.1.2" resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" @@ -2960,6 +4150,10 @@ number-is-nan@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" +nwmatcher@^1.4.3: + version "1.4.4" + resolved "https://registry.yarnpkg.com/nwmatcher/-/nwmatcher-1.4.4.tgz#2285631f34a95f0d0395cd900c96ed39b58f346e" + oauth-sign@~0.8.1, oauth-sign@~0.8.2: version "0.8.2" resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43" @@ -2976,12 +4170,30 @@ object-copy@^0.1.0: define-property "^0.2.5" kind-of "^3.0.3" +object-keys@^1.0.8: + version "1.0.11" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.11.tgz#c54601778ad560f1142ce0e01bcca8b56d13426d" + object-visit@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" dependencies: isobject "^3.0.0" +object.getownpropertydescriptors@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz#8758c846f5b407adab0f236e0986f14b051caa16" + dependencies: + define-properties "^1.1.2" + es-abstract "^1.5.1" + +object.omit@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" + dependencies: + for-own "^0.1.4" + is-extendable "^0.1.1" + object.pick@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" @@ -2994,7 +4206,7 @@ on-finished@~2.3.0: dependencies: ee-first "1.1.1" -once@1.x, once@^1.3.0, once@^1.3.1, once@^1.3.3, once@^1.4.0: +once@1.x, once@^1.3.0, once@^1.3.1, once@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" dependencies: @@ -3038,17 +4250,29 @@ os-homedir@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" -os-tmpdir@^1.0.0, os-tmpdir@~1.0.2: +os-locale@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-2.1.0.tgz#42bc2900a6b5b8bd17376c8e882b65afccf24bf2" + dependencies: + execa "^0.7.0" + lcid "^1.0.0" + mem "^1.1.0" + +os-tmpdir@^1.0.0, os-tmpdir@^1.0.1, os-tmpdir@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" osenv@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.4.tgz#42fe6d5953df06c8064be6f176c3d05aaaa34644" + version "0.1.5" + resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410" dependencies: os-homedir "^1.0.0" os-tmpdir "^1.0.0" +p-finally@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" + p-limit@^1.1.0: version "1.2.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.2.0.tgz#0e92b6bedcb59f022c13d0f1949dc82d15909f1c" @@ -3078,8 +4302,8 @@ parallel-transform@^1.1.0: readable-stream "^2.1.5" parse-asn1@^5.0.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/parse-asn1/-/parse-asn1-5.1.0.tgz#37c4f9b7ed3ab65c74817b5f2480937fbf97c712" + version "5.1.1" + resolved "https://registry.yarnpkg.com/parse-asn1/-/parse-asn1-5.1.1.tgz#f6bf293818332bd0dab54efb16087724745e6ca8" dependencies: asn1.js "^4.0.0" browserify-aes "^1.0.0" @@ -3087,6 +4311,25 @@ parse-asn1@^5.0.0: evp_bytestokey "^1.0.0" pbkdf2 "^3.0.3" +parse-glob@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/parse-glob/-/parse-glob-3.0.4.tgz#b2c376cfb11f35513badd173ef0bb6e3a388391c" + dependencies: + glob-base "^0.3.0" + is-dotfile "^1.0.0" + is-extglob "^1.0.0" + is-glob "^2.0.0" + +parse-json@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" + dependencies: + error-ex "^1.2.0" + +parse5@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/parse5/-/parse5-4.0.0.tgz#6d78656e3da8d78b4ec0b906f7c08ef1dfe3f608" + parseurl@~1.3.1: version "1.3.2" resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.2.tgz#fc289d4ed8993119460c156253262cdc8de65bf3" @@ -3103,11 +4346,17 @@ path-dirname@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/path-dirname/-/path-dirname-1.0.2.tgz#cc33d24d525e099a5388c0336c6e32b9160609e0" +path-exists@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-2.1.0.tgz#0feb6c64f0fc518d9a754dd5efb62c7022761f4b" + dependencies: + pinkie-promise "^2.0.0" + path-exists@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" -path-is-absolute@^1.0.0: +path-is-absolute@^1.0.0, path-is-absolute@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" @@ -3115,6 +4364,10 @@ path-is-inside@^1.0.1, path-is-inside@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" +path-key@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + path-parse@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" @@ -3123,15 +4376,17 @@ path-to-regexp@0.1.7: version "0.1.7" resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" -path-to-regexp@^1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.7.0.tgz#59fde0f435badacba103a84e9d3bc64e96b9937d" +path-type@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-1.1.0.tgz#59c44f7ee491da704da415da5a4070ba4f8fe441" dependencies: - isarray "0.0.1" + graceful-fs "^4.1.2" + pify "^2.0.0" + pinkie-promise "^2.0.0" pbkdf2@^3.0.3: - version "3.0.14" - resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.14.tgz#a35e13c64799b06ce15320f459c230e68e73bade" + version "3.0.16" + resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.16.tgz#7404208ec6b01b62d85bf83853a8064f8d9c2a5c" dependencies: create-hash "^1.1.2" create-hmac "^1.1.4" @@ -3147,7 +4402,7 @@ performance-now@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" -pify@^2.0.0, pify@^2.3.0: +pify@^2.0.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" @@ -3172,13 +4427,17 @@ pkg-dir@^2.0.0: find-up "^2.1.0" platform@^1.3.3: - version "1.3.4" - resolved "https://registry.yarnpkg.com/platform/-/platform-1.3.4.tgz#6f0fb17edaaa48f21442b3a975c063130f1c3ebd" + version "1.3.5" + resolved "https://registry.yarnpkg.com/platform/-/platform-1.3.5.tgz#fb6958c696e07e2918d2eeda0f0bc9448d733444" pluralize@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777" +pn@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/pn/-/pn-1.1.0.tgz#e2f4cef0e219f463c179ab37463e4e1ecdccbafb" + posix-character-classes@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" @@ -3305,27 +4564,27 @@ postcss-minify-selectors@^2.0.4: postcss "^5.0.14" postcss-selector-parser "^2.0.0" -postcss-modules-extract-imports@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/postcss-modules-extract-imports/-/postcss-modules-extract-imports-1.1.0.tgz#b614c9720be6816eaee35fb3a5faa1dba6a05ddb" +postcss-modules-extract-imports@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/postcss-modules-extract-imports/-/postcss-modules-extract-imports-1.2.0.tgz#66140ecece38ef06bf0d3e355d69bf59d141ea85" dependencies: postcss "^6.0.1" -postcss-modules-local-by-default@^1.0.1: +postcss-modules-local-by-default@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/postcss-modules-local-by-default/-/postcss-modules-local-by-default-1.2.0.tgz#f7d80c398c5a393fa7964466bd19500a7d61c069" dependencies: css-selector-tokenizer "^0.7.0" postcss "^6.0.1" -postcss-modules-scope@^1.0.0: +postcss-modules-scope@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/postcss-modules-scope/-/postcss-modules-scope-1.1.0.tgz#d6ea64994c79f97b62a72b426fbe6056a194bb90" dependencies: css-selector-tokenizer "^0.7.0" postcss "^6.0.1" -postcss-modules-values@^1.1.0: +postcss-modules-values@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/postcss-modules-values/-/postcss-modules-values-1.3.0.tgz#ecffa9d7e192518389f42ad0e83f72aec456ea20" dependencies: @@ -3422,12 +4681,12 @@ postcss@^5.0.10, postcss@^5.0.11, postcss@^5.0.12, postcss@^5.0.13, postcss@^5.0 supports-color "^3.2.3" postcss@^6.0.1: - version "6.0.15" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-6.0.15.tgz#f460cd6269fede0d1bf6defff0b934a9845d974d" + version "6.0.21" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-6.0.21.tgz#8265662694eddf9e9a5960db6da33c39e4cd069d" dependencies: - chalk "^2.3.0" + chalk "^2.3.2" source-map "^0.6.1" - supports-color "^5.1.0" + supports-color "^5.3.0" prelude-ls@~1.1.2: version "1.1.2" @@ -3437,13 +4696,28 @@ prepend-http@^1.0.0: version "1.0.4" resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc" -prettier@^1.11.1: - version "1.11.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.11.1.tgz#61e43fc4cd44e68f2b0dfc2c38cd4bb0fccdcc75" +preserve@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" + +prettier@^1.13.5: + version "1.13.5" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.13.5.tgz#7ae2076998c8edce79d63834e9b7b09fead6bfd0" -process-nextick-args@~1.0.6: - version "1.0.7" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" +pretty-format@^23.0.1: + version "23.0.1" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-23.0.1.tgz#d61d065268e4c759083bccbca27a01ad7c7601f4" + dependencies: + ansi-regex "^3.0.0" + ansi-styles "^3.2.0" + +private@^0.1.8: + version "0.1.8" + resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff" + +process-nextick-args@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa" process@^0.11.10: version "0.11.10" @@ -3463,7 +4737,7 @@ promise@^6.0.1: dependencies: asap "~1.0.0" -promise@^7.1.1: +promise@^7.0.1, promise@^7.1.1: version "7.3.1" resolved "https://registry.yarnpkg.com/promise/-/promise-7.3.1.tgz#064b72602b18f90f29192b8b1bc418ffd1ebd3bf" dependencies: @@ -3476,8 +4750,8 @@ promise@~2.0: is-promise "~1" prop-types@^15.5.10: - version "15.6.0" - resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.0.tgz#ceaf083022fc46b4a35f69e13ef75aed0d639856" + version "15.6.1" + resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.1.tgz#36644453564255ddda391191fb3a125cbdf654ca" dependencies: fbjs "^0.8.16" loose-envify "^1.3.1" @@ -3499,8 +4773,8 @@ pseudomap@^1.0.2: resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" public-encrypt@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/public-encrypt/-/public-encrypt-4.0.0.tgz#39f699f3a46560dd5ebacbca693caf7c65c18cc6" + version "4.0.2" + resolved "https://registry.yarnpkg.com/public-encrypt/-/public-encrypt-4.0.2.tgz#46eb9107206bf73489f8b85b69d91334c6610994" dependencies: bn.js "^4.1.0" browserify-rsa "^4.0.0" @@ -3508,14 +4782,108 @@ public-encrypt@^4.0.0: parse-asn1 "^5.0.0" randombytes "^2.0.1" -pump@^1.0.0: +pug-attrs@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/pug-attrs/-/pug-attrs-2.0.3.tgz#a3095f970e64151f7bdad957eef55fb5d7905d15" + dependencies: + constantinople "^3.0.1" + js-stringify "^1.0.1" + pug-runtime "^2.0.4" + +pug-code-gen@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/pug-code-gen/-/pug-code-gen-2.0.1.tgz#0951ec83225d74d8cfc476a7f99a259b5f7d050c" + dependencies: + constantinople "^3.0.1" + doctypes "^1.1.0" + js-stringify "^1.0.1" + pug-attrs "^2.0.3" + pug-error "^1.3.2" + pug-runtime "^2.0.4" + void-elements "^2.0.1" + with "^5.0.0" + +pug-error@^1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/pug-error/-/pug-error-1.3.2.tgz#53ae7d9d29bb03cf564493a026109f54c47f5f26" + +pug-filters@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/pug-filters/-/pug-filters-3.1.0.tgz#27165555bc04c236e4aa2b0366246dfa021b626e" + dependencies: + clean-css "^4.1.11" + constantinople "^3.0.1" + jstransformer "1.0.0" + pug-error "^1.3.2" + pug-walk "^1.1.7" + resolve "^1.1.6" + uglify-js "^2.6.1" + +pug-lexer@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/pug-lexer/-/pug-lexer-4.0.0.tgz#210c18457ef2e1760242740c5e647bd794cec278" + dependencies: + character-parser "^2.1.1" + is-expression "^3.0.0" + pug-error "^1.3.2" + +pug-linker@^3.0.5: + version "3.0.5" + resolved "https://registry.yarnpkg.com/pug-linker/-/pug-linker-3.0.5.tgz#9e9a7ae4005682d027deeb96b000f88eeb83a02f" + dependencies: + pug-error "^1.3.2" + pug-walk "^1.1.7" + +pug-load@^2.0.11: + version "2.0.11" + resolved "https://registry.yarnpkg.com/pug-load/-/pug-load-2.0.11.tgz#e648e57ed113fe2c1f45d57858ea2bad6bc01527" + dependencies: + object-assign "^4.1.0" + pug-walk "^1.1.7" + +pug-loader@^2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/pug-loader/-/pug-loader-2.4.0.tgz#18eebdda045d9c31c2856f1cc3ceb8d3df7ca49a" + dependencies: + loader-utils "^1.1.0" + pug-walk "^1.0.0" + resolve "^1.1.7" + +pug-parser@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/pug-parser/-/pug-parser-5.0.0.tgz#e394ad9b3fca93123940aff885c06e44ab7e68e4" + dependencies: + pug-error "^1.3.2" + token-stream "0.0.1" + +pug-runtime@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/pug-runtime/-/pug-runtime-2.0.4.tgz#e178e1bda68ab2e8c0acfc9bced2c54fd88ceb58" + +pug-strip-comments@^1.0.3: version "1.0.3" - resolved "https://registry.yarnpkg.com/pump/-/pump-1.0.3.tgz#5dfe8311c33bbf6fc18261f9f34702c47c08a954" + resolved "https://registry.yarnpkg.com/pug-strip-comments/-/pug-strip-comments-1.0.3.tgz#f1559592206edc6f85310dacf4afb48a025af59f" dependencies: - end-of-stream "^1.1.0" - once "^1.3.1" + pug-error "^1.3.2" + +pug-walk@^1.0.0, pug-walk@^1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/pug-walk/-/pug-walk-1.1.7.tgz#c00d5c5128bac5806bec15d2b7e7cdabe42531f3" -pump@^2.0.1: +pug@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/pug/-/pug-2.0.3.tgz#71cba82537c95a5eab7ed04696e4221f53aa878e" + dependencies: + pug-code-gen "^2.0.1" + pug-filters "^3.1.0" + pug-lexer "^4.0.0" + pug-linker "^3.0.5" + pug-load "^2.0.11" + pug-parser "^5.0.0" + pug-runtime "^2.0.4" + pug-strip-comments "^1.0.3" + +pump@^2.0.0, pump@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/pump/-/pump-2.0.1.tgz#12399add6e4cf7526d973cbc8b5ce2e2908b3909" dependencies: @@ -3523,17 +4891,21 @@ pump@^2.0.1: once "^1.3.1" pumpify@^1.3.3: - version "1.3.5" - resolved "https://registry.yarnpkg.com/pumpify/-/pumpify-1.3.5.tgz#1b671c619940abcaeac0ad0e3a3c164be760993b" + version "1.4.0" + resolved "https://registry.yarnpkg.com/pumpify/-/pumpify-1.4.0.tgz#80b7c5df7e24153d03f0e7ac8a05a5d068bd07fb" dependencies: - duplexify "^3.1.2" - inherits "^2.0.1" - pump "^1.0.0" + duplexify "^3.5.3" + inherits "^2.0.3" + pump "^2.0.0" punycode@1.3.2: version "1.3.2" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" +punycode@2.x.x, punycode@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.0.tgz#5f863edc89b96db09074bad7947bf09056ca4e7d" + punycode@^1.2.4, punycode@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" @@ -3555,8 +4927,8 @@ qs@~6.4.0: resolved "https://registry.yarnpkg.com/qs/-/qs-6.4.0.tgz#13e26d28ad6b0ffaa91312cd3bf708ed351e7233" qs@~6.5.1: - version "6.5.1" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.1.tgz#349cdf6eef89ec45c12d7d5eb3fc0c870343a6d8" + version "6.5.2" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" query-string@^4.1.0: version "4.3.4" @@ -3573,15 +4945,23 @@ querystring@0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620" +randomatic@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-3.0.0.tgz#d35490030eb4f7578de292ce6dfb04a91a128923" + dependencies: + is-number "^4.0.0" + kind-of "^6.0.0" + math-random "^1.0.1" + randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.0.5.tgz#dc009a246b8d09a177b4b7a0ae77bc570f4b1b79" + version "2.0.6" + resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.0.6.tgz#d302c522948588848a8d300c932b44c24231da80" dependencies: safe-buffer "^5.1.0" randomfill@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/randomfill/-/randomfill-1.0.3.tgz#b96b7df587f01dd91726c418f30553b1418e3d62" + version "1.0.4" + resolved "https://registry.yarnpkg.com/randomfill/-/randomfill-1.0.4.tgz#c92196fc86ab42be983f1bf31778224931d61458" dependencies: randombytes "^2.0.5" safe-buffer "^5.1.0" @@ -3599,10 +4979,10 @@ raw-loader@~0.5.0, raw-loader@~0.5.1: resolved "https://registry.yarnpkg.com/raw-loader/-/raw-loader-0.5.1.tgz#0c3d0beaed8a01c966d9787bf778281252a979aa" rc@^1.1.7: - version "1.2.2" - resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.2.tgz#d8ce9cb57e8d64d9c7badd9876c7c34cbe3c7077" + version "1.2.7" + resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.7.tgz#8a10ca30d588d00464360372b890d06dacd02297" dependencies: - deep-extend "~0.4.0" + deep-extend "^0.5.1" ini "~1.3.0" minimist "^1.2.0" strip-json-comments "~2.0.1" @@ -3626,16 +5006,31 @@ react@^15.2.1: object-assign "^4.1.0" prop-types "^15.5.10" -"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.4, readable-stream@^2.0.6, readable-stream@^2.1.4, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.2.6, readable-stream@^2.3.3: - version "2.3.3" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.3.tgz#368f2512d79f9d46fdfc71349ae7878bbc1eb95c" +read-pkg-up@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02" + dependencies: + find-up "^1.0.0" + read-pkg "^1.0.0" + +read-pkg@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-1.1.0.tgz#f5ffaa5ecd29cb31c0474bca7d756b6bb29e3f28" + dependencies: + load-json-file "^1.0.0" + normalize-package-data "^2.3.2" + path-type "^1.0.0" + +"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.4, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.3: + version "2.3.6" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" dependencies: core-util-is "~1.0.0" inherits "~2.0.3" isarray "~1.0.0" - process-nextick-args "~1.0.6" + process-nextick-args "~2.0.0" safe-buffer "~5.1.1" - string_decoder "~1.0.3" + string_decoder "~1.1.1" util-deprecate "~1.0.1" readdirp@^2.0.0: @@ -3647,6 +5042,12 @@ readdirp@^2.0.0: readable-stream "^2.0.2" set-immediate-shim "^1.0.1" +realpath-native@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/realpath-native/-/realpath-native-1.0.0.tgz#7885721a83b43bd5327609f0ddecb2482305fdf0" + dependencies: + util.promisify "^1.0.0" + reduce-css-calc@^1.2.6: version "1.3.0" resolved "https://registry.yarnpkg.com/reduce-css-calc/-/reduce-css-calc-1.3.0.tgz#747c914e049614a4c9cfbba629871ad1d2927716" @@ -3665,7 +5066,17 @@ regenerate@^1.2.1: version "1.3.3" resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.3.3.tgz#0c336d3980553d755c39b586ae3b20aa49c82b7f" -regex-not@^1.0.0: +regenerator-runtime@^0.11.0: + version "0.11.1" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" + +regex-cache@^0.4.2: + version "0.4.4" + resolved "https://registry.yarnpkg.com/regex-cache/-/regex-cache-0.4.4.tgz#75bdc58a2a1496cec48a12835bc54c8d562336dd" + dependencies: + is-equal-shallow "^0.1.3" + +regex-not@^1.0.0, regex-not@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" dependencies: @@ -3673,8 +5084,8 @@ regex-not@^1.0.0: safe-regex "^1.1.0" regexpp@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-1.0.1.tgz#d857c3a741dce075c2848dcb019a0a975b190d43" + version "1.1.0" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-1.1.0.tgz#0e3516dd0b7904f413d2d4193dce4618c3a689ab" regexpu-core@^1.0.0: version "1.0.0" @@ -3706,14 +5117,34 @@ repeat-string@^1.5.2, repeat-string@^1.6.1: version "1.6.1" resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" -request-promise@^0.x: - version "0.4.3" - resolved "https://registry.yarnpkg.com/request-promise/-/request-promise-0.4.3.tgz#3c8ddc82f06f8908d720aede1d6794258e22121c" +repeating@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/repeating/-/repeating-2.0.1.tgz#5214c53a926d3552707527fbab415dbc08d06dda" dependencies: - bluebird "^2.3" - chalk "^1.1.0" - lodash "^3.10.0" - request "^2.34" + is-finite "^1.0.0" + +request-promise-core@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/request-promise-core/-/request-promise-core-1.1.1.tgz#3eee00b2c5aa83239cfb04c5700da36f81cd08b6" + dependencies: + lodash "^4.13.1" + +request-promise-native@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/request-promise-native/-/request-promise-native-1.0.5.tgz#5281770f68e0c9719e5163fd3fab482215f4fda5" + dependencies: + request-promise-core "1.1.1" + stealthy-require "^1.1.0" + tough-cookie ">=2.3.3" + +request-promise@^4.x: + version "4.2.2" + resolved "https://registry.yarnpkg.com/request-promise/-/request-promise-4.2.2.tgz#d1ea46d654a6ee4f8ee6a4fea1018c22911904b4" + dependencies: + bluebird "^3.5.0" + request-promise-core "1.1.1" + stealthy-require "^1.1.0" + tough-cookie ">=2.3.3" request@2.79.0: version "2.79.0" @@ -3767,9 +5198,9 @@ request@2.81.0: tunnel-agent "^0.6.0" uuid "^3.0.0" -request@^2.34: - version "2.83.0" - resolved "https://registry.yarnpkg.com/request/-/request-2.83.0.tgz#ca0b65da02ed62935887808e6f510381034e3356" +request@^2.83.0: + version "2.86.0" + resolved "https://registry.yarnpkg.com/request/-/request-2.86.0.tgz#2b9497f449b0a32654c081a5cf426bbfb5bf5b69" dependencies: aws-sign2 "~0.7.0" aws4 "^1.6.0" @@ -3789,11 +5220,18 @@ request@^2.34: performance-now "^2.1.0" qs "~6.5.1" safe-buffer "^5.1.1" - stringstream "~0.0.5" tough-cookie "~2.3.3" tunnel-agent "^0.6.0" uuid "^3.1.0" +require-directory@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + +require-main-filename@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" + require-uncached@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" @@ -3801,21 +5239,31 @@ require-uncached@^1.0.3: caller-path "^0.1.0" resolve-from "^1.0.0" +resolve-cwd@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-2.0.0.tgz#00a9f7387556e27038eae232caa372a6a59b665a" + dependencies: + resolve-from "^3.0.0" + resolve-from@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" +resolve-from@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-3.0.0.tgz#b22c7af7d9d6881bc8b6e653335eebcb0a188748" + resolve-url@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" -resolve@1.1.x: +resolve@1.1.7, resolve@1.1.x: version "1.1.7" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" -resolve@^1.3.3: - version "1.5.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36" +resolve@^1.1.6, resolve@^1.1.7, resolve@^1.3.3: + version "1.7.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.7.1.tgz#aadd656374fd298aee895bc026b8297418677fd3" dependencies: path-parse "^1.0.5" @@ -3836,19 +5284,23 @@ right-align@^0.1.1: dependencies: align-text "^0.1.1" -rimraf@2, rimraf@^2.2.8, rimraf@^2.5.1, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2: +rimraf@^2.2.8, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2: version "2.6.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" dependencies: glob "^7.0.5" ripemd160@^2.0.0, ripemd160@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.1.tgz#0f4584295c53a3628af7e6d79aca21ce57d1c6e7" + version "2.0.2" + resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" dependencies: - hash-base "^2.0.0" + hash-base "^3.0.0" inherits "^2.0.1" +rsvp@^3.3.3: + version "3.6.2" + resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-3.6.2.tgz#2e96491599a96cde1b515d5674a8f7a91452926a" + run-async@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" @@ -3871,9 +5323,9 @@ rx-lite@*, rx-lite@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-4.0.8.tgz#0b1e11af8bc44836f04a6407e92da42467b79444" -safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@~5.1.0, safe-buffer@~5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" +safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: + version "5.1.2" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" safe-regex@^1.1.0: version "1.1.0" @@ -3881,11 +5333,26 @@ safe-regex@^1.1.0: dependencies: ret "~0.1.10" -samsam@1.x, samsam@^1.1.3: - version "1.3.0" - resolved "https://registry.yarnpkg.com/samsam/-/samsam-1.3.0.tgz#8d1d9350e25622da30de3e44ba692b5221ab7c50" +"safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.1.0: + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + +sane@^2.0.0: + version "2.5.2" + resolved "https://registry.yarnpkg.com/sane/-/sane-2.5.2.tgz#b4dc1861c21b427e929507a3e751e2a2cb8ab3fa" + dependencies: + anymatch "^2.0.0" + capture-exit "^1.2.0" + exec-sh "^0.2.0" + fb-watchman "^2.0.0" + micromatch "^3.1.4" + minimist "^1.1.1" + walker "~1.0.5" + watch "~0.18.0" + optionalDependencies: + fsevents "^1.2.3" -sax@~1.2.1: +sax@^1.2.4, sax@~1.2.1: version "1.2.4" resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" @@ -3895,14 +5362,7 @@ schema-utils@^0.3.0: dependencies: ajv "^5.0.0" -schema-utils@^0.4.2: - version "0.4.3" - resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-0.4.3.tgz#e2a594d3395834d5e15da22b48be13517859458e" - dependencies: - ajv "^5.0.0" - ajv-keywords "^2.1.0" - -schema-utils@^0.4.5: +schema-utils@^0.4.0, schema-utils@^0.4.4, schema-utils@^0.4.5: version "0.4.5" resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-0.4.5.tgz#21836f0608aac17b78f9e3e24daff14a5ca13a3e" dependencies: @@ -3915,11 +5375,7 @@ script-loader@~0.7.0: dependencies: raw-loader "~0.5.1" -semver@^5.3.0: - version "5.4.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e" - -semver@^5.4.1: +"semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@^5.4.1: version "5.5.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab" @@ -3958,8 +5414,8 @@ send@0.13.2: statuses "~1.2.1" serialize-javascript@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-1.4.0.tgz#7c958514db6ac2443a8abc062dc9f7886a7f6005" + version "1.5.0" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-1.5.0.tgz#1aa336162c88a890ddad5384baebc93a655161fe" serve-static@~1.10.2: version "1.10.3" @@ -3969,16 +5425,10 @@ serve-static@~1.10.2: parseurl "~1.3.1" send "0.13.2" -set-blocking@~2.0.0: +set-blocking@^2.0.0, set-blocking@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" -set-getter@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/set-getter/-/set-getter-0.1.0.tgz#d769c182c9d5a51f409145f2fba82e5e86e80376" - dependencies: - to-object-path "^0.3.0" - set-immediate-shim@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz#4b2b1b27eb808a9f8dcc481a58e5e56f599f3f61" @@ -4006,8 +5456,8 @@ setimmediate@^1.0.4, setimmediate@^1.0.5: resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" sha.js@^2.4.0, sha.js@^2.4.8: - version "2.4.9" - resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.9.tgz#98f64880474b74f4a38b8da9d3c0f2d104633e7d" + version "2.4.11" + resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" dependencies: inherits "^2.0.1" safe-buffer "^5.0.1" @@ -4022,66 +5472,23 @@ shebang-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" -should-equal@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/should-equal/-/should-equal-1.0.1.tgz#0b6e9516f2601a9fb0bb2dcc369afa1c7e200af7" - dependencies: - should-type "^1.0.0" - -should-format@^3.0.2: - version "3.0.3" - resolved "https://registry.yarnpkg.com/should-format/-/should-format-3.0.3.tgz#9bfc8f74fa39205c53d38c34d717303e277124f1" - dependencies: - should-type "^1.3.0" - should-type-adaptors "^1.0.1" - -should-type-adaptors@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/should-type-adaptors/-/should-type-adaptors-1.1.0.tgz#401e7f33b5533033944d5cd8bf2b65027792e27a" - dependencies: - should-type "^1.3.0" - should-util "^1.0.0" - -should-type@^1.0.0, should-type@^1.3.0, should-type@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/should-type/-/should-type-1.4.0.tgz#0756d8ce846dfd09843a6947719dfa0d4cff5cf3" - -should-util@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/should-util/-/should-util-1.0.0.tgz#c98cda374aa6b190df8ba87c9889c2b4db620063" - -should@^11.1.1: - version "11.2.1" - resolved "https://registry.yarnpkg.com/should/-/should-11.2.1.tgz#90f55145552d01cfc200666e4e818a1c9670eda2" - dependencies: - should-equal "^1.0.0" - should-format "^3.0.2" - should-type "^1.4.0" - should-type-adaptors "^1.0.1" - should-util "^1.0.0" +shellwords@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" simple-git@^1.65.0: - version "1.85.0" - resolved "https://registry.yarnpkg.com/simple-git/-/simple-git-1.85.0.tgz#563ad291efc8a127735e8fbcd796967377614cd4" + version "1.92.0" + resolved "https://registry.yarnpkg.com/simple-git/-/simple-git-1.92.0.tgz#6061468eb7d19f0141078fc742e62457e910f547" dependencies: debug "^3.1.0" -sinon@^2.3.2: - version "2.4.1" - resolved "https://registry.yarnpkg.com/sinon/-/sinon-2.4.1.tgz#021fd64b54cb77d9d2fb0d43cdedfae7629c3a36" - dependencies: - diff "^3.1.0" - formatio "1.2.0" - lolex "^1.6.0" - native-promise-only "^0.8.1" - path-to-regexp "^1.7.0" - samsam "^1.1.3" - text-encoding "0.6.4" - type-detect "^4.0.0" +slash@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" slice-ansi@1.0.0: version "1.0.0" @@ -4104,8 +5511,8 @@ snapdragon-util@^3.0.1: kind-of "^3.2.0" snapdragon@^0.8.1: - version "0.8.1" - resolved "https://registry.yarnpkg.com/snapdragon/-/snapdragon-0.8.1.tgz#e12b5487faded3e3dea0ac91e9400bf75b401370" + version "0.8.2" + resolved "https://registry.yarnpkg.com/snapdragon/-/snapdragon-0.8.2.tgz#64922e7c565b0e14204ba1aa7d6964278d25182d" dependencies: base "^0.11.1" debug "^2.2.0" @@ -4114,7 +5521,7 @@ snapdragon@^0.8.1: map-cache "^0.2.2" source-map "^0.5.6" source-map-resolve "^0.5.0" - use "^2.0.0" + use "^3.1.0" sntp@1.x.x: version "1.0.9" @@ -4139,15 +5546,28 @@ source-list-map@^2.0.0: resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.0.tgz#aaa47403f7b245a92fbc97ea08f250d6087ed085" source-map-resolve@^0.5.0: - version "0.5.1" - resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.1.tgz#7ad0f593f2281598e854df80f19aae4b92d7a11a" + version "0.5.2" + resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.2.tgz#72e2cc34095543e43b2c62b2c4c10d4a9054f259" dependencies: - atob "^2.0.0" + atob "^2.1.1" decode-uri-component "^0.2.0" resolve-url "^0.2.1" source-map-url "^0.4.0" urix "^0.1.0" +source-map-support@^0.4.15: + version "0.4.18" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.18.tgz#0286a6de8be42641338594e97ccea75f0a2c585f" + dependencies: + source-map "^0.5.6" + +source-map-support@^0.5.6: + version "0.5.6" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.6.tgz#4435cee46b1aab62b8e8610ce60f788091c51c13" + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + source-map-url@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" @@ -4158,11 +5578,11 @@ source-map@0.4.x, source-map@^0.4.4: dependencies: amdefine ">=0.0.4" -source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.1: +source-map@0.5.x, source-map@^0.5.3, source-map@^0.5.6, source-map@^0.5.7, source-map@~0.5.1: version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" -source-map@^0.6.1, source-map@~0.6.1: +source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" @@ -4178,6 +5598,28 @@ source-map@~0.2.0: dependencies: amdefine ">=0.0.4" +spdx-correct@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.0.0.tgz#05a5b4d7153a195bc92c3c425b69f3b2a9524c82" + dependencies: + spdx-expression-parse "^3.0.0" + spdx-license-ids "^3.0.0" + +spdx-exceptions@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.1.0.tgz#2c7ae61056c714a5b9b9b2b2af7d311ef5c78fe9" + +spdx-expression-parse@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz#99e119b7a5da00e05491c9fa338b7904823b41d0" + dependencies: + spdx-exceptions "^2.1.0" + spdx-license-ids "^3.0.0" + +spdx-license-ids@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.0.tgz#7a7cd28470cc6d3a1cfe6d66886f6bc430d3ac87" + split-string@^3.0.1, split-string@^3.0.2: version "3.1.0" resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" @@ -4189,8 +5631,8 @@ sprintf-js@~1.0.2: resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" sshpk@^1.7.0: - version "1.13.1" - resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.13.1.tgz#512df6da6287144316dc4c18fe1cf1d940739be3" + version "1.14.1" + resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.14.1.tgz#130f5975eddad963f1d56f92b9ac6c51fa9f83eb" dependencies: asn1 "~0.2.3" assert-plus "^1.0.0" @@ -4208,6 +5650,10 @@ ssri@^5.2.4: dependencies: safe-buffer "^5.1.1" +stack-utils@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-1.0.1.tgz#d4f33ab54e8e38778b0ca5cfd3b3afb12db68620" + static-extend@^0.1.1: version "0.1.2" resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" @@ -4216,13 +5662,17 @@ static-extend@^0.1.1: object-copy "^0.1.0" statuses@1: - version "1.4.0" - resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.4.0.tgz#bb73d446da2796106efcc1b601a253d6c46bd087" + version "1.5.0" + resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" statuses@~1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.2.1.tgz#dded45cc18256d51ed40aec142489d5c61026d28" +stealthy-require@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/stealthy-require/-/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b" + stream-browserify@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-2.0.1.tgz#66266ee5f9bdb9940a4e4514cafb43bb71e5c9db" @@ -4238,12 +5688,12 @@ stream-each@^1.1.0: stream-shift "^1.0.0" stream-http@^2.7.2: - version "2.7.2" - resolved "https://registry.yarnpkg.com/stream-http/-/stream-http-2.7.2.tgz#40a050ec8dc3b53b33d9909415c02c0bf1abfbad" + version "2.8.1" + resolved "https://registry.yarnpkg.com/stream-http/-/stream-http-2.8.1.tgz#d0441be1a457a73a733a8a7b53570bebd9ef66a4" dependencies: builtin-status-codes "^3.0.0" inherits "^2.0.1" - readable-stream "^2.2.6" + readable-stream "^2.3.3" to-arraybuffer "^1.0.0" xtend "^4.0.0" @@ -4255,6 +5705,13 @@ strict-uri-encode@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713" +string-length@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/string-length/-/string-length-2.0.0.tgz#d40dbb686a3ace960c1cffca562bf2c45f8363ed" + dependencies: + astral-regex "^1.0.0" + strip-ansi "^4.0.0" + string-width@^1.0.1, string-width@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" @@ -4263,20 +5720,20 @@ string-width@^1.0.1, string-width@^1.0.2: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" -string-width@^2.1.0, string-width@^2.1.1: +string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" dependencies: is-fullwidth-code-point "^2.0.0" strip-ansi "^4.0.0" -string_decoder@^1.0.0, string_decoder@~1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.0.3.tgz#0fc67d7c141825de94282dd536bec6b9bce860ab" +string_decoder@^1.0.0, string_decoder@~1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" dependencies: safe-buffer "~5.1.0" -stringstream@~0.0.4, stringstream@~0.0.5: +stringstream@~0.0.4: version "0.0.5" resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.5.tgz#4e484cd4de5a0bbbee18e46307710a8a81621878" @@ -4292,6 +5749,20 @@ strip-ansi@^4.0.0: dependencies: ansi-regex "^3.0.0" +strip-bom@3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + +strip-bom@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e" + dependencies: + is-utf8 "^0.2.0" + +strip-eof@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" + strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" @@ -4303,17 +5774,11 @@ style-loader@^0.19.1: loader-utils "^1.0.2" schema-utils "^0.3.0" -supports-color@3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.1.2.tgz#72a262894d9d408b956ca05ff37b2ed8a6e2a2d5" - dependencies: - has-flag "^1.0.0" - supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" -supports-color@^3.1.0, supports-color@^3.2.3: +supports-color@^3.1.0, supports-color@^3.1.2, supports-color@^3.2.3: version "3.2.3" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.2.3.tgz#65ac0504b3954171d8a64946b2ae3cbb8a5f54f6" dependencies: @@ -4325,11 +5790,11 @@ supports-color@^4.0.0: dependencies: has-flag "^2.0.0" -supports-color@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.1.0.tgz#058a021d1b619f7ddf3980d712ea3590ce7de3d5" +supports-color@^5.3.0: + version "5.4.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.4.0.tgz#1c6b337402c2137605efe19f10fec390f6faab54" dependencies: - has-flag "^2.0.0" + has-flag "^3.0.0" svgo@^0.7.0: version "0.7.2" @@ -4343,6 +5808,10 @@ svgo@^0.7.0: sax "~1.2.1" whet.extend "~0.9.9" +symbol-tree@^3.2.2: + version "3.2.2" + resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6" + table@4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/table/-/table-4.0.2.tgz#a33447375391e766ad34d3486e6e2aedc84d2e36" @@ -4358,35 +5827,36 @@ tapable@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/tapable/-/tapable-1.0.0.tgz#cbb639d9002eed9c6b5975eb20598d7936f1f9f2" -tar-pack@^3.4.0: - version "3.4.1" - resolved "https://registry.yarnpkg.com/tar-pack/-/tar-pack-3.4.1.tgz#e1dbc03a9b9d3ba07e896ad027317eb679a10a1f" - dependencies: - debug "^2.2.0" - fstream "^1.0.10" - fstream-ignore "^1.0.5" - once "^1.3.3" - readable-stream "^2.1.4" - rimraf "^2.5.1" - tar "^2.2.1" - uid-number "^0.0.6" - -tar@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/tar/-/tar-2.2.1.tgz#8e4d2a256c0e2185c6b18ad694aec968b83cb1d1" +tar@^4: + version "4.4.2" + resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.2.tgz#60685211ba46b38847b1ae7ee1a24d744a2cd462" dependencies: - block-stream "*" - fstream "^1.0.2" - inherits "2" + chownr "^1.0.1" + fs-minipass "^1.2.5" + minipass "^2.2.4" + minizlib "^1.1.0" + mkdirp "^0.5.0" + safe-buffer "^5.1.2" + yallist "^3.0.2" -text-encoding@0.6.4: - version "0.6.4" - resolved "https://registry.yarnpkg.com/text-encoding/-/text-encoding-0.6.4.tgz#e399a982257a276dae428bb92845cb71bdc26d19" +test-exclude@^4.2.1: + version "4.2.1" + resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-4.2.1.tgz#dfa222f03480bca69207ca728b37d74b45f724fa" + dependencies: + arrify "^1.0.1" + micromatch "^3.1.8" + object-assign "^4.1.0" + read-pkg-up "^1.0.1" + require-main-filename "^1.0.1" text-table@~0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" +throat@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/throat/-/throat-4.1.0.tgz#89037cbc92c56ab18926e6ba4cbb200e15672a6a" + through2@^2.0.0: version "2.0.3" resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.3.tgz#0004569b37c7c74ba39c43f3ced78d1ad94140be" @@ -4403,8 +5873,8 @@ time-stamp@^2.0.0: resolved "https://registry.yarnpkg.com/time-stamp/-/time-stamp-2.0.0.tgz#95c6a44530e15ba8d6f4a3ecb8c3a3fac46da357" timers-browserify@^2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/timers-browserify/-/timers-browserify-2.0.4.tgz#96ca53f4b794a5e7c0e1bd7cc88a372298fa01e6" + version "2.0.10" + resolved "https://registry.yarnpkg.com/timers-browserify/-/timers-browserify-2.0.10.tgz#1d28e3d2aadf1d5a5996c4e9f95601cd053480ae" dependencies: setimmediate "^1.0.4" @@ -4414,10 +5884,18 @@ tmp@^0.0.33: dependencies: os-tmpdir "~1.0.2" +tmpl@1.0.x: + version "1.0.4" + resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1" + to-arraybuffer@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz#7d229b1fcc637e466ca081180836a7aabff83f43" +to-fast-properties@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47" + to-object-path@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" @@ -4431,26 +5909,37 @@ to-regex-range@^2.1.0: is-number "^3.0.0" repeat-string "^1.6.1" -to-regex@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.1.tgz#15358bee4a2c83bd76377ba1dc049d0f18837aae" +to-regex@^3.0.1, to-regex@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" dependencies: - define-property "^0.2.5" - extend-shallow "^2.0.1" - regex-not "^1.0.0" + define-property "^2.0.2" + extend-shallow "^3.0.2" + regex-not "^1.0.2" + safe-regex "^1.1.0" -topo@1.x.x: - version "1.1.0" - resolved "https://registry.yarnpkg.com/topo/-/topo-1.1.0.tgz#e9d751615d1bb87dc865db182fa1ca0a5ef536d5" +token-stream@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/token-stream/-/token-stream-0.0.1.tgz#ceeefc717a76c4316f126d0b9dbaa55d7e7df01a" + +topo@2.x.x: + version "2.0.2" + resolved "https://registry.yarnpkg.com/topo/-/topo-2.0.2.tgz#cd5615752539057c0dc0491a621c3bc6fbe1d182" dependencies: - hoek "2.x.x" + hoek "4.x.x" -tough-cookie@~2.3.0, tough-cookie@~2.3.3: - version "2.3.3" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.3.tgz#0b618a5565b6dea90bf3425d04d55edc475a7561" +tough-cookie@>=2.3.3, tough-cookie@^2.3.3, tough-cookie@~2.3.0, tough-cookie@~2.3.3: + version "2.3.4" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.4.tgz#ec60cee38ac675063ffc97a5c18970578ee83655" dependencies: punycode "^1.4.1" +tr46@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-1.0.1.tgz#a8b13fd6bfd2489519674ccde55ba3693b706d09" + dependencies: + punycode "^2.1.0" + transformers@2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/transformers/-/transformers-2.1.0.tgz#5d23cb35561dd85dc67fb8482309b47d53cce9a7" @@ -4459,6 +5948,14 @@ transformers@2.1.0: promise "~2.0" uglify-js "~2.2.5" +trim-right@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" + +tslib@^1.9.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.0.tgz#e37a86fda8cbbaf23a057f473c9f4dc64e5fc2e8" + tty-browserify@0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6" @@ -4483,24 +5980,20 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" -type-detect@^4.0.0: - version "4.0.5" - resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.5.tgz#d70e5bc81db6de2a381bcaca0c6e0cbdc7635de2" - type-is@~1.6.6: - version "1.6.15" - resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.15.tgz#cab10fb4909e441c82842eafe1ad646c81804410" + version "1.6.16" + resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.16.tgz#f89ce341541c672b25ee7ae3c73dee3b2be50194" dependencies: media-typer "0.3.0" - mime-types "~2.1.15" + mime-types "~2.1.18" typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" -typescript@^2.9.0-dev.20180412: - version "2.9.0-dev.20180412" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.9.0-dev.20180412.tgz#5380b2afb44b720b0d8164f844b90ebd81948a7e" +typescript@^2.9.0-dev.20180518: + version "2.9.0-dev.20180518" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.9.0-dev.20180518.tgz#7c709cb5d59e60a5e346cc5856277fd7b8ced68c" ua-parser-js@^0.7.9: version "0.7.17" @@ -4513,7 +6006,7 @@ uglify-es@^3.3.4: commander "~2.13.0" source-map "~0.6.1" -uglify-js@^2.4.19, uglify-js@^2.6: +uglify-js@^2.4.19, uglify-js@^2.6, uglify-js@^2.6.1: version "2.8.29" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd" dependencies: @@ -4546,10 +6039,6 @@ uglifyjs-webpack-plugin@^1.2.4: webpack-sources "^1.1.0" worker-farm "^1.5.2" -uid-number@^0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/uid-number/-/uid-number-0.0.6.tgz#0ea10e8035e8eb5b8e4449f06da1c730663baa81" - union-value@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.0.tgz#5c71c34cb5bad5dcebe3ea0cd08207ba5aa1aea4" @@ -4597,8 +6086,14 @@ unset-value@^1.0.0: isobject "^3.0.0" upath@^1.0.0: - version "1.0.4" - resolved "https://registry.yarnpkg.com/upath/-/upath-1.0.4.tgz#ee2321ba0a786c50973db043a50b7bcba822361d" + version "1.0.5" + resolved "https://registry.yarnpkg.com/upath/-/upath-1.0.5.tgz#02cab9ecebe95bbec6d5fc2566325725ab6d1a73" + +uri-js@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-3.0.2.tgz#f90b858507f81dea4dcfbb3c4c3dbfa2b557faaa" + dependencies: + punycode "^2.1.0" urix@^0.1.0: version "0.1.0" @@ -4619,18 +6114,23 @@ url@^0.11.0: punycode "1.3.2" querystring "0.2.0" -use@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/use/-/use-2.0.2.tgz#ae28a0d72f93bf22422a18a2e379993112dec8e8" +use@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/use/-/use-3.1.0.tgz#14716bf03fdfefd03040aef58d8b4b85f3a7c544" dependencies: - define-property "^0.2.5" - isobject "^3.0.0" - lazy-cache "^2.0.2" + kind-of "^6.0.2" util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" +util.promisify@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/util.promisify/-/util.promisify-1.0.0.tgz#440f7165a459c9a16dc145eb8e72f35687097030" + dependencies: + define-properties "^1.1.2" + object.getownpropertydescriptors "^2.0.3" + util@0.10.3, util@^0.10.3: version "0.10.3" resolved "https://registry.yarnpkg.com/util/-/util-0.10.3.tgz#7afb1afe50805246489e3db7fe0ed379336ac0f9" @@ -4642,8 +6142,8 @@ utils-merge@1.0.0: resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.0.tgz#0294fb922bb9375153541c4f7096231f287c8af8" uuid@^3.0.0, uuid@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" + version "3.2.1" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.2.1.tgz#12c528bb9d58d0b9265d9a2f6f0fe8be17ff1f14" val-loader@^1.0.2: version "1.1.0" @@ -4651,13 +6151,20 @@ val-loader@^1.0.2: dependencies: loader-utils "^1.0.0" +validate-npm-package-license@^3.0.1: + version "3.0.3" + resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.3.tgz#81643bcbef1bdfecd4623793dc4648948ba98338" + dependencies: + spdx-correct "^3.0.0" + spdx-expression-parse "^3.0.0" + vary@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/vary/-/vary-1.0.1.tgz#99e4981566a286118dfb2b817357df7993376d10" vendors@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/vendors/-/vendors-1.0.1.tgz#37ad73c8ee417fb3d580e785312307d274847f22" + version "1.0.2" + resolved "https://registry.yarnpkg.com/vendors/-/vendors-1.0.2.tgz#7fcb5eef9f5623b156bcea89ec37d63676f21801" verror@1.10.0: version "1.10.0" @@ -4673,18 +6180,51 @@ vm-browserify@0.0.4, vm-browserify@~0.0.0: dependencies: indexof "0.0.1" -void-elements@~2.0.1: +void-elements@^2.0.1, void-elements@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/void-elements/-/void-elements-2.0.1.tgz#c066afb582bb1cb4128d60ea92392e94d5e9dbec" +w3c-hr-time@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz#82ac2bff63d950ea9e3189a58a65625fedf19045" + dependencies: + browser-process-hrtime "^0.1.2" + +wabt@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/wabt/-/wabt-1.0.0.tgz#f33a5c4a6405370ec80ba97e782d092f1d599ff4" + +walker@~1.0.5: + version "1.0.7" + resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.7.tgz#2f7f9b8fd10d677262b18a884e28d19618e028fb" + dependencies: + makeerror "1.0.x" + +wast-loader@^1.5.5: + version "1.5.7" + resolved "https://registry.yarnpkg.com/wast-loader/-/wast-loader-1.5.7.tgz#1b165cef7225c70a7e82a50e4f8bf0bc1ec9f2fd" + dependencies: + wabt "^1.0.0" + +watch@~0.18.0: + version "0.18.0" + resolved "https://registry.yarnpkg.com/watch/-/watch-0.18.0.tgz#28095476c6df7c90c963138990c0a5423eb4b986" + dependencies: + exec-sh "^0.2.0" + minimist "^1.2.0" + watchpack@^1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-1.5.0.tgz#231e783af830a22f8966f65c4c4bacc814072eed" + version "1.6.0" + resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-1.6.0.tgz#4bc12c2ebe8aa277a71f1d3f14d685c7b446cd00" dependencies: chokidar "^2.0.2" graceful-fs "^4.1.2" neo-async "^2.5.0" +webidl-conversions@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" + webpack-dev-middleware@^1.9.0: version "1.12.2" resolved "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-1.12.2.tgz#f8fc1120ce3b4fc5680ceecb43d777966b21105e" @@ -4702,15 +6242,37 @@ webpack-sources@^1.0.1, webpack-sources@^1.1.0: source-list-map "^2.0.0" source-map "~0.6.1" +whatwg-encoding@^1.0.1, whatwg-encoding@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.3.tgz#57c235bc8657e914d24e1a397d3c82daee0a6ba3" + dependencies: + iconv-lite "0.4.19" + whatwg-fetch@>=0.10.0: - version "2.0.3" - resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz#9c84ec2dcf68187ff00bc64e1274b442176e1c84" + version "2.0.4" + resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz#dde6a5df315f9d39991aa17621853d720b85566f" + +whatwg-mimetype@^2.0.0, whatwg-mimetype@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.1.0.tgz#f0f21d76cbba72362eb609dbed2a30cd17fcc7d4" + +whatwg-url@^6.4.0: + version "6.4.1" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-6.4.1.tgz#fdb94b440fd4ad836202c16e9737d511f012fd67" + dependencies: + lodash.sortby "^4.7.0" + tr46 "^1.0.1" + webidl-conversions "^4.0.2" whet.extend@~0.9.9: version "0.9.9" resolved "https://registry.yarnpkg.com/whet.extend/-/whet.extend-0.9.9.tgz#f877d5bf648c97e5aa542fadc16d6a259b9c11a1" -which@^1.1.1, which@^1.2.9: +which-module@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" + +which@^1.1.1, which@^1.2.12, which@^1.2.9, which@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a" dependencies: @@ -4726,6 +6288,13 @@ window-size@0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d" +with@^5.0.0: + version "5.1.1" + resolved "https://registry.yarnpkg.com/with/-/with-5.1.1.tgz#fa4daa92daf32c4ea94ed453c81f04686b575dfe" + dependencies: + acorn "^3.1.0" + acorn-globals "^3.0.0" + with@~4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/with/-/with-4.0.3.tgz#eefd154e9e79d2c8d3417b647a8f14d9fecce14e" @@ -4751,32 +6320,62 @@ worker-farm@^1.5.2: dependencies: errno "~0.1.7" -worker-loader@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/worker-loader/-/worker-loader-1.1.0.tgz#8cf21869a07add84d66f821d948d23c1eb98e809" +worker-loader@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/worker-loader/-/worker-loader-1.1.1.tgz#920d74ddac6816fc635392653ed8b4af1929fd92" dependencies: loader-utils "^1.0.0" - schema-utils "^0.3.0" + schema-utils "^0.4.0" + +wrap-ansi@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" + dependencies: + string-width "^1.0.1" + strip-ansi "^3.0.1" wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" +write-file-atomic@^2.1.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-2.3.0.tgz#1ff61575c2e2a4e8e510d6fa4e243cce183999ab" + dependencies: + graceful-fs "^4.1.11" + imurmurhash "^0.1.4" + signal-exit "^3.0.2" + write@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/write/-/write-0.2.1.tgz#5fc03828e264cea3fe91455476f7a3c566cb0757" dependencies: mkdirp "^0.5.1" +ws@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-4.1.0.tgz#a979b5d7d4da68bf54efe0408967c324869a7289" + dependencies: + async-limiter "~1.0.0" + safe-buffer "~5.1.0" + +xml-name-validator@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a" + xtend@^4.0.0, xtend@~4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" xxhashjs@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/xxhashjs/-/xxhashjs-0.2.1.tgz#9bbe9be896142976dfa34c061b2d068c43d30de0" + version "0.2.2" + resolved "https://registry.yarnpkg.com/xxhashjs/-/xxhashjs-0.2.2.tgz#8a6251567621a1c46a5ae204da0249c7f8caa9d8" dependencies: - cuint latest + cuint "^0.2.2" + +y18n@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41" y18n@^4.0.0: version "4.0.0" @@ -4786,6 +6385,33 @@ yallist@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" +yallist@^3.0.0, yallist@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.0.2.tgz#8452b4bb7e83c7c188d8041c1a837c773d6d8bb9" + +yargs-parser@^9.0.2: + version "9.0.2" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-9.0.2.tgz#9ccf6a43460fe4ed40a9bb68f48d43b8a68cc077" + dependencies: + camelcase "^4.1.0" + +yargs@^11.0.0: + version "11.0.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-11.0.0.tgz#c052931006c5eee74610e5fc0354bedfd08a201b" + dependencies: + cliui "^4.0.0" + decamelize "^1.1.1" + find-up "^2.1.0" + get-caller-file "^1.0.1" + os-locale "^2.0.0" + require-directory "^2.1.1" + require-main-filename "^1.0.1" + set-blocking "^2.0.0" + string-width "^2.0.0" + which-module "^2.0.0" + y18n "^3.2.1" + yargs-parser "^9.0.2" + yargs@~3.10.0: version "3.10.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.10.0.tgz#f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1"