diff --git a/.codecov.yml b/.codecov.yml index d295391be7a..9f22d86e981 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -4,7 +4,7 @@ codecov: coverage: precision: 2 round: down - range: '50...100' + range: "50...100" parsers: gcov: @@ -15,6 +15,6 @@ parsers: macro: no comment: - layout: 'reach,diff,flags,files,footer' + layout: "reach,diff,flags,files,footer" behavior: default require_changes: no diff --git a/.eslintrc.js b/.eslintrc.js index 2cd5cba0359..282964570ca 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,12 +1,17 @@ module.exports = { root: true, reportUnusedDisableDirectives: true, - extends: ['eslint:recommended', 'plugin:node/recommended', 'plugin:prettier/recommended', 'prettier'], - parserOptions: { ecmaVersion: 2018, sourceType: 'script' }, - plugins: ['node'], + extends: [ + "eslint:recommended", + "plugin:node/recommended", + "plugin:prettier/recommended", + "prettier", + ], + parserOptions: { ecmaVersion: 2018, sourceType: "script" }, + plugins: ["node"], settings: { node: { - allowModules: ['@webpack-cli/generators'], + allowModules: ["@webpack-cli/generators"], }, }, env: { @@ -15,27 +20,31 @@ module.exports = { jest: true, }, rules: { - quotes: ['error', 'single', { avoidEscape: true, allowTemplateLiterals: false }], - 'no-process-exit': 'off', - 'no-template-curly-in-string': 'error', - 'no-caller': 'error', - 'no-extra-bind': 'error', - 'no-loop-func': 'error', - 'no-undef': 'error', + "no-process-exit": "off", + "no-template-curly-in-string": "error", + "no-caller": "error", + "no-extra-bind": "error", + "no-loop-func": "error", + "no-undef": "error", + "prefer-const": "error", }, overrides: [ { settings: { node: { - tryExtensions: ['.ts', '.tsx', '.js', '.jsx', '.json'], + tryExtensions: [".ts", ".tsx", ".js", ".jsx", ".json"], }, }, - files: ['**/*.ts'], - extends: ['plugin:@typescript-eslint/eslint-recommended', 'plugin:@typescript-eslint/recommended', 'prettier'], - parser: '@typescript-eslint/parser', - plugins: ['@typescript-eslint'], + files: ["**/*.ts"], + extends: [ + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended", + "prettier", + ], + parser: "@typescript-eslint/parser", + plugins: ["@typescript-eslint"], rules: { - 'node/no-unsupported-features/es-syntax': 'off', + "node/no-unsupported-features/es-syntax": "off", }, }, ], diff --git a/.github/ISSUE_TEMPLATE/Bug_report.md b/.github/ISSUE_TEMPLATE/Bug_report.md index a96266fed03..ba266dbec29 100644 --- a/.github/ISSUE_TEMPLATE/Bug_report.md +++ b/.github/ISSUE_TEMPLATE/Bug_report.md @@ -1,7 +1,7 @@ --- name: "[BUG]: \U0001F41EReport" about: "Template for \U0001F98E's you encounter with webpack-cli" -labels: 'Bug' +labels: "Bug" --- **Describe the bug** diff --git a/.github/ISSUE_TEMPLATE/Feature_request.md b/.github/ISSUE_TEMPLATE/Feature_request.md index 71aecb8c586..643a7d5fe36 100644 --- a/.github/ISSUE_TEMPLATE/Feature_request.md +++ b/.github/ISSUE_TEMPLATE/Feature_request.md @@ -1,7 +1,7 @@ --- name: "[FEATURE]: Feature request \U0001F914" about: "Suggest ideas you wish webpack-cli had \U0001F680" -labels: 'Feature Request' +labels: "Feature Request" --- **Is your feature request related to a problem? Please describe.** diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 8323e7c9467..8505d9a5fdf 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,10 +1,10 @@ version: 2 updates: - package-ecosystem: npm - directory: '/' + directory: "/" schedule: interval: daily - time: '04:00' + time: "04:00" timezone: Europe/Berlin open-pull-requests-limit: 10 versioning-strategy: lockfile-only diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 6e9c6d6f145..ddeb6e45a76 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -12,7 +12,7 @@ on: workflow_dispatch: inputs: tags: - description: 'Test description' + description: "Test description" jobs: lint: @@ -54,9 +54,12 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] - node-version: [10.x, 12.x, 14.x] + node-version: [10.x, 12.x, 14.x, 16.x] webpack-version: [4, latest] dev-server-version: [latest, next] + exclude: + - node-version: 10.x + dev-server-version: next steps: - uses: actions/checkout@v2 @@ -112,7 +115,7 @@ jobs: - uses: actions/setup-node@v1 with: - node-version: '12.x' + node-version: "12.x" - run: npm install diff --git a/.husky/commit-msg b/.husky/commit-msg index 7cd8dd9a45d..e8511eaeaf6 100755 --- a/.husky/commit-msg +++ b/.husky/commit-msg @@ -1,4 +1,4 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" -npx --no-install commitlint --edit +npx --no-install commitlint --edit $1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 9636f25f990..8446fcd688a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,18 @@ +# [4.7.0](https://github.com/webpack/webpack-cli/compare/webpack-cli@4.6.0...webpack-cli@4.7.0) (2021-05-06) + +### Bug Fixes + +- parsing of empty `--env` flags ([#2643](https://github.com/webpack/webpack-cli/issues/2643)) ([bc12f1a](https://github.com/webpack/webpack-cli/commit/bc12f1a2a833f09a0585050a0f5dd854da188f1d)) +- update usage info ([#2594](https://github.com/webpack/webpack-cli/issues/2594)) ([9d07d67](https://github.com/webpack/webpack-cli/commit/9d07d67faf147cbaf0dddb95038403963e5f2afb)) + +### Features + +- add `create` and `new` alias for `init` ([#2616](https://github.com/webpack/webpack-cli/issues/2616)) ([5a9789d](https://github.com/webpack/webpack-cli/commit/5a9789db237b7696adfdc9826b0dda749fedfa9a)) +- add `server` alias for `serve` command ([#2631](https://github.com/webpack/webpack-cli/issues/2631)) ([c9ee947](https://github.com/webpack/webpack-cli/commit/c9ee947618c06447bc1f949e4d401e63f737f38d)) +- add flag to force start finish log ([#2566](https://github.com/webpack/webpack-cli/issues/2566)) ([281aad3](https://github.com/webpack/webpack-cli/commit/281aad3ee4961f1643453eb1a926e88e0b7f019c)) +- added `--no-devtool` to webpack v4([#2603](https://github.com/webpack/webpack-cli/issues/2603)) ([7c6f390](https://github.com/webpack/webpack-cli/commit/7c6f390a1d64d562065ffc31d8b23d833813ee9d)) +- added support arguments description ([#2659](https://github.com/webpack/webpack-cli/issues/2659)) ([4dfd166](https://github.com/webpack/webpack-cli/commit/4dfd166f757ce94130bf9b7580f2dbe2868b8f4f)) + # [4.6.0](https://github.com/webpack/webpack-cli/compare/webpack-cli@4.5.0...webpack-cli@4.6.0) (2021-03-27) ### Bug Fixes diff --git a/INIT.md b/INIT.md index 115aa5cdaa0..3fde9c09e10 100644 --- a/INIT.md +++ b/INIT.md @@ -47,7 +47,7 @@ webpack-cli init **To generate with default answers** ```bash -webpack-cli init --force +webpack-cli init -f, --force ``` **To scaffold in a specified path** @@ -59,7 +59,7 @@ webpack-cli init [generation-path] **To scaffold specified template** ```bash -webpack-cli init --template +webpack-cli init -t, --template ``` ## Description of questions asked by the generator @@ -82,7 +82,11 @@ Adds a development server to serve webpack bundles and hence make development fa Adds `html-webpack-plugin` that simplifies creation of HTML files to serve your bundles. -4. `Which of the following CSS solutions do you want to use?` +4. `Do you want to add PWA support?` + +Adds [`workbox-webpack-plugin`](https://developers.google.com/web/tools/workbox/modules/workbox-webpack-plugin) which generates a complete service worker for you. + +5. `Which of the following CSS solutions do you want to use?` > _Property/key resolved: [module.rules](https://webpack.js.org/configuration/module/#module-rules) (for .css files)_ diff --git a/OPTIONS.md b/OPTIONS.md index 88515e0f378..f0c25ad650d 100644 --- a/OPTIONS.md +++ b/OPTIONS.md @@ -23,11 +23,13 @@ Options: --no-cache Negative 'cache' option. --cache-max-generations Number of generations unused cache entries stay in memory cache at minimum (1 = may be removed after unused for a single compilation, ..., Infinity: kept forever). --cache-type In memory caching. Filesystem caching. + --cache-allow-collecting-memory Allows to collect unused memory allocated during deserialization. This requires copying data into smaller buffers and has a performance cost. + --no-cache-allow-collecting-memory Negative 'cache-allow-collecting-memory' option. --cache-cache-directory Base directory for the cache (defaults to node_modules/.cache/webpack). --cache-cache-location Locations for the cache (defaults to cacheDirectory / name). --cache-hash-algorithm Algorithm used for generation the hash (see node.js crypto package). - --cache-idle-timeout Time in ms after which idle period the cache storing should happen (only for store: 'pack' or 'idle'). - --cache-idle-timeout-for-initial-store Time in ms after which idle period the initial cache storing should happen (only for store: 'pack' or 'idle'). + --cache-idle-timeout Time in ms after which idle period the cache storing should happen (only for store: 'pack'). + --cache-idle-timeout-for-initial-store Time in ms after which idle period the initial cache storing should happen (only for store: 'pack'). --cache-immutable-paths A path to a immutable directory (usually a package manager cache directory). --cache-immutable-paths-reset Clear all items provided in configuration. List of paths that are managed by a package manager and contain a version or hash in its path so all files are immutable. --cache-managed-paths A path to a managed directory (usually a node_modules directory). @@ -35,6 +37,8 @@ Options: --cache-max-age Time for which unused cache entries stay in the filesystem cache at minimum (in milliseconds). --cache-max-memory-generations Number of generations unused cache entries stay in memory cache at minimum (0 = no memory cache used, 1 = may be removed after unused for a single compilation, ..., Infinity: kept forever). Cache entries will be deserialized from disk when removed from memory cache. --cache-name Name for the cache. Different names will lead to different coexisting caches. + --cache-profile Track and log detailed timing information for individual cache items. + --no-cache-profile Negative 'cache-profile' option. --cache-store When to store data to the filesystem. (pack: Store data when compiler is idle in a single file). --cache-version Version of the cache data. Different versions won't allow to reuse the cache and override existing content. Update the version when config changed in a way which doesn't allow to reuse cache. This will invalidate the cache. --context The base directory (absolute path!) for resolving the `entry` option. If `output.pathinfo` is set, the included pathinfo is shortened to this directory. @@ -48,6 +52,8 @@ Options: --no-experiments-asset Negative 'experiments-asset' option. --experiments-async-web-assembly Support WebAssembly as asynchronous EcmaScript Module. --no-experiments-async-web-assembly Negative 'experiments-async-web-assembly' option. + --experiments-execute-module Enable build-time execution of modules from the module graph for plugins and loaders. + --no-experiments-execute-module Negative 'experiments-execute-module' option. --experiments-layers Enable module and chunk layers. --no-experiments-layers Negative 'experiments-layers' option. --experiments-lazy-compilation Compile entrypoints and import()s only when they are accessed. @@ -346,22 +352,36 @@ Options: --no-module-parser-javascript-esm-wrapped-context-recursive Negative 'module-parser-javascript-esm-wrapped-context-recursive' option. --module-parser-javascript-esm-wrapped-context-reg-exp Set the inner regular expression for partial dynamic dependencies. --module-rules-compiler Match the child compiler name. + --module-rules-compiler-not Logical NOT. --module-rules-dependency Match dependency type. + --module-rules-dependency-not Logical NOT. --module-rules-enforce Enforce this rule as pre or post step. --module-rules-exclude Shortcut for resource.exclude. + --module-rules-exclude-not Logical NOT. --module-rules-include Shortcut for resource.include. + --module-rules-include-not Logical NOT. --module-rules-issuer Match the issuer of the module (The module pointing to this module). + --module-rules-issuer-not Logical NOT. --module-rules-issuer-layer Match layer of the issuer of this module (The module pointing to this module). + --module-rules-issuer-layer-not Logical NOT. --module-rules-layer Specifies the layer in which the module should be placed in. --module-rules-loader A loader request. --module-rules-mimetype Match module mimetype when load from Data URI. + --module-rules-mimetype-not Logical NOT. --module-rules-real-resource Match the real resource path of the module. + --module-rules-real-resource-not Logical NOT. --module-rules-resource Match the resource path of the module. + --module-rules-resource-not Logical NOT. --module-rules-resource-fragment Match the resource fragment of the module. + --module-rules-resource-fragment-not Logical NOT. --module-rules-resource-query Match the resource query of the module. + --module-rules-resource-query-not Logical NOT. + --module-rules-scheme Match module scheme. + --module-rules-scheme-not Logical NOT. --module-rules-side-effects Flags a module as with or without side effects. --no-module-rules-side-effects Negative 'module-rules-side-effects' option. --module-rules-test Shortcut for resource.test. + --module-rules-test-not Logical NOT. --module-rules-type Module type to use for the module. --module-rules-use-ident Unique loader options identifier. --module-rules-use-loader A loader request. @@ -552,6 +572,8 @@ Options: --no-output-strict-module-error-handling Negative 'output-strict-module-error-handling' option. --output-strict-module-exception-handling Handles exceptions in module loading correctly at a performance cost (Deprecated). This will handle module error compatible with the Node.js CommonJS way. --no-output-strict-module-exception-handling Negative 'output-strict-module-exception-handling' option. + --output-trusted-types [value] Use a Trusted Types policy to create urls for chunks. 'output.uniqueName' is used a default policy name. Passing a string sets a custom policy name. The name of the Trusted Types policy created by webpack to serve bundle chunks. + --output-trusted-types-policy-name The name of the Trusted Types policy created by webpack to serve bundle chunks. --output-unique-name A unique name of the webpack build to avoid multiple webpack runtimes to conflict when using globals. --output-wasm-loading The method of loading WebAssembly Modules (methods included by default are 'fetch' (web/WebWorker), 'async-node' (node.js), but others might be added by plugins). --no-output-wasm-loading Negative 'output-wasm-loading' option. diff --git a/SERVE-OPTIONS.md b/SERVE-OPTIONS.md index efb5b9e51ab..f072b073aca 100644 --- a/SERVE-OPTIONS.md +++ b/SERVE-OPTIONS.md @@ -4,38 +4,49 @@ Usage: webpack serve|server|s [entries...] [options] Run the webpack dev server. Options: - -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. + -c, --config Provide path to a webpack configuration file e.g. + ./webpack.config.js. --config-name Name of the configuration to use. - -m, --merge Merge two or more configurations using 'webpack-merge'. - --env Environment passed to the configuration when it is a function. + -m, --merge Merge two or more configurations using + 'webpack-merge'. + --env Environment passed to the configuration when it + is a function. --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. -j, --json [value] Prints result as JSON or store it in a file. -d, --devtool Determine source maps to use. --no-devtool Do not generate source maps. - --entry The entry point(s) of your application e.g. ./src/main.js. + --entry The entry point(s) of your application e.g. + ./src/main.js. --mode Defines the mode to pass to webpack. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path Output location of the file generated by webpack e.g. ./dist/. - --stats [value] It instructs webpack on how to treat the stats e.g. verbose. + --name Name of the configuration. Used when loading + multiple configurations. + -o, --output-path Output location of the file generated by webpack + e.g. ./dist/. + --stats [value] It instructs webpack on how to treat the stats + e.g. verbose. --no-stats Disable stats output. -t, --target Sets the build target e.g. node. --no-target Negative 'target' option. --watch-options-stdin Stop watching when stdin stream has ended. --no-watch-options-stdin Do not stop watching when stdin stream has ended. - --bonjour Broadcasts the server via ZeroConf networking on start + --bonjour Broadcasts the server via ZeroConf networking on + start --lazy Lazy --liveReload Enables/Disables live reloading on changing files --serveIndex Enables/Disables serveIndex middleware - --inline Inline mode (set to false to disable including client scripts like livereload) + --inline Inline mode (set to false to disable including + client scripts like livereload) --profile Print compilation profile data for progress steps --progress Print compilation progress in percentage --hot-only Do not refresh page if HMR fails --stdin close when stdin ends - --open [value] Open the default browser, or optionally specify a browser name + --open [value] Open the default browser, or optionally specify a + browser name --useLocalIp Open default browser with local IP --open-page Open default browser with the specified page - --client-log-level Log level in the browser (trace, debug, info, warn, error or silent) + --client-log-level Log level in the browser (trace, debug, info, + warn, error or silent) --https HTTPS --http2 HTTP/2, must be used with HTTPS --key Path to a SSL key. @@ -45,19 +56,23 @@ Options: --pfx-passphrase Passphrase for pfx file. --content-base A directory or URL to serve HTML content from. --watch-content-base Enable live-reloading of the content-base. - --history-api-fallback Fallback to /index.html for Single Page Applications. + --history-api-fallback Fallback to /index.html for Single Page + Applications. --compress Enable gzip compression --port The port --disable-host-check Will not check the host --socket Socket to listen --public The public hostname/ip address of the server --host The hostname/ip address the server will bind to - --allowed-hosts A list of hosts that are allowed to access the dev server, separated by spaces + --allowed-hosts A list of hosts that are allowed to access the + dev server, separated by spaces Global options: --color Enable colors on console. --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -v, --version Output the version number of 'webpack', + 'webpack-cli' and 'webpack-dev-server' and + commands. -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. diff --git a/commitlint.config.js b/commitlint.config.js index 2f9d1aa0e6c..db74d15522c 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -1,3 +1,3 @@ module.exports = { - extends: ['@commitlint/config-conventional'], + extends: ["@commitlint/config-conventional"], }; diff --git a/jest.config.js b/jest.config.js index ae3797dcc82..af8a0297593 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,25 +1,30 @@ -const { cli } = require('webpack'); +const { cli } = require("webpack"); // Ignore core-flags test for webpack@4 const ignorePattern = - typeof cli !== 'undefined' ? ['/node_modules/'] : ['/node_modules/', '/test/build/core-flags']; + typeof cli !== "undefined" + ? ["/node_modules/"] + : ["/node_modules/", "/test/build/core-flags"]; module.exports = { testPathIgnorePatterns: ignorePattern, - testEnvironment: 'node', + testEnvironment: "node", collectCoverage: true, - coverageDirectory: '.nyc_output', - coverageReporters: ['json'], - coveragePathIgnorePatterns: ['/test/'], + coverageDirectory: ".nyc_output", + coverageReporters: ["json"], + coveragePathIgnorePatterns: ["/test/"], transform: { - '^.+\\.(ts)?$': 'ts-jest', + "^.+\\.(ts)?$": "ts-jest", }, - testRegex: ['/test/.*\\.(test.js|test.ts)$'], - moduleFileExtensions: ['ts', 'js', 'json'], - snapshotResolver: '/scripts/snapshotResolver.js', - watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname'], - setupFilesAfterEnv: ['/setupTest.js'], - globalTeardown: '/scripts/cleanupTest.js', - globalSetup: '/scripts/globalSetup.js', - modulePathIgnorePatterns: ['/test/loader/test-loader', '/test/plugin/test-plugin'], + testRegex: ["/test/.*\\.(test.js|test.ts)$"], + moduleFileExtensions: ["ts", "js", "json"], + snapshotResolver: "/scripts/snapshotResolver.js", + watchPlugins: ["jest-watch-typeahead/filename", "jest-watch-typeahead/testname"], + setupFilesAfterEnv: ["/setupTest.js"], + globalTeardown: "/scripts/cleanupTest.js", + globalSetup: "/scripts/globalSetup.js", + modulePathIgnorePatterns: [ + "/test/loader/test-loader", + "/test/plugin/test-plugin", + ], }; diff --git a/lint-staged.config.js b/lint-staged.config.js index 3a61f2cf20b..e487d8f7c5a 100644 --- a/lint-staged.config.js +++ b/lint-staged.config.js @@ -1,4 +1,4 @@ module.exports = { - '*.{json,md,yml,css}': ['prettier --write'], - '*.{js,ts}': ['eslint --fix', 'prettier --write'], + "*.{json,md,yml,css}": ["prettier --write"], + "*.{js,ts}": ["eslint --fix", "prettier --write"], }; diff --git a/open-bot.yml b/open-bot.yml index 0e6a5847211..aedfe64095e 100644 --- a/open-bot.yml +++ b/open-bot.yml @@ -1,4 +1,4 @@ -bot: 'webpack-bot' +bot: "webpack-bot" rules: # Add ci-ok, ci-not-ok labels depending on travis status # comment to point the user to the results @@ -8,16 +8,16 @@ rules: pull_request: mergeable: true status_1: - context: 'continuous-integration/travis-ci/pr' + context: "continuous-integration/travis-ci/pr" ensure_1: - value: '{{status_1.state}}' - equals: 'success' + value: "{{status_1.state}}" + equals: "success" actions: label: - add: 'PR: CI-ok' - remove: 'PR: CI-not-ok' + add: "PR: CI-ok" + remove: "PR: CI-not-ok" comment: - identifier: 'ci-result' + identifier: "ci-result" message: |- Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon. - filters: @@ -25,15 +25,15 @@ rules: pull_request: mergeable: true status_1: - context: 'continuous-integration/travis-ci/pr' + context: "continuous-integration/travis-ci/pr" any: ensure_1: - value: '{{status_1.state}}' - equals: 'failure' + value: "{{status_1.state}}" + equals: "failure" actions: label: - add: 'PR: CI-not-ok' - remove: 'PR: CI-ok' + add: "PR: CI-not-ok" + remove: "PR: CI-ok" set: id: report_ci value: yep @@ -41,27 +41,27 @@ rules: # Report specific error message if jest tests fails - filters: ensure: - value: '{{report_ci}}' + value: "{{report_ci}}" equals: yep commit: true status: - context: 'continuous-integration/travis-ci/pr' + context: "continuous-integration/travis-ci/pr" travis_job: - state: 'failed' + state: "failed" allow_failure: false config: env: JOB_PART=integration fetch: travis_job.log string_cleanup: id: logResult - value: '{{{fetch}}}' + value: "{{{fetch}}}" remove: - "^[\\s\\S]+?npm run travis:\\$JOB_PART\n*" - "npm ERR!.*\n" - "\n*=============================================================================\n[\\s\\S]*" actions: comment: - identifier: 'ci-result' + identifier: "ci-result" message: |- @{{commit.author.login}} Please review the following output log for errors: @@ -77,26 +77,26 @@ rules: # Report specific error message if linting fails - filters: ensure: - value: '{{report_ci}}' + value: "{{report_ci}}" equals: yep commit: true status: - context: 'continuous-integration/travis-ci/pr' + context: "continuous-integration/travis-ci/pr" travis_job: - state: 'failed' + state: "failed" config: env: JOB_PART=lint fetch: travis_job.log string_cleanup: id: logResult - value: '{{{fetch}}}' + 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]*" actions: comment: - identifier: 'ci-result' + 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: @@ -112,14 +112,14 @@ rules: # Report a general error message - filters: ensure: - value: '{{report_ci}}' + value: "{{report_ci}}" equals: yep commit: true status_1: - context: 'continuous-integration/travis-ci/pr' + context: "continuous-integration/travis-ci/pr" actions: comment: - identifier: 'ci-result' + identifier: "ci-result" message: |- @{{commit.author.login}} The most important CI builds failed. This way your PR can't be merged. @@ -133,18 +133,18 @@ rules: mergeable: false actions: label: - add: 'PR: conflict' + add: "PR: conflict" remove: - - 'PR: tests-needed' - - 'PR: CI-ok' - - 'PR: CI-not-ok' + - "PR: tests-needed" + - "PR: CI-ok" + - "PR: CI-not-ok" - filters: open: true pull_request: mergeable: true actions: label: - remove: 'PR: conflict' + remove: "PR: conflict" # add unreviewed, reviewed, review-outdated labels # comment to ping reviewer @@ -156,15 +156,15 @@ rules: review: state: APPROVED|CHANGES_REQUESTED ensure: - value: '{{review.state}}' + value: "{{review.state}}" equals: APPROVED actions: label: - add: 'PR: reviewed-approved' + add: "PR: reviewed-approved" remove: - - 'PR: review-outdated' - - 'PR: unreviewed' - - 'PR: reviewed' + - "PR: review-outdated" + - "PR: unreviewed" + - "PR: reviewed" - filters: open: true in_order: @@ -172,15 +172,15 @@ rules: review: state: APPROVED|CHANGES_REQUESTED ensure: - value: '{{review.state}}' + value: "{{review.state}}" equals: CHANGES_REQUESTED actions: label: - add: 'PR: reviewed-changes-requested' + add: "PR: reviewed-changes-requested" remove: - - 'PR: review-outdated' - - 'PR: unreviewed' - - 'PR: reviewed' + - "PR: review-outdated" + - "PR: unreviewed" + - "PR: reviewed" - filters: open: true in_order: @@ -188,20 +188,20 @@ rules: state: APPROVED|CHANGES_REQUESTED commit: true not: - label: 'review-outdated' + label: "review-outdated" ensure: - value: '{{commit.author.login}}' - notEquals: '{{review.user.login}}' + value: "{{commit.author.login}}" + notEquals: "{{review.user.login}}" actions: label: - add: 'PR: review-outdated' + add: "PR: review-outdated" remove: - - 'PR: reviewed-approved' - - 'PR: reviewed-changes-requested' - - 'PR: unreviewed' - - 'PR: reviewed' + - "PR: reviewed-approved" + - "PR: reviewed-changes-requested" + - "PR: unreviewed" + - "PR: reviewed" comment: - identifier: 'review-outdated' + identifier: "review-outdated" message: |- @{{commit.author.login}} Thanks for your update. @@ -215,17 +215,17 @@ rules: review: state: APPROVED|CHANGES_REQUESTED actions: - label: 'PR: unreviewed' + label: "PR: unreviewed" # add small label to small pull requests - filters: open: true pull_request: - additions: '<= 10' - deletions: '<= 10' - changed_files: '<= 2' + additions: "<= 10" + deletions: "<= 10" + changed_files: "<= 2" actions: - label: 'PR: small' + label: "PR: small" # add non-master label to pull request to other branch - filters: @@ -234,11 +234,11 @@ rules: minimum: 1d maximum: 1w pull_request: - head_ref: '^master$' - permission: 'read|none' + head_ref: "^master$" + permission: "read|none" actions: comment: - identifier: 'head-master' + identifier: "head-master" edit: true message: |- Hi @{{pull_request.user.login}}. @@ -256,12 +256,12 @@ rules: not: comment_1: matching: "moved\\-by\\-bot" - author: '.' + author: "." permission: - user: '{{comment.actor.login}}' + user: "{{comment.actor.login}}" actions: new_issue: - target: '{{{comment_match.[1]}}}' + target: "{{{comment_match.[1]}}}" body: |- {{{issue.body}}} @@ -284,8 +284,8 @@ rules: not: label: inactive ensure: - value: '{{issue.reactions.[+1]}}' - range: '< 10' + value: "{{issue.reactions.[+1]}}" + range: "< 10" last_action_age: 26w # half a year actions: comment: diff --git a/package.json b/package.json index 28615a73fe4..5e8c1131207 100644 --- a/package.json +++ b/package.json @@ -49,10 +49,10 @@ "webpack": "4.x.x || 5.x.x" }, "devDependencies": { - "@commitlint/cli": "^12.1.1", - "@commitlint/config-conventional": "^12.1.1", + "@commitlint/cli": "^12.1.4", + "@commitlint/config-conventional": "^12.1.4", "@types/jest": "^26.0.15", - "@types/node": "^14.14.40", + "@types/node": "^15.0.3", "@typescript-eslint/eslint-plugin": "^4.14.1", "@typescript-eslint/parser": "^4.14.1", "@webpack-cli/migrate": "^1.1.2", @@ -69,19 +69,19 @@ "get-port": "^5.1.1", "husky": "^6.0.0", "internal-ip": "^6.2.0", - "jest": "^26.6.1", + "jest": "^27.0.3", "jest-watch-typeahead": "^0.6.1", "lerna": "^4.0.0", "lint-staged": "^10.5.0", "nyc": "^15.1.0", - "prettier": "^2.1.2", + "prettier": "^2.3.0", "readable-stream": "^3.6.0", "rimraf": "^3.0.2", "strip-ansi": "^6.0.0", - "ts-jest": "^26.5.5", + "ts-jest": "^27.0.2", "ts-node": "^9.1.1", "typescript": "^4.1.3", - "webpack": "^5.35.1", + "webpack": "^5.38.1", "webpack-bundle-analyzer": "^4.3.0", "webpack-dev-server": "^3.11.2" } diff --git a/packages/configtest/CHANGELOG.md b/packages/configtest/CHANGELOG.md index 16433bac9f4..9ad04de301a 100644 --- a/packages/configtest/CHANGELOG.md +++ b/packages/configtest/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.0.4](https://github.com/webpack/webpack-cli/compare/@webpack-cli/configtest@1.0.3...@webpack-cli/configtest@1.0.4) (2021-06-07) + +### Bug Fixes + +- prettier config ([#2719](https://github.com/webpack/webpack-cli/issues/2719)) ([181295f](https://github.com/webpack/webpack-cli/commit/181295fb1b1973c201c221813562219d85b845ae)) + ## [1.0.3](https://github.com/webpack/webpack-cli/compare/@webpack-cli/configtest@1.0.2...@webpack-cli/configtest@1.0.3) (2021-05-06) **Note:** Version bump only for package @webpack-cli/configtest diff --git a/packages/configtest/package.json b/packages/configtest/package.json index c41b00c5b1a..7b4d4079963 100644 --- a/packages/configtest/package.json +++ b/packages/configtest/package.json @@ -1,6 +1,6 @@ { "name": "@webpack-cli/configtest", - "version": "1.0.3", + "version": "1.0.4", "description": "Validate a webpack configuration.", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/packages/configtest/src/index.ts b/packages/configtest/src/index.ts index caa31de3f49..025ef647d29 100644 --- a/packages/configtest/src/index.ts +++ b/packages/configtest/src/index.ts @@ -5,10 +5,10 @@ class ConfigTestCommand { await cli.makeCommand( { - name: 'configtest [config-path]', - alias: 't', - description: 'Validate a webpack configuration.', - pkg: '@webpack-cli/configtest', + name: "configtest [config-path]", + alias: "t", + description: "Validate a webpack configuration.", + pkg: "@webpack-cli/configtest", }, [], async (configPath: string | undefined): Promise => { @@ -28,11 +28,11 @@ class ConfigTestCommand { } if (configPaths.size === 0) { - logger.error('No configuration found.'); + logger.error("No configuration found."); process.exit(2); } - logger.info(`Validate '${Array.from(configPaths).join(' ,')}'.`); + logger.info(`Validate '${Array.from(configPaths).join(" ,")}'.`); try { // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -52,7 +52,9 @@ class ConfigTestCommand { process.exit(2); } - logger.success('There are no validation errors in the given webpack configuration.'); + logger.success( + "There are no validation errors in the given webpack configuration.", + ); }, ); } diff --git a/packages/generators/CHANGELOG.md b/packages/generators/CHANGELOG.md index add4d89f9a6..f18f03f3850 100644 --- a/packages/generators/CHANGELOG.md +++ b/packages/generators/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.2.0](https://github.com/webpack/webpack-cli/compare/@webpack-cli/generators@2.1.0...@webpack-cli/generators@2.2.0) (2021-06-07) + +### Bug Fixes + +- prettier config ([#2719](https://github.com/webpack/webpack-cli/issues/2719)) ([181295f](https://github.com/webpack/webpack-cli/commit/181295fb1b1973c201c221813562219d85b845ae)) + +### Features + +- **generators:** add aliases for options ([#2700](https://github.com/webpack/webpack-cli/issues/2700)) ([2172ad9](https://github.com/webpack/webpack-cli/commit/2172ad9f3e515b1b9a87558e80772bef1b6f42d6)) +- **init-generator:** configure workbox-webpack-plugin as opted ([#2722](https://github.com/webpack/webpack-cli/issues/2722)) ([f229e29](https://github.com/webpack/webpack-cli/commit/f229e29ace0acf88dafef51d86c9671efff52c72)) + # [2.1.0](https://github.com/webpack/webpack-cli/compare/@webpack-cli/generators@2.0.0...@webpack-cli/generators@2.1.0) (2021-05-06) ### Bug Fixes diff --git a/packages/generators/README.md b/packages/generators/README.md index 5b66e5a9690..22c00e6ba93 100644 --- a/packages/generators/README.md +++ b/packages/generators/README.md @@ -19,7 +19,12 @@ To run the package programmatically, install it as a dependency. When using the ### Node ```js -const { addonGenerator, initGenerator, loaderGenerator, pluginGenerator } = require('@webpack-cli/generators'); +const { + addonGenerator, + initGenerator, + loaderGenerator, + pluginGenerator, +} = require("@webpack-cli/generators"); // ... compose with yeoman env or add a generator to your own yeoman project ``` diff --git a/packages/generators/addon-template/package.json.js b/packages/generators/addon-template/package.json.js index 28ce806a7a7..3a18def4000 100644 --- a/packages/generators/addon-template/package.json.js +++ b/packages/generators/addon-template/package.json.js @@ -1,7 +1,7 @@ module.exports = (name) => { return { - version: '1.0.0', - description: 'webpack loader', + version: "1.0.0", + description: "webpack loader", name, }; }; diff --git a/packages/generators/init-template/default/index.js b/packages/generators/init-template/default/index.js index a420803c09e..019c0f4bc8e 100644 --- a/packages/generators/init-template/default/index.js +++ b/packages/generators/init-template/default/index.js @@ -1 +1 @@ -console.log('Hello World!'); +console.log("Hello World!"); diff --git a/packages/generators/init-template/default/package.json.js b/packages/generators/init-template/default/package.json.js index d50cd74f5a4..3f45ce163f2 100644 --- a/packages/generators/init-template/default/package.json.js +++ b/packages/generators/init-template/default/package.json.js @@ -1,18 +1,18 @@ module.exports = (isUsingDevServer) => { const scripts = { - build: 'webpack --mode=production --node-env=production', - 'build:dev': 'webpack --mode=development', - 'build:prod': 'webpack --mode=production --node-env=production', - watch: 'webpack --watch', + build: "webpack --mode=production --node-env=production", + "build:dev": "webpack --mode=development", + "build:prod": "webpack --mode=production --node-env=production", + watch: "webpack --watch", }; if (isUsingDevServer) { - scripts.serve = 'webpack serve'; + scripts.serve = "webpack serve"; } return { - version: '1.0.0', - description: 'My webpack project', - name: 'my-webpack-project', + version: "1.0.0", + description: "My webpack project", + name: "my-webpack-project", scripts, }; }; diff --git a/packages/generators/init-template/default/postcss.config.js b/packages/generators/init-template/default/postcss.config.js index 13efa3d39c3..8855b03e6ea 100644 --- a/packages/generators/init-template/default/postcss.config.js +++ b/packages/generators/init-template/default/postcss.config.js @@ -1,5 +1,5 @@ module.exports = { // Add you postcss configuration here // Learn more about it at https://github.com/webpack-contrib/postcss-loader#config-files - plugins: [['autoprefixer']], + plugins: [["autoprefixer"]], }; diff --git a/packages/generators/init-template/default/template.html b/packages/generators/init-template/default/template.html deleted file mode 100644 index a3677c8e755..00000000000 --- a/packages/generators/init-template/default/template.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - Webpack App - - -

Hello world!

-

Tip: Check your console

- - diff --git a/packages/generators/init-template/default/template.html.tpl b/packages/generators/init-template/default/template.html.tpl new file mode 100644 index 00000000000..d61cf83b04b --- /dev/null +++ b/packages/generators/init-template/default/template.html.tpl @@ -0,0 +1,26 @@ + + + + + Webpack App + + +

Hello world!

+

Tip: Check your console

+ + <% if (workboxWebpackPlugin) { %> + <% } %> + diff --git a/packages/generators/init-template/default/webpack.configjs.tpl b/packages/generators/init-template/default/webpack.configjs.tpl index 29e9c7d3e7f..68d9a7ddc59 100644 --- a/packages/generators/init-template/default/webpack.configjs.tpl +++ b/packages/generators/init-template/default/webpack.configjs.tpl @@ -2,7 +2,8 @@ const path = require('path');<% if (htmlWebpackPlugin) { %> const HtmlWebpackPlugin = require('html-webpack-plugin');<% } %><% if (extractPlugin !== 'No') { %> -const MiniCssExtractPlugin = require('mini-css-extract-plugin');<% } %> +const MiniCssExtractPlugin = require('mini-css-extract-plugin');<% } %><% if (workboxWebpackPlugin) { %> +const WorkboxWebpackPlugin = require('workbox-webpack-plugin');<% } %> const isProduction = process.env.NODE_ENV == 'production'; <% if (isCSS) { %> @@ -85,6 +86,9 @@ module.exports = () => { <% if (extractPlugin === "Only for Production") { %> config.plugins.push(new MiniCssExtractPlugin()); <% } %> + <% if (workboxWebpackPlugin) { %> + config.plugins.push(new WorkboxWebpackPlugin.GenerateSW()); + <% } %> } else { config.mode = 'development'; } diff --git a/packages/generators/package.json b/packages/generators/package.json index a822470d4e9..0059d899379 100644 --- a/packages/generators/package.json +++ b/packages/generators/package.json @@ -1,6 +1,6 @@ { "name": "@webpack-cli/generators", - "version": "2.1.0", + "version": "2.2.0", "description": "Webpack-CLI generators", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/packages/generators/src/addon-generator.ts b/packages/generators/src/addon-generator.ts index 7206853e592..270cdffcbc4 100644 --- a/packages/generators/src/addon-generator.ts +++ b/packages/generators/src/addon-generator.ts @@ -1,8 +1,8 @@ -import fs from 'fs'; -import path from 'path'; -import Generator from 'yeoman-generator'; +import fs from "fs"; +import path from "path"; +import Generator from "yeoman-generator"; -import { List } from './utils/scaffold-utils'; +import { List } from "./utils/scaffold-utils"; // Helper to get the template-directory content @@ -57,14 +57,16 @@ const addonGenerator = ( public async prompting(): Promise { if (!this.supportedTemplates.includes(this.template)) { - this.utils.logger.warn(`⚠ ${this.template} is not a valid template, please select one from below`); + this.utils.logger.warn( + `⚠ ${this.template} is not a valid template, please select one from below`, + ); const { selectedTemplate } = await List( this, - 'selectedTemplate', - 'Select a valid template from below:', + "selectedTemplate", + "Select a valid template from below:", this.supportedTemplates, - 'default', + "default", false, ); @@ -88,7 +90,7 @@ const addonGenerator = ( try { fs.mkdirSync(pathToProjectDir, { recursive: true }); } catch (error) { - this.utils.logger.error('Failed to create directory'); + this.utils.logger.error("Failed to create directory"); this.utils.logger.error(error); } this.destinationRoot(pathToProjectDir); @@ -96,9 +98,12 @@ const addonGenerator = ( } public writing(): void { - const packageJsonTemplatePath = '../addon-template/package.json.js'; - // eslint-disable-next-line @typescript-eslint/no-var-requires - this.fs.extendJSON(this.destinationPath('package.json'), require(packageJsonTemplatePath)(this.props.name)); + const packageJsonTemplatePath = "../addon-template/package.json.js"; + this.fs.extendJSON( + this.destinationPath("package.json"), + // eslint-disable-next-line @typescript-eslint/no-var-requires + require(packageJsonTemplatePath)(this.props.name), + ); let files = []; try { @@ -110,20 +115,27 @@ const addonGenerator = ( } // Template file paths should be of the form `path/to/_file.js.tpl` - const copyTemplateFiles = files.filter((filePath) => path.basename(filePath).startsWith('_')); + const copyTemplateFiles = files.filter((filePath) => + path.basename(filePath).startsWith("_"), + ); // File paths should be of the form `path/to/file.js.tpl` const copyFiles = files.filter((filePath) => !copyTemplateFiles.includes(filePath)); copyFiles.forEach((filePath) => { // `absolute-path/to/file.js.tpl` -> `destination-path/file.js` - const destFilePath = path.relative(this.resolvedTemplatePath, filePath).replace('.tpl', ''); + const destFilePath = path + .relative(this.resolvedTemplatePath, filePath) + .replace(".tpl", ""); this.fs.copyTpl(filePath, this.destinationPath(destFilePath)); }); copyTemplateFiles.forEach((filePath) => { // `absolute-path/to/_file.js.tpl` -> `destination-path/file.js` - const destFilePath = path.relative(this.resolvedTemplatePath, filePath).replace('_', '').replace('.tpl', ''); + const destFilePath = path + .relative(this.resolvedTemplatePath, filePath) + .replace("_", "") + .replace(".tpl", ""); this.fs.copyTpl(filePath, this.destinationPath(destFilePath), templateFn(this)); }); } @@ -132,10 +144,10 @@ const addonGenerator = ( const packager = this.utils.getPackageManager(); const opts: { dev?: boolean; - 'save-dev'?: boolean; - } = packager === 'yarn' ? { dev: true } : { 'save-dev': true }; + "save-dev"?: boolean; + } = packager === "yarn" ? { dev: true } : { "save-dev": true }; - this.scheduleInstallTask(packager, ['webpack-defaults', 'bluebird'], opts); + this.scheduleInstallTask(packager, ["webpack-defaults", "bluebird"], opts); } }; }; diff --git a/packages/generators/src/handlers.ts b/packages/generators/src/handlers.ts index fe2f36ff63d..5c5061b1f4c 100644 --- a/packages/generators/src/handlers.ts +++ b/packages/generators/src/handlers.ts @@ -1,4 +1,4 @@ -import * as defaultHandler from './handlers/default'; +import * as defaultHandler from "./handlers/default"; export default { default: defaultHandler, diff --git a/packages/generators/src/handlers/default.ts b/packages/generators/src/handlers/default.ts index c607c07a695..ee6a075965e 100644 --- a/packages/generators/src/handlers/default.ts +++ b/packages/generators/src/handlers/default.ts @@ -1,7 +1,7 @@ -import path from 'path'; -import { CustomGenerator } from '../types'; +import path from "path"; +import { CustomGenerator } from "../types"; -const templatePath = path.resolve(__dirname, '../../init-template/default'); +const templatePath = path.resolve(__dirname, "../../init-template/default"); const resolveFile = (file: string): string => { return path.resolve(templatePath, file); }; @@ -12,110 +12,155 @@ const resolveFile = (file: string): string => { * @param Question Contains questions */ -// eslint-disable-next-line @typescript-eslint/no-explicit-any -export async function questions(self: CustomGenerator, Question: Record): Promise { +export async function questions( + self: CustomGenerator, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + Question: Record, +): Promise { // Handle JS language solutions const { langType } = await Question.List( self, - 'langType', - 'Which of the following JS solutions do you want to use?', - ['none', 'ES6', 'Typescript'], - 'none', + "langType", + "Which of the following JS solutions do you want to use?", + ["none", "ES6", "Typescript"], + "none", self.force, ); switch (langType) { - case 'ES6': - self.dependencies = [...self.dependencies, 'babel-loader', '@babel/core', '@babel/preset-env']; + case "ES6": + self.dependencies.push("babel-loader", "@babel/core", "@babel/preset-env"); break; - case 'Typescript': - self.dependencies = [...self.dependencies, 'typescript', 'ts-loader']; + case "Typescript": + self.dependencies.push("typescript", "ts-loader"); break; } // Configure devServer configuraion - const { devServer } = await Question.Confirm(self, 'devServer', 'Do you want to use webpack-dev-server?', true, self.force); + const { devServer } = await Question.Confirm( + self, + "devServer", + "Do you want to use webpack-dev-server?", + true, + self.force, + ); if (devServer) { - self.dependencies = [...self.dependencies, 'webpack-dev-server']; + self.dependencies.push("webpack-dev-server"); } // Handle addition of html-webpack-plugin const { htmlWebpackPlugin } = await Question.Confirm( self, - 'htmlWebpackPlugin', - 'Do you want to simplify the creation of HTML files for your bundle?', + "htmlWebpackPlugin", + "Do you want to simplify the creation of HTML files for your bundle?", true, self.force, ); if (htmlWebpackPlugin) { - self.dependencies = [...self.dependencies, 'html-webpack-plugin']; + self.dependencies.push("html-webpack-plugin"); + } + + // Handle addition of workbox-webpack-plugin + const { workboxWebpackPlugin } = await Question.Confirm( + self, + "workboxWebpackPlugin", + "Do you want to add PWA support?", + true, + self.force, + ); + if (workboxWebpackPlugin) { + self.dependencies.push("workbox-webpack-plugin"); } // Store all answers for generation - self.answers = { ...self.answers, langType, devServer, htmlWebpackPlugin }; + self.answers = { + ...self.answers, + langType, + devServer, + htmlWebpackPlugin, + workboxWebpackPlugin, + }; // Handle CSS solutions const { cssType } = await Question.List( self, - 'cssType', - 'Which of the following CSS solutions do you want to use?', - ['none', 'CSS only', 'SASS', 'LESS', 'Stylus'], - 'none', + "cssType", + "Which of the following CSS solutions do you want to use?", + ["none", "CSS only", "SASS", "LESS", "Stylus"], + "none", self.force, ); - if (cssType == 'none') { - self.answers = { ...self.answers, cssType, isCSS: false, isPostCSS: false, extractPlugin: 'No' }; + if (cssType == "none") { + self.answers = { + ...self.answers, + cssType, + isCSS: false, + isPostCSS: false, + extractPlugin: "No", + }; return; } const { isCSS } = - cssType != 'CSS only' - ? await Question.Confirm(self, 'isCSS', `Will you be using CSS styles along with ${cssType} in your project?`, true, self.force) + cssType != "CSS only" + ? await Question.Confirm( + self, + "isCSS", + `Will you be using CSS styles along with ${cssType} in your project?`, + true, + self.force, + ) : { isCSS: true }; const { isPostCSS } = await Question.Confirm( self, - 'isPostCSS', - 'Will you be using PostCSS in your project?', - cssType == 'CSS only', + "isPostCSS", + "Will you be using PostCSS in your project?", + cssType == "CSS only", self.force, ); const { extractPlugin } = await Question.List( self, - 'extractPlugin', - 'Do you want to extract CSS for every file?', - ['No', 'Only for Production', 'Yes'], - 'No', + "extractPlugin", + "Do you want to extract CSS for every file?", + ["No", "Only for Production", "Yes"], + "No", self.force, ); switch (cssType) { - case 'SASS': - self.dependencies = [...self.dependencies, 'sass-loader', 'sass']; + case "SASS": + self.dependencies.push("sass-loader", "sass"); break; - case 'LESS': - self.dependencies = [...self.dependencies, 'less-loader', 'less']; + case "LESS": + self.dependencies.push("less-loader", "less"); break; - case 'Stylus': - self.dependencies = [...self.dependencies, 'stylus-loader', 'stylus']; + case "Stylus": + self.dependencies.push("stylus-loader", "stylus"); break; } if (isCSS) { - self.dependencies = [...self.dependencies, 'style-loader', 'css-loader']; + self.dependencies.push("style-loader", "css-loader"); } if (isPostCSS) { - self.dependencies = [...self.dependencies, 'postcss-loader', 'postcss', 'autoprefixer']; + self.dependencies.push("postcss-loader", "postcss", "autoprefixer"); } - if (extractPlugin !== 'No') { - self.dependencies = [...self.dependencies, 'mini-css-extract-plugin']; + if (extractPlugin !== "No") { + self.dependencies.push("mini-css-extract-plugin"); } - self.answers = { ...self.answers, cssType, isCSS, isPostCSS, extractPlugin }; + self.answers = { + ...self.answers, + cssType, + isCSS, + isPostCSS, + extractPlugin, + }; } /** @@ -124,42 +169,53 @@ export async function questions(self: CustomGenerator, Question: Record { - options.generationPath = generationPath || '.'; + options.generationPath = generationPath || "."; - const env = yeoman.createEnv([], { cwd: options.generationPath }); - const generatorName = 'webpack-init-generator'; + const env = yeoman.createEnv([], { + cwd: options.generationPath, + }); + const generatorName = "webpack-init-generator"; env.registerStub(initGenerator, generatorName); env.run(generatorName, { cli, options }, () => { - logger.success('Project has been initialised with webpack!'); + logger.success("Project has been initialised with webpack!"); }); }, ); await cli.makeCommand( { - name: 'loader [output-path]', - alias: 'l', - description: 'Scaffold a loader.', + name: "loader [output-path]", + alias: "l", + description: "Scaffold a loader.", argsDescription: { - 'output-path': 'Path to the output directory, e.g. ./loaderName', + "output-path": "Path to the output directory, e.g. ./loaderName", }, - usage: '[output-path] [options]', - pkg: '@webpack-cli/generators', + usage: "[output-path] [options]", + pkg: "@webpack-cli/generators", }, [ { - name: 'template', - configs: [{ type: 'string' }], - description: 'Type of template', - defaultValue: 'default', + name: "template", + alias: "t", + configs: [{ type: "string" }], + description: "Type of template", + defaultValue: "default", }, ], async (outputPath, options) => { const env = yeoman.createEnv([], { cwd: outputPath }); - const generatorName = 'webpack-loader-generator'; + const generatorName = "webpack-loader-generator"; env.registerStub(loaderGenerator, generatorName); env.run(generatorName, { cli, options }, () => { - logger.success('Loader template has been successfully scaffolded.'); + logger.success("Loader template has been successfully scaffolded."); }); }, ); await cli.makeCommand( { - name: 'plugin [output-path]', - alias: 'p', - description: 'Scaffold a plugin.', + name: "plugin [output-path]", + alias: "p", + description: "Scaffold a plugin.", argsDescription: { - 'output-path': 'Path to the output directory, e.g. ./pluginName', + "output-path": "Path to the output directory, e.g. ./pluginName", }, - usage: '[output-path] [options]', - pkg: '@webpack-cli/generators', + usage: "[output-path] [options]", + pkg: "@webpack-cli/generators", }, [ { - name: 'template', - configs: [{ type: 'string' }], - description: 'Type of template', - defaultValue: 'default', + name: "template", + alias: "t", + configs: [{ type: "string" }], + description: "Type of template", + defaultValue: "default", }, ], async (outputPath, options) => { const env = yeoman.createEnv([], { cwd: outputPath }); - const generatorName = 'webpack-plugin-generator'; + const generatorName = "webpack-plugin-generator"; env.registerStub(pluginGenerator, generatorName); env.run(generatorName, { cli, options }, () => { - logger.success('Plugin template has been successfully scaffolded.'); + logger.success("Plugin template has been successfully scaffolded."); }); }, ); diff --git a/packages/generators/src/init-generator.ts b/packages/generators/src/init-generator.ts index 2032b95f353..1006e2aeb5a 100644 --- a/packages/generators/src/init-generator.ts +++ b/packages/generators/src/init-generator.ts @@ -1,12 +1,12 @@ -import { blue, yellow } from 'colorette'; -import path from 'path'; -import * as Question from './utils/scaffold-utils'; +import { blue, yellow } from "colorette"; +import path from "path"; +import * as Question from "./utils/scaffold-utils"; -import { CustomGenerator } from './types'; -import { existsSync, mkdirSync } from 'fs'; -import handlers from './handlers'; +import { CustomGenerator } from "./types"; +import { existsSync, mkdirSync } from "fs"; +import handlers from "./handlers"; -import { readFileSync, writeFileSync } from 'fs'; +import { readFileSync, writeFileSync } from "fs"; /** * @@ -38,7 +38,7 @@ export default class InitGenerator extends CustomGenerator { this.generationPath = options.generationPath; this.resolvedGenerationPath = path.resolve(process.cwd(), this.generationPath); this.force = options.force; - this.dependencies = ['webpack', 'webpack-cli']; + this.dependencies = ["webpack", "webpack-cli"]; this.supportedTemplates = Object.keys(handlers); this.answers = {}; const { cli } = opts; @@ -48,7 +48,11 @@ export default class InitGenerator extends CustomGenerator { // eslint-disable-next-line @typescript-eslint/no-explicit-any public async prompting(): Promise { if (!existsSync(this.resolvedGenerationPath)) { - this.utils.logger.log(`${blue('ℹ INFO ')} supplied generation path doesn't exist, required folders will be created.`); + this.utils.logger.log( + `${blue( + "ℹ INFO ", + )} supplied generation path doesn't exist, required folders will be created.`, + ); try { mkdirSync(this.resolvedGenerationPath, { recursive: true }); } catch (error) { @@ -58,14 +62,16 @@ export default class InitGenerator extends CustomGenerator { } if (!this.supportedTemplates.includes(this.template)) { - this.utils.logger.warn(`⚠ ${this.template} is not a valid template, please select one from below`); + this.utils.logger.warn( + `⚠ ${this.template} is not a valid template, please select one from below`, + ); const { selectedTemplate } = await Question.List( this, - 'selectedTemplate', - 'Select a valid template from below:', + "selectedTemplate", + "Select a valid template from below:", this.supportedTemplates, - 'default', + "default", false, ); @@ -77,18 +83,18 @@ export default class InitGenerator extends CustomGenerator { // Handle installation of prettier try { // eslint-disable-next-line node/no-extraneous-require - require.resolve('prettier'); + require.resolve("prettier"); } catch (err) { const { installPrettier } = await Question.Confirm( this, - 'installPrettier', - 'Do you like to install prettier to format generated configuration?', + "installPrettier", + "Do you like to install prettier to format generated configuration?", true, false, ); if (installPrettier) { - this.dependencies.push('prettier'); + this.dependencies.push("prettier"); } } } @@ -97,14 +103,16 @@ export default class InitGenerator extends CustomGenerator { const packager = this.utils.getPackageManager(); const opts: { dev?: boolean; - 'save-dev'?: boolean; - } = packager === 'yarn' ? { dev: true } : { 'save-dev': true }; + "save-dev"?: boolean; + } = packager === "yarn" ? { dev: true } : { "save-dev": true }; - this.scheduleInstallTask(packager, this.dependencies, opts, { cwd: this.generationPath }); + this.scheduleInstallTask(packager, this.dependencies, opts, { + cwd: this.generationPath, + }); } public writing(): void { - this.utils.logger.log(`${blue('ℹ INFO ')} Initialising project...`); + this.utils.logger.log(`${blue("ℹ INFO ")} Initialising project...`); handlers[this.template].generate(this); } @@ -112,12 +120,20 @@ export default class InitGenerator extends CustomGenerator { // Prettify configuration file if possible try { // eslint-disable-next-line node/no-extraneous-require, @typescript-eslint/no-var-requires - const prettier = require('prettier'); - const source = readFileSync(this.configurationPath, { encoding: 'utf8' }); - const formattedSource = prettier.format(source, { parser: 'babel' }); + const prettier = require("prettier"); + const source = readFileSync(this.configurationPath, { + encoding: "utf8", + }); + const formattedSource = prettier.format(source, { + parser: "babel", + }); writeFileSync(this.configurationPath, formattedSource); } catch (err) { - this.utils.logger.log(`${yellow(`⚠ Generated configuration may not be properly formatted as prettier is not installed.`)}`); + this.utils.logger.log( + `${yellow( + `⚠ Generated configuration may not be properly formatted as prettier is not installed.`, + )}`, + ); return; } } diff --git a/packages/generators/src/loader-generator.ts b/packages/generators/src/loader-generator.ts index 4131e0b1474..fe4ce3c0722 100644 --- a/packages/generators/src/loader-generator.ts +++ b/packages/generators/src/loader-generator.ts @@ -1,6 +1,6 @@ -import path from 'path'; -import addonGenerator from './addon-generator'; -import { toKebabCase } from './utils/helpers'; +import path from "path"; +import addonGenerator from "./addon-generator"; +import { toKebabCase } from "./utils/helpers"; /** * Formats a string into webpack loader format @@ -13,7 +13,7 @@ export function makeLoaderName(name: string): string { name = toKebabCase(name); if (!/loader$/.test(name)) { - name += '-loader'; + name += "-loader"; } return name; @@ -31,15 +31,15 @@ export function makeLoaderName(name: string): string { export const LoaderGenerator = addonGenerator( [ { - default: 'my-loader', + default: "my-loader", filter: makeLoaderName, - message: 'Loader name', - name: 'name', - type: 'input', + message: "Loader name", + name: "name", + type: "input", validate: (str: string): boolean => str.length > 0, }, ], - path.resolve(__dirname, '../loader-template'), + path.resolve(__dirname, "../loader-template"), (gen): Record => ({ name: gen.props.name }), ); diff --git a/packages/generators/src/plugin-generator.ts b/packages/generators/src/plugin-generator.ts index 832775e3e32..3cb8e28f7c2 100644 --- a/packages/generators/src/plugin-generator.ts +++ b/packages/generators/src/plugin-generator.ts @@ -1,6 +1,6 @@ -import path from 'path'; -import addonGenerator from './addon-generator'; -import { toKebabCase, toUpperCamelCase } from './utils/helpers'; +import path from "path"; +import addonGenerator from "./addon-generator"; +import { toKebabCase, toUpperCamelCase } from "./utils/helpers"; /** * A yeoman generator class for creating a webpack @@ -13,16 +13,18 @@ import { toKebabCase, toUpperCamelCase } from './utils/helpers'; export const PluginGenerator = addonGenerator( [ { - default: 'my-webpack-plugin', + default: "my-webpack-plugin", filter: toKebabCase, - message: 'Plugin name', - name: 'name', - type: 'input', + message: "Plugin name", + name: "name", + type: "input", validate: (str: string): boolean => str.length > 0, }, ], - path.resolve(__dirname, '../plugin-template'), - (gen): Record => ({ name: toUpperCamelCase(gen.props.name) }), + path.resolve(__dirname, "../plugin-template"), + (gen): Record => ({ + name: toUpperCamelCase(gen.props.name), + }), ); export default PluginGenerator; diff --git a/packages/generators/src/types/index.ts b/packages/generators/src/types/index.ts index 16b610934ac..142e74184ae 100644 --- a/packages/generators/src/types/index.ts +++ b/packages/generators/src/types/index.ts @@ -1,4 +1,4 @@ -import Generator from 'yeoman-generator'; +import Generator from "yeoman-generator"; export class CustomGenerator extends Generator { public force: boolean; diff --git a/packages/generators/src/update-generator.ts b/packages/generators/src/update-generator.ts index 9f2adbc15de..83e32c6dbda 100644 --- a/packages/generators/src/update-generator.ts +++ b/packages/generators/src/update-generator.ts @@ -1,3 +1,3 @@ -import Generator from 'yeoman-generator'; +import Generator from "yeoman-generator"; export default class UpdateGenerator extends Generator {} diff --git a/packages/generators/src/utils/helpers.ts b/packages/generators/src/utils/helpers.ts index 550c11beca3..1c6291d7877 100644 --- a/packages/generators/src/utils/helpers.ts +++ b/packages/generators/src/utils/helpers.ts @@ -6,7 +6,7 @@ const regex = /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+ * @returns output string */ export function toKebabCase(str: string): string { - return str.match(regex).join('-').toLowerCase(); + return str.match(regex).join("-").toLowerCase(); } /** @@ -18,5 +18,5 @@ export function toUpperCamelCase(str: string): string { return str .match(regex) .map((x) => x.slice(0, 1).toUpperCase() + x.slice(1).toLowerCase()) - .join(''); + .join(""); } diff --git a/packages/generators/src/utils/scaffold-utils.ts b/packages/generators/src/utils/scaffold-utils.ts index c7064a02559..08babde5720 100644 --- a/packages/generators/src/utils/scaffold-utils.ts +++ b/packages/generators/src/utils/scaffold-utils.ts @@ -1,4 +1,4 @@ -import Generator from 'yeoman-generator'; +import Generator from "yeoman-generator"; type CustomGeneratorStringPrompt = { [x: string]: string } | Promise<{ [x: string]: string }>; type CustomGeneratorBoolPrompt = { [x: string]: boolean } | Promise<{ [x: string]: boolean }>; @@ -17,15 +17,21 @@ export function List( return { [name]: defaultChoice }; } - return self.prompt([{ choices, message, name, type: 'list', default: defaultChoice }]); + return self.prompt([{ choices, message, name, type: "list", default: defaultChoice }]); } -export function Input(self: Generator, name: string, message: string, defaultChoice?: string, skip = false): CustomGeneratorStringPrompt { +export function Input( + self: Generator, + name: string, + message: string, + defaultChoice?: string, + skip = false, +): CustomGeneratorStringPrompt { if (skip) { return { [name]: defaultChoice }; } - return self.prompt([{ default: defaultChoice, message, name, type: 'input' }]); + return self.prompt([{ default: defaultChoice, message, name, type: "input" }]); } export function InputValidate( @@ -40,7 +46,12 @@ export function InputValidate( return { [name]: defaultChoice }; } - const input: Generator.Question = { message, name, type: 'input', validate: cb }; + const input: Generator.Question = { + message, + name, + type: "input", + validate: cb, + }; if (defaultChoice) { input.default = defaultChoice; @@ -49,10 +60,16 @@ export function InputValidate( return self.prompt([input]); } -export function Confirm(self: Generator, name: string, message: string, defaultChoice = true, skip = false): CustomGeneratorBoolPrompt { +export function Confirm( + self: Generator, + name: string, + message: string, + defaultChoice = true, + skip = false, +): CustomGeneratorBoolPrompt { if (skip) { return { [name]: defaultChoice }; } - return self.prompt([{ default: defaultChoice, message, name, type: 'confirm' }]); + return self.prompt([{ default: defaultChoice, message, name, type: "confirm" }]); } diff --git a/packages/info/CHANGELOG.md b/packages/info/CHANGELOG.md index 07c03504a95..b9fadf73a0d 100644 --- a/packages/info/CHANGELOG.md +++ b/packages/info/CHANGELOG.md @@ -3,6 +3,16 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [1.3.0](https://github.com/webpack/webpack-cli/compare/@webpack-cli/info@1.2.4...@webpack-cli/info@1.3.0) (2021-06-07) + +### Bug Fixes + +- prettier config ([#2719](https://github.com/webpack/webpack-cli/issues/2719)) ([181295f](https://github.com/webpack/webpack-cli/commit/181295fb1b1973c201c221813562219d85b845ae)) + +### Features + +- **info:** add alias for --output ([#2709](https://github.com/webpack/webpack-cli/issues/2709)) ([3453053](https://github.com/webpack/webpack-cli/commit/34530530f99750a5efc382293127753f05fc8064)) + ## [1.2.4](https://github.com/webpack/webpack-cli/compare/@webpack-cli/info@1.2.3...@webpack-cli/info@1.2.4) (2021-05-06) **Note:** Version bump only for package @webpack-cli/info diff --git a/packages/info/README.md b/packages/info/README.md index adb62cccd0b..1c9303b21be 100644 --- a/packages/info/README.md +++ b/packages/info/README.md @@ -32,9 +32,9 @@ webpack info [options] #### Output format -| Flag | Description | Type | -| ------------------------------- | --------------------------------------- | ------ | -| `--output < json or markdown >` | To get the output in a specified format | string | +| Flag | Description | Type | +| ----------------------------------- | --------------------------------------- | ------ | +| `-o, --output < json or markdown >` | To get the output in a specified format | string | _Not supported for config_ diff --git a/packages/info/package.json b/packages/info/package.json index 0fdbae5baef..1492a0d9c37 100644 --- a/packages/info/package.json +++ b/packages/info/package.json @@ -1,6 +1,6 @@ { "name": "@webpack-cli/info", - "version": "1.2.4", + "version": "1.3.0", "description": "Outputs info about system and webpack config", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/packages/info/src/index.ts b/packages/info/src/index.ts index 0bf50cd5bf5..fddf308f01c 100644 --- a/packages/info/src/index.ts +++ b/packages/info/src/index.ts @@ -1,4 +1,4 @@ -import envinfo from 'envinfo'; +import envinfo from "envinfo"; interface Information { Binaries?: string[]; @@ -10,23 +10,23 @@ interface Information { } const DEFAULT_DETAILS: Information = { - Binaries: ['Node', 'Yarn', 'npm'], + Binaries: ["Node", "Yarn", "npm"], Browsers: [ - 'Brave Browser', - 'Chrome', - 'Chrome Canary', - 'Edge', - 'Firefox', - 'Firefox Developer Edition', - 'Firefox Nightly', - 'Internet Explorer', - 'Safari', - 'Safari Technology Preview', + "Brave Browser", + "Chrome", + "Chrome Canary", + "Edge", + "Firefox", + "Firefox Developer Edition", + "Firefox Nightly", + "Internet Explorer", + "Safari", + "Safari Technology Preview", ], - Monorepos: ['Yarn Workspaces', 'Lerna'], - System: ['OS', 'CPU', 'Memory'], - npmGlobalPackages: ['webpack', 'webpack-cli'], - npmPackages: '*webpack*', + Monorepos: ["Yarn Workspaces", "Lerna"], + System: ["OS", "CPU", "Memory"], + npmGlobalPackages: ["webpack", "webpack-cli"], + npmPackages: "*webpack*", }; class InfoCommand { @@ -36,21 +36,23 @@ class InfoCommand { await cli.makeCommand( { - name: 'info', - alias: 'i', - description: 'Outputs information about your system.', - usage: '[options]', - pkg: '@webpack-cli/info', + name: "info", + alias: "i", + description: "Outputs information about your system.", + usage: "[options]", + pkg: "@webpack-cli/info", }, [ { - name: 'output', + name: "output", + alias: "o", configs: [ { - type: 'string', + type: "string", }, ], - description: 'To get the output in a specified format ( accept json or markdown )', + description: + "To get the output in a specified format ( accept json or markdown )", }, ], async (options) => { @@ -60,14 +62,14 @@ class InfoCommand { if (output) { // Remove quotes if exist - output = output.replace(/['"]+/g, ''); + output = output.replace(/['"]+/g, ""); switch (output) { - case 'markdown': - envinfoConfig['markdown'] = true; + case "markdown": + envinfoConfig["markdown"] = true; break; - case 'json': - envinfoConfig['json'] = true; + case "json": + envinfoConfig["json"] = true; break; default: logger.error(`'${output}' is not a valid value for output`); @@ -77,8 +79,8 @@ class InfoCommand { let info = await envinfo.run(DEFAULT_DETAILS, envinfoConfig); - info = info.replace(/npmPackages/g, 'Packages'); - info = info.replace(/npmGlobalPackages/g, 'Global Packages'); + info = info.replace(/npmPackages/g, "Packages"); + info = info.replace(/npmGlobalPackages/g, "Global Packages"); logger.raw(info); }, diff --git a/packages/serve/CHANGELOG.md b/packages/serve/CHANGELOG.md index 7fc1065c03a..27218f220a7 100644 --- a/packages/serve/CHANGELOG.md +++ b/packages/serve/CHANGELOG.md @@ -3,6 +3,16 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [1.5.0](https://github.com/webpack/webpack-cli/compare/@webpack-cli/serve@1.4.0...@webpack-cli/serve@1.5.0) (2021-06-07) + +### Bug Fixes + +- prettier config ([#2719](https://github.com/webpack/webpack-cli/issues/2719)) ([181295f](https://github.com/webpack/webpack-cli/commit/181295fb1b1973c201c221813562219d85b845ae)) + +### Features + +- new CLI options API for serve ([#2754](https://github.com/webpack/webpack-cli/issues/2754)) ([bb7c9d3](https://github.com/webpack/webpack-cli/commit/bb7c9d3c9b0dca11242e2febcd41805c063e1317)) + # [1.4.0](https://github.com/webpack/webpack-cli/compare/@webpack-cli/serve@1.3.1...@webpack-cli/serve@1.4.0) (2021-05-06) ### Bug Fixes diff --git a/packages/serve/package.json b/packages/serve/package.json index a792278f363..48d7b30329b 100644 --- a/packages/serve/package.json +++ b/packages/serve/package.json @@ -1,6 +1,6 @@ { "name": "@webpack-cli/serve", - "version": "1.4.0", + "version": "1.5.0", "description": "", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/packages/serve/src/index.ts b/packages/serve/src/index.ts index 2235c563073..bc2d6f7db6e 100644 --- a/packages/serve/src/index.ts +++ b/packages/serve/src/index.ts @@ -1,17 +1,36 @@ -import startDevServer from './startDevServer'; +import startDevServer from "./startDevServer"; class ServeCommand { // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any async apply(cli: any): Promise { - const { logger } = cli; + const { logger, webpack } = cli; const loadDevServerOptions = () => { + // TODO simplify this after drop webpack v4 and webpack-dev-server v3 // eslint-disable-next-line @typescript-eslint/no-var-requires, node/no-extraneous-require - const options = require('webpack-dev-server/bin/cli-flags'); + const devServer = require("webpack-dev-server"); + const isNewDevServerCLIAPI = typeof devServer.schema !== "undefined"; + + let options = {}; + + if (isNewDevServerCLIAPI) { + if (typeof webpack.cli.getArguments === "function") { + options = webpack.cli.getArguments(devServer.schema); + } else { + options = devServer.cli.getArguments(); + } + } else { + // eslint-disable-next-line node/no-extraneous-require + options = require("webpack-dev-server/bin/cli-flags"); + } // Old options format // { devServer: [{...}, {}...] } + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore if (options.devServer) { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore return options.devServer; } @@ -26,12 +45,12 @@ class ServeCommand { await cli.makeCommand( { - name: 'serve [entries...]', - alias: ['server', 's'], - description: 'Run the webpack dev server.', - usage: '[entries...] [options]', - pkg: '@webpack-cli/serve', - dependencies: ['webpack-dev-server'], + name: "serve [entries...]", + alias: ["server", "s"], + description: "Run the webpack dev server.", + usage: "[entries...] [options]", + pkg: "@webpack-cli/serve", + dependencies: ["webpack-dev-server"], }, () => { let devServerFlags = []; @@ -39,11 +58,15 @@ class ServeCommand { try { devServerFlags = loadDevServerOptions(); } catch (error) { - logger.error(`You need to install 'webpack-dev-server' for running 'webpack serve'.\n${error}`); + logger.error( + `You need to install 'webpack-dev-server' for running 'webpack serve'.\n${error}`, + ); process.exit(2); } - const builtInOptions = cli.getBuiltInOptions().filter((option) => option.name !== 'watch'); + const builtInOptions = cli + .getBuiltInOptions() + .filter((option) => option.name !== "watch"); return [...builtInOptions, ...devServerFlags]; }, @@ -60,7 +83,7 @@ class ServeCommand { // eslint-disable-next-line @typescript-eslint/no-explicit-any const webpackOptions: Record = {}; // eslint-disable-next-line @typescript-eslint/no-explicit-any - const devServerOptions: Record = {}; + let devServerOptions: Record = {}; // eslint-disable-next-line @typescript-eslint/no-explicit-any const processors: Array<(opts: Record) => void> = []; @@ -69,13 +92,17 @@ class ServeCommand { const kebabedOption = cli.utils.toKebabCase(optionName); // `webpack-dev-server` has own logic for the `--hot` option const isBuiltInOption = - kebabedOption !== 'hot' && builtInOptions.find((builtInOption) => builtInOption.name === kebabedOption); + kebabedOption !== "hot" && + builtInOptions.find( + (builtInOption) => builtInOption.name === kebabedOption, + ); if (isBuiltInOption) { webpackOptions[optionName] = options[optionName]; } else { const needToProcess = devServerFlags.find( - (devServerOption) => devServerOption.name === kebabedOption && devServerOption.processor, + (devServerOption) => + devServerOption.name === kebabedOption && devServerOption.processor, ); if (needToProcess) { @@ -94,7 +121,10 @@ class ServeCommand { webpackOptions.entry = [...entries, ...(webpackOptions.entry || [])]; } - webpackOptions.argv = { ...options, env: { WEBPACK_SERVE: true, ...options.env } }; + webpackOptions.argv = { + ...options, + env: { WEBPACK_SERVE: true, ...options.env }, + }; const compiler = await cli.createCompiler(webpackOptions); @@ -112,7 +142,7 @@ class ServeCommand { delete devServerOptions.stdin; } - process.stdin.on('end', () => { + process.stdin.on("end", () => { Promise.all( servers.map((server) => { return new Promise((resolve) => { @@ -128,6 +158,65 @@ class ServeCommand { process.stdin.resume(); } + // eslint-disable-next-line @typescript-eslint/no-var-requires, node/no-extraneous-require + const devServer = require("webpack-dev-server"); + const isNewDevServerCLIAPI = typeof devServer.schema !== "undefined"; + + if (isNewDevServerCLIAPI) { + const args = devServerFlags.reduce((accumulator, flag) => { + accumulator[flag.name] = flag; + return accumulator; + }, {}); + const values = Object.keys(devServerOptions).reduce((accumulator, name) => { + const kebabName = cli.utils.toKebabCase(name); + if (args[kebabName]) { + accumulator[kebabName] = options[name]; + } + return accumulator; + }, {}); + const result = Object.assign({}, compiler.options.devServer); + const problems = ( + typeof webpack.cli.processArguments === "function" + ? webpack.cli + : devServer.cli + ).processArguments(args, result, values); + + if (problems) { + const groupBy = (xs, key) => { + return xs.reduce((rv, x) => { + (rv[x[key]] = rv[x[key]] || []).push(x); + + return rv; + }, {}); + }; + + const problemsByPath = groupBy(problems, "path"); + + for (const path in problemsByPath) { + const problems = problemsByPath[path]; + problems.forEach((problem) => { + cli.logger.error( + `${cli.utils.capitalizeFirstLetter( + problem.type.replace(/-/g, " "), + )}${problem.value ? ` '${problem.value}'` : ""} for the '--${ + problem.argument + }' option${ + problem.index ? ` by index '${problem.index}'` : "" + }`, + ); + + if (problem.expected) { + cli.logger.error(`Expected: '${problem.expected}'`); + } + }); + } + + process.exit(2); + } + + devServerOptions = result; + } + try { servers = await startDevServer(compiler, devServerOptions, options, logger); } catch (error) { diff --git a/packages/serve/src/startDevServer.ts b/packages/serve/src/startDevServer.ts index e1d7e2fb9aa..8795a299654 100644 --- a/packages/serve/src/startDevServer.ts +++ b/packages/serve/src/startDevServer.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ /* eslint-disable @typescript-eslint/no-var-requires */ -import { devServerOptionsType } from './types'; +import { devServerOptionsType } from "./types"; /** * @@ -25,15 +25,20 @@ export default async function startDevServer( try { // eslint-disable-next-line node/no-extraneous-require - devServerVersion = require('webpack-dev-server/package.json').version; + devServerVersion = require("webpack-dev-server/package.json").version; // eslint-disable-next-line node/no-extraneous-require - Server = require('webpack-dev-server/lib/Server'); + Server = require("webpack-dev-server"); } catch (err) { - logger.error(`You need to install 'webpack-dev-server' for running 'webpack serve'.\n${err}`); + logger.error( + `You need to install 'webpack-dev-server' for running 'webpack serve'.\n${err}`, + ); process.exit(2); } - const mergeOptions = (devServerOptions: devServerOptionsType, devServerCliOptions: devServerOptionsType): devServerOptionsType => { + const mergeOptions = ( + devServerOptions: devServerOptionsType, + devServerCliOptions: devServerOptionsType, + ): devServerOptionsType => { // CLI options should take precedence over devServer options, // and CLI options should have no default values included const options = { ...devServerOptions, ...devServerCliOptions }; @@ -41,7 +46,10 @@ export default async function startDevServer( if (devServerOptions.client && devServerCliOptions.client) { // the user could set some client options in their devServer config, // then also specify client options on the CLI - options.client = { ...devServerOptions.client, ...devServerCliOptions.client }; + options.client = { + ...devServerOptions.client, + ...devServerCliOptions.client, + }; } return options; @@ -52,7 +60,9 @@ export default async function startDevServer( let compilersWithDevServerOption; if (isMultiCompiler) { - compilersWithDevServerOption = compiler.compilers.filter((compiler) => compiler.options.devServer); + compilersWithDevServerOption = compiler.compilers.filter( + (compiler) => compiler.options.devServer, + ); // No compilers found with the `devServer` option, let's use first compiler if (compilersWithDevServerOption.length === 0) { @@ -62,20 +72,25 @@ export default async function startDevServer( compilersWithDevServerOption = [compiler]; } - const isDevServer4 = devServerVersion.startsWith('4'); + const isDevServer4 = devServerVersion.startsWith("4"); const usedPorts = []; const devServersOptions = []; for (const compilerWithDevServerOption of compilersWithDevServerOption) { - const options = mergeOptions(compilerWithDevServerOption.options.devServer || {}, devServerCliOptions); + const options = mergeOptions( + compilerWithDevServerOption.options.devServer || {}, + devServerCliOptions, + ); if (!isDevServer4) { const getPublicPathOption = (): string => { const normalizePublicPath = (publicPath): string => - typeof publicPath === 'undefined' || publicPath === 'auto' ? '/' : publicPath; + typeof publicPath === "undefined" || publicPath === "auto" ? "/" : publicPath; if (cliOptions.outputPublicPath) { - return normalizePublicPath(compilerWithDevServerOption.options.output.publicPath); + return normalizePublicPath( + compilerWithDevServerOption.options.output.publicPath, + ); } // webpack-dev-server@3 @@ -97,7 +112,7 @@ export default async function startDevServer( return compilerWithDevServerOption.options.stats; }; - options.host = options.host || 'localhost'; + options.host = options.host || "localhost"; options.port = options.port || 8080; options.stats = getStatsOption(); options.publicPath = getPublicPathOption(); @@ -108,7 +123,7 @@ export default async function startDevServer( if (usedPorts.find((port) => portNumber === port)) { throw new Error( - 'Unique ports must be specified for each devServer option in your webpack configuration. Alternatively, run only 1 devServer config using the --config-name flag to specify your desired config.', + "Unique ports must be specified for each devServer option in your webpack configuration. Alternatively, run only 1 devServer config using the --config-name flag to specify your desired config.", ); } diff --git a/packages/serve/src/types.ts b/packages/serve/src/types.ts index 2195684f43d..8eefb21c0ca 100644 --- a/packages/serve/src/types.ts +++ b/packages/serve/src/types.ts @@ -37,7 +37,7 @@ export type devServerOptionsType = { }; enum hotOptionEnum { - only = 'only', + only = "only", } type devServerClientOptions = { @@ -62,10 +62,10 @@ type clientOverlay = { }; enum devServerClientLogging { - none = 'none', - error = 'error', - warn = 'warn', - info = 'info', - log = 'log', - verbose = 'verbose', + none = "none", + error = "error", + warn = "warn", + info = "info", + log = "log", + verbose = "verbose", } diff --git a/packages/webpack-cli/CHANGELOG.md b/packages/webpack-cli/CHANGELOG.md index a846be43228..f39f8186089 100644 --- a/packages/webpack-cli/CHANGELOG.md +++ b/packages/webpack-cli/CHANGELOG.md @@ -3,6 +3,13 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [4.7.1](https://github.com/webpack/webpack-cli/compare/webpack-cli@4.7.0...webpack-cli@4.7.1) (2021-06-07) + +### Bug Fixes + +- not found module after ask installation ([#2761](https://github.com/webpack/webpack-cli/issues/2761)) ([557ad05](https://github.com/webpack/webpack-cli/commit/557ad05ae8168255b57698bdd2d98cbc7b53812d)) +- prettier config ([#2719](https://github.com/webpack/webpack-cli/issues/2719)) ([181295f](https://github.com/webpack/webpack-cli/commit/181295fb1b1973c201c221813562219d85b845ae)) + # [4.7.0](https://github.com/webpack/webpack-cli/compare/webpack-cli@4.6.0...webpack-cli@4.7.0) (2021-05-06) ### Bug Fixes diff --git a/packages/webpack-cli/bin/cli.js b/packages/webpack-cli/bin/cli.js index 9a9f5f02a59..d62a625831c 100755 --- a/packages/webpack-cli/bin/cli.js +++ b/packages/webpack-cli/bin/cli.js @@ -1,16 +1,16 @@ #!/usr/bin/env node -'use strict'; +"use strict"; -const Module = require('module'); +const Module = require("module"); const originalModuleCompile = Module.prototype._compile; -require('v8-compile-cache'); +require("v8-compile-cache"); -const importLocal = require('import-local'); -const runCLI = require('../lib/bootstrap'); -const utils = require('../lib/utils'); +const importLocal = require("import-local"); +const runCLI = require("../lib/bootstrap"); +const utils = require("../lib/utils"); if (!process.env.WEBPACK_CLI_SKIP_IMPORT_LOCAL) { // Prefer the local installation of `webpack-cli` @@ -19,23 +19,27 @@ if (!process.env.WEBPACK_CLI_SKIP_IMPORT_LOCAL) { } } -process.title = 'webpack'; +process.title = "webpack"; -if (utils.packageExists('webpack')) { +if (utils.packageExists("webpack")) { runCLI(process.argv, originalModuleCompile); } else { const { promptInstallation, logger, colors } = utils; - promptInstallation('webpack', () => { - utils.logger.error(`It looks like ${colors.bold('webpack')} is not installed.`); + promptInstallation("webpack", () => { + utils.logger.error(`It looks like ${colors.bold("webpack")} is not installed.`); }) .then(() => { - logger.success(`${colors.bold('webpack')} was installed successfully.`); + logger.success(`${colors.bold("webpack")} was installed successfully.`); runCLI(process.argv, originalModuleCompile); }) .catch(() => { - logger.error(`Action Interrupted, Please try once again or install ${colors.bold('webpack')} manually.`); + logger.error( + `Action Interrupted, Please try once again or install ${colors.bold( + "webpack", + )} manually.`, + ); process.exit(2); }); diff --git a/packages/webpack-cli/lib/bootstrap.js b/packages/webpack-cli/lib/bootstrap.js index 0a83a81c9e2..72499f8a364 100644 --- a/packages/webpack-cli/lib/bootstrap.js +++ b/packages/webpack-cli/lib/bootstrap.js @@ -1,5 +1,5 @@ -const WebpackCLI = require('./webpack-cli'); -const utils = require('./utils'); +const WebpackCLI = require("./webpack-cli"); +const utils = require("./utils"); const runCLI = async (args, originalModuleCompile) => { try { diff --git a/packages/webpack-cli/lib/index.js b/packages/webpack-cli/lib/index.js index 0af01e8eb7c..76a626301f7 100644 --- a/packages/webpack-cli/lib/index.js +++ b/packages/webpack-cli/lib/index.js @@ -1,5 +1,5 @@ -const CLI = require('./webpack-cli'); -const utils = require('./utils'); +const CLI = require("./webpack-cli"); +const utils = require("./utils"); module.exports = CLI; module.exports.utils = utils; diff --git a/packages/webpack-cli/lib/plugins/CLIPlugin.js b/packages/webpack-cli/lib/plugins/CLIPlugin.js index c9a0963431c..7668857d341 100644 --- a/packages/webpack-cli/lib/plugins/CLIPlugin.js +++ b/packages/webpack-cli/lib/plugins/CLIPlugin.js @@ -4,8 +4,10 @@ class CLIPlugin { } setupHotPlugin(compiler) { - const { HotModuleReplacementPlugin } = compiler.webpack || require('webpack'); - const hotModuleReplacementPlugin = Boolean(compiler.options.plugins.find((plugin) => plugin instanceof HotModuleReplacementPlugin)); + const { HotModuleReplacementPlugin } = compiler.webpack || require("webpack"); + const hotModuleReplacementPlugin = Boolean( + compiler.options.plugins.find((plugin) => plugin instanceof HotModuleReplacementPlugin), + ); if (!hotModuleReplacementPlugin) { new HotModuleReplacementPlugin().apply(compiler); @@ -13,15 +15,17 @@ class CLIPlugin { } setupPrefetchPlugin(compiler) { - const { PrefetchPlugin } = compiler.webpack || require('webpack'); + const { PrefetchPlugin } = compiler.webpack || require("webpack"); new PrefetchPlugin(null, this.options.prefetch).apply(compiler); } async setupBundleAnalyzerPlugin(compiler) { // eslint-disable-next-line node/no-extraneous-require - const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer'); - const bundleAnalyzerPlugin = Boolean(compiler.options.plugins.find((plugin) => plugin instanceof BundleAnalyzerPlugin)); + const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer"); + const bundleAnalyzerPlugin = Boolean( + compiler.options.plugins.find((plugin) => plugin instanceof BundleAnalyzerPlugin), + ); if (!bundleAnalyzerPlugin) { new BundleAnalyzerPlugin().apply(compiler); @@ -29,17 +33,21 @@ class CLIPlugin { } setupProgressPlugin(compiler) { - const { ProgressPlugin } = compiler.webpack || require('webpack'); - const progressPlugin = Boolean(compiler.options.plugins.find((plugin) => plugin instanceof ProgressPlugin)); + const { ProgressPlugin } = compiler.webpack || require("webpack"); + const progressPlugin = Boolean( + compiler.options.plugins.find((plugin) => plugin instanceof ProgressPlugin), + ); if (!progressPlugin) { - new ProgressPlugin({ profile: this.options.progress === 'profile' }).apply(compiler); + new ProgressPlugin({ + profile: this.options.progress === "profile", + }).apply(compiler); } } setupHelpfulOutput(compiler) { - const pluginName = 'webpack-cli'; - const getCompilationName = () => (compiler.name ? `'${compiler.name}'` : ''); + const pluginName = "webpack-cli"; + const getCompilationName = () => (compiler.name ? `'${compiler.name}'` : ""); const logCompilation = (message) => { if (process.env.WEBPACK_CLI_START_FINISH_FORCE_LOG) { process.stderr.write(message); @@ -53,10 +61,12 @@ class CLIPlugin { compiler.hooks.run.tap(pluginName, () => { const name = getCompilationName(); - logCompilation(`Compiler${name ? ` ${name}` : ''} starting... `); + logCompilation(`Compiler${name ? ` ${name}` : ""} starting... `); if (configPath) { - this.logger.log(`Compiler${name ? ` ${name}` : ''} is using config: '${configPath}'`); + this.logger.log( + `Compiler${name ? ` ${name}` : ""} is using config: '${configPath}'`, + ); } }); @@ -64,15 +74,19 @@ class CLIPlugin { const { bail, watch } = compiler.options; if (bail && watch) { - this.logger.warn('You are using "bail" with "watch". "bail" will still exit webpack when the first error is found.'); + this.logger.warn( + 'You are using "bail" with "watch". "bail" will still exit webpack when the first error is found.', + ); } const name = getCompilationName(); - logCompilation(`Compiler${name ? ` ${name}` : ''} starting... `); + logCompilation(`Compiler${name ? ` ${name}` : ""} starting... `); if (configPath) { - this.logger.log(`Compiler${name ? ` ${name}` : ''} is using config: '${configPath}'`); + this.logger.log( + `Compiler${name ? ` ${name}` : ""} is using config: '${configPath}'`, + ); } }); @@ -86,18 +100,20 @@ class CLIPlugin { (compiler.webpack ? compiler.hooks.afterDone : compiler.hooks.done).tap(pluginName, () => { const name = getCompilationName(); - logCompilation(`Compiler${name ? ` ${name}` : ''} finished`); + logCompilation(`Compiler${name ? ` ${name}` : ""} finished`); process.nextTick(() => { if (compiler.watchMode) { - this.logger.log(`Compiler${name ? `${name}` : ''} is watching files for updates...`); + this.logger.log( + `Compiler${name ? `${name}` : ""} is watching files for updates...`, + ); } }); }); } apply(compiler) { - this.logger = compiler.getInfrastructureLogger('webpack-cli'); + this.logger = compiler.getInfrastructureLogger("webpack-cli"); if (this.options.progress) { this.setupProgressPlugin(compiler); diff --git a/packages/webpack-cli/lib/utils/capitalize-first-letter.js b/packages/webpack-cli/lib/utils/capitalize-first-letter.js index 3ddf802630a..e8c129e2a86 100644 --- a/packages/webpack-cli/lib/utils/capitalize-first-letter.js +++ b/packages/webpack-cli/lib/utils/capitalize-first-letter.js @@ -1,6 +1,6 @@ const capitalizeFirstLetter = (string) => { - if (typeof string !== 'string') { - return ''; + if (typeof string !== "string") { + return ""; } return string.charAt(0).toUpperCase() + string.slice(1); diff --git a/packages/webpack-cli/lib/utils/dynamic-import-loader.js b/packages/webpack-cli/lib/utils/dynamic-import-loader.js index a9dbedc197b..6981496934e 100644 --- a/packages/webpack-cli/lib/utils/dynamic-import-loader.js +++ b/packages/webpack-cli/lib/utils/dynamic-import-loader.js @@ -2,7 +2,7 @@ function dynamicImportLoader() { let importESM; try { - importESM = new Function('id', 'return import(id);'); + importESM = new Function("id", "return import(id);"); } catch (e) { importESM = null; } diff --git a/packages/webpack-cli/lib/utils/get-package-manager.js b/packages/webpack-cli/lib/utils/get-package-manager.js index 616e64b31c2..fa67d192810 100644 --- a/packages/webpack-cli/lib/utils/get-package-manager.js +++ b/packages/webpack-cli/lib/utils/get-package-manager.js @@ -1,8 +1,8 @@ -const fs = require('fs'); -const path = require('path'); -const { sync } = require('execa'); +const fs = require("fs"); +const path = require("path"); +const { sync } = require("execa"); -const utils = require('./index'); +const utils = require("./index"); /** * @@ -12,29 +12,29 @@ const utils = require('./index'); * @returns {String} - The package manager name */ function getPackageManager() { - const hasLocalNpm = fs.existsSync(path.resolve(process.cwd(), 'package-lock.json')); + const hasLocalNpm = fs.existsSync(path.resolve(process.cwd(), "package-lock.json")); if (hasLocalNpm) { - return 'npm'; + return "npm"; } - const hasLocalYarn = fs.existsSync(path.resolve(process.cwd(), 'yarn.lock')); + const hasLocalYarn = fs.existsSync(path.resolve(process.cwd(), "yarn.lock")); if (hasLocalYarn) { - return 'yarn'; + return "yarn"; } - const hasLocalPnpm = fs.existsSync(path.resolve(process.cwd(), 'pnpm-lock.yaml')); + const hasLocalPnpm = fs.existsSync(path.resolve(process.cwd(), "pnpm-lock.yaml")); if (hasLocalPnpm) { - return 'pnpm'; + return "pnpm"; } try { // the sync function below will fail if npm is not installed, // an error will be thrown - if (sync('npm', ['--version'])) { - return 'npm'; + if (sync("npm", ["--version"])) { + return "npm"; } } catch (e) { // Nothing @@ -43,8 +43,8 @@ function getPackageManager() { try { // the sync function below will fail if yarn is not installed, // an error will be thrown - if (sync('yarn', ['--version'])) { - return 'yarn'; + if (sync("yarn", ["--version"])) { + return "yarn"; } } catch (e) { // Nothing @@ -53,11 +53,11 @@ function getPackageManager() { try { // the sync function below will fail if pnpm is not installed, // an error will be thrown - if (sync('pnpm', ['--version'])) { - return 'pnpm'; + if (sync("pnpm", ["--version"])) { + return "pnpm"; } } catch (e) { - utils.logger.error('No package manager found.'); + utils.logger.error("No package manager found."); process.exit(2); } } diff --git a/packages/webpack-cli/lib/utils/index.js b/packages/webpack-cli/lib/utils/index.js index 045c98f2aab..800174bec22 100644 --- a/packages/webpack-cli/lib/utils/index.js +++ b/packages/webpack-cli/lib/utils/index.js @@ -1,49 +1,49 @@ module.exports = { get colors() { - return require('colorette'); + return require("colorette"); }, get levenshtein() { - return require('fastest-levenshtein'); + return require("fastest-levenshtein"); }, get interpret() { - return require('interpret'); + return require("interpret"); }, get rechoir() { - return require('rechoir'); + return require("rechoir"); }, get capitalizeFirstLetter() { - return require('./capitalize-first-letter'); + return require("./capitalize-first-letter"); }, get dynamicImportLoader() { - return require('./dynamic-import-loader'); + return require("./dynamic-import-loader"); }, get getPackageManager() { - return require('./get-package-manager'); + return require("./get-package-manager"); }, get logger() { - return require('./logger'); + return require("./logger"); }, get packageExists() { - return require('./package-exists'); + return require("./package-exists"); }, get promptInstallation() { - return require('./prompt-installation'); + return require("./prompt-installation"); }, get runCommand() { - return require('./run-command'); + return require("./run-command"); }, get toKebabCase() { - return require('./to-kebab-case'); + return require("./to-kebab-case"); }, }; diff --git a/packages/webpack-cli/lib/utils/logger.js b/packages/webpack-cli/lib/utils/logger.js index b0d37baafd8..88ee114bb1d 100644 --- a/packages/webpack-cli/lib/utils/logger.js +++ b/packages/webpack-cli/lib/utils/logger.js @@ -1,5 +1,5 @@ -const utils = require('./index'); -const util = require('util'); +const utils = require("./index"); +const util = require("util"); module.exports = { error: (val) => console.error(`[webpack-cli] ${utils.colors.red(util.format(val))}`), diff --git a/packages/webpack-cli/lib/utils/package-exists.js b/packages/webpack-cli/lib/utils/package-exists.js index 532b619c8b2..5f17b718415 100644 --- a/packages/webpack-cli/lib/utils/package-exists.js +++ b/packages/webpack-cli/lib/utils/package-exists.js @@ -1,9 +1,24 @@ +const fs = require("fs"); +const path = require("path"); + function packageExists(packageName) { - try { - return require.resolve(packageName); - } catch (error) { - return false; + if (process.versions.pnp) { + return true; } + + let dir = __dirname; + + do { + try { + if (fs.statSync(path.join(dir, "node_modules", packageName)).isDirectory()) { + return true; + } + } catch (_error) { + // Nothing + } + } while (dir !== (dir = path.dirname(dir))); + + return false; } module.exports = packageExists; diff --git a/packages/webpack-cli/lib/utils/prompt-installation.js b/packages/webpack-cli/lib/utils/prompt-installation.js index ef029f9c0ba..e870019335a 100644 --- a/packages/webpack-cli/lib/utils/prompt-installation.js +++ b/packages/webpack-cli/lib/utils/prompt-installation.js @@ -1,5 +1,5 @@ -const utils = require('./index'); -const prompt = require('./prompt'); +const utils = require("./index"); +const prompt = require("./prompt"); /** * @@ -19,17 +19,23 @@ async function promptInstallation(packageName, preMessage) { } // yarn uses 'add' command, rest npm and pnpm both use 'install' - const commandToBeRun = `${packageManager} ${[packageManager === 'yarn' ? 'add' : 'install', '-D', packageName].join(' ')}`; + const commandToBeRun = `${packageManager} ${[ + packageManager === "yarn" ? "add" : "install", + "-D", + packageName, + ].join(" ")}`; const { colors } = utils; let installConfirm; try { installConfirm = await prompt({ - message: `[webpack-cli] Would you like to install '${colors.green(packageName)}' package? (That will run '${colors.green( - commandToBeRun, - )}') (${colors.yellow('Y/n')})`, - defaultResponse: 'Y', + message: `[webpack-cli] Would you like to install '${colors.green( + packageName, + )}' package? (That will run '${colors.green(commandToBeRun)}') (${colors.yellow( + "Y/n", + )})`, + defaultResponse: "Y", stream: process.stderr, }); } catch (error) { @@ -45,7 +51,7 @@ async function promptInstallation(packageName, preMessage) { process.exit(2); } - return utils.packageExists(packageName); + return packageName; } process.exit(2); diff --git a/packages/webpack-cli/lib/utils/prompt.js b/packages/webpack-cli/lib/utils/prompt.js index b8fbdf29fed..e28b944b2a1 100644 --- a/packages/webpack-cli/lib/utils/prompt.js +++ b/packages/webpack-cli/lib/utils/prompt.js @@ -1,5 +1,5 @@ const prompt = ({ message, defaultResponse, stream }) => { - const readline = require('readline'); + const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: stream, @@ -13,7 +13,7 @@ const prompt = ({ message, defaultResponse, stream }) => { const response = (answer || defaultResponse).toLowerCase(); // Resolve with the input response - if (response === 'y' || response === 'yes') { + if (response === "y" || response === "yes") { resolve(true); } else { resolve(false); diff --git a/packages/webpack-cli/lib/utils/run-command.js b/packages/webpack-cli/lib/utils/run-command.js index 58463661c27..62b75da9e69 100644 --- a/packages/webpack-cli/lib/utils/run-command.js +++ b/packages/webpack-cli/lib/utils/run-command.js @@ -1,9 +1,9 @@ -const execa = require('execa'); -const utils = require('./index'); +const execa = require("execa"); +const utils = require("./index"); async function runCommand(command, args = []) { try { - await execa(command, args, { stdio: 'inherit', shell: true }); + await execa(command, args, { stdio: "inherit", shell: true }); } catch (error) { utils.logger.error(error.message); process.exit(2); diff --git a/packages/webpack-cli/lib/utils/to-kebab-case.js b/packages/webpack-cli/lib/utils/to-kebab-case.js index fb241fbdc94..be7e976a3c7 100644 --- a/packages/webpack-cli/lib/utils/to-kebab-case.js +++ b/packages/webpack-cli/lib/utils/to-kebab-case.js @@ -1,5 +1,5 @@ const toKebabCase = (str) => { - return str.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase(); + return str.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(); }; module.exports = toKebabCase; diff --git a/packages/webpack-cli/lib/webpack-cli.js b/packages/webpack-cli/lib/webpack-cli.js index cd39489449a..5ab16847c01 100644 --- a/packages/webpack-cli/lib/webpack-cli.js +++ b/packages/webpack-cli/lib/webpack-cli.js @@ -1,30 +1,99 @@ -const fs = require('fs'); -const path = require('path'); -const { pathToFileURL } = require('url'); -const Module = require('module'); +const fs = require("fs"); +const path = require("path"); +const { pathToFileURL } = require("url"); +const Module = require("module"); -const { program, Option } = require('commander'); -const utils = require('./utils'); +const { program, Option } = require("commander"); +const utils = require("./utils"); class WebpackCLI { constructor() { // Global - this.webpack = require(process.env.WEBPACK_PACKAGE || 'webpack'); + this.webpack = require(process.env.WEBPACK_PACKAGE || "webpack"); this.logger = utils.logger; this.utils = utils; // Initialize program this.program = program; - this.program.name('webpack'); + this.program.name("webpack"); this.program.configureOutput({ writeErr: this.logger.error, - outputError: (str, write) => write(`Error: ${this.utils.capitalizeFirstLetter(str.replace(/^error:/, '').trim())}`), + outputError: (str, write) => + write( + `Error: ${this.utils.capitalizeFirstLetter(str.replace(/^error:/, "").trim())}`, + ), }); } + async tryRequireThenImport(module, handleError = true) { + let result; + + try { + result = require(module); + } catch (error) { + let previousModuleCompile; + + // TODO Workaround https://github.com/zertosh/v8-compile-cache/issues/30 + if (this._originalModuleCompile) { + previousModuleCompile = Module.prototype._compile; + + Module.prototype._compile = this._originalModuleCompile; + } + + const dynamicImportLoader = this.utils.dynamicImportLoader(); + + if (this._originalModuleCompile) { + Module.prototype._compile = previousModuleCompile; + } + + if ( + (error.code === "ERR_REQUIRE_ESM" || + process.env.WEBPACK_CLI_FORCE_LOAD_ESM_CONFIG) && + pathToFileURL && + dynamicImportLoader + ) { + const urlForConfig = pathToFileURL(module); + + result = await dynamicImportLoader(urlForConfig); + result = result.default; + + return result; + } + + if (handleError) { + this.logger.error(error); + process.exit(2); + } else { + throw error; + } + } + + // For babel/typescript + if (result.default) { + result = result.default; + } + + return result; + } + + loadJSONFile(pathToFile) { + let result; + + try { + result = require(pathToFile); + } catch (error) { + this.logger.error(error); + process.exit(2); + } + + return result; + } + async makeCommand(commandOptions, options, action) { const alreadyLoaded = this.program.commands.find( - (command) => command.name() === commandOptions.name.split(' ')[0] || command.aliases().includes(commandOptions.alias), + (command) => + command.name() === commandOptions.name.split(" ")[0] || + command.aliases().includes(commandOptions.alias), ); if (alreadyLoaded) { @@ -54,7 +123,7 @@ class WebpackCLI { if (commandOptions.pkg) { command.pkg = commandOptions.pkg; } else { - command.pkg = 'webpack-cli'; + command.pkg = "webpack-cli"; } const { forHelp } = this.program; @@ -77,21 +146,23 @@ class WebpackCLI { await promptInstallation(dependency, () => { this.logger.error( - `For using '${colors.green(commandOptions.name.split(' ')[0])}' command you need to install: '${colors.green( - dependency, - )}' package`, + `For using '${colors.green( + commandOptions.name.split(" ")[0], + )}' command you need to install: '${colors.green(dependency)}' package`, ); }); } } if (options) { - if (typeof options === 'function') { + if (typeof options === "function") { if (forHelp && !allDependenciesInstalled) { command.description( - `${commandOptions.description} To see all available options you need to install ${commandOptions.dependencies + `${ + commandOptions.description + } To see all available options you need to install ${commandOptions.dependencies .map((dependency) => `'${dependency}'`) - .join(',')}.`, + .join(",")}.`, ); options = []; } else { @@ -115,41 +186,41 @@ class WebpackCLI { if (option.configs) { let needNegativeOption = false; - let mainOptionType = new Set(); + const mainOptionType = new Set(); option.configs.forEach((config) => { // Possible value: "enum" | "string" | "path" | "number" | "boolean" | "RegExp" | "reset" switch (config.type) { - case 'reset': + case "reset": mainOptionType.add(Boolean); break; - case 'boolean': + case "boolean": if (!needNegativeOption) { needNegativeOption = true; } mainOptionType.add(Boolean); break; - case 'number': + case "number": mainOptionType.add(Number); break; - case 'string': - case 'path': - case 'RegExp': + case "string": + case "path": + case "RegExp": mainOptionType.add(String); break; - case 'enum': { + case "enum": { let hasFalseEnum = false; const enumTypes = config.values.map((value) => { switch (typeof value) { - case 'string': + case "string": mainOptionType.add(String); break; - case 'number': + case "number": mainOptionType.add(Number); break; - case 'boolean': + case "boolean": if (!hasFalseEnum && value === false) { hasFalseEnum = true; break; @@ -171,7 +242,7 @@ class WebpackCLI { mainOption = { flags: option.alias ? `-${option.alias}, --${option.name}` : `--${option.name}`, - description: option.description || '', + description: option.description || "", type: mainOptionType, multiple: option.multiple, defaultValue: option.defaultValue, @@ -180,15 +251,19 @@ class WebpackCLI { if (needNegativeOption) { negativeOption = { flags: `--no-${option.name}`, - description: option.negatedDescription ? option.negatedDescription : `Negative '${option.name}' option.`, + description: option.negatedDescription + ? option.negatedDescription + : `Negative '${option.name}' option.`, }; } } else { mainOption = { flags: option.alias ? `-${option.alias}, --${option.name}` : `--${option.name}`, // TODO `describe` used by `webpack-dev-server@3` - description: option.description || option.describe || '', - type: option.type ? new Set(Array.isArray(option.type) ? option.type : [option.type]) : new Set([Boolean]), + description: option.description || option.describe || "", + type: option.type + ? new Set(Array.isArray(option.type) ? option.type : [option.type]) + : new Set([Boolean]), multiple: option.multiple, defaultValue: option.defaultValue, }; @@ -196,15 +271,17 @@ class WebpackCLI { if (option.negative) { negativeOption = { flags: `--no-${option.name}`, - description: option.negatedDescription ? option.negatedDescription : `Negative '${option.name}' option.`, + description: option.negatedDescription + ? option.negatedDescription + : `Negative '${option.name}' option.`, }; } } if (mainOption.type.size > 1 && mainOption.type.has(Boolean)) { - mainOption.flags = `${mainOption.flags} [value${mainOption.multiple ? '...' : ''}]`; + mainOption.flags = `${mainOption.flags} [value${mainOption.multiple ? "..." : ""}]`; } else if (mainOption.type.size > 0 && !mainOption.type.has(Boolean)) { - mainOption.flags = `${mainOption.flags} `; + mainOption.flags = `${mainOption.flags} `; } if (mainOption.type.size === 1) { @@ -218,7 +295,9 @@ class WebpackCLI { skipDefault = false; } - return mainOption.multiple ? [].concat(prev).concat(Number(value)) : Number(value); + return mainOption.multiple + ? [].concat(prev).concat(Number(value)) + : Number(value); }) .default(mainOption.defaultValue); @@ -243,7 +322,10 @@ class WebpackCLI { command.addOption(optionForCommand); } else if (mainOption.type.has(Boolean)) { - const optionForCommand = new Option(mainOption.flags, mainOption.description).default(mainOption.defaultValue); + const optionForCommand = new Option( + mainOption.flags, + mainOption.description, + ).default(mainOption.defaultValue); optionForCommand.helpLevel = option.helpLevel; @@ -260,7 +342,11 @@ class WebpackCLI { } else if (mainOption.type.size > 1) { let skipDefault = true; - const optionForCommand = new Option(mainOption.flags, mainOption.description, mainOption.defaultValue) + const optionForCommand = new Option( + mainOption.flags, + mainOption.description, + mainOption.defaultValue, + ) .argParser((value, prev = []) => { if (mainOption.defaultValue && mainOption.multiple && skipDefault) { prev = []; @@ -271,7 +357,9 @@ class WebpackCLI { const numberValue = Number(value); if (!isNaN(numberValue)) { - return mainOption.multiple ? [].concat(prev).concat(numberValue) : numberValue; + return mainOption.multiple + ? [].concat(prev).concat(numberValue) + : numberValue; } } @@ -311,53 +399,54 @@ class WebpackCLI { } const minimumHelpFlags = [ - 'config', - 'config-name', - 'merge', - 'env', - 'mode', - 'watch', - 'watch-options-stdin', - 'stats', - 'devtool', - 'entry', - 'target', - 'progress', - 'json', - 'name', - 'output-path', - 'node-env', + "config", + "config-name", + "merge", + "env", + "mode", + "watch", + "watch-options-stdin", + "stats", + "devtool", + "entry", + "target", + "progress", + "json", + "name", + "output-path", + "node-env", ]; const builtInFlags = [ // For configs { - name: 'config', - alias: 'c', + name: "config", + alias: "c", configs: [ { - type: 'string', + type: "string", }, ], multiple: true, - description: 'Provide path to a webpack configuration file e.g. ./webpack.config.js.', + description: + "Provide path to a webpack configuration file e.g. ./webpack.config.js.", }, { - name: 'config-name', + name: "config-name", configs: [ { - type: 'string', + type: "string", }, ], multiple: true, - description: 'Name of the configuration to use.', + description: "Name of the configuration to use.", }, { - name: 'merge', - alias: 'm', + name: "merge", + alias: "m", configs: [ { - type: 'enum', + type: "enum", values: [true], }, ], @@ -365,10 +454,10 @@ class WebpackCLI { }, // Complex configs { - name: 'env', + name: "env", type: (value, previous = {}) => { // for https://github.com/webpack/webpack-cli/issues/2642 - if (value.endsWith('=')) { + if (value.endsWith("=")) { value.concat('""'); } @@ -383,12 +472,12 @@ class WebpackCLI { prevRef[someKey] = {}; } - if (typeof prevRef[someKey] === 'string') { + if (typeof prevRef[someKey] === "string") { prevRef[someKey] = {}; } if (index === splitKeys.length - 1) { - if (typeof val === 'string') { + if (typeof val === "string") { prevRef[someKey] = val; } else { prevRef[someKey] = true; @@ -401,187 +490,188 @@ class WebpackCLI { return previous; }, multiple: true, - description: 'Environment passed to the configuration when it is a function.', + description: "Environment passed to the configuration when it is a function.", }, { - name: 'node-env', + name: "node-env", configs: [ { - type: 'string', + type: "string", }, ], multiple: false, - description: 'Sets process.env.NODE_ENV to the specified value.', + description: "Sets process.env.NODE_ENV to the specified value.", }, // Adding more plugins { - name: 'hot', - alias: 'h', + name: "hot", + alias: "h", configs: [ { - type: 'string', + type: "string", }, { - type: 'boolean', + type: "boolean", }, ], negative: true, - description: 'Enables Hot Module Replacement', - negatedDescription: 'Disables Hot Module Replacement.', + description: "Enables Hot Module Replacement", + negatedDescription: "Disables Hot Module Replacement.", }, { - name: 'analyze', + name: "analyze", configs: [ { - type: 'enum', + type: "enum", values: [true], }, ], multiple: false, - description: 'It invokes webpack-bundle-analyzer plugin to get bundle information.', + description: "It invokes webpack-bundle-analyzer plugin to get bundle information.", }, { - name: 'progress', + name: "progress", configs: [ { - type: 'string', + type: "string", }, { - type: 'enum', + type: "enum", values: [true], }, ], - description: 'Print compilation progress during build.', + description: "Print compilation progress during build.", }, { - name: 'prefetch', + name: "prefetch", configs: [ { - type: 'string', + type: "string", }, ], - description: 'Prefetch this request.', + description: "Prefetch this request.", }, // Output options { - name: 'json', + name: "json", configs: [ { - type: 'string', + type: "string", }, { - type: 'enum', + type: "enum", values: [true], }, ], - alias: 'j', - description: 'Prints result as JSON or store it in a file.', + alias: "j", + description: "Prints result as JSON or store it in a file.", }, // For webpack@4 { - name: 'entry', + name: "entry", configs: [ { - type: 'string', + type: "string", }, ], multiple: true, - description: 'The entry point(s) of your application e.g. ./src/main.js.', + description: "The entry point(s) of your application e.g. ./src/main.js.", }, { - name: 'output-path', - alias: 'o', + name: "output-path", + alias: "o", configs: [ { - type: 'string', + type: "string", }, ], - description: 'Output location of the file generated by webpack e.g. ./dist/.', + description: "Output location of the file generated by webpack e.g. ./dist/.", }, { - name: 'target', - alias: 't', + name: "target", + alias: "t", configs: [ { - type: 'string', + type: "string", }, ], multiple: this.webpack.cli !== undefined, - description: 'Sets the build target e.g. node.', + description: "Sets the build target e.g. node.", }, { - name: 'devtool', + name: "devtool", configs: [ { - type: 'string', + type: "string", }, { - type: 'enum', + type: "enum", values: [false], }, ], negative: true, - alias: 'd', - description: 'Determine source maps to use.', - negatedDescription: 'Do not generate source maps.', + alias: "d", + description: "Determine source maps to use.", + negatedDescription: "Do not generate source maps.", }, { - name: 'mode', + name: "mode", configs: [ { - type: 'string', + type: "string", }, ], - description: 'Defines the mode to pass to webpack.', + description: "Defines the mode to pass to webpack.", }, { - name: 'name', + name: "name", configs: [ { - type: 'string', + type: "string", }, ], - description: 'Name of the configuration. Used when loading multiple configurations.', + description: + "Name of the configuration. Used when loading multiple configurations.", }, { - name: 'stats', + name: "stats", configs: [ { - type: 'string', + type: "string", }, { - type: 'boolean', + type: "boolean", }, ], negative: true, - description: 'It instructs webpack on how to treat the stats e.g. verbose.', - negatedDescription: 'Disable stats output.', + description: "It instructs webpack on how to treat the stats e.g. verbose.", + negatedDescription: "Disable stats output.", }, { - name: 'watch', + name: "watch", configs: [ { - type: 'boolean', + type: "boolean", }, ], negative: true, - alias: 'w', - description: 'Watch for files changes.', - negatedDescription: 'Do not watch for file changes.', + alias: "w", + description: "Watch for files changes.", + negatedDescription: "Do not watch for file changes.", }, { - name: 'watch-options-stdin', + name: "watch-options-stdin", configs: [ { - type: 'boolean', + type: "boolean", }, ], negative: true, - description: 'Stop watching when stdin stream has ended.', - negatedDescription: 'Do not stop watching when stdin stream has ended.', + description: "Stop watching when stdin stream has ended.", + negatedDescription: "Do not stop watching when stdin stream has ended.", }, ]; @@ -592,18 +682,29 @@ class WebpackCLI { const inBuiltIn = builtInFlags.find((builtInFlag) => builtInFlag.name === flag); if (inBuiltIn) { - return { ...meta, name: flag, group: 'core', ...inBuiltIn, configs: meta.configs || [] }; + return { + ...meta, + name: flag, + group: "core", + ...inBuiltIn, + configs: meta.configs || [], + }; } - return { ...meta, name: flag, group: 'core' }; + return { ...meta, name: flag, group: "core" }; }) : []; const options = [] - .concat(builtInFlags.filter((builtInFlag) => !coreFlags.find((coreFlag) => builtInFlag.name === coreFlag.name))) + .concat( + builtInFlags.filter( + (builtInFlag) => + !coreFlags.find((coreFlag) => builtInFlag.name === coreFlag.name), + ), + ) .concat(coreFlags) .map((option) => { - option.helpLevel = minimumHelpFlags.includes(option.name) ? 'minimum' : 'verbose'; + option.helpLevel = minimumHelpFlags.includes(option.name) ? "minimum" : "verbose"; return option; }); @@ -614,7 +715,7 @@ class WebpackCLI { } applyNodeEnv(options) { - if (typeof options.nodeEnv === 'string') { + if (typeof options.nodeEnv === "string") { process.env.NODE_ENV = options.nodeEnv; } } @@ -622,63 +723,64 @@ class WebpackCLI { async run(args, parseOptions) { // Built-in internal commands const buildCommandOptions = { - name: 'build [entries...]', - alias: ['bundle', 'b'], - description: 'Run webpack (default command, can be omitted).', - usage: '[entries...] [options]', + name: "build [entries...]", + alias: ["bundle", "b"], + description: "Run webpack (default command, can be omitted).", + usage: "[entries...] [options]", }; const watchCommandOptions = { - name: 'watch [entries...]', - alias: 'w', - description: 'Run webpack and watch for files changes.', - usage: '[entries...] [options]', + name: "watch [entries...]", + alias: "w", + description: "Run webpack and watch for files changes.", + usage: "[entries...] [options]", }; const versionCommandOptions = { - name: 'version [commands...]', - alias: 'v', - description: "Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands.", + name: "version [commands...]", + alias: "v", + description: + "Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands.", }; const helpCommandOptions = { - name: 'help [command] [option]', - alias: 'h', - description: 'Display help for commands and options.', + name: "help [command] [option]", + alias: "h", + description: "Display help for commands and options.", }; // Built-in external commands const externalBuiltInCommandsInfo = [ { - name: 'serve [entries...]', - alias: ['server', 's'], - pkg: '@webpack-cli/serve', + name: "serve [entries...]", + alias: ["server", "s"], + pkg: "@webpack-cli/serve", }, { - name: 'info', - alias: 'i', - pkg: '@webpack-cli/info', + name: "info", + alias: "i", + pkg: "@webpack-cli/info", }, { - name: 'init', - alias: ['create', 'new', 'c', 'n'], - pkg: '@webpack-cli/generators', + name: "init", + alias: ["create", "new", "c", "n"], + pkg: "@webpack-cli/generators", }, { - name: 'loader', - alias: 'l', - pkg: '@webpack-cli/generators', + name: "loader", + alias: "l", + pkg: "@webpack-cli/generators", }, { - name: 'plugin', - alias: 'p', - pkg: '@webpack-cli/generators', + name: "plugin", + alias: "p", + pkg: "@webpack-cli/generators", }, { - name: 'migrate', - alias: 'm', - pkg: '@webpack-cli/migrate', + name: "migrate", + alias: "m", + pkg: "@webpack-cli/migrate", }, { - name: 'configtest [config-path]', - alias: 't', - pkg: '@webpack-cli/configtest', + name: "configtest [config-path]", + alias: "t", + pkg: "@webpack-cli/configtest", }, ]; @@ -689,12 +791,14 @@ class WebpackCLI { helpCommandOptions, ...externalBuiltInCommandsInfo, ]; - const getCommandName = (name) => name.split(' ')[0]; + const getCommandName = (name) => name.split(" ")[0]; const isKnownCommand = (name) => knownCommands.find( (command) => getCommandName(command.name) === name || - (Array.isArray(command.alias) ? command.alias.includes(name) : command.alias === name), + (Array.isArray(command.alias) + ? command.alias.includes(name) + : command.alias === name), ); const isCommand = (input, commandOptions) => { const longName = getCommandName(commandOptions.name); @@ -714,15 +818,17 @@ class WebpackCLI { return false; }; const findCommandByName = (name) => - this.program.commands.find((command) => name === command.name() || command.aliases().includes(name)); - const isOption = (value) => value.startsWith('-'); + this.program.commands.find( + (command) => name === command.name() || command.aliases().includes(name), + ); + const isOption = (value) => value.startsWith("-"); const isGlobalOption = (value) => - value === '--color' || - value === '--no-color' || - value === '-v' || - value === '--version' || - value === '-h' || - value === '--help'; + value === "--color" || + value === "--no-color" || + value === "-v" || + value === "--version" || + value === "-h" || + value === "--help"; const loadCommandByName = async (commandName, allowToInstall = false) => { const isBuildCommandUsed = isCommand(commandName, buildCommandOptions); @@ -733,7 +839,9 @@ class WebpackCLI { await this.makeCommand( isBuildCommandUsed ? buildCommandOptions : watchCommandOptions, - isWatchCommandUsed ? options.filter((option) => option.name !== 'watch') : options, + isWatchCommandUsed + ? options.filter((option) => option.name !== "watch") + : options, async (entries, options) => { if (entries.length > 0) { options.entry = [...entries, ...(options.entry || [])]; @@ -765,7 +873,7 @@ class WebpackCLI { pkg = commandName; } - if (pkg !== 'webpack-cli' && !this.utils.packageExists(pkg)) { + if (pkg !== "webpack-cli" && !this.utils.packageExists(pkg)) { if (!allowToInstall) { return; } @@ -773,24 +881,24 @@ class WebpackCLI { const { promptInstallation, colors } = this.utils; pkg = await promptInstallation(pkg, () => { - this.logger.error(`For using this command you need to install: '${colors.green(pkg)}' package`); + this.logger.error( + `For using this command you need to install: '${colors.green( + pkg, + )}' package`, + ); }); } let loadedCommand; try { - loadedCommand = require(pkg); + loadedCommand = await this.tryRequireThenImport(pkg, false); } catch (error) { // Ignore, command is not installed return; } - if (loadedCommand.default) { - loadedCommand = loadedCommand.default; - } - let command; try { @@ -811,38 +919,46 @@ class WebpackCLI { process.exit(0); } - if (error.code === 'executeSubCommandAsync') { + if (error.code === "executeSubCommandAsync") { process.exit(2); } - if (error.code === 'commander.help') { + if (error.code === "commander.help") { process.exit(0); } - if (error.code === 'commander.unknownOption') { + if (error.code === "commander.unknownOption") { let name = error.message.match(/'(.+)'/); if (name) { name = name[1].substr(2); - if (name.includes('=')) { - name = name.split('=')[0]; + if (name.includes("=")) { + name = name.split("=")[0]; } const { operands } = this.program.parseOptions(this.program.args); - const operand = typeof operands[0] !== 'undefined' ? operands[0] : getCommandName(buildCommandOptions.name); + const operand = + typeof operands[0] !== "undefined" + ? operands[0] + : getCommandName(buildCommandOptions.name); if (operand) { const command = findCommandByName(operand); if (!command) { this.logger.error(`Can't find and load command '${operand}'`); - this.logger.error("Run 'webpack --help' to see available commands and options"); + this.logger.error( + "Run 'webpack --help' to see available commands and options", + ); process.exit(2); } command.options.forEach((option) => { - if (!option.hidden && this.utils.levenshtein.distance(name, option.long.slice(2)) < 3) { + if ( + !option.hidden && + this.utils.levenshtein.distance(name, option.long.slice(2)) < 3 + ) { this.logger.error(`Did you mean '--${option.name()}'?`); } }); @@ -862,15 +978,15 @@ class WebpackCLI { // Default `--color` and `--no-color` options const cli = this; - this.program.option('--color', 'Enable colors on console.'); - this.program.on('option:color', function () { + this.program.option("--color", "Enable colors on console."); + this.program.on("option:color", function () { const { color } = this.opts(); cli.utils.colors.options.changed = true; cli.utils.colors.options.enabled = color; }); - this.program.option('--no-color', 'Disable colors on console.'); - this.program.on('option:no-color', function () { + this.program.option("--no-color", "Disable colors on console."); + this.program.on("option:no-color", function () { const { color } = this.opts(); cli.utils.colors.options.changed = true; @@ -900,36 +1016,45 @@ class WebpackCLI { }); if (possibleCommandNames.length > 0) { - await Promise.all(possibleCommandNames.map((possibleCommand) => loadCommandByName(possibleCommand))); + await Promise.all( + possibleCommandNames.map((possibleCommand) => + loadCommandByName(possibleCommand), + ), + ); for (const possibleCommandName of possibleCommandNames) { const foundCommand = findCommandByName(possibleCommandName); if (!foundCommand) { this.logger.error(`Unknown command '${possibleCommandName}'`); - this.logger.error("Run 'webpack --help' to see available commands and options"); + this.logger.error( + "Run 'webpack --help' to see available commands and options", + ); process.exit(2); } try { - const { name, version } = require(`${foundCommand.pkg}/package.json`); + const { name, version } = this.loadJSONFile( + `${foundCommand.pkg}/package.json`, + ); this.logger.raw(`${name} ${version}`); } catch (e) { - this.logger.error(`Error: External package '${foundCommand.pkg}' not found`); + this.logger.error( + `Error: External package '${foundCommand.pkg}' not found`, + ); process.exit(2); } } } - const pkgJSON = require('../package.json'); + const pkgJSON = this.loadJSONFile("../package.json"); this.logger.raw(`webpack ${this.webpack.version}`); this.logger.raw(`webpack-cli ${pkgJSON.version}`); - if (this.utils.packageExists('webpack-dev-server')) { - // eslint-disable-next-line - const { version } = require('webpack-dev-server/package.json'); + if (this.utils.packageExists("webpack-dev-server")) { + const { version } = this.loadJSONFile("webpack-dev-server/package.json"); this.logger.raw(`webpack-dev-server ${version}`); } @@ -937,7 +1062,7 @@ class WebpackCLI { process.exit(0); }; this.program.option( - '-v, --version', + "-v, --version", "Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands.", ); @@ -945,8 +1070,10 @@ class WebpackCLI { const { bold } = this.utils.colors; const outputIncorrectUsageOfHelp = () => { - this.logger.error('Incorrect use of help'); - this.logger.error("Please use: 'webpack help [command] [option]' | 'webpack [command] --help'"); + this.logger.error("Incorrect use of help"); + this.logger.error( + "Please use: 'webpack help [command] [option]' | 'webpack [command] --help'", + ); this.logger.error("Run 'webpack --help' to see available commands and options"); process.exit(2); }; @@ -959,32 +1086,43 @@ class WebpackCLI { sortSubcommands: true, // Support multiple aliases commandUsage: (command) => { - let parentCmdNames = ''; + let parentCmdNames = ""; - for (let parentCmd = command.parent; parentCmd; parentCmd = parentCmd.parent) { + for ( + let parentCmd = command.parent; + parentCmd; + parentCmd = parentCmd.parent + ) { parentCmdNames = `${parentCmd.name()} ${parentCmdNames}`; } if (isGlobalHelp) { return `${parentCmdNames}${command.usage()}\n${this.utils.colors.bold( - 'Alternative usage to run commands:', + "Alternative usage to run commands:", )} ${parentCmdNames}[command] [options]`; } - return `${parentCmdNames}${command.name()}|${command.aliases().join('|')} ${command.usage()}`; + return `${parentCmdNames}${command.name()}|${command + .aliases() + .join("|")} ${command.usage()}`; }, // Support multiple aliases subcommandTerm: (command) => { const humanReadableArgumentName = (argument) => { - const nameOutput = argument.name + (argument.variadic === true ? '...' : ''); + const nameOutput = + argument.name + (argument.variadic === true ? "..." : ""); - return argument.required ? '<' + nameOutput + '>' : '[' + nameOutput + ']'; + return argument.required + ? "<" + nameOutput + ">" + : "[" + nameOutput + "]"; }; - const args = command._args.map((arg) => humanReadableArgumentName(arg)).join(' '); + const args = command._args + .map((arg) => humanReadableArgumentName(arg)) + .join(" "); - return `${command.name()}|${command.aliases().join('|')}${args ? ` ${args}` : ''}${ - command.options.length > 0 ? ' [options]' : '' - }`; + return `${command.name()}|${command.aliases().join("|")}${ + args ? ` ${args}` : "" + }${command.options.length > 0 ? " [options]" : ""}`; }, visibleOptions: function visibleOptions(command) { return command.options.filter((option) => { @@ -993,9 +1131,9 @@ class WebpackCLI { } switch (option.helpLevel) { - case 'verbose': + case "verbose": return isVerbose; - case 'minimum': + case "minimum": default: return true; } @@ -1007,37 +1145,48 @@ class WebpackCLI { helper.longestOptionTermLength(command, helper), // For global options helper.longestOptionTermLength(program, helper), - helper.longestSubcommandTermLength(isGlobalHelp ? program : command, helper), + helper.longestSubcommandTermLength( + isGlobalHelp ? program : command, + helper, + ), ); }, formatHelp: (command, helper) => { const termWidth = helper.padWidth(command, helper); - const helpWidth = helper.helpWidth || process.env.WEBPACK_CLI_HELP_WIDTH || 80; + const helpWidth = + helper.helpWidth || process.env.WEBPACK_CLI_HELP_WIDTH || 80; const itemIndentWidth = 2; const itemSeparatorWidth = 2; // between term and description const formatItem = (term, description) => { if (description) { - const fullText = `${term.padEnd(termWidth + itemSeparatorWidth)}${description}`; - - return helper.wrap(fullText, helpWidth - itemIndentWidth, termWidth + itemSeparatorWidth); + const fullText = `${term.padEnd( + termWidth + itemSeparatorWidth, + )}${description}`; + + return helper.wrap( + fullText, + helpWidth - itemIndentWidth, + termWidth + itemSeparatorWidth, + ); } return term; }; - const formatList = (textArray) => textArray.join('\n').replace(/^/gm, ' '.repeat(itemIndentWidth)); + const formatList = (textArray) => + textArray.join("\n").replace(/^/gm, " ".repeat(itemIndentWidth)); // Usage - let output = [`${bold('Usage:')} ${helper.commandUsage(command)}`, '']; + let output = [`${bold("Usage:")} ${helper.commandUsage(command)}`, ""]; // Description const commandDescription = isGlobalHelp - ? 'The build tool for modern web applications.' + ? "The build tool for modern web applications." : helper.commandDescription(command); if (commandDescription.length > 0) { - output = output.concat([commandDescription, '']); + output = output.concat([commandDescription, ""]); } // Arguments @@ -1046,16 +1195,25 @@ class WebpackCLI { .map((argument) => formatItem(argument.term, argument.description)); if (argumentList.length > 0) { - output = output.concat([bold('Arguments:'), formatList(argumentList), '']); + output = output.concat([ + bold("Arguments:"), + formatList(argumentList), + "", + ]); } // Options const optionList = helper .visibleOptions(command) - .map((option) => formatItem(helper.optionTerm(option), helper.optionDescription(option))); + .map((option) => + formatItem( + helper.optionTerm(option), + helper.optionDescription(option), + ), + ); if (optionList.length > 0) { - output = output.concat([bold('Options:'), formatList(optionList), '']); + output = output.concat([bold("Options:"), formatList(optionList), ""]); } // Global options @@ -1064,19 +1222,32 @@ class WebpackCLI { ); if (globalOptionList.length > 0) { - output = output.concat([bold('Global options:'), formatList(globalOptionList), '']); + output = output.concat([ + bold("Global options:"), + formatList(globalOptionList), + "", + ]); } // Commands const commandList = helper .visibleCommands(isGlobalHelp ? program : command) - .map((command) => formatItem(helper.subcommandTerm(command), helper.subcommandDescription(command))); + .map((command) => + formatItem( + helper.subcommandTerm(command), + helper.subcommandDescription(command), + ), + ); if (commandList.length > 0) { - output = output.concat([bold('Commands:'), formatList(commandList), '']); + output = output.concat([ + bold("Commands:"), + formatList(commandList), + "", + ]); } - return output.join('\n'); + return output.join("\n"); }, }); @@ -1087,7 +1258,9 @@ class WebpackCLI { }), ); - const buildCommand = findCommandByName(getCommandName(buildCommandOptions.name)); + const buildCommand = findCommandByName( + getCommandName(buildCommandOptions.name), + ); this.logger.raw(buildCommand.helpInformation()); } else { @@ -1101,11 +1274,15 @@ class WebpackCLI { const builtInCommandUsed = externalBuiltInCommandsInfo.find( (command) => command.name.includes(name) || name === command.alias, ); - if (typeof builtInCommandUsed !== 'undefined') { - this.logger.error(`For using '${name}' command you need to install '${builtInCommandUsed.pkg}' package`); + if (typeof builtInCommandUsed !== "undefined") { + this.logger.error( + `For using '${name}' command you need to install '${builtInCommandUsed.pkg}' package`, + ); } else { this.logger.error(`Can't find and load command '${name}'`); - this.logger.error("Run 'webpack --help' to see available commands and options"); + this.logger.error( + "Run 'webpack --help' to see available commands and options", + ); } process.exit(2); } @@ -1133,7 +1310,9 @@ class WebpackCLI { await loadCommandByName(commandName); - const command = isGlobalOption(optionName) ? program : findCommandByName(commandName); + const command = isGlobalOption(optionName) + ? program + : findCommandByName(commandName); if (!command) { this.logger.error(`Can't find and load command '${commandName}'`); @@ -1141,7 +1320,9 @@ class WebpackCLI { process.exit(2); } - const option = command.options.find((option) => option.short === optionName || option.long === optionName); + const option = command.options.find( + (option) => option.short === optionName || option.long === optionName, + ); if (!option) { this.logger.error(`Unknown option '${optionName}'`); @@ -1150,30 +1331,39 @@ class WebpackCLI { } const nameOutput = - option.flags.replace(/^.+[[<]/, '').replace(/(\.\.\.)?[\]>].*$/, '') + (option.variadic === true ? '...' : ''); - const value = option.required ? '<' + nameOutput + '>' : option.optional ? '[' + nameOutput + ']' : ''; + option.flags.replace(/^.+[[<]/, "").replace(/(\.\.\.)?[\]>].*$/, "") + + (option.variadic === true ? "..." : ""); + const value = option.required + ? "<" + nameOutput + ">" + : option.optional + ? "[" + nameOutput + "]" + : ""; this.logger.raw( - `${bold('Usage')}: webpack${isCommandSpecified ? ` ${commandName}` : ''} ${option.long}${value ? ` ${value}` : ''}`, + `${bold("Usage")}: webpack${isCommandSpecified ? ` ${commandName}` : ""} ${ + option.long + }${value ? ` ${value}` : ""}`, ); if (option.short) { this.logger.raw( - `${bold('Short:')} webpack${isCommandSpecified ? ` ${commandName}` : ''} ${option.short}${ - value ? ` ${value}` : '' - }`, + `${bold("Short:")} webpack${isCommandSpecified ? ` ${commandName}` : ""} ${ + option.short + }${value ? ` ${value}` : ""}`, ); } if (option.description) { - this.logger.raw(`${bold('Description:')} ${option.description}`); + this.logger.raw(`${bold("Description:")} ${option.description}`); } if (!option.negate && options.defaultValue) { - this.logger.raw(`${bold('Default value:')} ${JSON.stringify(option.defaultValue)}`); + this.logger.raw( + `${bold("Default value:")} ${JSON.stringify(option.defaultValue)}`, + ); } - this.logger.raw(''); + this.logger.raw(""); // TODO implement this after refactor cli arguments // logger.raw('Possible values: foo | bar'); @@ -1182,44 +1372,48 @@ class WebpackCLI { outputIncorrectUsageOfHelp(); } - this.logger.raw("To see list of all supported commands and options run 'webpack --help=verbose'.\n"); - this.logger.raw(`${bold('Webpack documentation:')} https://webpack.js.org/.`); - this.logger.raw(`${bold('CLI documentation:')} https://webpack.js.org/api/cli/.`); - this.logger.raw(`${bold('Made with ♥ by the webpack team')}.`); + this.logger.raw( + "To see list of all supported commands and options run 'webpack --help=verbose'.\n", + ); + this.logger.raw(`${bold("Webpack documentation:")} https://webpack.js.org/.`); + this.logger.raw(`${bold("CLI documentation:")} https://webpack.js.org/api/cli/.`); + this.logger.raw(`${bold("Made with ♥ by the webpack team")}.`); process.exit(0); }; this.program.helpOption(false); this.program.addHelpCommand(false); - this.program.option('-h, --help [verbose]', 'Display help for commands and options.'); + this.program.option("-h, --help [verbose]", "Display help for commands and options."); let isInternalActionCalled = false; // Default action - this.program.usage('[options]'); + this.program.usage("[options]"); this.program.allowUnknownOption(true); this.program.action(async (options, program) => { if (!isInternalActionCalled) { isInternalActionCalled = true; } else { - this.logger.error('No commands found to run'); + this.logger.error("No commands found to run"); process.exit(2); } // Command and options const { operands, unknown } = this.program.parseOptions(program.args); const defaultCommandToRun = getCommandName(buildCommandOptions.name); - const hasOperand = typeof operands[0] !== 'undefined'; + const hasOperand = typeof operands[0] !== "undefined"; const operand = hasOperand ? operands[0] : defaultCommandToRun; - const isHelpOption = typeof options.help !== 'undefined'; + const isHelpOption = typeof options.help !== "undefined"; const isHelpCommandSyntax = isCommand(operand, helpCommandOptions); if (isHelpOption || isHelpCommandSyntax) { let isVerbose = false; if (isHelpOption) { - if (typeof options.help === 'string') { - if (options.help !== 'verbose') { - this.logger.error("Unknown value for '--help' option, please use '--help=verbose'"); + if (typeof options.help === "string") { + if (options.help !== "verbose") { + this.logger.error( + "Unknown value for '--help' option, please use '--help=verbose'", + ); process.exit(2); } @@ -1235,13 +1429,21 @@ class WebpackCLI { .concat(operands.slice(1)) // Syntax `webpack help [option]` .concat(unknown) - .concat(isHelpCommandSyntax && typeof options.color !== 'undefined' ? [options.color ? '--color' : '--no-color'] : []) - .concat(isHelpCommandSyntax && typeof options.version !== 'undefined' ? ['--version'] : []); + .concat( + isHelpCommandSyntax && typeof options.color !== "undefined" + ? [options.color ? "--color" : "--no-color"] + : [], + ) + .concat( + isHelpCommandSyntax && typeof options.version !== "undefined" + ? ["--version"] + : [], + ); await outputHelp(optionsForHelp, isVerbose, isHelpCommandSyntax, program); } - const isVersionOption = typeof options.version !== 'undefined'; + const isVersionOption = typeof options.version !== "undefined"; const isVersionCommandSyntax = isCommand(operand, versionCommandOptions); if (isVersionOption || isVersionCommandSyntax) { @@ -1259,7 +1461,7 @@ class WebpackCLI { if (isKnownCommand(commandToRun)) { await loadCommandByName(commandToRun, true); } else { - let isEntrySyntax = fs.existsSync(operand); + const isEntrySyntax = fs.existsSync(operand); if (isEntrySyntax) { commandToRun = defaultCommandToRun; @@ -1270,13 +1472,17 @@ class WebpackCLI { this.logger.error(`Unknown command or entry '${operand}'`); const found = knownCommands.find( - (commandOptions) => this.utils.levenshtein.distance(operand, getCommandName(commandOptions.name)) < 3, + (commandOptions) => + this.utils.levenshtein.distance( + operand, + getCommandName(commandOptions.name), + ) < 3, ); if (found) { this.logger.error( `Did you mean '${getCommandName(found.name)}' (alias '${ - Array.isArray(found.alias) ? found.alias.join(', ') : found.alias + Array.isArray(found.alias) ? found.alias.join(", ") : found.alias }')?`, ); } @@ -1286,7 +1492,9 @@ class WebpackCLI { } } - await this.program.parseAsync([commandToRun, ...commandOperands, ...unknown], { from: 'user' }); + await this.program.parseAsync([commandToRun, ...commandOperands, ...unknown], { + from: "user", + }); }); await this.program.parseAsync(args, parseOptions); @@ -1296,7 +1504,9 @@ class WebpackCLI { const loadConfig = async (configPath) => { const { interpret } = this.utils; const ext = path.extname(configPath); - const interpreted = Object.keys(interpret.jsVariants).find((variant) => variant === ext); + const interpreted = Object.keys(interpret.jsVariants).find( + (variant) => variant === ext, + ); if (interpreted) { const { rechoir } = this.utils; @@ -1311,7 +1521,7 @@ class WebpackCLI { error.failures.forEach((failure) => { this.logger.error(failure.error.message); }); - this.logger.error('Please install one of them'); + this.logger.error("Please install one of them"); process.exit(2); } @@ -1323,39 +1533,7 @@ class WebpackCLI { let options; try { - try { - options = require(configPath); - } catch (error) { - let previousModuleCompile; - - // TODO Workaround https://github.com/zertosh/v8-compile-cache/issues/30 - if (this._originalModuleCompile) { - previousModuleCompile = Module.prototype._compile; - - Module.prototype._compile = this._originalModuleCompile; - } - - const dynamicImportLoader = this.utils.dynamicImportLoader(); - - if (this._originalModuleCompile) { - Module.prototype._compile = previousModuleCompile; - } - - if ( - (error.code === 'ERR_REQUIRE_ESM' || process.env.WEBPACK_CLI_FORCE_LOAD_ESM_CONFIG) && - pathToFileURL && - dynamicImportLoader - ) { - const urlForConfig = pathToFileURL(configPath); - - options = await dynamicImportLoader(urlForConfig); - options = options.default; - - return { options, path: configPath }; - } - - throw error; - } + options = await this.tryRequireThenImport(configPath, false); } catch (error) { this.logger.error(`Failed to load '${configPath}' config`); @@ -1368,10 +1546,6 @@ class WebpackCLI { process.exit(2); } - if (options.default) { - options = options.default; - } - return { options, path: configPath }; }; @@ -1379,14 +1553,14 @@ class WebpackCLI { const isMultiCompiler = Array.isArray(loadedConfig.options); const config = isMultiCompiler ? loadedConfig.options : [loadedConfig.options]; - let evaluatedConfig = await Promise.all( + const evaluatedConfig = await Promise.all( config.map(async (rawConfig) => { - if (typeof rawConfig.then === 'function') { + if (typeof rawConfig.then === "function") { rawConfig = await rawConfig; } // `Promise` may return `Function` - if (typeof rawConfig === 'function') { + if (typeof rawConfig === "function") { // when config is a function, pass the env from args to the config function rawConfig = await rawConfig(argv.env, argv); } @@ -1397,7 +1571,7 @@ class WebpackCLI { loadedConfig.options = isMultiCompiler ? evaluatedConfig : evaluatedConfig[0]; - const isObject = (value) => typeof value === 'object' && value !== null; + const isObject = (value) => typeof value === "object" && value !== null; if (!isObject(loadedConfig.options) && !Array.isArray(loadedConfig.options)) { this.logger.error(`Invalid configuration in '${loadedConfig.path}'`); @@ -1407,11 +1581,13 @@ class WebpackCLI { return loadedConfig; }; - let config = { options: {}, path: new WeakMap() }; + const config = { options: {}, path: new WeakMap() }; if (options.config && options.config.length > 0) { const evaluatedConfigs = await Promise.all( - options.config.map(async (value) => evaluateConfig(await loadConfig(path.resolve(value)), options.argv || {})), + options.config.map(async (value) => + evaluateConfig(await loadConfig(path.resolve(value)), options.argv || {}), + ), ); config.options = []; @@ -1433,10 +1609,14 @@ class WebpackCLI { const { interpret } = this.utils; // Order defines the priority, in decreasing order - const defaultConfigFiles = ['webpack.config', '.webpack/webpack.config', '.webpack/webpackfile'] + const defaultConfigFiles = [ + "webpack.config", + ".webpack/webpack.config", + ".webpack/webpackfile", + ] .map((filename) => // Since .cjs is not available on interpret side add it manually to default config extension list - [...Object.keys(interpret.extensions), '.cjs'].map((ext) => ({ + [...Object.keys(interpret.extensions), ".cjs"].map((ext) => ({ path: path.resolve(filename + ext), ext: ext, module: interpret.extensions[ext], @@ -1492,20 +1672,25 @@ class WebpackCLI { if (notfoundConfigNames.length > 0) { this.logger.error( - notfoundConfigNames.map((configName) => `Configuration with the name "${configName}" was not found.`).join(' '), + notfoundConfigNames + .map( + (configName) => + `Configuration with the name "${configName}" was not found.`, + ) + .join(" "), ); process.exit(2); } } if (options.merge) { - const { merge } = require('webpack-merge'); + const merge = await this.tryRequireThenImport("webpack-merge"); // we can only merge when there are multiple configurations // either by passing multiple configs by flags or passing a // single config exporting an array if (!Array.isArray(config.options) || config.options.length <= 1) { - this.logger.error('At least two configurations are required for merge.'); + this.logger.error("At least two configurations are required for merge."); process.exit(2); } @@ -1528,24 +1713,34 @@ class WebpackCLI { // TODO refactor async applyOptions(config, options) { if (options.analyze) { - if (!this.utils.packageExists('webpack-bundle-analyzer')) { + if (!this.utils.packageExists("webpack-bundle-analyzer")) { const { promptInstallation, colors } = this.utils; - await promptInstallation('webpack-bundle-analyzer', () => { - this.logger.error(`It looks like ${colors.yellow('webpack-bundle-analyzer')} is not installed.`); + await promptInstallation("webpack-bundle-analyzer", () => { + this.logger.error( + `It looks like ${colors.yellow( + "webpack-bundle-analyzer", + )} is not installed.`, + ); }); - this.logger.success(`${colors.yellow('webpack-bundle-analyzer')} was installed successfully.`); + this.logger.success( + `${colors.yellow("webpack-bundle-analyzer")} was installed successfully.`, + ); } } - if (typeof options.progress === 'string' && options.progress !== 'profile') { - this.logger.error(`'${options.progress}' is an invalid value for the --progress option. Only 'profile' is allowed.`); + if (typeof options.progress === "string" && options.progress !== "profile") { + this.logger.error( + `'${options.progress}' is an invalid value for the --progress option. Only 'profile' is allowed.`, + ); process.exit(2); } - if (typeof options.hot === 'string' && options.hot !== 'only') { - this.logger.error(`'${options.hot}' is an invalid value for the --hot option. Use 'only' instead.`); + if (typeof options.hot === "string" && options.hot !== "only") { + this.logger.error( + `'${options.hot}' is an invalid value for the --hot option. Use 'only' instead.`, + ); process.exit(2); } @@ -1554,15 +1749,15 @@ class WebpackCLI { configOptions.watch && options.argv && options.argv.env && - (options.argv.env['WEBPACK_WATCH'] || options.argv.env['WEBPACK_SERVE']) + (options.argv.env["WEBPACK_WATCH"] || options.argv.env["WEBPACK_SERVE"]) ) { this.logger.warn( `No need to use the '${ - options.argv.env['WEBPACK_WATCH'] ? 'watch' : 'serve' + options.argv.env["WEBPACK_WATCH"] ? "watch" : "serve" }' command together with '{ watch: true }' configuration, it does not make sense.`, ); - if (options.argv.env['WEBPACK_SERVE']) { + if (options.argv.env["WEBPACK_SERVE"]) { configOptions.watch = false; } } @@ -1577,7 +1772,7 @@ class WebpackCLI { if (this.webpack.cli) { const processArguments = (configOptions) => { const args = this.getBuiltInOptions() - .filter((flag) => flag.group === 'core') + .filter((flag) => flag.group === "core") .reduce((accumulator, flag) => { accumulator[flag.name] = flag; @@ -1585,7 +1780,7 @@ class WebpackCLI { }, {}); const values = Object.keys(options).reduce((accumulator, name) => { - if (name === 'argv') { + if (name === "argv") { return accumulator; } @@ -1608,16 +1803,18 @@ class WebpackCLI { return rv; }, {}); }; - const problemsByPath = groupBy(problems, 'path'); + const problemsByPath = groupBy(problems, "path"); for (const path in problemsByPath) { const problems = problemsByPath[path]; problems.forEach((problem) => { this.logger.error( - `${this.utils.capitalizeFirstLetter(problem.type.replace(/-/g, ' '))}${ - problem.value ? ` '${problem.value}'` : '' - } for the '--${problem.argument}' option${problem.index ? ` by index '${problem.index}'` : ''}`, + `${this.utils.capitalizeFirstLetter( + problem.type.replace(/-/g, " "), + )}${problem.value ? ` '${problem.value}'` : ""} for the '--${ + problem.argument + }' option${problem.index ? ` by index '${problem.index}'` : ""}`, ); if (problem.expected) { @@ -1638,7 +1835,7 @@ class WebpackCLI { const setupDefaultOptions = (configOptions) => { // No need to run for webpack@4 - if (configOptions.cache && configOptions.cache.type === 'filesystem') { + if (configOptions.cache && configOptions.cache.type === "filesystem") { const configPath = config.path.get(configOptions); if (configPath) { @@ -1686,7 +1883,7 @@ class WebpackCLI { configOptions.target = options.target; } - if (typeof options.devtool !== 'undefined') { + if (typeof options.devtool !== "undefined") { configOptions.devtool = options.devtool; } @@ -1696,7 +1893,9 @@ class WebpackCLI { !configOptions.mode && process.env && process.env.NODE_ENV && - (process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'none') + (process.env.NODE_ENV === "development" || + process.env.NODE_ENV === "production" || + process.env.NODE_ENV === "none") ) { configOptions.mode = process.env.NODE_ENV; } @@ -1705,15 +1904,15 @@ class WebpackCLI { configOptions.name = options.name; } - if (typeof options.stats !== 'undefined') { + if (typeof options.stats !== "undefined") { configOptions.stats = options.stats; } - if (typeof options.watch !== 'undefined') { + if (typeof options.watch !== "undefined") { configOptions.watch = options.watch; } - if (typeof options.watchOptionsStdin !== 'undefined') { + if (typeof options.watchOptionsStdin !== "undefined") { configOptions.watchOptions = { ...configOptions.watchOptions, ...{ stdin: options.watchOptionsStdin }, @@ -1733,17 +1932,20 @@ class WebpackCLI { const statsForWebpack4 = this.webpack.Stats && this.webpack.Stats.presetToOptions; if (statsForWebpack4) { - if (typeof configOptions.stats === 'undefined') { + if (typeof configOptions.stats === "undefined") { configOptions.stats = {}; - } else if (typeof configOptions.stats === 'boolean' || typeof configOptions.stats === 'string') { + } else if ( + typeof configOptions.stats === "boolean" || + typeof configOptions.stats === "string" + ) { if ( - typeof configOptions.stats === 'string' && - configOptions.stats !== 'none' && - configOptions.stats !== 'verbose' && - configOptions.stats !== 'detailed' && - configOptions.stats !== 'minimal' && - configOptions.stats !== 'errors-only' && - configOptions.stats !== 'errors-warnings' + typeof configOptions.stats === "string" && + configOptions.stats !== "none" && + configOptions.stats !== "verbose" && + configOptions.stats !== "detailed" && + configOptions.stats !== "minimal" && + configOptions.stats !== "errors-only" && + configOptions.stats !== "errors-warnings" ) { return configOptions; } @@ -1751,11 +1953,13 @@ class WebpackCLI { configOptions.stats = this.webpack.Stats.presetToOptions(configOptions.stats); } } else { - if (typeof configOptions.stats === 'undefined') { - configOptions.stats = { preset: 'normal' }; - } else if (typeof configOptions.stats === 'boolean') { - configOptions.stats = configOptions.stats ? { preset: 'normal' } : { preset: 'none' }; - } else if (typeof configOptions.stats === 'string') { + if (typeof configOptions.stats === "undefined") { + configOptions.stats = { preset: "normal" }; + } else if (typeof configOptions.stats === "boolean") { + configOptions.stats = configOptions.stats + ? { preset: "normal" } + : { preset: "none" }; + } else if (typeof configOptions.stats === "string") { configOptions.stats = { preset: configOptions.stats }; } } @@ -1763,11 +1967,11 @@ class WebpackCLI { let colors; // From arguments - if (typeof this.utils.colors.options.changed !== 'undefined') { + if (typeof this.utils.colors.options.changed !== "undefined") { colors = Boolean(this.utils.colors.options.enabled); } // From stats - else if (typeof configOptions.stats.colors !== 'undefined') { + else if (typeof configOptions.stats.colors !== "undefined") { colors = configOptions.stats.colors; } // Default @@ -1788,13 +1992,13 @@ class WebpackCLI { } async applyCLIPlugin(config, cliOptions) { + const CLIPlugin = await this.tryRequireThenImport("./plugins/CLIPlugin"); + const addCLIPlugin = (configOptions) => { if (!configOptions.plugins) { configOptions.plugins = []; } - const CLIPlugin = require('./plugins/CLIPlugin'); - configOptions.plugins.unshift( new CLIPlugin({ configPath: config.path.get(configOptions), @@ -1808,6 +2012,7 @@ class WebpackCLI { return configOptions; }; + config.options = Array.isArray(config.options) ? config.options.map((options) => addCLIPlugin(options)) : addCLIPlugin(config.options); @@ -1817,7 +2022,9 @@ class WebpackCLI { needWatchStdin(compiler) { if (compiler.compilers) { - return compiler.compilers.some((compiler) => compiler.options.watchOptions && compiler.options.watchOptions.stdin); + return compiler.compilers.some( + (compiler) => compiler.options.watchOptions && compiler.options.watchOptions.stdin, + ); } return compiler.options.watchOptions && compiler.options.watchOptions.stdin; @@ -1826,9 +2033,10 @@ class WebpackCLI { isValidationError(error) { // https://github.com/webpack/webpack/blob/master/lib/index.js#L267 // https://github.com/webpack/webpack/blob/v4.44.2/lib/webpack.js#L90 - const ValidationError = this.webpack.ValidationError || this.webpack.WebpackOptionsValidationError; + const ValidationError = + this.webpack.ValidationError || this.webpack.WebpackOptionsValidationError; - return error instanceof ValidationError || error.name === 'ValidationError'; + return error instanceof ValidationError || error.name === "ValidationError"; } async createCompiler(options, callback) { @@ -1874,7 +2082,15 @@ class WebpackCLI { } async buildCommand(options, isWatchCommand) { + // eslint-disable-next-line prefer-const let compiler; + let createJsonStringifyStream; + + if (options.json) { + const jsonExt = await this.tryRequireThenImport("@discoveryjs/json-ext"); + + createJsonStringifyStream = jsonExt.stringifyStream; + } const callback = (error, stats) => { if (error) { @@ -1891,7 +2107,11 @@ class WebpackCLI { } const statsOptions = compiler.compilers - ? { children: compiler.compilers.map((compiler) => (compiler.options ? compiler.options.stats : undefined)) } + ? { + children: compiler.compilers.map((compiler) => + compiler.options ? compiler.options.stats : undefined, + ), + } : compiler.options ? compiler.options.stats : undefined; @@ -1903,8 +2123,7 @@ class WebpackCLI { statsOptions.colors = statsOptions.children.some((child) => child.colors); } - if (options.json) { - const { stringifyStream: createJsonStringifyStream } = require('@discoveryjs/json-ext'); + if (options.json && createJsonStringifyStream) { const handleWriteError = (error) => { this.logger.error(error); process.exit(2); @@ -1912,19 +2131,21 @@ class WebpackCLI { if (options.json === true) { createJsonStringifyStream(stats.toJson(statsOptions)) - .on('error', handleWriteError) + .on("error", handleWriteError) .pipe(process.stdout) - .on('error', handleWriteError) - .on('close', () => process.stdout.write('\n')); + .on("error", handleWriteError) + .on("close", () => process.stdout.write("\n")); } else { createJsonStringifyStream(stats.toJson(statsOptions)) - .on('error', handleWriteError) + .on("error", handleWriteError) .pipe(fs.createWriteStream(options.json)) - .on('error', handleWriteError) + .on("error", handleWriteError) // Use stderr to logging - .on('close', () => + .on("close", () => process.stderr.write( - `[webpack-cli] ${this.utils.colors.green(`stats are successfully stored as json to ${options.json}`)}\n`, + `[webpack-cli] ${this.utils.colors.green( + `stats are successfully stored as json to ${options.json}`, + )}\n`, ), ); } @@ -1956,10 +2177,12 @@ class WebpackCLI { } const isWatch = (compiler) => - compiler.compilers ? compiler.compilers.some((compiler) => compiler.options.watch) : compiler.options.watch; + compiler.compilers + ? compiler.compilers.some((compiler) => compiler.options.watch) + : compiler.options.watch; if (isWatch(compiler) && this.needWatchStdin(compiler)) { - process.stdin.on('end', () => { + process.stdin.on("end", () => { process.exit(0); }); process.stdin.resume(); diff --git a/packages/webpack-cli/package.json b/packages/webpack-cli/package.json index 2707920aed6..37f1314fa25 100644 --- a/packages/webpack-cli/package.json +++ b/packages/webpack-cli/package.json @@ -1,6 +1,6 @@ { "name": "webpack-cli", - "version": "4.7.0", + "version": "4.7.1", "description": "CLI for webpack & friends", "license": "MIT", "repository": { @@ -30,9 +30,9 @@ ], "dependencies": { "@discoveryjs/json-ext": "^0.5.0", - "@webpack-cli/configtest": "^1.0.3", - "@webpack-cli/info": "^1.2.4", - "@webpack-cli/serve": "^1.4.0", + "@webpack-cli/configtest": "^1.0.4", + "@webpack-cli/info": "^1.3.0", + "@webpack-cli/serve": "^1.5.0", "colorette": "^1.2.1", "commander": "^7.0.0", "execa": "^5.0.0", diff --git a/prettier.config.js b/prettier.config.js index 89d4592e472..a3ca7933373 100644 --- a/prettier.config.js +++ b/prettier.config.js @@ -1,5 +1,4 @@ module.exports = { - singleQuote: true, - trailingComma: 'all', - printWidth: 140, + printWidth: 100, + trailingComma: "all", }; diff --git a/scripts/cleanupTest.js b/scripts/cleanupTest.js index 0f1638df0cf..9be7a8effdb 100644 --- a/scripts/cleanupTest.js +++ b/scripts/cleanupTest.js @@ -1,19 +1,19 @@ // eslint-disable-next-line node/no-unpublished-require -const rimraf = require('rimraf'); -const { join } = require('path'); -const collectTestFolders = require('./utils'); +const rimraf = require("rimraf"); +const { join } = require("path"); +const collectTestFolders = require("./utils"); const outputDirectories = [ - 'bin', - 'binary', - 'dist', - 'test', - 'test-assets', - 'test-plugin', - 'test-loader', - 'test-cache-path', - 'test-locate-cache', - 'stats.json', + "bin", + "binary", + "dist", + "test", + "test-assets", + "test-plugin", + "test-loader", + "test-cache-path", + "test-locate-cache", + "stats.json", ]; const folderStrategy = (stats, file) => { diff --git a/scripts/globalSetup.js b/scripts/globalSetup.js index d043a5903d0..c38c758c60d 100644 --- a/scripts/globalSetup.js +++ b/scripts/globalSetup.js @@ -1,3 +1,3 @@ -const { version } = require('webpack'); +const { version } = require("webpack"); module.exports = () => console.log(`\n Running tests for webpack @${version} \n`); diff --git a/scripts/prepareSuite.js b/scripts/prepareSuite.js index caa5106c371..6ffb4b59562 100644 --- a/scripts/prepareSuite.js +++ b/scripts/prepareSuite.js @@ -1,10 +1,10 @@ // eslint-disable-next-line node/no-unpublished-require -const execa = require('execa'); +const execa = require("execa"); // eslint-disable-next-line node/no-unpublished-require -const { red, green } = require('colorette'); -const collectTestFolders = require('./utils'); +const { red, green } = require("colorette"); +const collectTestFolders = require("./utils"); -const PACKAGE = 'package.json'; +const PACKAGE = "package.json"; const getFoldersWithPackage = (stats, file) => { return stats.isFile() && file === PACKAGE; @@ -14,14 +14,14 @@ const getFoldersWithPackage = (stats, file) => { try { const folders = collectTestFolders(getFoldersWithPackage); for (const folder of folders) { - await execa('yarn', { + await execa("yarn", { cwd: folder, - stdio: 'inherit', + stdio: "inherit", }); } - console.log(green(' Successfully prepared the test suite ')); + console.log(green(" Successfully prepared the test suite ")); } catch (e) { - console.error(red(' Unable to prepare the test suite ')); + console.error(red(" Unable to prepare the test suite ")); console.error(e.stack); process.exitCode = 1; } diff --git a/scripts/setupBuild.js b/scripts/setupBuild.js index 47baf48f865..1daf7485f1b 100644 --- a/scripts/setupBuild.js +++ b/scripts/setupBuild.js @@ -1,7 +1,7 @@ -const { writeFileSync, readFileSync } = require('fs'); -const { resolve } = require('path'); +const { writeFileSync, readFileSync } = require("fs"); +const { resolve } = require("path"); -const tsConfigPath = resolve(__dirname, '../tsconfig.json'); +const tsConfigPath = resolve(__dirname, "../tsconfig.json"); const tsConfigRaw = readFileSync(tsConfigPath); const tsConfig = JSON.parse(tsConfigRaw); diff --git a/scripts/snapshotResolver.js b/scripts/snapshotResolver.js index 5c8ab291240..0683c4e30b9 100644 --- a/scripts/snapshotResolver.js +++ b/scripts/snapshotResolver.js @@ -1,24 +1,33 @@ -const path = require('path'); +const path = require("path"); -const webpack = require('webpack'); +const webpack = require("webpack"); //eslint-disable-next-line node/no-unpublished-require -const [devServerVersion] = require('webpack-dev-server/package.json').version; +const [devServerVersion] = require("webpack-dev-server/package.json").version; const [webpackVersion] = webpack.version; const snapshotExtension = `.snap.webpack${webpackVersion}`; const snapshotExtensionForServe = `.snap.devServer${devServerVersion}.webpack${webpackVersion}`; -const helpCommandTestDir = path.resolve(__dirname, '../test/help'); -const serveCommandTestDir = path.resolve(__dirname, '../test/serve'); +const helpCommandTestDir = path.resolve(__dirname, "../test/help"); +const serveCommandTestDir = path.resolve(__dirname, "../test/serve"); module.exports = { resolveSnapshotPath: (testPath) => { if (testPath.startsWith(helpCommandTestDir) || testPath.startsWith(serveCommandTestDir)) { - return path.join(path.dirname(testPath), '__snapshots__', `${path.basename(testPath)}${snapshotExtensionForServe}`); + return path.join( + path.dirname(testPath), + "__snapshots__", + `${path.basename(testPath)}${snapshotExtensionForServe}`, + ); } - return path.join(path.dirname(testPath), '__snapshots__', `${path.basename(testPath)}${snapshotExtension}`); + return path.join( + path.dirname(testPath), + "__snapshots__", + `${path.basename(testPath)}${snapshotExtension}`, + ); }, - resolveTestPath: (snapshotPath) => snapshotPath.replace(`${path.sep}__snapshots__`, '').slice(0, -snapshotExtension.length), - testPathForConsistencyCheck: path.join('consistency_check', '__tests__', 'example.test.js'), + resolveTestPath: (snapshotPath) => + snapshotPath.replace(`${path.sep}__snapshots__`, "").slice(0, -snapshotExtension.length), + testPathForConsistencyCheck: path.join("consistency_check", "__tests__", "example.test.js"), }; diff --git a/scripts/updateDocs.js b/scripts/updateDocs.js index 753863af2ba..6193903a675 100644 --- a/scripts/updateDocs.js +++ b/scripts/updateDocs.js @@ -1,31 +1,39 @@ //eslint-disable-next-line node/no-unpublished-require -const { sync } = require('execa'); -const { resolve } = require('path'); -const { writeFileSync } = require('fs'); +const { sync } = require("execa"); +const { resolve } = require("path"); +const { writeFileSync } = require("fs"); try { - const { stdout: cliOptions } = sync(resolve(__dirname, '../packages/webpack-cli/bin/cli.js'), ['--help=verbose'], { - cwd: __dirname, - reject: false, - }); + const { stdout: cliOptions } = sync( + resolve(__dirname, "../packages/webpack-cli/bin/cli.js"), + ["--help=verbose"], + { + cwd: __dirname, + reject: false, + }, + ); // format output for markdown - const mdContent = ['```\n', cliOptions, '\n```'].join(''); + const mdContent = ["```\n", cliOptions, "\n```"].join(""); // create OPTIONS.md - writeFileSync('OPTIONS.md', mdContent); + writeFileSync("OPTIONS.md", mdContent); // serve options - const { stdout: serveOptions } = sync(resolve(__dirname, '../packages/webpack-cli/bin/cli.js'), ['serve', '--help'], { - cwd: __dirname, - reject: false, - }); + const { stdout: serveOptions } = sync( + resolve(__dirname, "../packages/webpack-cli/bin/cli.js"), + ["serve", "--help"], + { + cwd: __dirname, + reject: false, + }, + ); // format output for markdown - const serveContent = ['```\n', serveOptions, '\n```'].join(''); + const serveContent = ["```\n", serveOptions, "\n```"].join(""); // create SERVE.md - writeFileSync('SERVE-OPTIONS.md', serveContent); + writeFileSync("SERVE-OPTIONS.md", serveContent); console.log('Successfully updated "OPTIONS.md" and "SERVE-OPTIONS.md"'); } catch (err) { diff --git a/scripts/utils.js b/scripts/utils.js index 966ce05f90d..dcc8770c13b 100644 --- a/scripts/utils.js +++ b/scripts/utils.js @@ -1,7 +1,7 @@ -const fs = require('fs'); -const path = require('path'); +const fs = require("fs"); +const path = require("path"); -const BASE_DIR = 'test/'; +const BASE_DIR = "test/"; function collectTestFolders(strategy) { const testFolder = path.resolve(path.join(process.cwd(), BASE_DIR)); @@ -30,7 +30,7 @@ function extractFolder(folderToRead, folders = [], folderStrategy) { folders.push(folderToRead); } - if (stats.isDirectory() && file !== 'node_modules') { + if (stats.isDirectory() && file !== "node_modules") { extractFolder(filePath, folders, folderStrategy); } }); diff --git a/setupTest.js b/setupTest.js index 6234cd7fd26..adc674767fa 100644 --- a/setupTest.js +++ b/setupTest.js @@ -1,7 +1,5 @@ -/*global jasmine*/ - jest.setTimeout(240000); -if (!jasmine.testPath.includes('colors.test.js')) { +if (!expect.getState().testPath.includes("colors.test.js")) { process.env.NO_COLOR = true; } diff --git a/smoketests/helpers.js b/smoketests/helpers.js index d25c1bcdcbd..7af0cc10990 100644 --- a/smoketests/helpers.js +++ b/smoketests/helpers.js @@ -1,11 +1,13 @@ /* eslint-disable node/no-unpublished-require */ -const fs = require('fs'); -const path = require('path'); -const execa = require('execa'); -const stripAnsi = require('strip-ansi'); +const fs = require("fs"); +const path = require("path"); +const execa = require("execa"); +const stripAnsi = require("strip-ansi"); -const ROOT_PATH = process.env.GITHUB_WORKSPACE ? process.env.GITHUB_WORKSPACE : path.resolve(__dirname, '..'); +const ROOT_PATH = process.env.GITHUB_WORKSPACE + ? process.env.GITHUB_WORKSPACE + : path.resolve(__dirname, ".."); const getPkgPath = (pkg, isSubPackage) => { const pkgPath = isSubPackage ? `./node_modules/@webpack-cli/${pkg}` : `./node_modules/${pkg}`; @@ -14,12 +16,12 @@ const getPkgPath = (pkg, isSubPackage) => { const swapPkgName = (current, isSubPackage = false) => { // info -> .info and vice-versa - const next = current.startsWith('.') ? current.substr(1) : `.${current}`; + const next = current.startsWith(".") ? current.substr(1) : `.${current}`; console.log(` swapping ${current} with ${next}`); fs.renameSync(getPkgPath(current, isSubPackage), getPkgPath(next, isSubPackage)); }; -const CLI_ENTRY_PATH = path.resolve(ROOT_PATH, './packages/webpack-cli/bin/cli.js'); +const CLI_ENTRY_PATH = path.resolve(ROOT_PATH, "./packages/webpack-cli/bin/cli.js"); const runTest = (package, cliArgs = [], logMessage, isSubPackage = false) => { // Simulate package missing @@ -29,25 +31,25 @@ const runTest = (package, cliArgs = [], logMessage, isSubPackage = false) => { cwd: __dirname, }); - proc.stdin.setDefaultEncoding('utf-8'); + proc.stdin.setDefaultEncoding("utf-8"); - proc.stdout.on('data', (chunk) => { + proc.stdout.on("data", (chunk) => { console.log(` stdout: ${chunk.toString()}`); }); return new Promise((resolve) => { const timeout = setTimeout(() => { - console.log(' timeout: killing process'); + console.log(" timeout: killing process"); proc.kill(); }, 30000); - const prompt = 'Would you like to install'; + const prompt = "Would you like to install"; let hasLogMessage = false, hasPrompt = false, hasPassed = false; - proc.stderr.on('data', (chunk) => { - let data = stripAnsi(chunk.toString()); + proc.stderr.on("data", (chunk) => { + const data = stripAnsi(chunk.toString()); console.log(` stderr: ${data}`); if (data.includes(logMessage)) { @@ -64,13 +66,13 @@ const runTest = (package, cliArgs = [], logMessage, isSubPackage = false) => { } }); - proc.on('exit', () => { + proc.on("exit", () => { swapPkgName(`.${package}`, isSubPackage); clearTimeout(timeout); resolve(hasPassed); }); - proc.on('error', () => { + proc.on("error", () => { swapPkgName(`.${package}`, isSubPackage); clearTimeout(timeout); resolve(false); @@ -86,18 +88,18 @@ const runTestStdout = ({ packageName, cliArgs, logMessage, isSubPackage } = {}) cwd: __dirname, }); - proc.stdin.setDefaultEncoding('utf-8'); + proc.stdin.setDefaultEncoding("utf-8"); return new Promise((resolve) => { const timeout = setTimeout(() => { - console.log(' timeout: killing process'); + console.log(" timeout: killing process"); proc.kill(); }, 30000); let hasPassed = false; - proc.stdout.on('data', (chunk) => { - let data = stripAnsi(chunk.toString()); + proc.stdout.on("data", (chunk) => { + const data = stripAnsi(chunk.toString()); console.log(` stdout: ${data}`); if (data.includes(logMessage)) { @@ -106,18 +108,18 @@ const runTestStdout = ({ packageName, cliArgs, logMessage, isSubPackage } = {}) } }); - proc.stderr.on('data', (chunk) => { - let data = stripAnsi(chunk.toString()); + proc.stderr.on("data", (chunk) => { + const data = stripAnsi(chunk.toString()); console.log(` stderr: ${data}`); }); - proc.on('exit', () => { + proc.on("exit", () => { swapPkgName(`.${packageName}`, isSubPackage); clearTimeout(timeout); resolve(hasPassed); }); - proc.on('error', () => { + proc.on("error", () => { swapPkgName(`.${packageName}`, isSubPackage); clearTimeout(timeout); resolve(false); @@ -125,7 +127,13 @@ const runTestStdout = ({ packageName, cliArgs, logMessage, isSubPackage } = {}) }); }; -const runTestStdoutWithInput = ({ packageName, cliArgs, inputs, logMessage, isSubPackage } = {}) => { +const runTestStdoutWithInput = ({ + packageName, + cliArgs, + inputs, + logMessage, + isSubPackage, +} = {}) => { // Simulate package missing swapPkgName(packageName, isSubPackage); @@ -133,18 +141,18 @@ const runTestStdoutWithInput = ({ packageName, cliArgs, inputs, logMessage, isSu cwd: __dirname, }); - proc.stdin.setDefaultEncoding('utf-8'); + proc.stdin.setDefaultEncoding("utf-8"); return new Promise((resolve) => { const timeout = setTimeout(() => { - console.log(' timeout: killing process'); + console.log(" timeout: killing process"); proc.kill(); }, 300000); let hasPassed = false; - proc.stdout.on('data', (chunk) => { - let data = stripAnsi(chunk.toString()); + proc.stdout.on("data", (chunk) => { + const data = stripAnsi(chunk.toString()); console.log(` stdout: ${data}`); if (data.includes(logMessage)) { @@ -159,18 +167,18 @@ const runTestStdoutWithInput = ({ packageName, cliArgs, inputs, logMessage, isSu }); }); - proc.stderr.on('data', (chunk) => { - let data = stripAnsi(chunk.toString()); + proc.stderr.on("data", (chunk) => { + const data = stripAnsi(chunk.toString()); console.log(` stderr: ${data}`); }); - proc.on('exit', () => { + proc.on("exit", () => { swapPkgName(`.${packageName}`, isSubPackage); clearTimeout(timeout); resolve(hasPassed); }); - proc.on('error', () => { + proc.on("error", () => { swapPkgName(`.${packageName}`, isSubPackage); clearTimeout(timeout); resolve(false); @@ -186,15 +194,15 @@ const runTestWithHelp = (package, cliArgs = [], logMessage, isSubPackage = false cwd: __dirname, }); - proc.stdin.setDefaultEncoding('utf-8'); + proc.stdin.setDefaultEncoding("utf-8"); - proc.stdout.on('data', (chunk) => { + proc.stdout.on("data", (chunk) => { console.log(` stdout: ${chunk.toString()}`); }); return new Promise((resolve) => { const timeout = setTimeout(() => { - console.log(' timeout: killing process'); + console.log(" timeout: killing process"); proc.kill(); }, 30000); @@ -204,8 +212,8 @@ const runTestWithHelp = (package, cliArgs = [], logMessage, isSubPackage = false hasUndefinedLogMessage = false, hasPassed = false; - proc.stderr.on('data', (chunk) => { - let data = stripAnsi(chunk.toString()); + proc.stderr.on("data", (chunk) => { + const data = stripAnsi(chunk.toString()); console.log(` stderr: ${data}`); if (data.includes(logMessage)) { @@ -222,13 +230,13 @@ const runTestWithHelp = (package, cliArgs = [], logMessage, isSubPackage = false } }); - proc.on('exit', () => { + proc.on("exit", () => { swapPkgName(`.${package}`, isSubPackage); clearTimeout(timeout); resolve(hasPassed); }); - proc.on('error', () => { + proc.on("error", () => { swapPkgName(`.${package}`, isSubPackage); clearTimeout(timeout); resolve(false); diff --git a/smoketests/index.js b/smoketests/index.js index b63f898e2ea..c734be20948 100644 --- a/smoketests/index.js +++ b/smoketests/index.js @@ -1,12 +1,12 @@ const tests = [ - require('./missing-packages/webpack-dev-server.test.js'), - require('./missing-packages/webpack.test.js'), - require('./missing-packages/webpack-bundle-analyzer.test.js'), - require('./missing-command-packages/generator.test.js'), - require('./missing-command-packages/serve.test.js'), - require('./missing-command-packages/info.test.js'), - require('./missing-command-packages/configtest.test.js'), - require('./missing-packages/prettier.test.js'), + require("./missing-packages/webpack-dev-server.test.js"), + require("./missing-packages/webpack.test.js"), + require("./missing-packages/webpack-bundle-analyzer.test.js"), + require("./missing-command-packages/generator.test.js"), + require("./missing-command-packages/serve.test.js"), + require("./missing-command-packages/info.test.js"), + require("./missing-command-packages/configtest.test.js"), + require("./missing-packages/prettier.test.js"), ]; (async () => { diff --git a/smoketests/missing-command-packages/configtest.test.js b/smoketests/missing-command-packages/configtest.test.js index 0154864f646..66683b4d53f 100644 --- a/smoketests/missing-command-packages/configtest.test.js +++ b/smoketests/missing-command-packages/configtest.test.js @@ -1,23 +1,25 @@ -'use strict'; +"use strict"; -const { runTest, runTestWithHelp } = require('../helpers'); +const { runTest, runTestWithHelp } = require("../helpers"); -const packageName = 'configtest'; +const packageName = "configtest"; const isSubPackage = true; const configTest = () => { - const args = ['configtest']; - const logMessage = "For using this command you need to install: '@webpack-cli/configtest' package"; + const args = ["configtest"]; + const logMessage = + "For using this command you need to install: '@webpack-cli/configtest' package"; return runTest(packageName, args, logMessage, isSubPackage); }; const configTestWithHelp = () => { - const args = ['help', 'configtest']; - const logMessage = "For using 'configtest' command you need to install '@webpack-cli/configtest' package"; + const args = ["help", "configtest"]; + const logMessage = + "For using 'configtest' command you need to install '@webpack-cli/configtest' package"; return runTestWithHelp(packageName, args, logMessage, isSubPackage); }; module.exports.run = [configTest, configTestWithHelp]; -module.exports.name = 'Missing @webpack-cli/configtest'; +module.exports.name = "Missing @webpack-cli/configtest"; diff --git a/smoketests/missing-command-packages/generator.test.js b/smoketests/missing-command-packages/generator.test.js index 8afd7495f6e..c0c95b8a8e9 100644 --- a/smoketests/missing-command-packages/generator.test.js +++ b/smoketests/missing-command-packages/generator.test.js @@ -1,23 +1,25 @@ -'use strict'; +"use strict"; -const { runTest, runTestWithHelp } = require('../helpers'); +const { runTest, runTestWithHelp } = require("../helpers"); -const packageName = 'generators'; +const packageName = "generators"; const isSubPackage = true; const initTest = () => { - const args = ['init']; - const logMessage = "For using this command you need to install: '@webpack-cli/generators' package"; + const args = ["init"]; + const logMessage = + "For using this command you need to install: '@webpack-cli/generators' package"; return runTest(packageName, args, logMessage, isSubPackage); }; const initTestWithHelp = () => { - const args = ['help', 'init']; - const logMessage = "For using 'init' command you need to install '@webpack-cli/generators' package"; + const args = ["help", "init"]; + const logMessage = + "For using 'init' command you need to install '@webpack-cli/generators' package"; return runTestWithHelp(packageName, args, logMessage, isSubPackage); }; module.exports.run = [initTest, initTestWithHelp]; -module.exports.name = 'Missing @webpack-cli/generators'; +module.exports.name = "Missing @webpack-cli/generators"; diff --git a/smoketests/missing-command-packages/info.test.js b/smoketests/missing-command-packages/info.test.js index 17a843422f6..3bdbe8b17ab 100644 --- a/smoketests/missing-command-packages/info.test.js +++ b/smoketests/missing-command-packages/info.test.js @@ -1,23 +1,23 @@ -'use strict'; +"use strict"; -const { runTest, runTestWithHelp } = require('../helpers'); +const { runTest, runTestWithHelp } = require("../helpers"); -const packageName = 'info'; +const packageName = "info"; const isSubPackage = true; const infoTest = () => { - const args = ['info']; + const args = ["info"]; const logMessage = "For using this command you need to install: '@webpack-cli/info' package"; return runTest(packageName, args, logMessage, isSubPackage); }; const infoTestWithHelp = () => { - const args = ['help', 'info']; + const args = ["help", "info"]; const logMessage = "For using 'info' command you need to install '@webpack-cli/info' package"; return runTestWithHelp(packageName, args, logMessage, isSubPackage); }; module.exports.run = [infoTest, infoTestWithHelp]; -module.exports.name = 'Missing @webpack-cli/info'; +module.exports.name = "Missing @webpack-cli/info"; diff --git a/smoketests/missing-command-packages/serve.test.js b/smoketests/missing-command-packages/serve.test.js index 7aa2a24c801..f0621b9c613 100644 --- a/smoketests/missing-command-packages/serve.test.js +++ b/smoketests/missing-command-packages/serve.test.js @@ -1,23 +1,23 @@ -'use strict'; +"use strict"; -const { runTest, runTestWithHelp } = require('../helpers'); +const { runTest, runTestWithHelp } = require("../helpers"); -const packageName = 'serve'; +const packageName = "serve"; const isSubPackage = true; const serveTest = () => { - const args = ['serve']; + const args = ["serve"]; const logMessage = "For using this command you need to install: '@webpack-cli/serve' package"; return runTest(packageName, args, logMessage, isSubPackage); }; const serveTestWithHelp = () => { - const args = ['help', 'serve']; + const args = ["help", "serve"]; const logMessage = "For using 'serve' command you need to install '@webpack-cli/serve' package"; return runTestWithHelp(packageName, args, logMessage, isSubPackage); }; module.exports.run = [serveTest, serveTestWithHelp]; -module.exports.name = 'Missing @webpack-cli/serve'; +module.exports.name = "Missing @webpack-cli/serve"; diff --git a/smoketests/missing-packages/prettier.test.js b/smoketests/missing-packages/prettier.test.js index 52cfe96ab4a..a11677ab865 100644 --- a/smoketests/missing-packages/prettier.test.js +++ b/smoketests/missing-packages/prettier.test.js @@ -1,32 +1,38 @@ -'use strict'; +"use strict"; -const { runTestStdout, runTestStdoutWithInput } = require('../helpers'); +const { runTestStdout, runTestStdoutWithInput } = require("../helpers"); // eslint-disable-next-line node/no-unpublished-require -const rimraf = require('rimraf'); -const { resolve } = require('path'); +const rimraf = require("rimraf"); +const { resolve } = require("path"); const prettierTest = async () => { - const packageName = 'prettier'; - const rootPath = resolve(__dirname, './test-assets'); - const cliArgs = ['init', rootPath, '--force']; - const logMessage = 'Do you like to install prettier to format generated configuration?'; + const packageName = "prettier"; + const rootPath = resolve(__dirname, "./test-assets"); + const cliArgs = ["init", rootPath, "--force"]; + const logMessage = "Do you like to install prettier to format generated configuration?"; const status = await runTestStdout({ packageName, cliArgs, logMessage }); rimraf.sync(rootPath); return status; }; const prettierTestWithNoAnswer = async () => { - const packageName = 'prettier'; - const rootPath = resolve(__dirname, './test-assets'); - const cliArgs = ['init', rootPath, '--force']; + const packageName = "prettier"; + const rootPath = resolve(__dirname, "./test-assets"); + const cliArgs = ["init", rootPath, "--force"]; const inputs = { - 'Do you like to install prettier to format generated configuration?': 'n\n', + "Do you like to install prettier to format generated configuration?": "n\n", }; - const logMessage = 'Generated configuration may not be properly formatted as prettier is not installed'; - const status = await runTestStdoutWithInput({ packageName, cliArgs, inputs, logMessage }); + const logMessage = + "Generated configuration may not be properly formatted as prettier is not installed"; + const status = await runTestStdoutWithInput({ + packageName, + cliArgs, + inputs, + logMessage, + }); rimraf.sync(rootPath); return status; }; module.exports.run = [prettierTest, prettierTestWithNoAnswer]; -module.exports.name = 'Missing prettier'; +module.exports.name = "Missing prettier"; diff --git a/smoketests/missing-packages/webpack-bundle-analyzer.test.js b/smoketests/missing-packages/webpack-bundle-analyzer.test.js index 29e5c74e9b8..6033e5fbfc2 100644 --- a/smoketests/missing-packages/webpack-bundle-analyzer.test.js +++ b/smoketests/missing-packages/webpack-bundle-analyzer.test.js @@ -1,14 +1,14 @@ -'use strict'; +"use strict"; -const { runTest } = require('../helpers'); +const { runTest } = require("../helpers"); const webpackBundleAnalyzerTest = () => { - const packageName = 'webpack-bundle-analyzer'; - const args = ['--analyze']; - const logMessage = 'It looks like webpack-bundle-analyzer is not installed.'; + const packageName = "webpack-bundle-analyzer"; + const args = ["--analyze"]; + const logMessage = "It looks like webpack-bundle-analyzer is not installed."; return runTest(packageName, args, logMessage); }; module.exports.run = [webpackBundleAnalyzerTest]; -module.exports.name = 'Missing webpack-bundle-analyzer'; +module.exports.name = "Missing webpack-bundle-analyzer"; diff --git a/smoketests/missing-packages/webpack-dev-server.test.js b/smoketests/missing-packages/webpack-dev-server.test.js index d4596cad1b9..e053a970a1d 100644 --- a/smoketests/missing-packages/webpack-dev-server.test.js +++ b/smoketests/missing-packages/webpack-dev-server.test.js @@ -1,22 +1,23 @@ -'use strict'; +"use strict"; -const { runTest, runTestStdout } = require('../helpers'); +const { runTest, runTestStdout } = require("../helpers"); const webpackDevServerTest = () => { - const packageName = 'webpack-dev-server'; - const args = ['serve']; - const logMessage = "For using 'serve' command you need to install: 'webpack-dev-server' package"; + const packageName = "webpack-dev-server"; + const args = ["serve"]; + const logMessage = + "For using 'serve' command you need to install: 'webpack-dev-server' package"; return runTest(packageName, args, logMessage); }; const webpackDevServerWithHelpTest = () => { - const packageName = 'webpack-dev-server'; - const cliArgs = ['help', 'serve']; + const packageName = "webpack-dev-server"; + const cliArgs = ["help", "serve"]; const logMessage = "To see all available options you need to install 'webpack-dev-server'"; return runTestStdout({ packageName, cliArgs, logMessage }); }; module.exports.run = [webpackDevServerTest, webpackDevServerWithHelpTest]; -module.exports.name = 'Missing webpack-dev-server'; +module.exports.name = "Missing webpack-dev-server"; diff --git a/smoketests/missing-packages/webpack.test.js b/smoketests/missing-packages/webpack.test.js index eda004c0972..3c8f0ecfaed 100644 --- a/smoketests/missing-packages/webpack.test.js +++ b/smoketests/missing-packages/webpack.test.js @@ -1,14 +1,14 @@ -'use strict'; +"use strict"; -const { runTest } = require('../helpers'); +const { runTest } = require("../helpers"); const webpackTest = () => { - const packageName = 'webpack'; + const packageName = "webpack"; const args = []; - const logMessage = 'It looks like webpack is not installed.'; + const logMessage = "It looks like webpack is not installed."; return runTest(packageName, args, logMessage); }; module.exports.run = [webpackTest]; -module.exports.name = 'Missing webpack'; +module.exports.name = "Missing webpack"; diff --git a/test/api/CLI.test.js b/test/api/CLI.test.js index 7c480374b84..b785fa4f90a 100644 --- a/test/api/CLI.test.js +++ b/test/api/CLI.test.js @@ -1,870 +1,884 @@ -const CLI = require('../../packages/webpack-cli/lib/webpack-cli'); +const CLI = require("../../packages/webpack-cli/lib/webpack-cli"); -describe('CLI API', () => { +describe("CLI API", () => { let cli; beforeEach(() => { cli = new CLI(); }); - describe('makeCommand', () => { - it('should make command', async (done) => { + describe("makeCommand", () => { + it("should make command", async () => { + expect.assertions(1); + cli.program.commands = []; - const command = await cli.makeCommand({ name: 'command' }, [], (options) => { + const command = await cli.makeCommand({ name: "command" }, [], (options) => { expect(options).toEqual({}); - - done(); }); - command.parseAsync([], { from: 'user' }); + command.parseAsync([], { from: "user" }); }); - it('should make command with Boolean option by default', async (done) => { + it("should make command with Boolean option by default", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'boolean', - description: 'description', + name: "boolean", + description: "description", }, ], (options) => { expect(options).toEqual({ boolean: true }); - - done(); }, ); - command.parseAsync(['--boolean'], { from: 'user' }); + command.parseAsync(["--boolean"], { from: "user" }); }); - it('should make command with Boolean option', async (done) => { + it("should make command with Boolean option", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'boolean', + name: "boolean", type: Boolean, - description: 'description', + description: "description", }, ], (options) => { expect(options).toEqual({ boolean: true }); - - done(); }, ); - command.parseAsync(['--boolean'], { from: 'user' }); + command.parseAsync(["--boolean"], { from: "user" }); }); - it('should make command with Boolean option and negative value', async (done) => { + it("should make command with Boolean option and negative value", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'boolean', + name: "boolean", type: Boolean, - description: 'description', + description: "description", negative: true, }, ], (options) => { expect(options).toEqual({ boolean: false }); - - done(); }, ); - command.parseAsync(['--no-boolean'], { from: 'user' }); + command.parseAsync(["--no-boolean"], { from: "user" }); }); - it('should make command with configs boolean option', async (done) => { + it("should make command with configs boolean option", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'configs-boolean', + name: "configs-boolean", configs: [ { - type: 'boolean', + type: "boolean", }, ], - description: 'description', + description: "description", }, ], (options) => { expect(options).toEqual({ configsBoolean: false }); - - done(); }, ); - command.parseAsync(['--no-configs-boolean'], { from: 'user' }); + command.parseAsync(["--no-configs-boolean"], { from: "user" }); }); - it('should make command with configs number option', async (done) => { + it("should make command with configs number option", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'configs-number', + name: "configs-number", configs: [ { - type: 'number', + type: "number", }, ], - description: 'description', + description: "description", }, ], (options) => { expect(options).toEqual({ configsNumber: 42 }); - - done(); }, ); - command.parseAsync(['--configs-number', '42'], { from: 'user' }); + command.parseAsync(["--configs-number", "42"], { from: "user" }); }); - it('should make command with configs string option', async (done) => { + it("should make command with configs string option", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'configs-string', + name: "configs-string", configs: [ { - type: 'string', + type: "string", }, ], - description: 'description', + description: "description", }, ], (options) => { - expect(options).toEqual({ configsString: 'foo' }); - - done(); + expect(options).toEqual({ configsString: "foo" }); }, ); - command.parseAsync(['--configs-string', 'foo'], { from: 'user' }); + command.parseAsync(["--configs-string", "foo"], { from: "user" }); }); - it('should make command with configs path option', async (done) => { + it("should make command with configs path option", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'configs-path', + name: "configs-path", configs: [ { - type: 'path', + type: "path", }, ], - description: 'description', + description: "description", }, ], (options) => { - expect(options).toEqual({ configsPath: '/root/foo' }); - - done(); + expect(options).toEqual({ configsPath: "/root/foo" }); }, ); - command.parseAsync(['--configs-path', '/root/foo'], { from: 'user' }); + command.parseAsync(["--configs-path", "/root/foo"], { + from: "user", + }); }); - it('should make command with configs RegExp option', async (done) => { + it("should make command with configs RegExp option", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'configs-regexp', + name: "configs-regexp", configs: [ { - type: 'RegExp', + type: "RegExp", }, ], - description: 'description', + description: "description", }, ], (options) => { - expect(options).toEqual({ configsRegexp: '\\w+' }); - - done(); + expect(options).toEqual({ configsRegexp: "\\w+" }); }, ); - command.parseAsync(['--configs-regexp', '\\w+'], { from: 'user' }); + command.parseAsync(["--configs-regexp", "\\w+"], { from: "user" }); }); - it('should make command with configs enum/string option', async (done) => { + it("should make command with configs enum/string option", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'enum-string', + name: "enum-string", configs: [ { - type: 'enum', - values: ['foo'], + type: "enum", + values: ["foo"], }, ], - description: 'description', + description: "description", }, ], (options) => { - expect(options).toEqual({ enumString: 'foo' }); - - done(); + expect(options).toEqual({ enumString: "foo" }); }, ); - command.parseAsync(['--enum-string', 'foo'], { from: 'user' }); + command.parseAsync(["--enum-string", "foo"], { from: "user" }); }); - it('should make command with configs enum/number option', async (done) => { + it("should make command with configs enum/number option", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'enum-number', + name: "enum-number", configs: [ { - type: 'enum', + type: "enum", values: [42], }, ], - description: 'description', + description: "description", }, ], (options) => { expect(options).toEqual({ enumNumber: 42 }); - - done(); }, ); - command.parseAsync(['--enum-number', '42'], { from: 'user' }); + command.parseAsync(["--enum-number", "42"], { from: "user" }); }); - it('should make command with configs enum/boolean option', async (done) => { + it("should make command with configs enum/boolean option", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'enum-boolean', + name: "enum-boolean", configs: [ { - type: 'boolean', + type: "boolean", values: [false], }, ], - description: 'description', + description: "description", }, ], (options) => { expect(options).toEqual({ enumBoolean: false }); - - done(); }, ); - command.parseAsync(['--no-enum-boolean'], { from: 'user' }); + command.parseAsync(["--no-enum-boolean"], { from: "user" }); }); - it('should make command with Boolean option and negative value #2', async (done) => { + it("should make command with Boolean option and negative value #2", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'boolean', + name: "boolean", type: Boolean, - description: 'description', + description: "description", negative: true, }, ], (options) => { expect(options).toEqual({ boolean: false }); - - done(); }, ); - command.parseAsync(['--boolean', '--no-boolean'], { from: 'user' }); + command.parseAsync(["--boolean", "--no-boolean"], { from: "user" }); }); - it('should make command with Boolean option and negative value #3', async (done) => { + it("should make command with Boolean option and negative value #3", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'boolean', + name: "boolean", type: Boolean, - description: 'description', + description: "description", negative: true, }, ], (options) => { expect(options).toEqual({ boolean: true }); - - done(); }, ); - command.parseAsync(['--no-boolean', '--boolean'], { from: 'user' }); + command.parseAsync(["--no-boolean", "--boolean"], { from: "user" }); }); - it('should make command with Boolean option with default value', async (done) => { + it("should make command with Boolean option with default value", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'boolean', + name: "boolean", type: Boolean, - description: 'description', + description: "description", defaultValue: false, }, ], (options) => { expect(options).toEqual({ boolean: false }); - - done(); }, ); - command.parseAsync([], { from: 'user' }); + command.parseAsync([], { from: "user" }); }); - it('should make command with String option', async (done) => { + it("should make command with String option", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'string', + name: "string", type: String, - description: 'description', + description: "description", }, ], (options) => { - expect(options).toEqual({ string: 'bar' }); - - done(); + expect(options).toEqual({ string: "bar" }); }, ); - command.parseAsync(['--string', 'bar'], { from: 'user' }); + command.parseAsync(["--string", "bar"], { from: "user" }); }); - it('should make command with String option with alias', async (done) => { + it("should make command with String option with alias", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'string', - alias: 's', + name: "string", + alias: "s", type: String, - description: 'description', + description: "description", }, ], (options) => { - expect(options).toEqual({ string: 'foo' }); - - done(); + expect(options).toEqual({ string: "foo" }); }, ); - command.parseAsync(['-s', 'foo'], { from: 'user' }); + command.parseAsync(["-s", "foo"], { from: "user" }); }); - it('should make command with String option with default value', async (done) => { + it("should make command with String option with default value", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'string', + name: "string", type: String, - description: 'description', - defaultValue: 'default-value', + description: "description", + defaultValue: "default-value", }, ], (options) => { - expect(options).toEqual({ string: 'default-value' }); - - done(); + expect(options).toEqual({ string: "default-value" }); }, ); - command.parseAsync([], { from: 'user' }); + command.parseAsync([], { from: "user" }); }); - it('should make command with String option with default value #2', async (done) => { + it("should make command with String option with default value #2", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'string', + name: "string", type: String, - description: 'description', - defaultValue: 'default-value', + description: "description", + defaultValue: "default-value", }, ], (options) => { - expect(options).toEqual({ string: 'foo' }); - - done(); + expect(options).toEqual({ string: "foo" }); }, ); - command.parseAsync(['--string', 'foo'], { from: 'user' }); + command.parseAsync(["--string", "foo"], { from: "user" }); }); - it('should make command with String option using "=" syntax', async (done) => { + it('should make command with String option using "=" syntax', async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'string', + name: "string", type: String, - description: 'description', + description: "description", }, ], (options) => { - expect(options).toEqual({ string: 'bar' }); - - done(); + expect(options).toEqual({ string: "bar" }); }, ); - command.parseAsync(['--string=bar'], { from: 'user' }); + command.parseAsync(["--string=bar"], { from: "user" }); }); - it('should make command with multiple String option', async (done) => { + it("should make command with multiple String option", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'string', + name: "string", multiple: true, type: String, - description: 'description', + description: "description", }, ], (options) => { - expect(options).toEqual({ string: ['foo', 'bar'] }); - - done(); + expect(options).toEqual({ string: ["foo", "bar"] }); }, ); - command.parseAsync(['--string', 'foo', 'bar'], { from: 'user' }); + command.parseAsync(["--string", "foo", "bar"], { from: "user" }); }); - it('should make command with multiple String option with default value', async (done) => { + it("should make command with multiple String option with default value", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'string', + name: "string", multiple: true, type: String, - description: 'description', - defaultValue: 'string', + description: "description", + defaultValue: "string", }, ], (options) => { - expect(options).toEqual({ string: 'string' }); - - done(); + expect(options).toEqual({ string: "string" }); }, ); - command.parseAsync([], { from: 'user' }); + command.parseAsync([], { from: "user" }); }); - it('should make command with multiple String option with default value #2', async (done) => { + it("should make command with multiple String option with default value #2", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'string', + name: "string", multiple: true, type: String, - description: 'description', - defaultValue: 'string', + description: "description", + defaultValue: "string", }, ], (options) => { - expect(options).toEqual({ string: ['foo', 'bar'] }); - - done(); + expect(options).toEqual({ string: ["foo", "bar"] }); }, ); - command.parseAsync(['--string', 'foo', '--string', 'bar'], { from: 'user' }); + command.parseAsync(["--string", "foo", "--string", "bar"], { + from: "user", + }); }); - it('should make command with multiple String option #2', async (done) => { + it("should make command with multiple String option #2", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'string', + name: "string", multiple: true, type: String, - description: 'description', + description: "description", }, ], (options) => { - expect(options).toEqual({ string: ['foo', 'bar'] }); - - done(); + expect(options).toEqual({ string: ["foo", "bar"] }); }, ); - command.parseAsync(['--string', 'foo', '--string', 'bar'], { from: 'user' }); + command.parseAsync(["--string", "foo", "--string", "bar"], { + from: "user", + }); }); - it('should make command with Number option', async (done) => { + it("should make command with Number option", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'number', + name: "number", type: Number, - description: 'description', + description: "description", }, ], (options) => { expect(options).toEqual({ number: 12 }); - - done(); }, ); - command.parseAsync(['--number', '12'], { from: 'user' }); + command.parseAsync(["--number", "12"], { from: "user" }); }); - it('should make command with Number option with default value', async (done) => { + it("should make command with Number option with default value", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'number', + name: "number", type: Number, - description: 'description', + description: "description", defaultValue: 20, }, ], (options) => { expect(options).toEqual({ number: 20 }); - - done(); }, ); - command.parseAsync([], { from: 'user' }); + command.parseAsync([], { from: "user" }); }); - it('should make command with multiple Number option', async (done) => { + it("should make command with multiple Number option", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'number', + name: "number", multiple: true, type: Number, - description: 'description', + description: "description", }, ], (options) => { expect(options).toEqual({ number: [1, 2] }); - - done(); }, ); - command.parseAsync(['--number', '1', '--number', '2'], { from: 'user' }); + command.parseAsync(["--number", "1", "--number", "2"], { + from: "user", + }); }); - it('should make command with multiple Number option and default value', async (done) => { + it("should make command with multiple Number option and default value", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'number', + name: "number", multiple: true, type: Number, - description: 'description', + description: "description", defaultValue: 50, }, ], (options) => { expect(options).toEqual({ number: [1, 2] }); - - done(); }, ); - command.parseAsync(['--number', '1', '--number', '2'], { from: 'user' }); + command.parseAsync(["--number", "1", "--number", "2"], { + from: "user", + }); }); - it('should make command with multiple Number option and default value', async (done) => { + it("should make command with multiple Number option and default value", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'number', + name: "number", multiple: true, type: Number, - description: 'description', + description: "description", defaultValue: 50, }, ], (options) => { expect(options).toEqual({ number: 50 }); - - done(); }, ); - command.parseAsync([], { from: 'user' }); + command.parseAsync([], { from: "user" }); }); - it('should make command with custom function type', async (done) => { + it("should make command with custom function type", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'custom', + name: "custom", type: () => { - return 'function'; + return "function"; }, - description: 'description', + description: "description", }, ], (options) => { - expect(options).toEqual({ custom: 'function' }); - - done(); + expect(options).toEqual({ custom: "function" }); }, ); - command.parseAsync(['--custom', 'value'], { from: 'user' }); + command.parseAsync(["--custom", "value"], { from: "user" }); }); - it('should make command with custom function type and default value', async (done) => { + it("should make command with custom function type and default value", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'custom', + name: "custom", type: () => { - return 'function'; + return "function"; }, - description: 'description', - defaultValue: 'default', + description: "description", + defaultValue: "default", }, ], (options) => { - expect(options).toEqual({ custom: 'default' }); - - done(); + expect(options).toEqual({ custom: "default" }); }, ); - command.parseAsync([], { from: 'user' }); + command.parseAsync([], { from: "user" }); }); - it('should make command with multiple custom function type', async (done) => { + it("should make command with multiple custom function type", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'custom', + name: "custom", type: (value, previous = []) => { return previous.concat([value]); }, - description: 'description', + description: "description", multiple: true, }, ], (options) => { - expect(options).toEqual({ custom: ['value', 'other'] }); - - done(); + expect(options).toEqual({ custom: ["value", "other"] }); }, ); - command.parseAsync(['--custom', 'value', '--custom', 'other'], { from: 'user' }); + command.parseAsync(["--custom", "value", "--custom", "other"], { + from: "user", + }); }); - it('should make command with multiple custom function type and default value', async (done) => { + it("should make command with multiple custom function type and default value", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'custom', + name: "custom", type: (value, previous = []) => { return previous.concat([value]); }, - description: 'description', + description: "description", multiple: true, defaultValue: 50, }, ], (options) => { expect(options).toEqual({ custom: 50 }); - - done(); }, ); - command.parseAsync([], { from: 'user' }); + command.parseAsync([], { from: "user" }); }); - it('should make command with multiple custom function type and default value #2', async (done) => { + it("should make command with multiple custom function type and default value #2", async () => { + expect.assertions(1); + cli.program.commands = []; let skipDefault = true; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'custom', + name: "custom", type: (value, previous = []) => { if (skipDefault) { previous = []; @@ -873,689 +887,816 @@ describe('CLI API', () => { return [].concat(previous).concat([value]); }, - description: 'description', + description: "description", multiple: true, defaultValue: 50, }, ], (options) => { - expect(options).toEqual({ custom: ['foo'] }); - - done(); + expect(options).toEqual({ custom: ["foo"] }); }, ); - command.parseAsync(['--custom', 'foo'], { from: 'user' }); + command.parseAsync(["--custom", "foo"], { from: "user" }); }); - it('should make command with Boolean and String option', async (done) => { + it("should make command with Boolean and String option", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'boolean-and-string', + name: "boolean-and-string", type: [Boolean, String], - description: 'description', + description: "description", }, ], (options) => { expect(options).toEqual({ booleanAndString: true }); - - done(); }, ); - command.parseAsync(['--boolean-and-string'], { from: 'user' }); + command.parseAsync(["--boolean-and-string"], { from: "user" }); }); - it('should make command with Boolean and String option #2', async (done) => { + it("should make command with Boolean and String option #2", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'boolean-and-string', + name: "boolean-and-string", type: [Boolean, String], - description: 'description', + description: "description", }, ], (options) => { - expect(options).toEqual({ booleanAndString: 'value' }); - - done(); + expect(options).toEqual({ booleanAndString: "value" }); }, ); - command.parseAsync(['--boolean-and-string', 'value'], { from: 'user' }); + command.parseAsync(["--boolean-and-string", "value"], { + from: "user", + }); }); - it('should make command with multiple Boolean and String option', async (done) => { + it("should make command with multiple Boolean and String option", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'boolean-and-string', + name: "boolean-and-string", type: [Boolean, String], - description: 'description', + description: "description", multiple: true, }, ], (options) => { expect(options).toEqual({ booleanAndString: true }); - - done(); }, ); - command.parseAsync(['--boolean-and-string'], { from: 'user' }); + command.parseAsync(["--boolean-and-string"], { from: "user" }); }); - it('should make command with multiple Boolean and String option #2', async (done) => { + it("should make command with multiple Boolean and String option #2", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'boolean-and-string', + name: "boolean-and-string", type: [Boolean, String], - description: 'description', + description: "description", multiple: true, }, ], (options) => { - expect(options).toEqual({ booleanAndString: ['bar', 'baz'] }); - - done(); + expect(options).toEqual({ + booleanAndString: ["bar", "baz"], + }); }, ); - command.parseAsync(['--boolean-and-string', 'bar', '--boolean-and-string', 'baz'], { from: 'user' }); + command.parseAsync(["--boolean-and-string", "bar", "--boolean-and-string", "baz"], { + from: "user", + }); }); - it('should make command with Boolean and String option and negative', async (done) => { + it("should make command with Boolean and String option and negative", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'boolean-and-string', + name: "boolean-and-string", type: [Boolean, String], - description: 'description', + description: "description", negative: true, }, ], (options) => { expect(options).toEqual({ booleanAndString: true }); - - done(); }, ); - command.parseAsync(['--boolean-and-string'], { from: 'user' }); + command.parseAsync(["--boolean-and-string"], { from: "user" }); }); - it('should make command with Boolean and String option and negative #2', async (done) => { + it("should make command with Boolean and String option and negative #2", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'boolean-and-string', + name: "boolean-and-string", type: [Boolean, String], - description: 'description', + description: "description", negative: true, }, ], (options) => { - expect(options).toEqual({ booleanAndString: 'foo' }); - - done(); + expect(options).toEqual({ booleanAndString: "foo" }); }, ); - command.parseAsync(['--boolean-and-string', 'foo'], { from: 'user' }); + command.parseAsync(["--boolean-and-string", "foo"], { + from: "user", + }); }); - it('should make command with Boolean and String option and negative #3', async (done) => { + it("should make command with Boolean and String option and negative #3", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'boolean-and-string', + name: "boolean-and-string", type: [Boolean, String], - description: 'description', + description: "description", negative: true, }, ], (options) => { expect(options).toEqual({ booleanAndString: false }); - - done(); }, ); - command.parseAsync(['--no-boolean-and-string'], { from: 'user' }); + command.parseAsync(["--no-boolean-and-string"], { from: "user" }); }); - it('should make command with Boolean and Number option', async (done) => { + it("should make command with Boolean and Number option", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'boolean-and-number', + name: "boolean-and-number", type: [Boolean, Number], - description: 'description', + description: "description", }, ], (options) => { expect(options).toEqual({ booleanAndNumber: true }); - - done(); }, ); - command.parseAsync(['--boolean-and-number'], { from: 'user' }); + command.parseAsync(["--boolean-and-number"], { from: "user" }); }); - it('should make command with Boolean and Number option #2', async (done) => { + it("should make command with Boolean and Number option #2", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'boolean-and-number', + name: "boolean-and-number", type: [Boolean, Number], - description: 'description', + description: "description", }, ], (options) => { expect(options).toEqual({ booleanAndNumber: 12 }); - - done(); }, ); - command.parseAsync(['--boolean-and-number', '12'], { from: 'user' }); + command.parseAsync(["--boolean-and-number", "12"], { + from: "user", + }); }); - it('should make command with array Boolean type', async (done) => { + it("should make command with array Boolean type", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'boolean', + name: "boolean", type: [Boolean], - description: 'description', + description: "description", }, ], (options) => { expect(options).toEqual({ boolean: true }); - - done(); }, ); - command.parseAsync(['--boolean'], { from: 'user' }); + command.parseAsync(["--boolean"], { from: "user" }); }); - it('should make command with Boolean and Number and String type', async (done) => { + it("should make command with Boolean and Number and String type", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'boolean-and-number-and-string', + name: "boolean-and-number-and-string", type: [Boolean, Number, String], - description: 'description', + description: "description", }, ], (options) => { - expect(options).toEqual({ booleanAndNumberAndString: true }); - - done(); + expect(options).toEqual({ + booleanAndNumberAndString: true, + }); }, ); - command.parseAsync(['--boolean-and-number-and-string'], { from: 'user' }); + command.parseAsync(["--boolean-and-number-and-string"], { + from: "user", + }); }); - it('should make command with Boolean and Number and String type #2', async (done) => { + it("should make command with Boolean and Number and String type #2", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'boolean-and-number-and-string', + name: "boolean-and-number-and-string", type: [Boolean, Number, String], - description: 'description', + description: "description", }, ], (options) => { expect(options).toEqual({ booleanAndNumberAndString: 12 }); - - done(); }, ); - command.parseAsync(['--boolean-and-number-and-string', '12'], { from: 'user' }); + command.parseAsync(["--boolean-and-number-and-string", "12"], { + from: "user", + }); }); - it('should make command with Boolean and Number and String type #3', async (done) => { + it("should make command with Boolean and Number and String type #3", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'boolean-and-number-and-string', + name: "boolean-and-number-and-string", type: [Boolean, Number, String], - description: 'description', + description: "description", }, ], (options) => { - expect(options).toEqual({ booleanAndNumberAndString: 'bar' }); - - done(); + expect(options).toEqual({ + booleanAndNumberAndString: "bar", + }); }, ); - command.parseAsync(['--boolean-and-number-and-string', 'bar'], { from: 'user' }); + command.parseAsync(["--boolean-and-number-and-string", "bar"], { + from: "user", + }); }); - it('should make command with Boolean and Number and String type and default value', async (done) => { + it("should make command with Boolean and Number and String type and default value", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'boolean-and-number-and-string', + name: "boolean-and-number-and-string", type: [Boolean, Number, String], - description: 'description', - defaultValue: 'default', + description: "description", + defaultValue: "default", }, ], (options) => { - expect(options).toEqual({ booleanAndNumberAndString: 'default' }); - - done(); + expect(options).toEqual({ + booleanAndNumberAndString: "default", + }); }, ); - command.parseAsync([], { from: 'user' }); + command.parseAsync([], { from: "user" }); }); - it('should make command with Boolean and Number and String type and default value #2', async (done) => { + it("should make command with Boolean and Number and String type and default value #2", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'boolean-and-number-and-string', + name: "boolean-and-number-and-string", type: [Boolean, Number, String], - description: 'description', - defaultValue: 'default', + description: "description", + defaultValue: "default", }, ], (options) => { - expect(options).toEqual({ booleanAndNumberAndString: 'foo' }); - - done(); + expect(options).toEqual({ + booleanAndNumberAndString: "foo", + }); }, ); - command.parseAsync(['--boolean-and-number-and-string', 'foo'], { from: 'user' }); + command.parseAsync(["--boolean-and-number-and-string", "foo"], { + from: "user", + }); }); - it('should make command with Boolean and Number and String type and default value #3', async (done) => { + it("should make command with Boolean and Number and String type and default value #3", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'boolean-and-number-and-string', + name: "boolean-and-number-and-string", type: [Boolean, Number, String], - description: 'description', - defaultValue: 'default', + description: "description", + defaultValue: "default", }, ], (options) => { expect(options).toEqual({ booleanAndNumberAndString: 12 }); - - done(); }, ); - command.parseAsync(['--boolean-and-number-and-string', '12'], { from: 'user' }); + command.parseAsync(["--boolean-and-number-and-string", "12"], { + from: "user", + }); }); - it('should make command with Boolean and Number and String type and default value #4', async (done) => { + it("should make command with Boolean and Number and String type and default value #4", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'boolean-and-number-and-string', + name: "boolean-and-number-and-string", type: [Boolean, Number, String], - description: 'description', - defaultValue: 'default', + description: "description", + defaultValue: "default", }, ], (options) => { - expect(options).toEqual({ booleanAndNumberAndString: 'default' }); - - done(); + expect(options).toEqual({ + booleanAndNumberAndString: "default", + }); }, ); - command.parseAsync(['--boolean-and-number-and-string'], { from: 'user' }); + command.parseAsync(["--boolean-and-number-and-string"], { + from: "user", + }); }); - it('should make command with multiple Boolean and Number and String type', async (done) => { + it("should make command with multiple Boolean and Number and String type", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'boolean-and-number-and-string', + name: "boolean-and-number-and-string", type: [Boolean, Number, String], - description: 'description', + description: "description", multiple: true, }, ], (options) => { - expect(options).toEqual({ booleanAndNumberAndString: true }); - - done(); + expect(options).toEqual({ + booleanAndNumberAndString: true, + }); }, ); - command.parseAsync(['--boolean-and-number-and-string'], { from: 'user' }); + command.parseAsync(["--boolean-and-number-and-string"], { + from: "user", + }); }); - it('should make command with multiple Boolean and Number and String type #2', async (done) => { + it("should make command with multiple Boolean and Number and String type #2", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'boolean-and-number-and-string', + name: "boolean-and-number-and-string", type: [Boolean, Number, String], - description: 'description', + description: "description", multiple: true, }, ], (options) => { - expect(options).toEqual({ booleanAndNumberAndString: ['foo'] }); - - done(); + expect(options).toEqual({ + booleanAndNumberAndString: ["foo"], + }); }, ); - command.parseAsync(['--boolean-and-number-and-string', 'foo'], { from: 'user' }); + command.parseAsync(["--boolean-and-number-and-string", "foo"], { + from: "user", + }); }); - it('should make command with multiple Boolean and Number and String type #3', async (done) => { + it("should make command with multiple Boolean and Number and String type #3", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'boolean-and-number-and-string', + name: "boolean-and-number-and-string", type: [Boolean, Number, String], - description: 'description', + description: "description", multiple: true, }, ], (options) => { - expect(options).toEqual({ booleanAndNumberAndString: [12] }); - - done(); + expect(options).toEqual({ + booleanAndNumberAndString: [12], + }); }, ); - command.parseAsync(['--boolean-and-number-and-string', '12'], { from: 'user' }); + command.parseAsync(["--boolean-and-number-and-string", "12"], { + from: "user", + }); }); - it('should make command with multiple Boolean and Number and String type #4', async (done) => { + it("should make command with multiple Boolean and Number and String type #4", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'boolean-and-number-and-string', + name: "boolean-and-number-and-string", type: [Boolean, Number, String], - description: 'description', + description: "description", multiple: true, }, ], (options) => { - expect(options).toEqual({ booleanAndNumberAndString: ['foo', 'bar'] }); - - done(); + expect(options).toEqual({ + booleanAndNumberAndString: ["foo", "bar"], + }); }, ); - command.parseAsync(['--boolean-and-number-and-string', 'foo', '--boolean-and-number-and-string', 'bar'], { from: 'user' }); + command.parseAsync( + [ + "--boolean-and-number-and-string", + "foo", + "--boolean-and-number-and-string", + "bar", + ], + { from: "user" }, + ); }); - it('should make command with multiple Boolean and Number and String type #5', async (done) => { + it("should make command with multiple Boolean and Number and String type #5", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'boolean-and-number-and-string', + name: "boolean-and-number-and-string", type: [Boolean, Number, String], - description: 'description', + description: "description", multiple: true, }, ], (options) => { - expect(options).toEqual({ booleanAndNumberAndString: ['foo', 12] }); - - done(); + expect(options).toEqual({ + booleanAndNumberAndString: ["foo", 12], + }); }, ); - command.parseAsync(['--boolean-and-number-and-string', 'foo', '--boolean-and-number-and-string', '12'], { from: 'user' }); + command.parseAsync( + ["--boolean-and-number-and-string", "foo", "--boolean-and-number-and-string", "12"], + { from: "user" }, + ); }); - it('should make command with multiple Boolean and Number and String and default value', async (done) => { + it("should make command with multiple Boolean and Number and String and default value", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'boolean-and-number-and-string', + name: "boolean-and-number-and-string", type: [Boolean, Number, String], - description: 'description', + description: "description", multiple: true, - defaultValue: 'default', + defaultValue: "default", }, ], (options) => { - expect(options).toEqual({ booleanAndNumberAndString: 'default' }); - - done(); + expect(options).toEqual({ + booleanAndNumberAndString: "default", + }); }, ); - command.parseAsync([], { from: 'user' }); + command.parseAsync([], { from: "user" }); }); - it('should make command with multiple Boolean and Number and String and default value #2', async (done) => { + it("should make command with multiple Boolean and Number and String and default value #2", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'boolean-and-number-and-string', + name: "boolean-and-number-and-string", type: [Boolean, Number, String], - description: 'description', + description: "description", multiple: true, - defaultValue: 'default', + defaultValue: "default", }, ], (options) => { - expect(options).toEqual({ booleanAndNumberAndString: ['foo'] }); - - done(); + expect(options).toEqual({ + booleanAndNumberAndString: ["foo"], + }); }, ); - command.parseAsync(['--boolean-and-number-and-string', 'foo'], { from: 'user' }); + command.parseAsync(["--boolean-and-number-and-string", "foo"], { + from: "user", + }); }); - it('should make command with multiple Boolean and Number and String and default value #3', async (done) => { + it("should make command with multiple Boolean and Number and String and default value #3", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'boolean-and-number-and-string', + name: "boolean-and-number-and-string", type: [Boolean, Number, String], - description: 'description', + description: "description", multiple: true, - defaultValue: 'default', + defaultValue: "default", }, ], (options) => { - expect(options).toEqual({ booleanAndNumberAndString: [12] }); - - done(); + expect(options).toEqual({ + booleanAndNumberAndString: [12], + }); }, ); - command.parseAsync(['--boolean-and-number-and-string', '12'], { from: 'user' }); + command.parseAsync(["--boolean-and-number-and-string", "12"], { + from: "user", + }); }); - it('should make command with multiple Boolean and Number and String and default value #4', async (done) => { + it("should make command with multiple Boolean and Number and String and default value #4", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'boolean-and-number-and-string', + name: "boolean-and-number-and-string", type: [Boolean, Number, String], - description: 'description', + description: "description", multiple: true, - defaultValue: 'default', + defaultValue: "default", }, ], (options) => { - expect(options).toEqual({ booleanAndNumberAndString: ['foo', 12] }); - - done(); + expect(options).toEqual({ + booleanAndNumberAndString: ["foo", 12], + }); }, ); - command.parseAsync(['--boolean-and-number-and-string', 'foo', '--boolean-and-number-and-string', '12'], { from: 'user' }); + command.parseAsync( + ["--boolean-and-number-and-string", "foo", "--boolean-and-number-and-string", "12"], + { from: "user" }, + ); }); - it('should make command with array of unknown types', async (done) => { + it("should make command with array of unknown types", async () => { + expect.assertions(1); + cli.program.commands = []; const command = await cli.makeCommand( { - name: 'command', + name: "command", }, [ { - name: 'unknown', + name: "unknown", type: [Boolean, Symbol], - description: 'description', + description: "description", + }, + ], + (options) => { + expect(options).toEqual({ unknown: "foo" }); + }, + ); + + command.parseAsync(["--unknown", "foo"], { from: "user" }); + }); + + it("should make command with Boolean option and use description", async () => { + expect.assertions(2); + + cli.program.commands = []; + + const command = await cli.makeCommand( + { + name: "command", + }, + [ + { + name: "boolean", + type: Boolean, + description: "Description", + negatedDescription: "Negated description", }, ], (options) => { - expect(options).toEqual({ unknown: 'foo' }); + expect(options).toEqual({ boolean: true }); + }, + ); + + command.parseAsync(["--boolean"], { from: "user" }); - done(); + expect(command.helpInformation()).toContain("--boolean Description"); + }); + + it("should make command with Boolean option and negative value and use negatedDescription", async () => { + expect.assertions(2); + + cli.program.commands = []; + + const command = await cli.makeCommand( + { + name: "command", + }, + [ + { + name: "boolean", + type: Boolean, + description: "description", + negative: true, + negatedDescription: "Negated description", + }, + ], + (options) => { + expect(options).toEqual({ boolean: false }); }, ); - command.parseAsync(['--unknown', 'foo'], { from: 'user' }); + command.parseAsync(["--no-boolean"], { from: "user" }); + + expect(command.helpInformation()).toContain("--no-boolean Negated description"); }); }); }); diff --git a/test/api/capitalizeFirstLetter.test.js b/test/api/capitalizeFirstLetter.test.js index 13bb7f2137b..bff15eeb923 100755 --- a/test/api/capitalizeFirstLetter.test.js +++ b/test/api/capitalizeFirstLetter.test.js @@ -1,11 +1,11 @@ -const capitalizeFirstLetter = require('../../packages/webpack-cli/lib/utils/capitalize-first-letter'); +const capitalizeFirstLetter = require("../../packages/webpack-cli/lib/utils/capitalize-first-letter"); -describe('capitalizeFirstLetter', () => { - it('should capitalize first letter', () => { - expect(capitalizeFirstLetter('webpack')).toEqual('Webpack'); +describe("capitalizeFirstLetter", () => { + it("should capitalize first letter", () => { + expect(capitalizeFirstLetter("webpack")).toEqual("Webpack"); }); - it('should return an empty string on passing a non-string value', () => { - expect(capitalizeFirstLetter(true)).toEqual(''); + it("should return an empty string on passing a non-string value", () => { + expect(capitalizeFirstLetter(true)).toEqual(""); }); }); diff --git a/test/api/get-package-manager.test.js b/test/api/get-package-manager.test.js index 1c3d03af5ed..d790ec0fc57 100644 --- a/test/api/get-package-manager.test.js +++ b/test/api/get-package-manager.test.js @@ -1,34 +1,34 @@ -const fs = require('fs'); -const path = require('path'); +const fs = require("fs"); +const path = require("path"); const syncMock = jest.fn(() => { return { - stdout: '1.0.0', + stdout: "1.0.0", }; }); -jest.setMock('execa', { +jest.setMock("execa", { sync: syncMock, }); -const utilsDirectory = path.resolve(__dirname, '../../packages/webpack-cli/lib/utils/'); -const getPackageManager = require(path.resolve(utilsDirectory, './get-package-manager')); +const utilsDirectory = path.resolve(__dirname, "../../packages/webpack-cli/lib/utils/"); +const getPackageManager = require(path.resolve(utilsDirectory, "./get-package-manager")); -jest.mock(path.resolve(utilsDirectory, './get-package-manager'), () => jest.fn()); -const globalModulesNpmValue = 'test-npm'; -jest.setMock('global-modules', globalModulesNpmValue); -jest.setMock(path.resolve(utilsDirectory, './prompt'), jest.fn()); +jest.mock(path.resolve(utilsDirectory, "./get-package-manager"), () => jest.fn()); +const globalModulesNpmValue = "test-npm"; +jest.setMock("global-modules", globalModulesNpmValue); +jest.setMock(path.resolve(utilsDirectory, "./prompt"), jest.fn()); -describe('packageUtils', () => { - describe('getPackageManager', () => { - const testYarnLockPath = path.resolve(__dirname, 'test-yarn-lock'); - const testNpmLockPath = path.resolve(__dirname, 'test-npm-lock'); - const testPnpmLockPath = path.resolve(__dirname, 'test-pnpm-lock'); - const testNpmAndPnpmPath = path.resolve(__dirname, 'test-npm-and-pnpm'); - const testNpmAndYarnPath = path.resolve(__dirname, 'test-npm-and-yarn'); - const testYarnAndPnpmPath = path.resolve(__dirname, 'test-yarn-and-pnpm'); - const testAllPath = path.resolve(__dirname, 'test-all-lock'); - const noLockPath = path.resolve(__dirname, 'no-lock-files'); +describe("packageUtils", () => { + describe("getPackageManager", () => { + const testYarnLockPath = path.resolve(__dirname, "test-yarn-lock"); + const testNpmLockPath = path.resolve(__dirname, "test-npm-lock"); + const testPnpmLockPath = path.resolve(__dirname, "test-pnpm-lock"); + const testNpmAndPnpmPath = path.resolve(__dirname, "test-npm-and-pnpm"); + const testNpmAndYarnPath = path.resolve(__dirname, "test-npm-and-yarn"); + const testYarnAndPnpmPath = path.resolve(__dirname, "test-yarn-and-pnpm"); + const testAllPath = path.resolve(__dirname, "test-all-lock"); + const noLockPath = path.resolve(__dirname, "no-lock-files"); - const cwdSpy = jest.spyOn(process, 'cwd'); + const cwdSpy = jest.spyOn(process, "cwd"); beforeAll(() => { // package-lock.json is ignored by .gitignore, so we simply @@ -36,71 +36,71 @@ describe('packageUtils', () => { if (!fs.existsSync(testNpmLockPath)) { fs.mkdirSync(testNpmLockPath); } - fs.writeFileSync(path.resolve(testNpmLockPath, 'package-lock.json'), ''); - fs.writeFileSync(path.resolve(testNpmAndPnpmPath, 'package-lock.json'), ''); - fs.writeFileSync(path.resolve(testNpmAndYarnPath, 'package-lock.json'), ''); - fs.writeFileSync(path.resolve(testAllPath, 'package-lock.json'), ''); + fs.writeFileSync(path.resolve(testNpmLockPath, "package-lock.json"), ""); + fs.writeFileSync(path.resolve(testNpmAndPnpmPath, "package-lock.json"), ""); + fs.writeFileSync(path.resolve(testNpmAndYarnPath, "package-lock.json"), ""); + fs.writeFileSync(path.resolve(testAllPath, "package-lock.json"), ""); }); beforeEach(() => { syncMock.mockClear(); }); - it('should find yarn.lock', () => { + it("should find yarn.lock", () => { cwdSpy.mockReturnValue(testYarnLockPath); - expect(getPackageManager()).toEqual('yarn'); + expect(getPackageManager()).toEqual("yarn"); expect(syncMock.mock.calls.length).toEqual(0); }); - it('should find package-lock.json', () => { + it("should find package-lock.json", () => { cwdSpy.mockReturnValue(testNpmLockPath); - expect(getPackageManager()).toEqual('npm'); + expect(getPackageManager()).toEqual("npm"); expect(syncMock.mock.calls.length).toEqual(0); }); - it('should find pnpm-lock.yaml', () => { + it("should find pnpm-lock.yaml", () => { cwdSpy.mockReturnValue(testPnpmLockPath); - expect(getPackageManager()).toEqual('pnpm'); + expect(getPackageManager()).toEqual("pnpm"); expect(syncMock.mock.calls.length).toEqual(0); }); - it('should prioritize npm over pnpm', () => { + it("should prioritize npm over pnpm", () => { cwdSpy.mockReturnValue(testNpmAndPnpmPath); - expect(getPackageManager()).toEqual('npm'); + expect(getPackageManager()).toEqual("npm"); expect(syncMock.mock.calls.length).toEqual(0); }); - it('should prioritize npm over yarn', () => { + it("should prioritize npm over yarn", () => { cwdSpy.mockReturnValue(testNpmAndYarnPath); - expect(getPackageManager()).toEqual('npm'); + expect(getPackageManager()).toEqual("npm"); expect(syncMock.mock.calls.length).toEqual(0); }); - it('should prioritize yarn over pnpm', () => { + it("should prioritize yarn over pnpm", () => { cwdSpy.mockReturnValue(testYarnAndPnpmPath); - expect(getPackageManager()).toEqual('yarn'); + expect(getPackageManager()).toEqual("yarn"); expect(syncMock.mock.calls.length).toEqual(0); }); - it('should prioritize npm with many lock files', () => { + it("should prioritize npm with many lock files", () => { cwdSpy.mockReturnValue(testAllPath); - expect(getPackageManager()).toEqual('npm'); + expect(getPackageManager()).toEqual("npm"); expect(syncMock.mock.calls.length).toEqual(0); }); - it('should prioritize global npm over other package managers', () => { + it("should prioritize global npm over other package managers", () => { cwdSpy.mockReturnValue(noLockPath); - expect(getPackageManager()).toEqual('npm'); + expect(getPackageManager()).toEqual("npm"); expect(syncMock.mock.calls.length).toEqual(1); }); - it('should throw error if no package manager is found', () => { + it("should throw error if no package manager is found", () => { syncMock.mockImplementation(() => { throw new Error(); }); - const mockExit = jest.spyOn(process, 'exit').mockImplementation(() => {}); + const mockExit = jest.spyOn(process, "exit").mockImplementation(() => {}); // Do not print warning in CI - const consoleMock = jest.spyOn(console, 'error').mockImplementation(() => {}); + const consoleMock = jest.spyOn(console, "error").mockImplementation(() => {}); expect(getPackageManager()).toBeFalsy(); expect(mockExit).toBeCalledWith(2); expect(consoleMock).toHaveBeenCalledTimes(1); diff --git a/test/api/prompt-installation.test.js b/test/api/prompt-installation.test.js index 666b218fc0f..691b8b123b8 100644 --- a/test/api/prompt-installation.test.js +++ b/test/api/prompt-installation.test.js @@ -1,25 +1,25 @@ -'use strict'; +"use strict"; -const path = require('path'); +const path = require("path"); // eslint-disable-next-line node/no-unpublished-require -const stripAnsi = require('strip-ansi'); -const globalModulesNpmValue = 'test-npm'; -const utilsDirectory = path.resolve(__dirname, '../../packages/webpack-cli/lib/utils/'); - -jest.setMock('global-modules', globalModulesNpmValue); -jest.setMock(path.resolve(utilsDirectory, './prompt'), jest.fn()); -jest.setMock(path.resolve(utilsDirectory, './run-command'), jest.fn()); -jest.setMock(path.resolve(utilsDirectory, './package-exists'), jest.fn()); -jest.setMock(path.resolve(utilsDirectory, './get-package-manager'), jest.fn()); - -const getPackageManager = require(path.resolve(utilsDirectory, './get-package-manager')); -const packageExists = require(path.resolve(utilsDirectory, './package-exists')); -const promptInstallation = require(path.resolve(utilsDirectory, './prompt-installation')); -const runCommand = require(path.resolve(utilsDirectory, './run-command')); -const prompt = require(path.resolve(utilsDirectory, './prompt')); - -describe('promptInstallation', () => { +const stripAnsi = require("strip-ansi"); +const globalModulesNpmValue = "test-npm"; +const utilsDirectory = path.resolve(__dirname, "../../packages/webpack-cli/lib/utils/"); + +jest.setMock("global-modules", globalModulesNpmValue); +jest.setMock(path.resolve(utilsDirectory, "./prompt"), jest.fn()); +jest.setMock(path.resolve(utilsDirectory, "./run-command"), jest.fn()); +jest.setMock(path.resolve(utilsDirectory, "./package-exists"), jest.fn()); +jest.setMock(path.resolve(utilsDirectory, "./get-package-manager"), jest.fn()); + +const getPackageManager = require(path.resolve(utilsDirectory, "./get-package-manager")); +const packageExists = require(path.resolve(utilsDirectory, "./package-exists")); +const promptInstallation = require(path.resolve(utilsDirectory, "./prompt-installation")); +const runCommand = require(path.resolve(utilsDirectory, "./run-command")); +const prompt = require(path.resolve(utilsDirectory, "./prompt")); + +describe("promptInstallation", () => { beforeAll(() => { packageExists.mockReturnValue(true); }); @@ -28,13 +28,13 @@ describe('promptInstallation', () => { prompt.mockClear(); }); - it('should prompt to install using npm if npm is package manager', async () => { + it("should prompt to install using npm if npm is package manager", async () => { prompt.mockReturnValue(true); - getPackageManager.mockReturnValue('npm'); + getPackageManager.mockReturnValue("npm"); const preMessage = jest.fn(); - const promptResult = await promptInstallation('test-package', preMessage); + const promptResult = await promptInstallation("test-package", preMessage); expect(promptResult).toBeTruthy(); expect(preMessage.mock.calls.length).toEqual(1); @@ -45,15 +45,15 @@ describe('promptInstallation', () => { ); // install the package using npm - expect(runCommand.mock.calls[0][0]).toEqual('npm install -D test-package'); + expect(runCommand.mock.calls[0][0]).toEqual("npm install -D test-package"); }); - it('should prompt to install using yarn if yarn is package manager', async () => { + it("should prompt to install using yarn if yarn is package manager", async () => { prompt.mockReturnValue({ installConfirm: true }); - getPackageManager.mockReturnValue('yarn'); + getPackageManager.mockReturnValue("yarn"); - const promptResult = await promptInstallation('test-package'); + const promptResult = await promptInstallation("test-package"); expect(promptResult).toBeTruthy(); expect(prompt.mock.calls.length).toEqual(1); @@ -63,15 +63,15 @@ describe('promptInstallation', () => { ); // install the package using yarn - expect(runCommand.mock.calls[0][0]).toEqual('yarn add -D test-package'); + expect(runCommand.mock.calls[0][0]).toEqual("yarn add -D test-package"); }); - it('should prompt to install using pnpm if pnpm is package manager', async () => { + it("should prompt to install using pnpm if pnpm is package manager", async () => { prompt.mockReturnValue({ installConfirm: true }); - getPackageManager.mockReturnValue('pnpm'); + getPackageManager.mockReturnValue("pnpm"); - const promptResult = await promptInstallation('test-package'); + const promptResult = await promptInstallation("test-package"); expect(promptResult).toBeTruthy(); expect(prompt.mock.calls.length).toEqual(1); @@ -81,16 +81,16 @@ describe('promptInstallation', () => { ); // install the package using npm - expect(runCommand.mock.calls[0][0]).toEqual('pnpm install -D test-package'); + expect(runCommand.mock.calls[0][0]).toEqual("pnpm install -D test-package"); }); - it('should support pre message', async () => { + it("should support pre message", async () => { prompt.mockReturnValue({ installConfirm: true }); - getPackageManager.mockReturnValue('npm'); + getPackageManager.mockReturnValue("npm"); const preMessage = jest.fn(); - const promptResult = await promptInstallation('test-package', preMessage); + const promptResult = await promptInstallation("test-package", preMessage); expect(promptResult).toBeTruthy(); expect(preMessage.mock.calls.length).toEqual(1); @@ -101,14 +101,14 @@ describe('promptInstallation', () => { ); // install the package using npm - expect(runCommand.mock.calls[0][0]).toEqual('npm install -D test-package'); + expect(runCommand.mock.calls[0][0]).toEqual("npm install -D test-package"); }); - it('should not install if install is not confirmed', async () => { + it("should not install if install is not confirmed", async () => { prompt.mockReturnValue(false); - const mockExit = jest.spyOn(process, 'exit').mockImplementation(() => {}); - const promptResult = await promptInstallation('test-package'); + const mockExit = jest.spyOn(process, "exit").mockImplementation(() => {}); + const promptResult = await promptInstallation("test-package"); expect(promptResult).toBeUndefined(); expect(prompt.mock.calls.length).toEqual(1); diff --git a/test/api/prompt.test.js b/test/api/prompt.test.js index 2ebf672b306..752f2aafb49 100755 --- a/test/api/prompt.test.js +++ b/test/api/prompt.test.js @@ -1,7 +1,7 @@ -const prompt = require('../../packages/webpack-cli/lib/utils/prompt'); -const { Writable } = require('stream'); +const prompt = require("../../packages/webpack-cli/lib/utils/prompt"); +const { Writable } = require("stream"); -describe('prompt', () => { +describe("prompt", () => { class MyWritable extends Writable { constructor(answer) { super(); @@ -13,18 +13,18 @@ describe('prompt', () => { } } - it('should work with default response', async () => { - const myWritable = new MyWritable('\r'); + it("should work with default response", async () => { + const myWritable = new MyWritable("\r"); const resultSuccess = await prompt({ - message: 'message', - defaultResponse: 'yes', + message: "message", + defaultResponse: "yes", stream: myWritable, }); const resultFail = await prompt({ - message: 'message', - defaultResponse: 'no', + message: "message", + defaultResponse: "no", stream: myWritable, }); @@ -33,18 +33,18 @@ describe('prompt', () => { }); it('should work with "yes" && "y" response', async () => { - const myWritable1 = new MyWritable('yes\r'); - const myWritable2 = new MyWritable('y\r'); + const myWritable1 = new MyWritable("yes\r"); + const myWritable2 = new MyWritable("y\r"); const resultSuccess1 = await prompt({ - message: 'message', - defaultResponse: 'no', + message: "message", + defaultResponse: "no", stream: myWritable1, }); const resultSuccess2 = await prompt({ - message: 'message', - defaultResponse: 'no', + message: "message", + defaultResponse: "no", stream: myWritable2, }); @@ -52,12 +52,12 @@ describe('prompt', () => { expect(resultSuccess2).toBe(true); }); - it('should work with unknown response', async () => { - const myWritable = new MyWritable('unknown\r'); + it("should work with unknown response", async () => { + const myWritable = new MyWritable("unknown\r"); const result = await prompt({ - message: 'message', - defaultResponse: 'yes', + message: "message", + defaultResponse: "yes", stream: myWritable, }); diff --git a/test/api/resolveConfig/env.webpack.config.cjs b/test/api/resolveConfig/env.webpack.config.cjs index d835806ac3c..ef09161948b 100644 --- a/test/api/resolveConfig/env.webpack.config.cjs +++ b/test/api/resolveConfig/env.webpack.config.cjs @@ -2,6 +2,6 @@ module.exports = function (env) { const configName = env.name; return { name: configName, - mode: env.test ? 'staging' : 'production', + mode: env.test ? "staging" : "production", }; }; diff --git a/test/api/resolveConfig/resolveConfig.test.js b/test/api/resolveConfig/resolveConfig.test.js index cff857beb18..83450146495 100644 --- a/test/api/resolveConfig/resolveConfig.test.js +++ b/test/api/resolveConfig/resolveConfig.test.js @@ -1,56 +1,69 @@ -const { resolve } = require('path'); -const WebpackCLI = require('../../../packages/webpack-cli/lib/webpack-cli'); -const config1 = require('./webpack.config1.cjs'); -const config2 = require('./webpack.config2.cjs'); -const arrayConfig = require('./webpack.config.cjs'); -const promiseConfig = require('./webpack.promise.config.cjs'); +const { resolve } = require("path"); +const WebpackCLI = require("../../../packages/webpack-cli/lib/webpack-cli"); +const config1 = require("./webpack.config1.cjs"); +const config2 = require("./webpack.config2.cjs"); +const arrayConfig = require("./webpack.config.cjs"); +const promiseConfig = require("./webpack.promise.config.cjs"); const cli = new WebpackCLI(); -describe('resolveConfig', function () { - it('should handle merge properly', async () => { +describe("resolveConfig", function () { + it("should handle merge properly", async () => { const result = await cli.resolveConfig({ merge: true, - config: [resolve(__dirname, './webpack.config.cjs')], + config: [resolve(__dirname, "./webpack.config.cjs")], }); const expectedOptions = { - output: { filename: './dist-commonjs.js', libraryTarget: 'commonjs' }, - entry: './a.js', - name: 'amd', - mode: 'production', - devtool: 'eval-cheap-module-source-map', - target: 'node', + output: { + filename: "./dist-commonjs.js", + libraryTarget: "commonjs", + }, + entry: "./a.js", + name: "amd", + mode: "production", + devtool: "eval-cheap-module-source-map", + target: "node", }; expect(result.options).toEqual(expectedOptions); }); - it('should return array for multiple config', async () => { + it("should return array for multiple config", async () => { const result = await cli.resolveConfig({ - config: [resolve(__dirname, './webpack.config1.cjs'), resolve(__dirname, './webpack.config2.cjs')], + config: [ + resolve(__dirname, "./webpack.config1.cjs"), + resolve(__dirname, "./webpack.config2.cjs"), + ], }); const expectedOptions = [config1, config2]; expect(result.options).toEqual(expectedOptions); }); - it('should return config object for single config', async () => { - const result = await cli.resolveConfig({ config: [resolve(__dirname, './webpack.config1.cjs')] }); + it("should return config object for single config", async () => { + const result = await cli.resolveConfig({ + config: [resolve(__dirname, "./webpack.config1.cjs")], + }); expect(result.options).toEqual(config1); }); - it('should return resolved config object for promise config', async () => { - const result = await cli.resolveConfig({ config: [resolve(__dirname, './webpack.promise.config.cjs')] }); + it("should return resolved config object for promise config", async () => { + const result = await cli.resolveConfig({ + config: [resolve(__dirname, "./webpack.promise.config.cjs")], + }); const expectedOptions = await promiseConfig(); expect(result.options).toEqual(expectedOptions); }); - it('should handle configs returning different types', async () => { + it("should handle configs returning different types", async () => { const result = await cli.resolveConfig({ - config: [resolve(__dirname, './webpack.promise.config.cjs'), resolve(__dirname, './webpack.config.cjs')], + config: [ + resolve(__dirname, "./webpack.promise.config.cjs"), + resolve(__dirname, "./webpack.config.cjs"), + ], }); const resolvedPromiseConfig = await promiseConfig(); const expectedOptions = [resolvedPromiseConfig, ...arrayConfig]; @@ -58,12 +71,12 @@ describe('resolveConfig', function () { expect(result.options).toEqual(expectedOptions); }); - it('should handle different env formats', async () => { + it("should handle different env formats", async () => { const result = await cli.resolveConfig({ - argv: { env: { test: true, name: 'Hisoka' } }, - config: [resolve(__dirname, './env.webpack.config.cjs')], + argv: { env: { test: true, name: "Hisoka" } }, + config: [resolve(__dirname, "./env.webpack.config.cjs")], }); - const expectedOptions = { mode: 'staging', name: 'Hisoka' }; + const expectedOptions = { mode: "staging", name: "Hisoka" }; expect(result.options).toEqual(expectedOptions); }); diff --git a/test/api/resolveConfig/webpack.config.cjs b/test/api/resolveConfig/webpack.config.cjs index be8b318c4ae..790bfaea913 100644 --- a/test/api/resolveConfig/webpack.config.cjs +++ b/test/api/resolveConfig/webpack.config.cjs @@ -1,21 +1,21 @@ module.exports = [ { output: { - filename: './dist-amd.js', - libraryTarget: 'amd', + filename: "./dist-amd.js", + libraryTarget: "amd", }, - entry: './a.js', - name: 'amd', - mode: 'development', - devtool: 'eval-cheap-module-source-map', + entry: "./a.js", + name: "amd", + mode: "development", + devtool: "eval-cheap-module-source-map", }, { output: { - filename: './dist-commonjs.js', - libraryTarget: 'commonjs', + filename: "./dist-commonjs.js", + libraryTarget: "commonjs", }, - entry: './a.js', - mode: 'production', - target: 'node', + entry: "./a.js", + mode: "production", + target: "node", }, ]; diff --git a/test/api/resolveConfig/webpack.config1.cjs b/test/api/resolveConfig/webpack.config1.cjs index 574e45209ff..9c66f25c9aa 100644 --- a/test/api/resolveConfig/webpack.config1.cjs +++ b/test/api/resolveConfig/webpack.config1.cjs @@ -1,7 +1,7 @@ module.exports = { output: { - libraryTarget: 'amd', + libraryTarget: "amd", }, - entry: './a.js', - name: 'amd', + entry: "./a.js", + name: "amd", }; diff --git a/test/api/resolveConfig/webpack.config2.cjs b/test/api/resolveConfig/webpack.config2.cjs index 551eb311c26..f835b84a40f 100644 --- a/test/api/resolveConfig/webpack.config2.cjs +++ b/test/api/resolveConfig/webpack.config2.cjs @@ -1,8 +1,8 @@ module.exports = { output: { - libraryTarget: 'commonjs', + libraryTarget: "commonjs", }, - entry: './a.js', - mode: 'production', - target: 'node', + entry: "./a.js", + mode: "production", + target: "node", }; diff --git a/test/api/resolveConfig/webpack.promise.config.cjs b/test/api/resolveConfig/webpack.promise.config.cjs index f657e66b809..97380066bba 100644 --- a/test/api/resolveConfig/webpack.promise.config.cjs +++ b/test/api/resolveConfig/webpack.promise.config.cjs @@ -2,10 +2,10 @@ module.exports = () => { return new Promise((resolve) => { setTimeout(() => { resolve({ - entry: './a', + entry: "./a", output: { - path: __dirname + '/binary', - filename: 'promise.js', + path: __dirname + "/binary", + filename: "promise.js", }, }); }, 500); diff --git a/test/api/scaffold-utils.test.js b/test/api/scaffold-utils.test.js index bea825029f4..06cdc64bfcb 100755 --- a/test/api/scaffold-utils.test.js +++ b/test/api/scaffold-utils.test.js @@ -1,7 +1,12 @@ -// eslint-disable-next-line node/no-missing-require -const { Confirm, List, InputValidate, Input } = require('../../packages/generators/src/utils/scaffold-utils'); +const { + Confirm, + List, + InputValidate, + Input, + // eslint-disable-next-line node/no-missing-require +} = require("../../packages/generators/src/utils/scaffold-utils"); -describe('utils', () => { +describe("utils", () => { let mockSelf; beforeEach(() => { @@ -11,64 +16,79 @@ describe('utils', () => { }, }; }); - describe('Inquirer', () => { - it('should emulate a prompt for List', () => { - expect(List(mockSelf, 'entry', 'does it work?', ['Yes', 'Maybe'], 'Yes')).toEqual({ - choices: ['Yes', 'Maybe'], - type: 'list', - name: 'entry', - message: 'does it work?', - default: 'Yes', + describe("Inquirer", () => { + it("should emulate a prompt for List", () => { + expect(List(mockSelf, "entry", "does it work?", ["Yes", "Maybe"], "Yes")).toEqual({ + choices: ["Yes", "Maybe"], + type: "list", + name: "entry", + message: "does it work?", + default: "Yes", }); }); - it('should make default value for a List', () => { - expect(List(mockSelf, 'entry', 'does it work?', ['Yes', 'Maybe'], 'Yes', true)).toEqual({ - entry: 'Yes', - }); + it("should make default value for a List", () => { + expect(List(mockSelf, "entry", "does it work?", ["Yes", "Maybe"], "Yes", true)).toEqual( + { + entry: "Yes", + }, + ); }); - it('should emulate a prompt for list input', () => { - expect(Input(mockSelf, 'plugins', 'what is your plugin?', 'openJSF')).toEqual({ - type: 'input', - name: 'plugins', - message: 'what is your plugin?', - default: 'openJSF', + it("should emulate a prompt for list input", () => { + expect(Input(mockSelf, "plugins", "what is your plugin?", "openJSF")).toEqual({ + type: "input", + name: "plugins", + message: "what is your plugin?", + default: "openJSF", }); }); - it('should return a default Input object value', () => { - expect(Input(mockSelf, 'plugins', 'what is your plugin?', 'my-plugin', true)).toEqual({ - plugins: 'my-plugin', + it("should return a default Input object value", () => { + expect(Input(mockSelf, "plugins", "what is your plugin?", "my-plugin", true)).toEqual({ + plugins: "my-plugin", }); }); - it('should emulate a prompt for confirm', () => { - expect(Confirm(mockSelf, 'context', 'what is your context?')).toEqual({ - name: 'context', + it("should emulate a prompt for confirm", () => { + expect(Confirm(mockSelf, "context", "what is your context?")).toEqual({ + name: "context", default: true, - message: 'what is your context?', - type: 'confirm', + message: "what is your context?", + type: "confirm", }); }); - it('should make a Confirm object with yes as default', () => { - expect(Confirm(mockSelf, 'context', 'what is your context?', true, true)).toEqual({ + it("should make a Confirm object with yes as default", () => { + expect(Confirm(mockSelf, "context", "what is your context?", true, true)).toEqual({ context: true, }); }); - it('should make an Input object with validation', () => { - expect(InputValidate(mockSelf, 'plugins', 'what is your plugin?', () => true)).toMatchSnapshot(); + it("should make an Input object with validation", () => { + expect( + InputValidate(mockSelf, "plugins", "what is your plugin?", () => true), + ).toMatchSnapshot(); }); - it('should make an Input object with validation and default value', () => { - expect(InputValidate(mockSelf, 'plugins', 'what is your plugin?', () => true, 'my-plugin')).toMatchSnapshot(); + it("should make an Input object with validation and default value", () => { + expect( + InputValidate(mockSelf, "plugins", "what is your plugin?", () => true, "my-plugin"), + ).toMatchSnapshot(); }); - it('should return a default Input object with validation and default value', () => { - expect(InputValidate(mockSelf, 'plugins', 'what is your plugin?', () => true, 'my-plugin', true)).toEqual({ - plugins: 'my-plugin', + it("should return a default Input object with validation and default value", () => { + expect( + InputValidate( + mockSelf, + "plugins", + "what is your plugin?", + () => true, + "my-plugin", + true, + ), + ).toEqual({ + plugins: "my-plugin", }); }); }); diff --git a/test/build/analyze/analyze-flag.test.js b/test/build/analyze/analyze-flag.test.js index 6807d6c6e3c..1b45e71a53d 100644 --- a/test/build/analyze/analyze-flag.test.js +++ b/test/build/analyze/analyze-flag.test.js @@ -1,14 +1,20 @@ -'use strict'; +"use strict"; -const { run, normalizeStdout } = require('../../utils/test-utils'); +const { run, normalizeStdout } = require("../../utils/test-utils"); describe('"analyze" option', () => { - it('should not load webpack-bundle-analyzer plugin twice with --analyze flag and plugin', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', './analyze.config.js', '--analyze']); + it("should not load webpack-bundle-analyzer plugin twice with --analyze flag and plugin", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "-c", + "./analyze.config.js", + "--analyze", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - expect(normalizeStdout(stdout)).toContain('Webpack Bundle Analyzer saved report to'); - expect(normalizeStdout(stdout).match(/Webpack Bundle Analyzer saved report to/g)).toHaveLength(1); + expect(normalizeStdout(stdout)).toContain("Webpack Bundle Analyzer saved report to"); + expect( + normalizeStdout(stdout).match(/Webpack Bundle Analyzer saved report to/g), + ).toHaveLength(1); }); }); diff --git a/test/build/analyze/analyze.config.js b/test/build/analyze/analyze.config.js index 71329e267b0..a1671a29911 100644 --- a/test/build/analyze/analyze.config.js +++ b/test/build/analyze/analyze.config.js @@ -1,7 +1,12 @@ // eslint-disable-next-line node/no-unpublished-require -const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer'); +const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer"); module.exports = { - mode: 'development', - plugins: [new BundleAnalyzerPlugin({ analyzerMode: 'static', openAnalyzer: false })], + mode: "development", + plugins: [ + new BundleAnalyzerPlugin({ + analyzerMode: "static", + openAnalyzer: false, + }), + ], }; diff --git a/test/build/analyze/webpack.config.js b/test/build/analyze/webpack.config.js index 1bd7a2cee42..bbb2b37c677 100644 --- a/test/build/analyze/webpack.config.js +++ b/test/build/analyze/webpack.config.js @@ -1,4 +1,4 @@ module.exports = { - mode: 'development', + mode: "development", plugins: [], }; diff --git a/test/build/bail/bail-and-watch-webpack.config.js b/test/build/bail/bail-and-watch-webpack.config.js index 85d95542909..e29774ed94d 100644 --- a/test/build/bail/bail-and-watch-webpack.config.js +++ b/test/build/bail/bail-and-watch-webpack.config.js @@ -1,7 +1,7 @@ module.exports = { - entry: './src/first.js', + entry: "./src/first.js", devtool: false, - mode: 'development', + mode: "development", bail: true, watch: true, }; diff --git a/test/build/bail/bail-multi-webpack.config.js b/test/build/bail/bail-multi-webpack.config.js index d36a8ba9fe3..c2890ba9fff 100644 --- a/test/build/bail/bail-multi-webpack.config.js +++ b/test/build/bail/bail-multi-webpack.config.js @@ -2,20 +2,20 @@ module.exports = [ { devtool: false, output: { - filename: './dist-first.js', + filename: "./dist-first.js", }, - name: 'first', - entry: './src/first.js', - mode: 'development', + name: "first", + entry: "./src/first.js", + mode: "development", bail: true, }, { devtool: false, output: { - filename: './dist-second.js', + filename: "./dist-second.js", }, - name: 'second', - entry: './src/second.js', - mode: 'development', + name: "second", + entry: "./src/second.js", + mode: "development", }, ]; diff --git a/test/build/bail/bail-webpack.config.js b/test/build/bail/bail-webpack.config.js index d3f445c8782..67c7bb44a8f 100644 --- a/test/build/bail/bail-webpack.config.js +++ b/test/build/bail/bail-webpack.config.js @@ -1,6 +1,6 @@ module.exports = { devtool: false, - entry: './src/first.js', - mode: 'development', + entry: "./src/first.js", + mode: "development", bail: true, }; diff --git a/test/build/bail/bail.test.js b/test/build/bail/bail.test.js index 1fc876c43b7..9e246571648 100644 --- a/test/build/bail/bail.test.js +++ b/test/build/bail/bail.test.js @@ -1,10 +1,10 @@ -'use strict'; +"use strict"; -const { run } = require('../../utils/test-utils'); +const { run } = require("../../utils/test-utils"); -describe('bail and watch warning', () => { - it('should not log warning in not watch mode', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', 'bail-webpack.config.js']); +describe("bail and watch warning", () => { + it("should not log warning in not watch mode", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["-c", "bail-webpack.config.js"]); expect(exitCode).toEqual(0); expect(stderr).toBeFalsy(); @@ -12,7 +12,10 @@ describe('bail and watch warning', () => { }); it('should not log warning in not watch mode without the "bail" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', 'no-bail-webpack.config.js']); + const { exitCode, stderr, stdout } = await run(__dirname, [ + "-c", + "no-bail-webpack.config.js", + ]); expect(exitCode).toEqual(0); expect(stderr).toBeFalsy(); diff --git a/test/build/bail/multi-webpack.config.js b/test/build/bail/multi-webpack.config.js index b36638f118f..9fe0cb532f1 100644 --- a/test/build/bail/multi-webpack.config.js +++ b/test/build/bail/multi-webpack.config.js @@ -2,21 +2,21 @@ module.exports = [ { devtool: false, output: { - filename: './dist-first.js', + filename: "./dist-first.js", }, - name: 'first', - entry: './src/first.js', - mode: 'development', + name: "first", + entry: "./src/first.js", + mode: "development", bail: true, watch: true, }, { devtool: false, output: { - filename: './dist-second.js', + filename: "./dist-second.js", }, - name: 'second', - entry: './src/second.js', - mode: 'development', + name: "second", + entry: "./src/second.js", + mode: "development", }, ]; diff --git a/test/build/bail/no-bail-webpack.config.js b/test/build/bail/no-bail-webpack.config.js index 8cf031757bd..b55c39fc397 100644 --- a/test/build/bail/no-bail-webpack.config.js +++ b/test/build/bail/no-bail-webpack.config.js @@ -1,5 +1,5 @@ module.exports = { devtool: false, - entry: './src/first.js', - mode: 'development', + entry: "./src/first.js", + mode: "development", }; diff --git a/test/build/bail/src/first.js b/test/build/bail/src/first.js index fb7e56835c4..6566b640f0b 100644 --- a/test/build/bail/src/first.js +++ b/test/build/bail/src/first.js @@ -1 +1 @@ -console.log('bail and watch warning test first'); +console.log("bail and watch warning test first"); diff --git a/test/build/bail/src/second.js b/test/build/bail/src/second.js index 5b277372189..aebac93b7f8 100644 --- a/test/build/bail/src/second.js +++ b/test/build/bail/src/second.js @@ -1 +1 @@ -console.log('bail and watch warning test second'); +console.log("bail and watch warning test second"); diff --git a/test/build/bail/watch-webpack.config.js b/test/build/bail/watch-webpack.config.js index fa93f3f225b..bf6be48c2c7 100644 --- a/test/build/bail/watch-webpack.config.js +++ b/test/build/bail/watch-webpack.config.js @@ -1,6 +1,6 @@ module.exports = { devtool: false, - entry: './src/first.js', - mode: 'development', + entry: "./src/first.js", + mode: "development", watch: true, }; diff --git a/test/build/basic/basic.test.js b/test/build/basic/basic.test.js index a21fcb50af2..a6a089e062e 100644 --- a/test/build/basic/basic.test.js +++ b/test/build/basic/basic.test.js @@ -1,10 +1,10 @@ -'use strict'; +"use strict"; -const { resolve } = require('path'); -const { run } = require('../../utils/test-utils'); +const { resolve } = require("path"); +const { run } = require("../../utils/test-utils"); -describe('bundle command', () => { - it('should work without command (default command)', async () => { +describe("bundle command", () => { + it("should work without command (default command)", async () => { const { exitCode, stderr, stdout } = await run(__dirname, []); expect(exitCode).toBe(0); @@ -12,48 +12,71 @@ describe('bundle command', () => { expect(stdout).toBeTruthy(); }); - it('should work without command and options (default command)', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--mode', 'development']); + it("should work without command and options (default command)", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--mode", "development"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); }); - it('should work with multiple entries syntax without command (default command)', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['./src/index.js', './src/other.js']); + it("should work with multiple entries syntax without command (default command)", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "./src/index.js", + "./src/other.js", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); }); - it('should work with multiple entries syntax without command with options (default command)', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['./src/index.js', './src/other.js', '--mode', 'development']); + it("should work with multiple entries syntax without command with options (default command)", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "./src/index.js", + "./src/other.js", + "--mode", + "development", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); }); - it('should work with multiple entries syntax without command with options #2 (default command)', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--mode', 'development', './src/index.js', './src/other.js']); + it("should work with multiple entries syntax without command with options #2 (default command)", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--mode", + "development", + "./src/index.js", + "./src/other.js", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); }); - it('should work with multiple entries syntax without command with options #3 (default command)', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['./src/index.js', './src/other.js', '--entry', './src/again.js']); + it("should work with multiple entries syntax without command with options #3 (default command)", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "./src/index.js", + "./src/other.js", + "--entry", + "./src/again.js", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); }); - it('should work with and override entries from the configuration', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['./src/index.js', './src/other.js', '--config', './entry.config.js']); + it("should work with and override entries from the configuration", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "./src/index.js", + "./src/other.js", + "--config", + "./entry.config.js", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -61,7 +84,7 @@ describe('bundle command', () => { }); it('should work with the "build" alias', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['build']); + const { exitCode, stderr, stdout } = await run(__dirname, ["build"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -69,7 +92,7 @@ describe('bundle command', () => { }); it('should work with "bundle" alias', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['bundle']); + const { exitCode, stderr, stdout } = await run(__dirname, ["bundle"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -77,7 +100,7 @@ describe('bundle command', () => { }); it('should work with the "b" alias', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['b']); + const { exitCode, stderr, stdout } = await run(__dirname, ["b"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -85,7 +108,7 @@ describe('bundle command', () => { }); it('should work with entries syntax using the "build" alias', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['build', './src/index.js']); + const { exitCode, stderr, stdout } = await run(__dirname, ["build", "./src/index.js"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -93,7 +116,7 @@ describe('bundle command', () => { }); it('should work with entries syntax using the "bundle" alias', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['bundle', './src/index.js']); + const { exitCode, stderr, stdout } = await run(__dirname, ["bundle", "./src/index.js"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -101,7 +124,7 @@ describe('bundle command', () => { }); it('should work with entries syntax using the "b" alias', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['b', './src/index.js']); + const { exitCode, stderr, stdout } = await run(__dirname, ["b", "./src/index.js"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -109,7 +132,11 @@ describe('bundle command', () => { }); it('should work with multiple entries syntax using the "build" alias', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['build', './src/index.js', './src/other.js']); + const { exitCode, stderr, stdout } = await run(__dirname, [ + "build", + "./src/index.js", + "./src/other.js", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -117,7 +144,13 @@ describe('bundle command', () => { }); it('should work with multiple entries syntax using the "build" alias and options', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['build', './src/index.js', './src/other.js', '--mode', 'development']); + const { exitCode, stderr, stdout } = await run(__dirname, [ + "build", + "./src/index.js", + "./src/other.js", + "--mode", + "development", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -125,7 +158,13 @@ describe('bundle command', () => { }); it('should work with multiple entries syntax using the "build" alias and options', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['build', '--mode', 'development', './src/index.js', './src/other.js']); + const { exitCode, stderr, stdout } = await run(__dirname, [ + "build", + "--mode", + "development", + "./src/index.js", + "./src/other.js", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -133,7 +172,7 @@ describe('bundle command', () => { }); it('should log error and suggest right name on the "buil" command', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['buil']); + const { exitCode, stderr, stdout } = await run(__dirname, ["buil"]); expect(exitCode).toBe(2); expect(stderr).toContain("Unknown command or entry 'buil'"); @@ -142,14 +181,14 @@ describe('bundle command', () => { expect(stdout).toBeFalsy(); }); - it('should log supplied config when logging level is log', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--config', './log.config.js']); - const configPath = resolve(__dirname, './log.config.js'); + it("should log supplied config when logging level is log", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--config", "./log.config.js"]); + const configPath = resolve(__dirname, "./log.config.js"); expect(exitCode).toBe(0); - expect(stderr).toContain('Compiler starting...'); + expect(stderr).toContain("Compiler starting..."); expect(stderr).toContain(`Compiler is using config: '${configPath}'`); - expect(stderr).toContain('Compiler finished'); + expect(stderr).toContain("Compiler finished"); expect(stdout).toBeTruthy(); }); }); diff --git a/test/build/basic/entry.config.js b/test/build/basic/entry.config.js index 431945f5225..f562d8db416 100644 --- a/test/build/basic/entry.config.js +++ b/test/build/basic/entry.config.js @@ -1,4 +1,4 @@ module.exports = { - mode: 'development', - entry: './src/entry.js', + mode: "development", + entry: "./src/entry.js", }; diff --git a/test/build/basic/log.config.js b/test/build/basic/log.config.js index 70619a29563..5906a9bce94 100644 --- a/test/build/basic/log.config.js +++ b/test/build/basic/log.config.js @@ -1,6 +1,6 @@ module.exports = { - mode: 'development', + mode: "development", infrastructureLogging: { - level: 'log', + level: "log", }, }; diff --git a/test/build/basic/src/again.js b/test/build/basic/src/again.js index eec159b09dc..f15e7f3d482 100644 --- a/test/build/basic/src/again.js +++ b/test/build/basic/src/again.js @@ -1 +1 @@ -console.log('again'); +console.log("again"); diff --git a/test/build/basic/src/entry.js b/test/build/basic/src/entry.js index 6daf0ddddd1..83ca8caa477 100644 --- a/test/build/basic/src/entry.js +++ b/test/build/basic/src/entry.js @@ -1 +1 @@ -console.log('CONFIG'); +console.log("CONFIG"); diff --git a/test/build/basic/src/other.js b/test/build/basic/src/other.js index 6be02374db1..6b2b3db0f65 100644 --- a/test/build/basic/src/other.js +++ b/test/build/basic/src/other.js @@ -1 +1 @@ -console.log('hello world'); +console.log("hello world"); diff --git a/test/build/build-errors/errors.test.js b/test/build/build-errors/errors.test.js index 68d91e234b3..874552f6a0d 100644 --- a/test/build/build-errors/errors.test.js +++ b/test/build/build-errors/errors.test.js @@ -1,10 +1,10 @@ -'use strict'; +"use strict"; -const { run, readFile } = require('../../utils/test-utils'); -const { resolve } = require('path'); +const { run, readFile } = require("../../utils/test-utils"); +const { resolve } = require("path"); -describe('errors', () => { - it('should output by default', async () => { +describe("errors", () => { + it("should output by default", async () => { const { exitCode, stderr, stdout } = await run(__dirname); expect(exitCode).toBe(1); @@ -14,7 +14,7 @@ describe('errors', () => { }); it('should output JSON with the "json" flag', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--json']); + const { exitCode, stderr, stdout } = await run(__dirname, ["--json"]); expect(exitCode).toBe(1); expect(stderr).toBeFalsy(); @@ -22,23 +22,25 @@ describe('errors', () => { const json = JSON.parse(stdout); - expect(json['hash']).toBeDefined(); - expect(json['errors']).toHaveLength(1); + expect(json["hash"]).toBeDefined(); + expect(json["errors"]).toHaveLength(1); // `message` for `webpack@5` - expect(json['errors'][0].message ? json['errors'][0].message : json['errors'][0]).toMatch(/Can't resolve/); + expect(json["errors"][0].message ? json["errors"][0].message : json["errors"][0]).toMatch( + /Can't resolve/, + ); }); - it('should store json to a file', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--json', 'stats.json']); + it("should store json to a file", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--json", "stats.json"]); expect(exitCode).toBe(1); - expect(stderr).toContain('stats are successfully stored as json to stats.json'); + expect(stderr).toContain("stats are successfully stored as json to stats.json"); expect(stdout).toBeFalsy(); let data; try { - data = await readFile(resolve(__dirname, 'stats.json'), 'utf-8'); + data = await readFile(resolve(__dirname, "stats.json"), "utf-8"); } catch (error) { expect(error).toBe(null); } @@ -47,9 +49,11 @@ describe('errors', () => { const json = JSON.parse(data); - expect(json['hash']).toBeDefined(); - expect(json['errors']).toHaveLength(1); + expect(json["hash"]).toBeDefined(); + expect(json["errors"]).toHaveLength(1); // `message` for `webpack@5` - expect(json['errors'][0].message ? json['errors'][0].message : json['errors'][0]).toMatch(/Can't resolve/); + expect(json["errors"][0].message ? json["errors"][0].message : json["errors"][0]).toMatch( + /Can't resolve/, + ); }); }); diff --git a/test/build/build-variable/build-variable.test.js b/test/build/build-variable/build-variable.test.js index 8810b29bb40..f7f8c1d2266 100644 --- a/test/build/build-variable/build-variable.test.js +++ b/test/build/build-variable/build-variable.test.js @@ -1,13 +1,13 @@ -'use strict'; +"use strict"; -const { run } = require('../../utils/test-utils'); +const { run } = require("../../utils/test-utils"); -describe('bundle variable', () => { - it('compiles without flags and export variable', async () => { +describe("bundle variable", () => { + it("compiles without flags and export variable", async () => { const { exitCode, stderr, stdout } = await run(__dirname, []); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - expect(stdout).toContain('PASS'); + expect(stdout).toContain("PASS"); }); }); diff --git a/test/build/build-variable/webpack.config.js b/test/build/build-variable/webpack.config.js index a0ed78dbfb5..ab0814d6de8 100644 --- a/test/build/build-variable/webpack.config.js +++ b/test/build/build-variable/webpack.config.js @@ -5,11 +5,11 @@ class CustomTestPlugin { this.isInEnvironment = isInEnvironment; } apply(compiler) { - compiler.hooks.done.tap('testPlugin', () => { + compiler.hooks.done.tap("testPlugin", () => { if (!isInProcess && this.isInEnvironment) { - console.log('PASS'); + console.log("PASS"); } else { - console.log('FAIL'); + console.log("FAIL"); } }); } @@ -17,7 +17,7 @@ class CustomTestPlugin { module.exports = (env) => { return { - mode: 'development', + mode: "development", devtool: false, plugins: [new CustomTestPlugin(env.WEBPACK_BUILD)], }; diff --git a/test/build/build-warnings/warnings.test.js b/test/build/build-warnings/warnings.test.js index d4cf196b324..2af5019f048 100644 --- a/test/build/build-warnings/warnings.test.js +++ b/test/build/build-warnings/warnings.test.js @@ -1,11 +1,11 @@ -'use strict'; +"use strict"; -const { run, readFile } = require('../../utils/test-utils'); -const { existsSync } = require('fs'); -const { resolve } = require('path'); +const { run, readFile } = require("../../utils/test-utils"); +const { existsSync } = require("fs"); +const { resolve } = require("path"); -describe('warnings', () => { - it('should output by default', async () => { +describe("warnings", () => { + it("should output by default", async () => { const { exitCode, stderr, stdout } = await run(__dirname); expect(exitCode).toBe(0); @@ -15,7 +15,7 @@ describe('warnings', () => { }); it('should output JSON with the "json" flag', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--json']); + const { exitCode, stderr, stdout } = await run(__dirname, ["--json"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -24,24 +24,26 @@ describe('warnings', () => { const json = JSON.parse(stdout); - expect(json['hash']).toBeDefined(); - expect(json['warnings']).toHaveLength(2); + expect(json["hash"]).toBeDefined(); + expect(json["warnings"]).toHaveLength(2); // `message` for `webpack@5` - expect(json['warnings'][0].message ? json['warnings'][0].message : json['warnings'][0]).toMatch(/Can't resolve/); + expect( + json["warnings"][0].message ? json["warnings"][0].message : json["warnings"][0], + ).toMatch(/Can't resolve/); }); - it('should store json to a file', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--json', 'stats.json']); + it("should store json to a file", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--json", "stats.json"]); expect(exitCode).toBe(0); - expect(stderr).toContain('stats are successfully stored as json to stats.json'); + expect(stderr).toContain("stats are successfully stored as json to stats.json"); expect(stdout).toBeFalsy(); - expect(existsSync(resolve(__dirname, './stats.json'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./stats.json"))).toBeTruthy(); let data; try { - data = await readFile(resolve(__dirname, 'stats.json'), 'utf-8'); + data = await readFile(resolve(__dirname, "stats.json"), "utf-8"); } catch (error) { expect(error).toBe(null); } @@ -50,9 +52,11 @@ describe('warnings', () => { const json = JSON.parse(data); - expect(json['hash']).toBeDefined(); - expect(json['warnings']).toHaveLength(2); + expect(json["hash"]).toBeDefined(); + expect(json["warnings"]).toHaveLength(2); // `message` for `webpack@5` - expect(json['warnings'][0].message ? json['warnings'][0].message : json['warnings'][0]).toMatch(/Can't resolve/); + expect( + json["warnings"][0].message ? json["warnings"][0].message : json["warnings"][0], + ).toMatch(/Can't resolve/); }); }); diff --git a/test/build/bundle-variable/bundle-variable.test.js b/test/build/bundle-variable/bundle-variable.test.js index 8810b29bb40..f7f8c1d2266 100644 --- a/test/build/bundle-variable/bundle-variable.test.js +++ b/test/build/bundle-variable/bundle-variable.test.js @@ -1,13 +1,13 @@ -'use strict'; +"use strict"; -const { run } = require('../../utils/test-utils'); +const { run } = require("../../utils/test-utils"); -describe('bundle variable', () => { - it('compiles without flags and export variable', async () => { +describe("bundle variable", () => { + it("compiles without flags and export variable", async () => { const { exitCode, stderr, stdout } = await run(__dirname, []); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - expect(stdout).toContain('PASS'); + expect(stdout).toContain("PASS"); }); }); diff --git a/test/build/bundle-variable/webpack.config.js b/test/build/bundle-variable/webpack.config.js index 574cefc527c..b8e6919b2db 100644 --- a/test/build/bundle-variable/webpack.config.js +++ b/test/build/bundle-variable/webpack.config.js @@ -5,11 +5,11 @@ class CustomTestPlugin { this.isInEnvironment = isInEnvironment; } apply(compiler) { - compiler.hooks.done.tap('testPlugin', () => { + compiler.hooks.done.tap("testPlugin", () => { if (!isInProcess && this.isInEnvironment) { - console.log('PASS'); + console.log("PASS"); } else { - console.log('FAIL'); + console.log("FAIL"); } }); } @@ -17,7 +17,7 @@ class CustomTestPlugin { module.exports = (env) => { return { - mode: 'development', + mode: "development", devtool: false, plugins: [new CustomTestPlugin(env.WEBPACK_BUNDLE)], }; diff --git a/test/build/cache/cache.test.js b/test/build/cache/cache.test.js index 409652657fd..496e7c7a04e 100644 --- a/test/build/cache/cache.test.js +++ b/test/build/cache/cache.test.js @@ -1,15 +1,20 @@ -'use strict'; +"use strict"; -const path = require('path'); +const path = require("path"); // eslint-disable-next-line node/no-unpublished-require -const rimraf = require('rimraf'); -const { run, isWebpack5 } = require('../../utils/test-utils'); +const rimraf = require("rimraf"); +const { run, isWebpack5 } = require("../../utils/test-utils"); -describe('cache', () => { - it('should work', async () => { - rimraf.sync(path.join(__dirname, '../../../node_modules/.cache/webpack/cache-test-default-development')); +describe("cache", () => { + it("should work", async () => { + rimraf.sync( + path.join( + __dirname, + "../../../node_modules/.cache/webpack/cache-test-default-development", + ), + ); - let { exitCode, stderr, stdout } = await run(__dirname, ['-c', './webpack.config.js']); + let { exitCode, stderr, stdout } = await run(__dirname, ["-c", "./webpack.config.js"]); expect(exitCode).toEqual(0); @@ -20,7 +25,7 @@ describe('cache', () => { expect(stdout).toBeTruthy(); } - ({ exitCode, stderr, stdout } = await run(__dirname, ['-c', './webpack.config.js'])); + ({ exitCode, stderr, stdout } = await run(__dirname, ["-c", "./webpack.config.js"])); expect(exitCode).toEqual(0); @@ -33,11 +38,21 @@ describe('cache', () => { } }); - it('should work in multi compiler mode', async () => { - rimraf.sync(path.join(__dirname, '../../../node_modules/.cache/webpack/cache-test-first-development')); - rimraf.sync(path.join(__dirname, '../../../node_modules/.cache/webpack/cache-test-second-development')); - - let { exitCode, stderr, stdout } = await run(__dirname, ['-c', './multi.config.js']); + it("should work in multi compiler mode", async () => { + rimraf.sync( + path.join( + __dirname, + "../../../node_modules/.cache/webpack/cache-test-first-development", + ), + ); + rimraf.sync( + path.join( + __dirname, + "../../../node_modules/.cache/webpack/cache-test-second-development", + ), + ); + + let { exitCode, stderr, stdout } = await run(__dirname, ["-c", "./multi.config.js"]); expect(exitCode).toEqual(0); @@ -48,7 +63,7 @@ describe('cache', () => { expect(stdout).toBeTruthy(); } - ({ exitCode, stderr, stdout } = await run(__dirname, ['-c', './multi.config.js'])); + ({ exitCode, stderr, stdout } = await run(__dirname, ["-c", "./multi.config.js"])); expect(exitCode).toEqual(0); @@ -61,16 +76,21 @@ describe('cache', () => { } }); - it('should work in multi compiler mode with the `--config-name` argument', async () => { - rimraf.sync(path.join(__dirname, '../../../node_modules/.cache/webpack/cache-test-third-development')); + it("should work in multi compiler mode with the `--config-name` argument", async () => { + rimraf.sync( + path.join( + __dirname, + "../../../node_modules/.cache/webpack/cache-test-third-development", + ), + ); let { exitCode, stderr, stdout } = await run(__dirname, [ - '-c', - './multi.config.js', - '--config-name', - 'cache-test-first', - '--name', - 'cache-test-third', + "-c", + "./multi.config.js", + "--config-name", + "cache-test-first", + "--name", + "cache-test-third", ]); expect(exitCode).toEqual(0); @@ -83,12 +103,12 @@ describe('cache', () => { } ({ exitCode, stderr, stdout } = await run(__dirname, [ - '-c', - './multi.config.js', - '--config-name', - 'cache-test-first', - '--name', - 'cache-test-third', + "-c", + "./multi.config.js", + "--config-name", + "cache-test-first", + "--name", + "cache-test-third", ])); expect(exitCode).toEqual(0); @@ -102,17 +122,22 @@ describe('cache', () => { } }); - it('should work with the `--merge` argument', async () => { - rimraf.sync(path.join(__dirname, '../../../node_modules/.cache/webpack/cache-test-fourth-development')); + it("should work with the `--merge` argument", async () => { + rimraf.sync( + path.join( + __dirname, + "../../../node_modules/.cache/webpack/cache-test-fourth-development", + ), + ); let { exitCode, stderr, stdout } = await run(__dirname, [ - '-c', - './multi.config.js', - '-c', - './webpack.config.js', - '--merge', - '--name', - 'cache-test-fourth', + "-c", + "./multi.config.js", + "-c", + "./webpack.config.js", + "--merge", + "--name", + "cache-test-fourth", ]); expect(exitCode).toEqual(0); @@ -125,13 +150,13 @@ describe('cache', () => { } ({ exitCode, stderr, stdout } = await run(__dirname, [ - '-c', - './multi.config.js', - '-c', - './webpack.config.js', - '--merge', - '--name', - 'cache-test-fourth', + "-c", + "./multi.config.js", + "-c", + "./webpack.config.js", + "--merge", + "--name", + "cache-test-fourth", ])); expect(exitCode).toEqual(0); @@ -145,21 +170,26 @@ describe('cache', () => { } }); - it('should work with the `--config-name` and `--merge` argument', async () => { - rimraf.sync(path.join(__dirname, '../../../node_modules/.cache/webpack/cache-test-fifth-development')); + it("should work with the `--config-name` and `--merge` argument", async () => { + rimraf.sync( + path.join( + __dirname, + "../../../node_modules/.cache/webpack/cache-test-fifth-development", + ), + ); let { exitCode, stderr, stdout } = await run(__dirname, [ - '-c', - './multi.config.js', - '-c', - './webpack.config.js', - '--merge', - '--config-name', - 'cache-test-first', - '--config-name', - 'cache-test-second', - '--name', - 'cache-test-fifth', + "-c", + "./multi.config.js", + "-c", + "./webpack.config.js", + "--merge", + "--config-name", + "cache-test-first", + "--config-name", + "cache-test-second", + "--name", + "cache-test-fifth", ]); expect(exitCode).toEqual(0); @@ -172,17 +202,17 @@ describe('cache', () => { } ({ exitCode, stderr, stdout } = await run(__dirname, [ - '-c', - './multi.config.js', - '-c', - './webpack.config.js', - '--merge', - '--config-name', - 'cache-test-first', - '--config-name', - 'cache-test-second', - '--name', - 'cache-test-fifth', + "-c", + "./multi.config.js", + "-c", + "./webpack.config.js", + "--merge", + "--config-name", + "cache-test-first", + "--config-name", + "cache-test-second", + "--name", + "cache-test-fifth", ])); expect(exitCode).toEqual(0); @@ -196,10 +226,18 @@ describe('cache', () => { } }); - it('should work with autoloading configuration', async () => { - rimraf.sync(path.join(__dirname, '../../../node_modules/.cache/webpack/cache-test-autoloading-development')); + it("should work with autoloading configuration", async () => { + rimraf.sync( + path.join( + __dirname, + "../../../node_modules/.cache/webpack/cache-test-autoloading-development", + ), + ); - let { exitCode, stderr, stdout } = await run(__dirname, ['--name', 'cache-test-autoloading']); + let { exitCode, stderr, stdout } = await run(__dirname, [ + "--name", + "cache-test-autoloading", + ]); expect(exitCode).toEqual(0); @@ -210,7 +248,7 @@ describe('cache', () => { expect(stdout).toBeTruthy(); } - ({ exitCode, stderr, stdout } = await run(__dirname, ['--name', 'cache-test-autoloading'])); + ({ exitCode, stderr, stdout } = await run(__dirname, ["--name", "cache-test-autoloading"])); expect(exitCode).toEqual(0); diff --git a/test/build/cache/multi.config.js b/test/build/cache/multi.config.js index d0b6222af3c..3ea23f5ed96 100644 --- a/test/build/cache/multi.config.js +++ b/test/build/cache/multi.config.js @@ -1,11 +1,11 @@ -const path = require('path'); +const path = require("path"); module.exports = [ { - mode: 'development', - name: 'cache-test-first', + mode: "development", + name: "cache-test-first", cache: { - type: 'filesystem', + type: "filesystem", buildDependencies: { config: [__filename], }, @@ -14,20 +14,20 @@ module.exports = [ debug: /cache/, }, entry: { - app: './src/main.js', + app: "./src/main.js", }, output: { - filename: '[name].bundle.js', - chunkFilename: '[name].bundle.js', - path: path.resolve(__dirname, 'dist'), - publicPath: '/', + filename: "[name].bundle.js", + chunkFilename: "[name].bundle.js", + path: path.resolve(__dirname, "dist"), + publicPath: "/", }, }, { - mode: 'development', - name: 'cache-test-second', + mode: "development", + name: "cache-test-second", cache: { - type: 'filesystem', + type: "filesystem", buildDependencies: { config: [__filename], }, @@ -36,13 +36,13 @@ module.exports = [ debug: /cache/, }, entry: { - app: './src/main.js', + app: "./src/main.js", }, output: { - filename: '[name].bundle.js', - chunkFilename: '[name].bundle.js', - path: path.resolve(__dirname, 'dist'), - publicPath: '/', + filename: "[name].bundle.js", + chunkFilename: "[name].bundle.js", + path: path.resolve(__dirname, "dist"), + publicPath: "/", }, }, ]; diff --git a/test/build/cache/src/main.js b/test/build/cache/src/main.js index fec83457547..8828db169ef 100644 --- a/test/build/cache/src/main.js +++ b/test/build/cache/src/main.js @@ -1 +1 @@ -console.log('tehghgst cache'); +console.log("tehghgst cache"); diff --git a/test/build/cache/webpack.config.js b/test/build/cache/webpack.config.js index e089c3d4b53..5e46040979e 100644 --- a/test/build/cache/webpack.config.js +++ b/test/build/cache/webpack.config.js @@ -1,10 +1,10 @@ -const path = require('path'); +const path = require("path"); module.exports = { - mode: 'development', - name: 'cache-test-default', + mode: "development", + name: "cache-test-default", cache: { - type: 'filesystem', + type: "filesystem", buildDependencies: { config: [__filename], }, @@ -13,12 +13,12 @@ module.exports = { debug: /cache/, }, entry: { - app: './src/main.js', + app: "./src/main.js", }, output: { - filename: '[name].bundle.js', - chunkFilename: '[name].bundle.js', - path: path.resolve(__dirname, 'dist'), - publicPath: '/', + filename: "[name].bundle.js", + chunkFilename: "[name].bundle.js", + path: path.resolve(__dirname, "dist"), + publicPath: "/", }, }; diff --git a/test/build/colors/colors-false.webpack.config.js b/test/build/colors/colors-false.webpack.config.js index 048815fb07d..c313e8689e2 100644 --- a/test/build/colors/colors-false.webpack.config.js +++ b/test/build/colors/colors-false.webpack.config.js @@ -2,5 +2,5 @@ module.exports = { stats: { colors: false, }, - mode: 'development', + mode: "development", }; diff --git a/test/build/colors/colors-true.webpack.config.js b/test/build/colors/colors-true.webpack.config.js index 21995734c9e..cd8f114f043 100644 --- a/test/build/colors/colors-true.webpack.config.js +++ b/test/build/colors/colors-true.webpack.config.js @@ -2,5 +2,5 @@ module.exports = { stats: { colors: true, }, - mode: 'development', + mode: "development", }; diff --git a/test/build/colors/colors.test.js b/test/build/colors/colors.test.js index 0e92a35c0ac..9d332515c6d 100644 --- a/test/build/colors/colors.test.js +++ b/test/build/colors/colors.test.js @@ -1,143 +1,179 @@ -'use strict'; +"use strict"; -const { run, isWebpack5 } = require('../../utils/test-utils'); -const { resolve } = require('path'); +const { run, isWebpack5 } = require("../../utils/test-utils"); +const { resolve } = require("path"); -describe('colors', () => { - it('should output by default', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [], { env: { FORCE_COLOR: true } }); +describe("colors", () => { + it("should output by default", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [], { + env: { FORCE_COLOR: true }, + }); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - const output = isWebpack5 ? 'successfully' : 'main.js'; + const output = isWebpack5 ? "successfully" : "main.js"; expect(stdout).toContain(`\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m`); }); it('should work with the "stats" option from flags', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--stats=verbose'], { env: { FORCE_COLOR: true } }); + const { exitCode, stderr, stdout } = await run(__dirname, ["--stats=verbose"], { + env: { FORCE_COLOR: true }, + }); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - const output = isWebpack5 ? 'successfully' : 'main.js'; + const output = isWebpack5 ? "successfully" : "main.js"; expect(stdout).toContain(`\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m`); }); it('should work with the "stats" option from flags and from configuration', async () => { const { exitCode, stderr, stdout } = await run( __dirname, - ['--stats=verbose', `--config=${resolve(__dirname, './no-stats.webpack.config.js')}`], + ["--stats=verbose", `--config=${resolve(__dirname, "./no-stats.webpack.config.js")}`], { env: { FORCE_COLOR: true } }, ); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - const output = isWebpack5 ? 'successfully' : 'main.js'; + const output = isWebpack5 ? "successfully" : "main.js"; expect(stdout).toContain(`\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m`); }); it('should work with the "stats" option from flags and from configuration #2', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--stats=verbose', '--config=stats-string.webpack.config.js'], { - env: { FORCE_COLOR: true }, - }); + const { exitCode, stderr, stdout } = await run( + __dirname, + ["--stats=verbose", "--config=stats-string.webpack.config.js"], + { + env: { FORCE_COLOR: true }, + }, + ); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - const output = isWebpack5 ? 'successfully' : 'main.js'; + const output = isWebpack5 ? "successfully" : "main.js"; expect(stdout).toContain(`\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m`); }); it('should work with the "stats" option and --color flags', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--stats=verbose', '--color']); + const { exitCode, stderr, stdout } = await run(__dirname, ["--stats=verbose", "--color"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - const output = isWebpack5 ? 'successfully' : 'main.js'; + const output = isWebpack5 ? "successfully" : "main.js"; expect(stdout).toContain(`\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m`); }); - it('should disable colored output with --no-color', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--stats=verbose', '--no-color']); + it("should disable colored output with --no-color", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--stats=verbose", + "--no-color", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - const output = isWebpack5 ? 'successfully' : 'main.js'; + const output = isWebpack5 ? "successfully" : "main.js"; expect(stdout).not.toContain(`\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m`); expect(stdout).toContain(output); }); it('should work with the "stats" option from the configuration', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--config=stats-string.webpack.config.js'], { - env: { FORCE_COLOR: true }, - }); + const { exitCode, stderr, stdout } = await run( + __dirname, + ["--config=stats-string.webpack.config.js"], + { + env: { FORCE_COLOR: true }, + }, + ); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - const output = isWebpack5 ? 'successfully' : 'main.js'; + const output = isWebpack5 ? "successfully" : "main.js"; expect(stdout).toContain(`\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m`); }); it('should work with the "stats" option from the configuration #1', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--config=stats-boolean.webpack.config.js'], { - env: { FORCE_COLOR: true }, - }); + const { exitCode, stderr, stdout } = await run( + __dirname, + ["--config=stats-boolean.webpack.config.js"], + { + env: { FORCE_COLOR: true }, + }, + ); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - const output = isWebpack5 ? 'successfully' : 'main.js'; + const output = isWebpack5 ? "successfully" : "main.js"; expect(stdout).toContain(`\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m`); }); it('should work with the "stats" option from the configuration #2', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--config=no-stats.webpack.config.js'], { - env: { FORCE_COLOR: true }, - }); + const { exitCode, stderr, stdout } = await run( + __dirname, + ["--config=no-stats.webpack.config.js"], + { + env: { FORCE_COLOR: true }, + }, + ); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - const output = isWebpack5 ? 'successfully' : 'main.js'; + const output = isWebpack5 ? "successfully" : "main.js"; expect(stdout).toContain(`\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m`); }); it('should work with the "stats" option from the configuration #3', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--config=colors-true.webpack.config.js']); + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--config=colors-true.webpack.config.js", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - const output = isWebpack5 ? 'successfully' : 'main.js'; + const output = isWebpack5 ? "successfully" : "main.js"; expect(stdout).toContain(`\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m`); }); it('should work with the "stats" option from the configuration #4', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--config=colors-false.webpack.config.js']); + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--config=colors-false.webpack.config.js", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - const output = isWebpack5 ? 'successfully' : 'main.js'; + const output = isWebpack5 ? "successfully" : "main.js"; expect(stdout).not.toContain(`\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m`); expect(stdout).toContain(output); }); - it('should prioritize --color over colors in config', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--config=colors-false.webpack.config.js', '--color']); + it("should prioritize --color over colors in config", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--config=colors-false.webpack.config.js", + "--color", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - const output = isWebpack5 ? 'successfully' : 'main.js'; + const output = isWebpack5 ? "successfully" : "main.js"; expect(stdout).toContain(`\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m`); }); - it('should prioritize --no-color over colors in config', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--config=colors-true.webpack.config.js', '--no-color']); + it("should prioritize --no-color over colors in config", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--config=colors-true.webpack.config.js", + "--no-color", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - const output = isWebpack5 ? 'successfully' : 'main.js'; + const output = isWebpack5 ? "successfully" : "main.js"; expect(stdout).not.toContain(`\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m`); expect(stdout).toContain(output); }); - it('should work in multi compiler mode', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--config=multiple-configs.js', '--color']); + it("should work in multi compiler mode", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--config=multiple-configs.js", + "--color", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); diff --git a/test/build/colors/multiple-configs.js b/test/build/colors/multiple-configs.js index 75a5ac19fd2..5ef28ccfd71 100644 --- a/test/build/colors/multiple-configs.js +++ b/test/build/colors/multiple-configs.js @@ -1,14 +1,14 @@ module.exports = [ { - name: 'first-config', - entry: './src/first.js', - stats: 'normal', - mode: 'development', + name: "first-config", + entry: "./src/first.js", + stats: "normal", + mode: "development", }, { - name: 'second-config', - entry: './src/second.js', - stats: 'normal', - mode: 'development', + name: "second-config", + entry: "./src/second.js", + stats: "normal", + mode: "development", }, ]; diff --git a/test/build/colors/no-stats.webpack.config.js b/test/build/colors/no-stats.webpack.config.js index 8b2d7eb877e..931bbe238fb 100644 --- a/test/build/colors/no-stats.webpack.config.js +++ b/test/build/colors/no-stats.webpack.config.js @@ -1,4 +1,4 @@ module.exports = { - name: 'test', - mode: 'development', + name: "test", + mode: "development", }; diff --git a/test/build/colors/src/first.js b/test/build/colors/src/first.js index e5ba023838e..8a9423b5c10 100644 --- a/test/build/colors/src/first.js +++ b/test/build/colors/src/first.js @@ -1 +1 @@ -console.log('first'); +console.log("first"); diff --git a/test/build/colors/src/second.js b/test/build/colors/src/second.js index e1595dffb00..5023a5896d0 100644 --- a/test/build/colors/src/second.js +++ b/test/build/colors/src/second.js @@ -1 +1 @@ -console.log('second'); +console.log("second"); diff --git a/test/build/colors/stats-boolean.webpack.config.js b/test/build/colors/stats-boolean.webpack.config.js index 4b5a5355c76..7abc3543a50 100644 --- a/test/build/colors/stats-boolean.webpack.config.js +++ b/test/build/colors/stats-boolean.webpack.config.js @@ -1,4 +1,4 @@ module.exports = { stats: true, - mode: 'development', + mode: "development", }; diff --git a/test/build/colors/stats-string.webpack.config.js b/test/build/colors/stats-string.webpack.config.js index f539326edb7..404fa404f68 100644 --- a/test/build/colors/stats-string.webpack.config.js +++ b/test/build/colors/stats-string.webpack.config.js @@ -1,4 +1,4 @@ module.exports = { - stats: 'verbose', - mode: 'development', + stats: "verbose", + mode: "development", }; diff --git a/test/build/colors/webpack.config.js b/test/build/colors/webpack.config.js index f2c3976d5d3..11623bb6280 100644 --- a/test/build/colors/webpack.config.js +++ b/test/build/colors/webpack.config.js @@ -1,3 +1,3 @@ module.exports = { - mode: 'development', + mode: "development", }; diff --git a/test/build/config-format/coffee/coffee.test.js b/test/build/config-format/coffee/coffee.test.js index 0ac85cd3956..c0aa525ac1f 100644 --- a/test/build/config-format/coffee/coffee.test.js +++ b/test/build/config-format/coffee/coffee.test.js @@ -1,15 +1,15 @@ -const { run } = require('../../../utils/test-utils'); +const { run } = require("../../../utils/test-utils"); -describe('webpack cli', () => { - it('should support coffeescript file as flag', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', 'webpack.config.coffee']); +describe("webpack cli", () => { + it("should support coffeescript file as flag", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["-c", "webpack.config.coffee"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); }); - it('should load coffeescript file by default', async () => { + it("should load coffeescript file by default", async () => { const { exitCode, stderr, stdout } = await run(__dirname, []); expect(exitCode).toBe(0); diff --git a/test/build/config-format/coffee/main.js b/test/build/config-format/coffee/main.js index 5fb227c6c10..faf5b223895 100644 --- a/test/build/config-format/coffee/main.js +++ b/test/build/config-format/coffee/main.js @@ -1 +1 @@ -console.log('Sakusa Kiyoomi'); +console.log("Sakusa Kiyoomi"); diff --git a/test/build/config-format/commonjs-default/commonjs-default.test.js b/test/build/config-format/commonjs-default/commonjs-default.test.js index 1e663dbc2b4..d1dbfad3b2d 100644 --- a/test/build/config-format/commonjs-default/commonjs-default.test.js +++ b/test/build/config-format/commonjs-default/commonjs-default.test.js @@ -1,8 +1,8 @@ -const { run } = require('../../../utils/test-utils'); +const { run } = require("../../../utils/test-utils"); -describe('webpack cli', () => { - it('should support CommonJS file', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', 'webpack.config.cjs']); +describe("webpack cli", () => { + it("should support CommonJS file", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["-c", "webpack.config.cjs"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); diff --git a/test/build/config-format/commonjs-default/main.js b/test/build/config-format/commonjs-default/main.js index 8ed93e41fb2..bea4f658c4a 100644 --- a/test/build/config-format/commonjs-default/main.js +++ b/test/build/config-format/commonjs-default/main.js @@ -1 +1 @@ -console.log('Hoshiumi'); +console.log("Hoshiumi"); diff --git a/test/build/config-format/commonjs-default/webpack.config.cjs b/test/build/config-format/commonjs-default/webpack.config.cjs index 415d965a247..c8befd13af8 100644 --- a/test/build/config-format/commonjs-default/webpack.config.cjs +++ b/test/build/config-format/commonjs-default/webpack.config.cjs @@ -1,11 +1,11 @@ -const path = require('path'); +const path = require("path"); const config = { - mode: 'production', - entry: './main.js', + mode: "production", + entry: "./main.js", output: { - path: path.resolve(__dirname, 'dist'), - filename: 'foo.bundle.js', + path: path.resolve(__dirname, "dist"), + filename: "foo.bundle.js", }, }; diff --git a/test/build/config-format/commonjs/commonjs.test.js b/test/build/config-format/commonjs/commonjs.test.js index 1e663dbc2b4..d1dbfad3b2d 100644 --- a/test/build/config-format/commonjs/commonjs.test.js +++ b/test/build/config-format/commonjs/commonjs.test.js @@ -1,8 +1,8 @@ -const { run } = require('../../../utils/test-utils'); +const { run } = require("../../../utils/test-utils"); -describe('webpack cli', () => { - it('should support CommonJS file', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', 'webpack.config.cjs']); +describe("webpack cli", () => { + it("should support CommonJS file", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["-c", "webpack.config.cjs"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); diff --git a/test/build/config-format/commonjs/main.js b/test/build/config-format/commonjs/main.js index 8ed93e41fb2..bea4f658c4a 100644 --- a/test/build/config-format/commonjs/main.js +++ b/test/build/config-format/commonjs/main.js @@ -1 +1 @@ -console.log('Hoshiumi'); +console.log("Hoshiumi"); diff --git a/test/build/config-format/commonjs/webpack.config.cjs b/test/build/config-format/commonjs/webpack.config.cjs index 7bb5d185edf..7aee196b1d9 100644 --- a/test/build/config-format/commonjs/webpack.config.cjs +++ b/test/build/config-format/commonjs/webpack.config.cjs @@ -1,11 +1,11 @@ -const path = require('path'); +const path = require("path"); const config = { - mode: 'production', - entry: './main.js', + mode: "production", + entry: "./main.js", output: { - path: path.resolve(__dirname, 'dist'), - filename: 'foo.bundle.js', + path: path.resolve(__dirname, "dist"), + filename: "foo.bundle.js", }, }; diff --git a/test/build/config-format/failure/failure.test.js b/test/build/config-format/failure/failure.test.js index b102fef11f0..ffa5ad01270 100644 --- a/test/build/config-format/failure/failure.test.js +++ b/test/build/config-format/failure/failure.test.js @@ -1,17 +1,19 @@ -const path = require('path'); +const path = require("path"); -const { run } = require('../../../utils/test-utils'); +const { run } = require("../../../utils/test-utils"); -describe('failure', () => { - it('should log error on not installed registers', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', 'webpack.config.iced']); +describe("failure", () => { + it("should log error on not installed registers", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["-c", "webpack.config.iced"]); expect(exitCode).toBe(2); - expect(stderr).toContain(`Unable load '${path.resolve(__dirname, './webpack.config.iced')}'`); + expect(stderr).toContain( + `Unable load '${path.resolve(__dirname, "./webpack.config.iced")}'`, + ); expect(stderr).toContain('Unable to use specified module loaders for ".iced".'); expect(stderr).toContain("Cannot find module 'iced-coffee-script/register'"); expect(stderr).toContain("Cannot find module 'iced-coffee-script'"); - expect(stderr).toContain('Please install one of them'); + expect(stderr).toContain("Please install one of them"); expect(stdout).toBeFalsy(); }); }); diff --git a/test/build/config-format/mjs/main.js b/test/build/config-format/mjs/main.js index a00a3125ea3..ecbe8cd001a 100644 --- a/test/build/config-format/mjs/main.js +++ b/test/build/config-format/mjs/main.js @@ -1 +1 @@ -console.log('You know who'); +console.log("You know who"); diff --git a/test/build/config-format/mjs/mjs.test.js b/test/build/config-format/mjs/mjs.test.js index a8775c8193e..baf15f4f698 100644 --- a/test/build/config-format/mjs/mjs.test.js +++ b/test/build/config-format/mjs/mjs.test.js @@ -1,8 +1,8 @@ -const { run } = require('../../../utils/test-utils'); +const { run } = require("../../../utils/test-utils"); -describe('webpack cli', () => { - it('should support mjs config format', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', 'webpack.config.mjs'], { +describe("webpack cli", () => { + it("should support mjs config format", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["-c", "webpack.config.mjs"], { env: { WEBPACK_CLI_FORCE_LOAD_ESM_CONFIG: true }, }); diff --git a/test/build/config-format/mjs/webpack.config.mjs b/test/build/config-format/mjs/webpack.config.mjs index 6717d84042e..987f3685e67 100644 --- a/test/build/config-format/mjs/webpack.config.mjs +++ b/test/build/config-format/mjs/webpack.config.mjs @@ -1,11 +1,11 @@ -import { fileURLToPath } from 'url'; -import path from 'path'; +import { fileURLToPath } from "url"; +import path from "path"; export default { - mode: 'production', - entry: './main.js', + mode: "production", + entry: "./main.js", output: { - path: path.resolve(path.dirname(fileURLToPath(import.meta.url)), 'dist'), - filename: 'foo.bundle.js', + path: path.resolve(path.dirname(fileURLToPath(import.meta.url)), "dist"), + filename: "foo.bundle.js", }, }; diff --git a/test/build/config-format/typescript-esnext/main.ts b/test/build/config-format/typescript-esnext/main.ts index 6b4ec5de3a4..dc6a7ea6788 100644 --- a/test/build/config-format/typescript-esnext/main.ts +++ b/test/build/config-format/typescript-esnext/main.ts @@ -1 +1 @@ -console.log('Rimuru Tempest'); +console.log("Rimuru Tempest"); diff --git a/test/build/config-format/typescript-esnext/typescript.test.js b/test/build/config-format/typescript-esnext/typescript.test.js index 683640ffd58..ac916906038 100644 --- a/test/build/config-format/typescript-esnext/typescript.test.js +++ b/test/build/config-format/typescript-esnext/typescript.test.js @@ -1,11 +1,11 @@ // eslint-disable-next-line node/no-unpublished-require -const { run, isWebpack5 } = require('../../../utils/test-utils'); -const { existsSync } = require('fs'); -const { resolve } = require('path'); +const { run, isWebpack5 } = require("../../../utils/test-utils"); +const { existsSync } = require("fs"); +const { resolve } = require("path"); -describe('webpack cli', () => { - it('should support typescript esnext file', async () => { - const isMacOS = process.platform === 'darwin'; +describe("webpack cli", () => { + it("should support typescript esnext file", async () => { + const isMacOS = process.platform === "darwin"; const majorNodeVersion = process.version.slice(1, 3); if (majorNodeVersion < 14) { expect(true).toBe(true); @@ -19,12 +19,12 @@ describe('webpack cli', () => { return; } - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', './webpack.config.ts'], { - nodeOptions: ['--loader=ts-node/esm'], + const { exitCode, stderr, stdout } = await run(__dirname, ["-c", "./webpack.config.ts"], { + nodeOptions: ["--loader=ts-node/esm"], }); expect(stderr).not.toBeFalsy(); expect(stdout).toBeTruthy(); expect(exitCode).toBe(0); - expect(existsSync(resolve(__dirname, 'dist/foo.bundle.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "dist/foo.bundle.js"))).toBeTruthy(); }); }); diff --git a/test/build/config-format/typescript-esnext/webpack.config.ts b/test/build/config-format/typescript-esnext/webpack.config.ts index f382c1724f1..4790b3d8029 100644 --- a/test/build/config-format/typescript-esnext/webpack.config.ts +++ b/test/build/config-format/typescript-esnext/webpack.config.ts @@ -1,12 +1,12 @@ /* eslint-disable node/no-unsupported-features/es-syntax */ -import * as path from 'path'; +import * as path from "path"; const config = { - mode: 'production', - entry: './main.ts', + mode: "production", + entry: "./main.ts", output: { - path: path.resolve('dist'), - filename: 'foo.bundle.js', + path: path.resolve("dist"), + filename: "foo.bundle.js", }, }; diff --git a/test/build/config-format/typescript/main.ts b/test/build/config-format/typescript/main.ts index 5dbd072a4f6..41d13d1a9a1 100644 --- a/test/build/config-format/typescript/main.ts +++ b/test/build/config-format/typescript/main.ts @@ -1 +1 @@ -console.log('Main typescript file'); +console.log("Main typescript file"); diff --git a/test/build/config-format/typescript/typescript.test.js b/test/build/config-format/typescript/typescript.test.js index 50b8f555179..08f1a7e8b8d 100644 --- a/test/build/config-format/typescript/typescript.test.js +++ b/test/build/config-format/typescript/typescript.test.js @@ -1,14 +1,14 @@ -const { run } = require('../../../utils/test-utils'); -const { existsSync } = require('fs'); -const { resolve } = require('path'); +const { run } = require("../../../utils/test-utils"); +const { existsSync } = require("fs"); +const { resolve } = require("path"); -describe('webpack cli', () => { - it('should support typescript file', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', './webpack.config.ts']); +describe("webpack cli", () => { + it("should support typescript file", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["-c", "./webpack.config.ts"]); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); expect(exitCode).toBe(0); - expect(existsSync(resolve(__dirname, 'dist/foo.bundle.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "dist/foo.bundle.js"))).toBeTruthy(); }); }); diff --git a/test/build/config-format/typescript/webpack.config.ts b/test/build/config-format/typescript/webpack.config.ts index bbc70963b3b..c46268523b5 100644 --- a/test/build/config-format/typescript/webpack.config.ts +++ b/test/build/config-format/typescript/webpack.config.ts @@ -1,13 +1,13 @@ /* eslint-disable node/no-unsupported-features/es-syntax */ /** eslint-disable **/ -import * as path from 'path'; +import * as path from "path"; const config = { - mode: 'production', - entry: './main.ts', + mode: "production", + entry: "./main.ts", output: { - path: path.resolve(__dirname, 'dist'), - filename: 'foo.bundle.js', + path: path.resolve(__dirname, "dist"), + filename: "foo.bundle.js", }, }; diff --git a/test/build/config-lookup/custom-name/a.js b/test/build/config-lookup/custom-name/a.js index 2651774ae60..e7134e7006d 100644 --- a/test/build/config-lookup/custom-name/a.js +++ b/test/build/config-lookup/custom-name/a.js @@ -1 +1 @@ -module.exports = 'foo'; +module.exports = "foo"; diff --git a/test/build/config-lookup/custom-name/config.webpack.js b/test/build/config-lookup/custom-name/config.webpack.js index 9b526a493e2..950e44a8b2a 100644 --- a/test/build/config-lookup/custom-name/config.webpack.js +++ b/test/build/config-lookup/custom-name/config.webpack.js @@ -1,9 +1,9 @@ -const { resolve } = require('path'); +const { resolve } = require("path"); module.exports = { - entry: resolve('./a.js'), + entry: resolve("./a.js"), output: { - path: resolve(__dirname, 'binary'), - filename: 'a.bundle.js', + path: resolve(__dirname, "binary"), + filename: "a.bundle.js", }, }; diff --git a/test/build/config-lookup/custom-name/config.webpack.mjs b/test/build/config-lookup/custom-name/config.webpack.mjs index 272b905bc1c..3b0545deb81 100644 --- a/test/build/config-lookup/custom-name/config.webpack.mjs +++ b/test/build/config-lookup/custom-name/config.webpack.mjs @@ -1,10 +1,10 @@ -import { fileURLToPath } from 'url'; -import path from 'path'; +import { fileURLToPath } from "url"; +import path from "path"; export default { - entry: './a.js', + entry: "./a.js", output: { - path: path.resolve(path.dirname(fileURLToPath(import.meta.url)), 'dist'), - filename: 'a.bundle.js', + path: path.resolve(path.dirname(fileURLToPath(import.meta.url)), "dist"), + filename: "a.bundle.js", }, }; diff --git a/test/build/config-lookup/custom-name/custom-name.test.js b/test/build/config-lookup/custom-name/custom-name.test.js index e03c561c5d3..ab211df7819 100644 --- a/test/build/config-lookup/custom-name/custom-name.test.js +++ b/test/build/config-lookup/custom-name/custom-name.test.js @@ -1,21 +1,28 @@ -'use strict'; +"use strict"; -const { resolve } = require('path'); -const { run } = require('../../../utils/test-utils'); +const { resolve } = require("path"); +const { run } = require("../../../utils/test-utils"); -describe('custom config file', () => { - it('should work with cjs format', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--config', resolve(__dirname, 'config.webpack.js')]); +describe("custom config file", () => { + it("should work with cjs format", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--config", + resolve(__dirname, "config.webpack.js"), + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); }); - it('should work with esm format', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--config', resolve(__dirname, 'config.webpack.mjs')], { - env: { WEBPACK_CLI_FORCE_LOAD_ESM_CONFIG: true }, - }); + it("should work with esm format", async () => { + const { exitCode, stderr, stdout } = await run( + __dirname, + ["--config", resolve(__dirname, "config.webpack.mjs")], + { + env: { WEBPACK_CLI_FORCE_LOAD_ESM_CONFIG: true }, + }, + ); if (/Error: Not supported/.test(stderr)) { expect(exitCode).toBe(2); diff --git a/test/build/config-lookup/dotfolder-array/a.js b/test/build/config-lookup/dotfolder-array/a.js index 8183079e838..96a83902deb 100644 --- a/test/build/config-lookup/dotfolder-array/a.js +++ b/test/build/config-lookup/dotfolder-array/a.js @@ -1 +1 @@ -module.exports = 'hay'; +module.exports = "hay"; diff --git a/test/build/config-lookup/dotfolder-array/dotfolder-array.test.js b/test/build/config-lookup/dotfolder-array/dotfolder-array.test.js index 81bc489fbfa..36d4cbff5d3 100644 --- a/test/build/config-lookup/dotfolder-array/dotfolder-array.test.js +++ b/test/build/config-lookup/dotfolder-array/dotfolder-array.test.js @@ -1,16 +1,16 @@ -'use strict'; -const { existsSync } = require('fs'); -const { resolve } = require('path'); -const { run } = require('../../../utils/test-utils'); +"use strict"; +const { existsSync } = require("fs"); +const { resolve } = require("path"); +const { run } = require("../../../utils/test-utils"); -describe('dotfolder array config lookup', () => { - it('should find a webpack array configuration in a dotfolder', async () => { +describe("dotfolder array config lookup", () => { + it("should find a webpack array configuration in a dotfolder", async () => { const { exitCode, stderr, stdout } = await run(__dirname, []); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); - expect(existsSync(resolve(__dirname, './dist/dist-commonjs.js'))).toBeTruthy(); - expect(existsSync(resolve(__dirname, './dist/dist-amd.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./dist/dist-commonjs.js"))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./dist/dist-amd.js"))).toBeTruthy(); }); }); diff --git a/test/build/config-lookup/dotfolder-single/dotfolder-single.test.js b/test/build/config-lookup/dotfolder-single/dotfolder-single.test.js index ebcf68f4ff2..a71ab9b51f9 100644 --- a/test/build/config-lookup/dotfolder-single/dotfolder-single.test.js +++ b/test/build/config-lookup/dotfolder-single/dotfolder-single.test.js @@ -1,18 +1,18 @@ -'use strict'; +"use strict"; -const { existsSync } = require('fs'); -const { resolve } = require('path'); +const { existsSync } = require("fs"); +const { resolve } = require("path"); -const { run } = require('../../../utils/test-utils'); +const { run } = require("../../../utils/test-utils"); -describe('dotfolder single config lookup', () => { - it('should find a webpack configuration in a dotfolder', async () => { +describe("dotfolder single config lookup", () => { + it("should find a webpack configuration in a dotfolder", async () => { const { exitCode, stderr, stdout } = await run(__dirname, []); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - expect(stdout).not.toContain('Module not found'); + expect(stdout).not.toContain("Module not found"); expect(stdout).toBeTruthy(); - expect(existsSync(resolve(__dirname, './dist/main.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./dist/main.js"))).toBeTruthy(); }); }); diff --git a/test/build/config-lookup/dotfolder-single/index_two.js b/test/build/config-lookup/dotfolder-single/index_two.js index 8183079e838..96a83902deb 100644 --- a/test/build/config-lookup/dotfolder-single/index_two.js +++ b/test/build/config-lookup/dotfolder-single/index_two.js @@ -1 +1 @@ -module.exports = 'hay'; +module.exports = "hay"; diff --git a/test/build/config-lookup/relative/a.js b/test/build/config-lookup/relative/a.js index 735d820f253..0e9a8dc5145 100644 --- a/test/build/config-lookup/relative/a.js +++ b/test/build/config-lookup/relative/a.js @@ -1 +1 @@ -module.exports = 'a.js'; +module.exports = "a.js"; diff --git a/test/build/config-lookup/relative/basic-config.test.js b/test/build/config-lookup/relative/basic-config.test.js index d75b77c935b..cb07beb1082 100644 --- a/test/build/config-lookup/relative/basic-config.test.js +++ b/test/build/config-lookup/relative/basic-config.test.js @@ -1,18 +1,28 @@ -'use strict'; +"use strict"; -const { run } = require('../../../utils/test-utils'); +const { run } = require("../../../utils/test-utils"); -describe('relative path to config', () => { - it('should work', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', 'webpack.config.js', '--output-path', './binary/a']); +describe("relative path to config", () => { + it("should work", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "-c", + "webpack.config.js", + "--output-path", + "./binary/a", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); }); - it('should work #2', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', './webpack.config.js', '--output-path', './binary/b']); + it("should work #2", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "-c", + "./webpack.config.js", + "--output-path", + "./binary/b", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); diff --git a/test/build/config-lookup/relative/webpack.config.js b/test/build/config-lookup/relative/webpack.config.js index b58f8a91f0d..70a68756b2f 100644 --- a/test/build/config-lookup/relative/webpack.config.js +++ b/test/build/config-lookup/relative/webpack.config.js @@ -1,9 +1,9 @@ -const { resolve } = require('path'); +const { resolve } = require("path"); module.exports = { - entry: './a.js', + entry: "./a.js", output: { - path: resolve(__dirname, 'binary'), - filename: 'a.bundle.js', + path: resolve(__dirname, "binary"), + filename: "a.bundle.js", }, }; diff --git a/test/build/config-name/config-name.test.js b/test/build/config-name/config-name.test.js index ed9f5da36b9..4dee9145219 100644 --- a/test/build/config-name/config-name.test.js +++ b/test/build/config-name/config-name.test.js @@ -1,63 +1,82 @@ -'use strict'; +"use strict"; -const { run } = require('../../utils/test-utils'); +const { run } = require("../../utils/test-utils"); -describe('--config-name flag', () => { - it('should select only the config whose name is passed with --config-name', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--config-name', 'first']); +describe("--config-name flag", () => { + it("should select only the config whose name is passed with --config-name", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--config-name", "first"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - expect(stdout).toContain('first'); - expect(stdout).not.toContain('second'); - expect(stdout).not.toContain('third'); + expect(stdout).toContain("first"); + expect(stdout).not.toContain("second"); + expect(stdout).not.toContain("third"); }); - it('should work with multiple values for --config-name', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--config-name', 'first', '--config-name', 'third']); + it("should work with multiple values for --config-name", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--config-name", + "first", + "--config-name", + "third", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - expect(stdout).toContain('first'); - expect(stdout).not.toContain('second'); - expect(stdout).toContain('third'); + expect(stdout).toContain("first"); + expect(stdout).not.toContain("second"); + expect(stdout).toContain("third"); }); - it('should work with multiple values for --config-name and multiple configurations', async () => { + it("should work with multiple values for --config-name and multiple configurations", async () => { const { exitCode, stderr, stdout } = await run( __dirname, - ['-c', './function-config.js', '-c', './single-other-config.js', '--config-name', 'first', '--config-name', 'four'], + [ + "-c", + "./function-config.js", + "-c", + "./single-other-config.js", + "--config-name", + "first", + "--config-name", + "four", + ], false, ); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - expect(stdout).toContain('first'); - expect(stdout).not.toContain('second'); - expect(stdout).not.toContain('third'); - expect(stdout).toContain('four'); + expect(stdout).toContain("first"); + expect(stdout).not.toContain("second"); + expect(stdout).not.toContain("third"); + expect(stdout).toContain("four"); }); - it('should log error if invalid config name is provided', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--config-name', 'test']); + it("should log error if invalid config name is provided", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--config-name", "test"]); expect(exitCode).toBe(2); expect(stderr).toContain('Configuration with the name "test" was not found.'); expect(stdout).toBeFalsy(); }); - it('should log error if multiple configurations are not found', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--config-name', 'test', '-c', 'single-config.js']); + it("should log error if multiple configurations are not found", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--config-name", + "test", + "-c", + "single-config.js", + ]); expect(exitCode).toBe(2); expect(stderr).toContain('Configuration with the name "test" was not found.'); expect(stdout).toBeFalsy(); }); - it('should log error if multiple configurations are not found #1', async () => { + it("should log error if multiple configurations are not found #1", async () => { const { exitCode, stderr, stdout } = await run( __dirname, - ['--config-name', 'test', '--config-name', 'bar', '-c', 'single-config.js'], + ["--config-name", "test", "--config-name", "bar", "-c", "single-config.js"], false, ); @@ -67,10 +86,10 @@ describe('--config-name flag', () => { expect(stdout).toBeFalsy(); }); - it('should log error if multiple configurations are not found #2', async () => { + it("should log error if multiple configurations are not found #2", async () => { const { exitCode, stderr, stdout } = await run( __dirname, - ['--config-name', 'first', '--config-name', 'bar', '-c', 'single-config.js'], + ["--config-name", "first", "--config-name", "bar", "-c", "single-config.js"], false, ); @@ -79,32 +98,42 @@ describe('--config-name flag', () => { expect(stdout).toBeFalsy(); }); - it('should work with config as a function', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--config', 'function-config.js', '--config-name', 'first']); + it("should work with config as a function", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--config", + "function-config.js", + "--config-name", + "first", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - expect(stdout).toContain('first'); - expect(stdout).not.toContain('second'); - expect(stdout).not.toContain('third'); + expect(stdout).toContain("first"); + expect(stdout).not.toContain("second"); + expect(stdout).not.toContain("third"); }); - it('should work with multiple values for --config-name when the config is a function', async () => { + it("should work with multiple values for --config-name when the config is a function", async () => { const { exitCode, stderr, stdout } = await run( __dirname, - ['--config', 'function-config.js', '--config-name', 'first', '--config-name', 'third'], + ["--config", "function-config.js", "--config-name", "first", "--config-name", "third"], false, ); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - expect(stdout).toContain('first'); - expect(stdout).not.toContain('second'); - expect(stdout).toContain('third'); + expect(stdout).toContain("first"); + expect(stdout).not.toContain("second"); + expect(stdout).toContain("third"); }); - it('should log error if invalid config name is provided ', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--config', 'function-config.js', '--config-name', 'test']); + it("should log error if invalid config name is provided ", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--config", + "function-config.js", + "--config-name", + "test", + ]); expect(exitCode).toBe(2); expect(stderr).toContain('Configuration with the name "test" was not found.'); diff --git a/test/build/config-name/function-config.js b/test/build/config-name/function-config.js index aea6af2f9fb..1f3c3343254 100644 --- a/test/build/config-name/function-config.js +++ b/test/build/config-name/function-config.js @@ -1,26 +1,26 @@ module.exports = () => [ { output: { - filename: './dist-first.js', + filename: "./dist-first.js", }, - name: 'first', - entry: './src/first.js', - mode: 'development', + name: "first", + entry: "./src/first.js", + mode: "development", }, { output: { - filename: './dist-second.js', + filename: "./dist-second.js", }, - name: 'second', - entry: './src/second.js', - mode: 'development', + name: "second", + entry: "./src/second.js", + mode: "development", }, { output: { - filename: './dist-third.js', + filename: "./dist-third.js", }, - name: 'third', - entry: './src/third.js', - mode: 'none', + name: "third", + entry: "./src/third.js", + mode: "none", }, ]; diff --git a/test/build/config-name/single-config.js b/test/build/config-name/single-config.js index e5fff043bc6..aa3c87af2b5 100644 --- a/test/build/config-name/single-config.js +++ b/test/build/config-name/single-config.js @@ -1,8 +1,8 @@ module.exports = { output: { - filename: './dist-single.js', + filename: "./dist-single.js", }, - name: 'first', - entry: './src/first.js', - mode: 'development', + name: "first", + entry: "./src/first.js", + mode: "development", }; diff --git a/test/build/config-name/single-other-config.js b/test/build/config-name/single-other-config.js index fd4c4a325a8..46055e1a635 100644 --- a/test/build/config-name/single-other-config.js +++ b/test/build/config-name/single-other-config.js @@ -1,8 +1,8 @@ module.exports = { output: { - filename: './dist-single.js', + filename: "./dist-single.js", }, - name: 'four', - entry: './src/first.js', - mode: 'development', + name: "four", + entry: "./src/first.js", + mode: "development", }; diff --git a/test/build/config-name/src/first.js b/test/build/config-name/src/first.js index 3dfd0a1def0..c0db0a7cb59 100644 --- a/test/build/config-name/src/first.js +++ b/test/build/config-name/src/first.js @@ -1 +1 @@ -console.log('first config'); +console.log("first config"); diff --git a/test/build/config-name/src/second.js b/test/build/config-name/src/second.js index 15c0f734c34..98f5a5f5420 100644 --- a/test/build/config-name/src/second.js +++ b/test/build/config-name/src/second.js @@ -1 +1 @@ -console.log('second config'); +console.log("second config"); diff --git a/test/build/config-name/src/third.js b/test/build/config-name/src/third.js index 1047ae56bdc..372f49950f7 100644 --- a/test/build/config-name/src/third.js +++ b/test/build/config-name/src/third.js @@ -1 +1 @@ -console.log('third config'); +console.log("third config"); diff --git a/test/build/config-name/webpack.config.js b/test/build/config-name/webpack.config.js index e3ea1bc7020..97ae11c7127 100644 --- a/test/build/config-name/webpack.config.js +++ b/test/build/config-name/webpack.config.js @@ -1,27 +1,27 @@ module.exports = [ { output: { - filename: './dist-first.js', + filename: "./dist-first.js", }, - name: 'first', - entry: './src/first.js', - mode: 'development', + name: "first", + entry: "./src/first.js", + mode: "development", }, { output: { - filename: './dist-second.js', + filename: "./dist-second.js", }, - name: 'second', - entry: './src/second.js', - mode: 'development', + name: "second", + entry: "./src/second.js", + mode: "development", }, { output: { - filename: './dist-third.js', + filename: "./dist-third.js", }, - name: 'third', - entry: './src/third.js', - mode: 'none', - stats: 'verbose', + name: "third", + entry: "./src/third.js", + mode: "none", + stats: "verbose", }, ]; diff --git a/test/build/config/absent/a.js b/test/build/config/absent/a.js index 8ac1838ebe9..fe6420ad3ce 100644 --- a/test/build/config/absent/a.js +++ b/test/build/config/absent/a.js @@ -1 +1 @@ -console.log('Zenitsu'); +console.log("Zenitsu"); diff --git a/test/build/config/absent/config-absent.test.js b/test/build/config/absent/config-absent.test.js index 61fcf448dc7..9442d6b6199 100644 --- a/test/build/config/absent/config-absent.test.js +++ b/test/build/config/absent/config-absent.test.js @@ -1,16 +1,21 @@ -'use strict'; +"use strict"; -const path = require('path'); -const { run } = require('../../../utils/test-utils'); +const path = require("path"); +const { run } = require("../../../utils/test-utils"); -describe('Config:', () => { - it('supplied config file is absent', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', path.resolve(__dirname, 'webpack.config.js')]); +describe("Config:", () => { + it("supplied config file is absent", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "-c", + path.resolve(__dirname, "webpack.config.js"), + ]); // should throw with correct exit code expect(exitCode).toBe(2); // Should contain the correct error message - expect(stderr).toContain(`Failed to load '${path.resolve(__dirname, 'webpack.config.js')}' config`); + expect(stderr).toContain( + `Failed to load '${path.resolve(__dirname, "webpack.config.js")}' config`, + ); expect(stdout).toBeFalsy(); }); }); diff --git a/test/build/config/absent/webpack.config-absent.js b/test/build/config/absent/webpack.config-absent.js index b58f8a91f0d..70a68756b2f 100644 --- a/test/build/config/absent/webpack.config-absent.js +++ b/test/build/config/absent/webpack.config-absent.js @@ -1,9 +1,9 @@ -const { resolve } = require('path'); +const { resolve } = require("path"); module.exports = { - entry: './a.js', + entry: "./a.js", output: { - path: resolve(__dirname, 'binary'), - filename: 'a.bundle.js', + path: resolve(__dirname, "binary"), + filename: "a.bundle.js", }, }; diff --git a/test/build/config/basic/a.js b/test/build/config/basic/a.js index 735d820f253..0e9a8dc5145 100644 --- a/test/build/config/basic/a.js +++ b/test/build/config/basic/a.js @@ -1 +1 @@ -module.exports = 'a.js'; +module.exports = "a.js"; diff --git a/test/build/config/basic/basic-config.test.js b/test/build/config/basic/basic-config.test.js index 3c7efd29718..3fa970ffdc4 100644 --- a/test/build/config/basic/basic-config.test.js +++ b/test/build/config/basic/basic-config.test.js @@ -1,15 +1,15 @@ -'use strict'; +"use strict"; -const { resolve } = require('path'); -const { run } = require('../../../utils/test-utils'); +const { resolve } = require("path"); +const { run } = require("../../../utils/test-utils"); -describe('basic config file', () => { - it('is able to understand and parse a very basic configuration file', async () => { +describe("basic config file", () => { + it("is able to understand and parse a very basic configuration file", async () => { const { exitCode, stderr, stdout } = await run(__dirname, [ - '-c', - resolve(__dirname, 'webpack.config.js'), - '--output-path', - './binary', + "-c", + resolve(__dirname, "webpack.config.js"), + "--output-path", + "./binary", ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); diff --git a/test/build/config/basic/webpack.config.js b/test/build/config/basic/webpack.config.js index b58f8a91f0d..70a68756b2f 100644 --- a/test/build/config/basic/webpack.config.js +++ b/test/build/config/basic/webpack.config.js @@ -1,9 +1,9 @@ -const { resolve } = require('path'); +const { resolve } = require("path"); module.exports = { - entry: './a.js', + entry: "./a.js", output: { - path: resolve(__dirname, 'binary'), - filename: 'a.bundle.js', + path: resolve(__dirname, "binary"), + filename: "a.bundle.js", }, }; diff --git a/test/build/config/defaults/basic-config/default-js-config.test.js b/test/build/config/defaults/basic-config/default-js-config.test.js index 2fa41973d10..4c8545729c8 100644 --- a/test/build/config/defaults/basic-config/default-js-config.test.js +++ b/test/build/config/defaults/basic-config/default-js-config.test.js @@ -1,27 +1,27 @@ -const fs = require('fs'); -const path = require('path'); -const { run, isWebpack5 } = require('../../../../utils/test-utils'); +const fs = require("fs"); +const path = require("path"); +const { run, isWebpack5 } = require("../../../../utils/test-utils"); -describe('Zero Config', () => { - it('runs when config is present but not supplied via flag', async () => { +describe("Zero Config", () => { + it("runs when config is present but not supplied via flag", async () => { const { exitCode, stderr, stdout } = await run(__dirname, []); expect(exitCode).toEqual(0); expect(stderr).toBeFalsy(); // default entry should be used - expect(stdout).toContain('./src/index.js'); + expect(stdout).toContain("./src/index.js"); // should pick up the output path from config - expect(stdout).toContain('test-output'); + expect(stdout).toContain("test-output"); if (!isWebpack5) { - expect(stdout).toContain('Hash'); - expect(stdout).toContain('Version'); - expect(stdout).toContain('Built at'); - expect(stdout).toContain('Time'); + expect(stdout).toContain("Hash"); + expect(stdout).toContain("Version"); + expect(stdout).toContain("Built at"); + expect(stdout).toContain("Time"); } // check that the output file exists - expect(fs.existsSync(path.join(__dirname, '/dist/test-output.js'))).toBeTruthy(); + expect(fs.existsSync(path.join(__dirname, "/dist/test-output.js"))).toBeTruthy(); }); }); diff --git a/test/build/config/defaults/basic-config/webpack.config.js b/test/build/config/defaults/basic-config/webpack.config.js index 6593a7a44a3..e153ad2935b 100644 --- a/test/build/config/defaults/basic-config/webpack.config.js +++ b/test/build/config/defaults/basic-config/webpack.config.js @@ -1,6 +1,6 @@ module.exports = { - mode: 'development', + mode: "development", output: { - filename: 'test-output.js', + filename: "test-output.js", }, }; diff --git a/test/build/config/defaults/cjs-config/default-cjs-config.test.js b/test/build/config/defaults/cjs-config/default-cjs-config.test.js index ef25d0ad564..096652549bf 100644 --- a/test/build/config/defaults/cjs-config/default-cjs-config.test.js +++ b/test/build/config/defaults/cjs-config/default-cjs-config.test.js @@ -1,26 +1,26 @@ -const fs = require('fs'); -const path = require('path'); -const { run, isWebpack5 } = require('../../../../utils/test-utils'); +const fs = require("fs"); +const path = require("path"); +const { run, isWebpack5 } = require("../../../../utils/test-utils"); -describe('Default Config:', () => { - it('Should be able to pick cjs config by default', async () => { +describe("Default Config:", () => { + it("Should be able to pick cjs config by default", async () => { const { exitCode, stderr, stdout } = await run(__dirname, []); expect(exitCode).toEqual(0); expect(stderr).toBeFalsy(); // default entry should be used - expect(stdout).toContain('./src/index.js'); + expect(stdout).toContain("./src/index.js"); // should pick up the output path from config - expect(stdout).toContain('test-output'); + expect(stdout).toContain("test-output"); if (!isWebpack5) { - expect(stdout).toContain('Hash'); - expect(stdout).toContain('Version'); - expect(stdout).toContain('Built at'); - expect(stdout).toContain('Time'); + expect(stdout).toContain("Hash"); + expect(stdout).toContain("Version"); + expect(stdout).toContain("Built at"); + expect(stdout).toContain("Time"); } // check that the output file exists - expect(fs.existsSync(path.join(__dirname, '/dist/test-output.js'))).toBeTruthy(); + expect(fs.existsSync(path.join(__dirname, "/dist/test-output.js"))).toBeTruthy(); }); }); diff --git a/test/build/config/defaults/cjs-config/webpack.config.cjs b/test/build/config/defaults/cjs-config/webpack.config.cjs index 6593a7a44a3..e153ad2935b 100644 --- a/test/build/config/defaults/cjs-config/webpack.config.cjs +++ b/test/build/config/defaults/cjs-config/webpack.config.cjs @@ -1,6 +1,6 @@ module.exports = { - mode: 'development', + mode: "development", output: { - filename: 'test-output.js', + filename: "test-output.js", }, }; diff --git a/test/build/config/defaults/dot-webpack-directory-webpackfile/multiple-location-config.test.js b/test/build/config/defaults/dot-webpack-directory-webpackfile/multiple-location-config.test.js index 5b68f73dc03..d5bc1d8ad9c 100644 --- a/test/build/config/defaults/dot-webpack-directory-webpackfile/multiple-location-config.test.js +++ b/test/build/config/defaults/dot-webpack-directory-webpackfile/multiple-location-config.test.js @@ -1,14 +1,14 @@ -'use strict'; -const { existsSync } = require('fs'); -const { resolve } = require('path'); -const { run } = require('../../../../utils/test-utils'); +"use strict"; +const { existsSync } = require("fs"); +const { resolve } = require("path"); +const { run } = require("../../../../utils/test-utils"); -describe('multiple dev config files with webpack.config.js', () => { - it('Uses webpack.config.development.js', async () => { +describe("multiple dev config files with webpack.config.js", () => { + it("Uses webpack.config.development.js", async () => { const { stdout, stderr, exitCode } = await run(__dirname, []); expect(exitCode).toEqual(0); expect(stderr).toBeFalsy(); expect(stdout).not.toBe(undefined); - expect(existsSync(resolve(__dirname, './binary/dev.folder.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./binary/dev.folder.js"))).toBeTruthy(); }); }); diff --git a/test/build/config/defaults/dot-webpack-directory/dev-none-config.test.js b/test/build/config/defaults/dot-webpack-directory/dev-none-config.test.js index 5c59efbbc78..c4948bebd66 100644 --- a/test/build/config/defaults/dot-webpack-directory/dev-none-config.test.js +++ b/test/build/config/defaults/dot-webpack-directory/dev-none-config.test.js @@ -1,14 +1,14 @@ -'use strict'; -const { existsSync } = require('fs'); -const { resolve } = require('path'); -const { run } = require('../../../../utils/test-utils'); +"use strict"; +const { existsSync } = require("fs"); +const { resolve } = require("path"); +const { run } = require("../../../../utils/test-utils"); -describe('multiple config files', () => { - it('Uses dev config when both dev and none are present', async () => { +describe("multiple config files", () => { + it("Uses dev config when both dev and none are present", async () => { const { stdout, stderr, exitCode } = await run(__dirname, []); expect(exitCode).toEqual(0); expect(stderr).toBeFalsy(); expect(stdout).not.toBe(undefined); - expect(existsSync(resolve(__dirname, './binary/dev.bundle.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./binary/dev.bundle.js"))).toBeTruthy(); }); }); diff --git a/test/build/config/defaults/mjs-config/default-mjs-config.test.js b/test/build/config/defaults/mjs-config/default-mjs-config.test.js index 3e96d4388a3..3577a417d1d 100644 --- a/test/build/config/defaults/mjs-config/default-mjs-config.test.js +++ b/test/build/config/defaults/mjs-config/default-mjs-config.test.js @@ -1,10 +1,12 @@ -const fs = require('fs'); -const path = require('path'); -const { run, isWebpack5 } = require('../../../../utils/test-utils'); +const fs = require("fs"); +const path = require("path"); +const { run, isWebpack5 } = require("../../../../utils/test-utils"); -describe('Default Config:', () => { - it('Should be able to pick mjs config by default', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [], { env: { WEBPACK_CLI_FORCE_LOAD_ESM_CONFIG: true } }); +describe("Default Config:", () => { + it("Should be able to pick mjs config by default", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [], { + env: { WEBPACK_CLI_FORCE_LOAD_ESM_CONFIG: true }, + }); if (/Error: Not supported/.test(stderr)) { expect(exitCode).toEqual(2); @@ -13,19 +15,19 @@ describe('Default Config:', () => { expect(exitCode).toEqual(0); expect(stderr).toBeFalsy(); // default entry should be used - expect(stdout).toContain('./src/index.js'); + expect(stdout).toContain("./src/index.js"); // should pick up the output path from config - expect(stdout).toContain('test-output'); + expect(stdout).toContain("test-output"); if (!isWebpack5) { - expect(stdout).toContain('Hash'); - expect(stdout).toContain('Version'); - expect(stdout).toContain('Built at'); - expect(stdout).toContain('Time'); + expect(stdout).toContain("Hash"); + expect(stdout).toContain("Version"); + expect(stdout).toContain("Built at"); + expect(stdout).toContain("Time"); } // check that the output file exists - expect(fs.existsSync(path.join(__dirname, '/dist/test-output.js'))).toBeTruthy(); + expect(fs.existsSync(path.join(__dirname, "/dist/test-output.js"))).toBeTruthy(); } }); }); diff --git a/test/build/config/defaults/mjs-config/webpack.config.mjs b/test/build/config/defaults/mjs-config/webpack.config.mjs index 3c5c06d4449..07661617d18 100644 --- a/test/build/config/defaults/mjs-config/webpack.config.mjs +++ b/test/build/config/defaults/mjs-config/webpack.config.mjs @@ -1,6 +1,6 @@ export default { - mode: 'development', + mode: "development", output: { - filename: 'test-output.js', + filename: "test-output.js", }, }; diff --git a/test/build/config/defaults/with-mode/multiple-config.test.js b/test/build/config/defaults/with-mode/multiple-config.test.js index f95169c84ca..65fca69f2ee 100644 --- a/test/build/config/defaults/with-mode/multiple-config.test.js +++ b/test/build/config/defaults/with-mode/multiple-config.test.js @@ -1,14 +1,14 @@ -'use strict'; -const { existsSync } = require('fs'); -const { resolve } = require('path'); -const { run } = require('../../../../utils/test-utils'); +"use strict"; +const { existsSync } = require("fs"); +const { resolve } = require("path"); +const { run } = require("../../../../utils/test-utils"); -describe('multiple config files', () => { - it('Uses dev config when development mode is supplied', async () => { - const { stdout, stderr, exitCode } = await run(__dirname, ['--mode', 'development']); +describe("multiple config files", () => { + it("Uses dev config when development mode is supplied", async () => { + const { stdout, stderr, exitCode } = await run(__dirname, ["--mode", "development"]); expect(exitCode).toEqual(0); expect(stderr).toBeFalsy(); expect(stdout).not.toBe(undefined); - expect(existsSync(resolve(__dirname, './binary/dev.bundle.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./binary/dev.bundle.js"))).toBeTruthy(); }); }); diff --git a/test/build/config/defaults/with-mode/webpack.config.js b/test/build/config/defaults/with-mode/webpack.config.js index 0e8c35c932f..5bba6294662 100644 --- a/test/build/config/defaults/with-mode/webpack.config.js +++ b/test/build/config/defaults/with-mode/webpack.config.js @@ -1,9 +1,9 @@ -const { resolve } = require('path'); +const { resolve } = require("path"); module.exports = { - entry: './index.js', + entry: "./index.js", output: { - path: resolve(__dirname, './binary'), - filename: 'dev.bundle.js', + path: resolve(__dirname, "./binary"), + filename: "dev.bundle.js", }, }; diff --git a/test/build/config/empty-array/empty-array.test.js b/test/build/config/empty-array/empty-array.test.js index 6433ec506c0..ec3ef7203b4 100644 --- a/test/build/config/empty-array/empty-array.test.js +++ b/test/build/config/empty-array/empty-array.test.js @@ -1,10 +1,13 @@ -'use strict'; -const { resolve } = require('path'); -const { run } = require('../../../utils/test-utils'); +"use strict"; +const { resolve } = require("path"); +const { run } = require("../../../utils/test-utils"); -describe('config flag with empty config file', () => { - it('should throw error with no configuration or index file', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', resolve(__dirname, 'webpack.config.js')]); +describe("config flag with empty config file", () => { + it("should throw error with no configuration or index file", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "-c", + resolve(__dirname, "webpack.config.js"), + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); diff --git a/test/build/config/empty-function/empty-function.test.js b/test/build/config/empty-function/empty-function.test.js index 6433ec506c0..ec3ef7203b4 100644 --- a/test/build/config/empty-function/empty-function.test.js +++ b/test/build/config/empty-function/empty-function.test.js @@ -1,10 +1,13 @@ -'use strict'; -const { resolve } = require('path'); -const { run } = require('../../../utils/test-utils'); +"use strict"; +const { resolve } = require("path"); +const { run } = require("../../../utils/test-utils"); -describe('config flag with empty config file', () => { - it('should throw error with no configuration or index file', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', resolve(__dirname, 'webpack.config.js')]); +describe("config flag with empty config file", () => { + it("should throw error with no configuration or index file", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "-c", + resolve(__dirname, "webpack.config.js"), + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); diff --git a/test/build/config/empty-promise/empty-promise.test.js b/test/build/config/empty-promise/empty-promise.test.js index 6433ec506c0..ec3ef7203b4 100644 --- a/test/build/config/empty-promise/empty-promise.test.js +++ b/test/build/config/empty-promise/empty-promise.test.js @@ -1,10 +1,13 @@ -'use strict'; -const { resolve } = require('path'); -const { run } = require('../../../utils/test-utils'); +"use strict"; +const { resolve } = require("path"); +const { run } = require("../../../utils/test-utils"); -describe('config flag with empty config file', () => { - it('should throw error with no configuration or index file', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', resolve(__dirname, 'webpack.config.js')]); +describe("config flag with empty config file", () => { + it("should throw error with no configuration or index file", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "-c", + resolve(__dirname, "webpack.config.js"), + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); diff --git a/test/build/config/empty/empty.test.js b/test/build/config/empty/empty.test.js index 6433ec506c0..ec3ef7203b4 100644 --- a/test/build/config/empty/empty.test.js +++ b/test/build/config/empty/empty.test.js @@ -1,10 +1,13 @@ -'use strict'; -const { resolve } = require('path'); -const { run } = require('../../../utils/test-utils'); +"use strict"; +const { resolve } = require("path"); +const { run } = require("../../../utils/test-utils"); -describe('config flag with empty config file', () => { - it('should throw error with no configuration or index file', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', resolve(__dirname, 'webpack.config.js')]); +describe("config flag with empty config file", () => { + it("should throw error with no configuration or index file", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "-c", + resolve(__dirname, "webpack.config.js"), + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); diff --git a/test/build/config/error-array/config-array-error.test.js b/test/build/config/error-array/config-array-error.test.js index d17d8453295..b803321dd7e 100644 --- a/test/build/config/error-array/config-array-error.test.js +++ b/test/build/config/error-array/config-array-error.test.js @@ -1,11 +1,11 @@ -'use strict'; -const { run } = require('../../../utils/test-utils'); +"use strict"; +const { run } = require("../../../utils/test-utils"); -describe('array config error', () => { - it('should throw syntax error and exit with non-zero exit code when even 1 object has syntax error', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', './webpack.config.js']); +describe("array config error", () => { + it("should throw syntax error and exit with non-zero exit code when even 1 object has syntax error", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["-c", "./webpack.config.js"]); expect(exitCode).toBe(2); - expect(stderr).toContain('SyntaxError: Unexpected token'); + expect(stderr).toContain("SyntaxError: Unexpected token"); expect(stdout).toBeFalsy(); }); }); diff --git a/test/build/config/error-commonjs/config-error.test.js b/test/build/config/error-commonjs/config-error.test.js index 8ab2a66de0c..89f2969234d 100644 --- a/test/build/config/error-commonjs/config-error.test.js +++ b/test/build/config/error-commonjs/config-error.test.js @@ -1,22 +1,28 @@ -'use strict'; -const { resolve } = require('path'); -const { run } = require('../../../utils/test-utils'); +"use strict"; +const { resolve } = require("path"); +const { run } = require("../../../utils/test-utils"); -describe('config error', () => { - it('should throw error with invalid configuration', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', resolve(__dirname, 'webpack.config.js')]); +describe("config error", () => { + it("should throw error with invalid configuration", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "-c", + resolve(__dirname, "webpack.config.js"), + ]); expect(exitCode).toBe(2); - expect(stderr).toContain('Invalid configuration object'); + expect(stderr).toContain("Invalid configuration object"); expect(stderr).toContain(`"development" | "production" | "none"`); expect(stdout).toBeFalsy(); }); - it('should throw syntax error and exit with non-zero exit code', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', resolve(__dirname, 'syntax-error.js')]); + it("should throw syntax error and exit with non-zero exit code", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "-c", + resolve(__dirname, "syntax-error.js"), + ]); expect(exitCode).toBe(2); - expect(stderr).toContain('SyntaxError: Unexpected token'); + expect(stderr).toContain("SyntaxError: Unexpected token"); expect(stdout).toBeFalsy(); }); }); diff --git a/test/build/config/error-commonjs/webpack.config.js b/test/build/config/error-commonjs/webpack.config.js index a967a05223c..a54311d53f7 100644 --- a/test/build/config/error-commonjs/webpack.config.js +++ b/test/build/config/error-commonjs/webpack.config.js @@ -1,5 +1,5 @@ module.exports = { - name: 'config-error', - mode: 'unknown', //error - target: 'node', + name: "config-error", + mode: "unknown", //error + target: "node", }; diff --git a/test/build/config/error-mjs/config-error.test.js b/test/build/config/error-mjs/config-error.test.js index c31d02ea66d..6a69898ca13 100644 --- a/test/build/config/error-mjs/config-error.test.js +++ b/test/build/config/error-mjs/config-error.test.js @@ -1,32 +1,40 @@ -'use strict'; -const { resolve } = require('path'); -const { run } = require('../../../utils/test-utils'); - -describe('config error', () => { - it('should throw error with invalid configuration', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', resolve(__dirname, 'webpack.config.mjs')], { - env: { WEBPACK_CLI_FORCE_LOAD_ESM_CONFIG: true }, - }); +"use strict"; +const { resolve } = require("path"); +const { run } = require("../../../utils/test-utils"); + +describe("config error", () => { + it("should throw error with invalid configuration", async () => { + const { exitCode, stderr, stdout } = await run( + __dirname, + ["-c", resolve(__dirname, "webpack.config.mjs")], + { + env: { WEBPACK_CLI_FORCE_LOAD_ESM_CONFIG: true }, + }, + ); expect(exitCode).toBe(2); if (!/Error: Not supported/.test(stderr)) { - expect(stderr).toContain('Invalid configuration object'); + expect(stderr).toContain("Invalid configuration object"); expect(stderr).toContain(`"development" | "production" | "none"`); } expect(stdout).toBeFalsy(); }); - it('should throw syntax error and exit with non-zero exit code', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', resolve(__dirname, 'syntax-error.mjs')], { - env: { WEBPACK_CLI_FORCE_LOAD_ESM_CONFIG: true }, - }); + it("should throw syntax error and exit with non-zero exit code", async () => { + const { exitCode, stderr, stdout } = await run( + __dirname, + ["-c", resolve(__dirname, "syntax-error.mjs")], + { + env: { WEBPACK_CLI_FORCE_LOAD_ESM_CONFIG: true }, + }, + ); expect(exitCode).toBe(2); if (!/Error: Not supported/.test(stderr)) { - expect(stderr).toContain('SyntaxError: Unexpected token'); + expect(stderr).toContain("SyntaxError: Unexpected token"); } expect(stdout).toBeFalsy(); diff --git a/test/build/config/error-mjs/webpack.config.mjs b/test/build/config/error-mjs/webpack.config.mjs index 2f7dc4a7e49..6f46f196806 100644 --- a/test/build/config/error-mjs/webpack.config.mjs +++ b/test/build/config/error-mjs/webpack.config.mjs @@ -1,5 +1,5 @@ export default { - name: 'config-error', - mode: 'unknown', //error - target: 'node', + name: "config-error", + mode: "unknown", //error + target: "node", }; diff --git a/test/build/config/function/functional-config.test.js b/test/build/config/function/functional-config.test.js index 1d6dca4c3c7..034ece3a855 100644 --- a/test/build/config/function/functional-config.test.js +++ b/test/build/config/function/functional-config.test.js @@ -1,27 +1,33 @@ -'use strict'; +"use strict"; -const { resolve } = require('path'); -const { existsSync } = require('fs'); -const { run } = require('../../../utils/test-utils'); +const { resolve } = require("path"); +const { existsSync } = require("fs"); +const { run } = require("../../../utils/test-utils"); -describe('functional config', () => { - it('should work as expected in case of single config', async () => { - const { stderr, stdout, exitCode } = await run(__dirname, ['--config', resolve(__dirname, 'single-webpack.config.js')]); +describe("functional config", () => { + it("should work as expected in case of single config", async () => { + const { stderr, stdout, exitCode } = await run(__dirname, [ + "--config", + resolve(__dirname, "single-webpack.config.js"), + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - expect(stdout).toContain('./src/index.js'); - expect(existsSync(resolve(__dirname, './dist/dist-single.js'))).toBeTruthy(); + expect(stdout).toContain("./src/index.js"); + expect(existsSync(resolve(__dirname, "./dist/dist-single.js"))).toBeTruthy(); }); - it('should work as expected in case of multiple config', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--config', resolve(__dirname, 'multi-webpack.config.js')]); + it("should work as expected in case of multiple config", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--config", + resolve(__dirname, "multi-webpack.config.js"), + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - expect(stdout).toContain('first'); - expect(stdout).toContain('second'); - expect(existsSync(resolve(__dirname, './dist/dist-first.js'))).toBeTruthy(); - expect(existsSync(resolve(__dirname, './dist/dist-second.js'))).toBeTruthy(); + expect(stdout).toContain("first"); + expect(stdout).toContain("second"); + expect(existsSync(resolve(__dirname, "./dist/dist-first.js"))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./dist/dist-second.js"))).toBeTruthy(); }); }); diff --git a/test/build/config/function/multi-webpack.config.js b/test/build/config/function/multi-webpack.config.js index 17546d938aa..e2d8ab2eb43 100644 --- a/test/build/config/function/multi-webpack.config.js +++ b/test/build/config/function/multi-webpack.config.js @@ -1,20 +1,20 @@ module.exports = () => [ { output: { - filename: './dist-first.js', + filename: "./dist-first.js", }, - name: 'first', - entry: './src/first.js', - mode: 'development', - stats: 'minimal', + name: "first", + entry: "./src/first.js", + mode: "development", + stats: "minimal", }, { output: { - filename: './dist-second.js', + filename: "./dist-second.js", }, - name: 'second', - entry: './src/second.js', - mode: 'development', - stats: 'minimal', + name: "second", + entry: "./src/second.js", + mode: "development", + stats: "minimal", }, ]; diff --git a/test/build/config/function/single-webpack.config.js b/test/build/config/function/single-webpack.config.js index dbf14dc44c9..c4f546f3f5d 100644 --- a/test/build/config/function/single-webpack.config.js +++ b/test/build/config/function/single-webpack.config.js @@ -1,9 +1,9 @@ module.exports = () => { return { output: { - filename: './dist-single.js', + filename: "./dist-single.js", }, - name: 'single', - mode: 'development', + name: "single", + mode: "development", }; }; diff --git a/test/build/config/function/src/first.js b/test/build/config/function/src/first.js index 5a33e8ffd02..b6c84715cfb 100644 --- a/test/build/config/function/src/first.js +++ b/test/build/config/function/src/first.js @@ -1 +1 @@ -console.log('first entry'); +console.log("first entry"); diff --git a/test/build/config/function/src/second.js b/test/build/config/function/src/second.js index 3ce234df055..284f324c0fc 100644 --- a/test/build/config/function/src/second.js +++ b/test/build/config/function/src/second.js @@ -1 +1 @@ -console.log('second entry'); +console.log("second entry"); diff --git a/test/build/config/invalid-export/invalid-export.test.js b/test/build/config/invalid-export/invalid-export.test.js index c38a21e3f51..7a70a7d5fa8 100644 --- a/test/build/config/invalid-export/invalid-export.test.js +++ b/test/build/config/invalid-export/invalid-export.test.js @@ -1,13 +1,18 @@ -'use strict'; -const { resolve } = require('path'); -const { run } = require('../../../utils/test-utils'); +"use strict"; +const { resolve } = require("path"); +const { run } = require("../../../utils/test-utils"); -describe('invalid export', () => { - it('should throw error with no configuration or index file', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', resolve(__dirname, 'webpack.config.js')]); +describe("invalid export", () => { + it("should throw error with no configuration or index file", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "-c", + resolve(__dirname, "webpack.config.js"), + ]); expect(exitCode).toBe(2); - expect(stderr).toContain(`Invalid configuration in '${resolve(__dirname, 'webpack.config.js')}'`); + expect(stderr).toContain( + `Invalid configuration in '${resolve(__dirname, "webpack.config.js")}'`, + ); expect(stdout).toBeFalsy(); }); }); diff --git a/test/build/config/invalid-export/webpack.config.js b/test/build/config/invalid-export/webpack.config.js index 2651774ae60..e7134e7006d 100644 --- a/test/build/config/invalid-export/webpack.config.js +++ b/test/build/config/invalid-export/webpack.config.js @@ -1 +1 @@ -module.exports = 'foo'; +module.exports = "foo"; diff --git a/test/build/config/invalid-path/a.js b/test/build/config/invalid-path/a.js index 735d820f253..0e9a8dc5145 100644 --- a/test/build/config/invalid-path/a.js +++ b/test/build/config/invalid-path/a.js @@ -1 +1 @@ -module.exports = 'a.js'; +module.exports = "a.js"; diff --git a/test/build/config/invalid-path/invalid-path.test.js b/test/build/config/invalid-path/invalid-path.test.js index 4350753aaef..6b73ece3b70 100644 --- a/test/build/config/invalid-path/invalid-path.test.js +++ b/test/build/config/invalid-path/invalid-path.test.js @@ -1,13 +1,18 @@ -'use strict'; -const path = require('path'); -const { run } = require('../../../utils/test-utils'); +"use strict"; +const path = require("path"); +const { run } = require("../../../utils/test-utils"); -describe('basic config file', () => { - it('is able to understand and parse a very basic configuration file', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', path.resolve(__dirname, 'invalid-webpack.config.js')]); +describe("basic config file", () => { + it("is able to understand and parse a very basic configuration file", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "-c", + path.resolve(__dirname, "invalid-webpack.config.js"), + ]); expect(exitCode).toBe(2); - expect(stderr).toContain(`Failed to load '${path.resolve(__dirname, 'invalid-webpack.config.js')}' config`); + expect(stderr).toContain( + `Failed to load '${path.resolve(__dirname, "invalid-webpack.config.js")}' config`, + ); expect(stdout).toBeFalsy(); }); }); diff --git a/test/build/config/invalid-path/webpack.config.js b/test/build/config/invalid-path/webpack.config.js index b58f8a91f0d..70a68756b2f 100644 --- a/test/build/config/invalid-path/webpack.config.js +++ b/test/build/config/invalid-path/webpack.config.js @@ -1,9 +1,9 @@ -const { resolve } = require('path'); +const { resolve } = require("path"); module.exports = { - entry: './a.js', + entry: "./a.js", output: { - path: resolve(__dirname, 'binary'), - filename: 'a.bundle.js', + path: resolve(__dirname, "binary"), + filename: "a.bundle.js", }, }; diff --git a/test/build/config/multiple-with-one-compilation/a.js b/test/build/config/multiple-with-one-compilation/a.js index 735d820f253..0e9a8dc5145 100644 --- a/test/build/config/multiple-with-one-compilation/a.js +++ b/test/build/config/multiple-with-one-compilation/a.js @@ -1 +1 @@ -module.exports = 'a.js'; +module.exports = "a.js"; diff --git a/test/build/config/multiple-with-one-compilation/multiple-with-one-compilation.test.js b/test/build/config/multiple-with-one-compilation/multiple-with-one-compilation.test.js index 3c7efd29718..3fa970ffdc4 100644 --- a/test/build/config/multiple-with-one-compilation/multiple-with-one-compilation.test.js +++ b/test/build/config/multiple-with-one-compilation/multiple-with-one-compilation.test.js @@ -1,15 +1,15 @@ -'use strict'; +"use strict"; -const { resolve } = require('path'); -const { run } = require('../../../utils/test-utils'); +const { resolve } = require("path"); +const { run } = require("../../../utils/test-utils"); -describe('basic config file', () => { - it('is able to understand and parse a very basic configuration file', async () => { +describe("basic config file", () => { + it("is able to understand and parse a very basic configuration file", async () => { const { exitCode, stderr, stdout } = await run(__dirname, [ - '-c', - resolve(__dirname, 'webpack.config.js'), - '--output-path', - './binary', + "-c", + resolve(__dirname, "webpack.config.js"), + "--output-path", + "./binary", ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); diff --git a/test/build/config/multiple-with-one-compilation/webpack.config.js b/test/build/config/multiple-with-one-compilation/webpack.config.js index fde09e6bba1..43c9fb9da62 100644 --- a/test/build/config/multiple-with-one-compilation/webpack.config.js +++ b/test/build/config/multiple-with-one-compilation/webpack.config.js @@ -1,11 +1,11 @@ -const { resolve } = require('path'); +const { resolve } = require("path"); module.exports = [ { - entry: './a.js', + entry: "./a.js", output: { - path: resolve(__dirname, 'binary'), - filename: 'a.bundle.js', + path: resolve(__dirname, "binary"), + filename: "a.bundle.js", }, }, ]; diff --git a/test/build/config/multiple/init.js b/test/build/config/multiple/init.js index 63e43c10599..d9d76664446 100644 --- a/test/build/config/multiple/init.js +++ b/test/build/config/multiple/init.js @@ -1 +1 @@ -console.log('Monkey D Luffy'); +console.log("Monkey D Luffy"); diff --git a/test/build/config/multiple/multiple-config.test.js b/test/build/config/multiple/multiple-config.test.js index 53ecd6edb02..fea09f2d6f7 100644 --- a/test/build/config/multiple/multiple-config.test.js +++ b/test/build/config/multiple/multiple-config.test.js @@ -1,16 +1,21 @@ -'use strict'; +"use strict"; -const { run } = require('../../../utils/test-utils'); +const { run } = require("../../../utils/test-utils"); -describe('Multiple config flag: ', () => { - it('spawns multiple compilers for multiple configs', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--config', 'webpack1.config.js', '--config', 'webpack2.config.js']); +describe("Multiple config flag: ", () => { + it("spawns multiple compilers for multiple configs", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--config", + "webpack1.config.js", + "--config", + "webpack2.config.js", + ]); // Should contain the correct exit code expect(exitCode).toEqual(0); expect(stderr).toBeFalsy(); // Should spawn multiple compilers - expect(stdout).toContain('amd:'); - expect(stdout).toContain('commonjs:'); + expect(stdout).toContain("amd:"); + expect(stdout).toContain("commonjs:"); }); }); diff --git a/test/build/config/multiple/webpack1.config.js b/test/build/config/multiple/webpack1.config.js index 88edf6386be..7cc9c7ab4d8 100644 --- a/test/build/config/multiple/webpack1.config.js +++ b/test/build/config/multiple/webpack1.config.js @@ -1,10 +1,10 @@ module.exports = { output: { - filename: './dist-amd.js', - libraryTarget: 'amd', + filename: "./dist-amd.js", + libraryTarget: "amd", }, - name: 'amd', - entry: './init.js', - mode: 'development', - devtool: 'eval-cheap-module-source-map', + name: "amd", + entry: "./init.js", + mode: "development", + devtool: "eval-cheap-module-source-map", }; diff --git a/test/build/config/multiple/webpack2.config.js b/test/build/config/multiple/webpack2.config.js index 2b96dbfda64..ec3198f969e 100644 --- a/test/build/config/multiple/webpack2.config.js +++ b/test/build/config/multiple/webpack2.config.js @@ -1,10 +1,10 @@ module.exports = { output: { - filename: './dist-commonjs.js', - libraryTarget: 'commonjs', + filename: "./dist-commonjs.js", + libraryTarget: "commonjs", }, - name: 'commonjs', - entry: './init.js', - mode: 'development', - target: 'node', + name: "commonjs", + entry: "./init.js", + mode: "development", + target: "node", }; diff --git a/test/build/config/no-config-array/no-config-array.test.js b/test/build/config/no-config-array/no-config-array.test.js index 406199c785c..24593003722 100644 --- a/test/build/config/no-config-array/no-config-array.test.js +++ b/test/build/config/no-config-array/no-config-array.test.js @@ -1,11 +1,14 @@ -'use strict'; +"use strict"; -const { resolve } = require('path'); -const { run } = require('../../../utils/test-utils'); +const { resolve } = require("path"); +const { run } = require("../../../utils/test-utils"); -describe('no configs in array', () => { - it('is able to understand and parse a very basic configuration file', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', resolve(__dirname, 'webpack.config.js')]); +describe("no configs in array", () => { + it("is able to understand and parse a very basic configuration file", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "-c", + resolve(__dirname, "webpack.config.js"), + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); diff --git a/test/build/config/no-config-object/a.js b/test/build/config/no-config-object/a.js index 735d820f253..0e9a8dc5145 100644 --- a/test/build/config/no-config-object/a.js +++ b/test/build/config/no-config-object/a.js @@ -1 +1 @@ -module.exports = 'a.js'; +module.exports = "a.js"; diff --git a/test/build/config/no-config-object/no-config-object.test.js b/test/build/config/no-config-object/no-config-object.test.js index fc83afb8626..faba425b674 100644 --- a/test/build/config/no-config-object/no-config-object.test.js +++ b/test/build/config/no-config-object/no-config-object.test.js @@ -1,11 +1,16 @@ -'use strict'; +"use strict"; -const { resolve } = require('path'); -const { run } = require('../../../utils/test-utils'); +const { resolve } = require("path"); +const { run } = require("../../../utils/test-utils"); -describe('empty config', () => { - it('should work', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', resolve(__dirname, 'webpack.config.js'), '--mode', 'development']); +describe("empty config", () => { + it("should work", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "-c", + resolve(__dirname, "webpack.config.js"), + "--mode", + "development", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); diff --git a/test/build/config/type/array-function-with-argv/a.js b/test/build/config/type/array-function-with-argv/a.js index 8609d075540..7b2a3460115 100644 --- a/test/build/config/type/array-function-with-argv/a.js +++ b/test/build/config/type/array-function-with-argv/a.js @@ -1 +1 @@ -console.log('a'); +console.log("a"); diff --git a/test/build/config/type/array-function-with-argv/b.js b/test/build/config/type/array-function-with-argv/b.js index eeb313a0347..6d012e7f1f1 100644 --- a/test/build/config/type/array-function-with-argv/b.js +++ b/test/build/config/type/array-function-with-argv/b.js @@ -1 +1 @@ -console.log('b'); +console.log("b"); diff --git a/test/build/config/type/array-function-with-argv/function-with-argv.test.js b/test/build/config/type/array-function-with-argv/function-with-argv.test.js index 72b2a36bbb3..51827b912a6 100644 --- a/test/build/config/type/array-function-with-argv/function-with-argv.test.js +++ b/test/build/config/type/array-function-with-argv/function-with-argv.test.js @@ -1,16 +1,16 @@ -'use strict'; -const { existsSync } = require('fs'); -const { resolve } = require('path'); -const { run } = require('../../../../utils/test-utils'); +"use strict"; +const { existsSync } = require("fs"); +const { resolve } = require("path"); +const { run } = require("../../../../utils/test-utils"); -describe('array of function with args', () => { - it('is able to understand a configuration file as a function', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--mode', 'development']); +describe("array of function with args", () => { + it("is able to understand a configuration file as a function", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--mode", "development"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); - expect(existsSync(resolve(__dirname, './dist/a-dev.js'))); - expect(existsSync(resolve(__dirname, './dist/b-dev.js'))); + expect(existsSync(resolve(__dirname, "./dist/a-dev.js"))); + expect(existsSync(resolve(__dirname, "./dist/b-dev.js"))); }); }); diff --git a/test/build/config/type/array-function-with-argv/webpack.config.js b/test/build/config/type/array-function-with-argv/webpack.config.js index da04c44d114..6756d1b368e 100644 --- a/test/build/config/type/array-function-with-argv/webpack.config.js +++ b/test/build/config/type/array-function-with-argv/webpack.config.js @@ -2,20 +2,20 @@ module.exports = [ (env, argv) => { const { mode } = argv; return { - entry: './a.js', - name: 'first', + entry: "./a.js", + name: "first", output: { - filename: mode === 'production' ? 'a-prod.js' : 'a-dev.js', + filename: mode === "production" ? "a-prod.js" : "a-dev.js", }, }; }, (env, argv) => { const { mode } = argv; return { - entry: './b.js', - name: 'second', + entry: "./b.js", + name: "second", output: { - filename: mode === 'production' ? 'b-prod.js' : 'b-dev.js', + filename: mode === "production" ? "b-prod.js" : "b-dev.js", }, }; }, diff --git a/test/build/config/type/array-function-with-env/a.js b/test/build/config/type/array-function-with-env/a.js index 8609d075540..7b2a3460115 100644 --- a/test/build/config/type/array-function-with-env/a.js +++ b/test/build/config/type/array-function-with-env/a.js @@ -1 +1 @@ -console.log('a'); +console.log("a"); diff --git a/test/build/config/type/array-function-with-env/array-function-with-env.test.js b/test/build/config/type/array-function-with-env/array-function-with-env.test.js index 6dd1804a6a8..16274153435 100644 --- a/test/build/config/type/array-function-with-env/array-function-with-env.test.js +++ b/test/build/config/type/array-function-with-env/array-function-with-env.test.js @@ -1,16 +1,16 @@ -'use strict'; -const { existsSync } = require('fs'); -const { resolve } = require('path'); -const { run } = require('../../../../utils/test-utils'); +"use strict"; +const { existsSync } = require("fs"); +const { resolve } = require("path"); +const { run } = require("../../../../utils/test-utils"); -describe('array of functions with env', () => { - it('is able to understand a configuration file as a function', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--mode', 'development']); +describe("array of functions with env", () => { + it("is able to understand a configuration file as a function", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--mode", "development"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); - expect(existsSync(resolve(__dirname, './dist/a-dev.js'))); - expect(existsSync(resolve(__dirname, './dist/b-dev.js'))); + expect(existsSync(resolve(__dirname, "./dist/a-dev.js"))); + expect(existsSync(resolve(__dirname, "./dist/b-dev.js"))); }); }); diff --git a/test/build/config/type/array-function-with-env/b.js b/test/build/config/type/array-function-with-env/b.js index eeb313a0347..6d012e7f1f1 100644 --- a/test/build/config/type/array-function-with-env/b.js +++ b/test/build/config/type/array-function-with-env/b.js @@ -1 +1 @@ -console.log('b'); +console.log("b"); diff --git a/test/build/config/type/array-function-with-env/webpack.config.js b/test/build/config/type/array-function-with-env/webpack.config.js index da04c44d114..6756d1b368e 100644 --- a/test/build/config/type/array-function-with-env/webpack.config.js +++ b/test/build/config/type/array-function-with-env/webpack.config.js @@ -2,20 +2,20 @@ module.exports = [ (env, argv) => { const { mode } = argv; return { - entry: './a.js', - name: 'first', + entry: "./a.js", + name: "first", output: { - filename: mode === 'production' ? 'a-prod.js' : 'a-dev.js', + filename: mode === "production" ? "a-prod.js" : "a-dev.js", }, }; }, (env, argv) => { const { mode } = argv; return { - entry: './b.js', - name: 'second', + entry: "./b.js", + name: "second", output: { - filename: mode === 'production' ? 'b-prod.js' : 'b-dev.js', + filename: mode === "production" ? "b-prod.js" : "b-dev.js", }, }; }, diff --git a/test/build/config/type/array-functions/a.js b/test/build/config/type/array-functions/a.js index ea51098c48f..2e67d56775e 100644 --- a/test/build/config/type/array-functions/a.js +++ b/test/build/config/type/array-functions/a.js @@ -1 +1 @@ -module.exports = 'a-function'; +module.exports = "a-function"; diff --git a/test/build/config/type/array-functions/array-functions.test.js b/test/build/config/type/array-functions/array-functions.test.js index de62cab46b8..23fa310800e 100644 --- a/test/build/config/type/array-functions/array-functions.test.js +++ b/test/build/config/type/array-functions/array-functions.test.js @@ -1,16 +1,19 @@ -'use strict'; -const { existsSync } = require('fs'); -const { resolve } = require('path'); -const { run } = require('../../../../utils/test-utils'); +"use strict"; +const { existsSync } = require("fs"); +const { resolve } = require("path"); +const { run } = require("../../../../utils/test-utils"); -describe('array of functions', () => { - it('is able to understand a configuration file as a function', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', resolve(__dirname, 'webpack.config.js')]); +describe("array of functions", () => { + it("is able to understand a configuration file as a function", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "-c", + resolve(__dirname, "webpack.config.js"), + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); - expect(existsSync(resolve(__dirname, './binary/a-functor.js'))).toBeTruthy(); - expect(existsSync(resolve(__dirname, './binary/b-functor.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./binary/a-functor.js"))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./binary/b-functor.js"))).toBeTruthy(); }); }); diff --git a/test/build/config/type/array-functions/b.js b/test/build/config/type/array-functions/b.js index 5614cdc34c5..0553594c766 100644 --- a/test/build/config/type/array-functions/b.js +++ b/test/build/config/type/array-functions/b.js @@ -1 +1 @@ -module.exports = 'b-function'; +module.exports = "b-function"; diff --git a/test/build/config/type/array-functions/webpack.config.js b/test/build/config/type/array-functions/webpack.config.js index 2d60cddbafb..81aaa17333c 100644 --- a/test/build/config/type/array-functions/webpack.config.js +++ b/test/build/config/type/array-functions/webpack.config.js @@ -1,21 +1,21 @@ module.exports = [ () => { return { - entry: './a', - name: 'first', + entry: "./a", + name: "first", output: { - path: __dirname + '/binary', - filename: 'a-functor.js', + path: __dirname + "/binary", + filename: "a-functor.js", }, }; }, () => { return { - entry: './b', - name: 'second', + entry: "./b", + name: "second", output: { - path: __dirname + '/binary', - filename: 'b-functor.js', + path: __dirname + "/binary", + filename: "b-functor.js", }, }; }, diff --git a/test/build/config/type/array-promises/a.js b/test/build/config/type/array-promises/a.js index 4f7f5db3d4c..312e630d83c 100644 --- a/test/build/config/type/array-promises/a.js +++ b/test/build/config/type/array-promises/a.js @@ -1 +1 @@ -module.exports = 'a-promise'; +module.exports = "a-promise"; diff --git a/test/build/config/type/array-promises/array-promises.test.js b/test/build/config/type/array-promises/array-promises.test.js index 828c0207f4b..40a7824e913 100644 --- a/test/build/config/type/array-promises/array-promises.test.js +++ b/test/build/config/type/array-promises/array-promises.test.js @@ -1,16 +1,16 @@ -'use strict'; -const { existsSync } = require('fs'); -const { resolve } = require('path'); -const { run } = require('../../../../utils/test-utils'); +"use strict"; +const { existsSync } = require("fs"); +const { resolve } = require("path"); +const { run } = require("../../../../utils/test-utils"); -describe('array of promises', () => { - it('is able to understand a configuration file as a promise', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', './webpack.config.js']); +describe("array of promises", () => { + it("is able to understand a configuration file as a promise", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["-c", "./webpack.config.js"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); - expect(existsSync(resolve(__dirname, './binary/a-promise.js'))).toBeTruthy(); - expect(existsSync(resolve(__dirname, './binary/b-promise.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./binary/a-promise.js"))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./binary/b-promise.js"))).toBeTruthy(); }); }); diff --git a/test/build/config/type/array-promises/b.js b/test/build/config/type/array-promises/b.js index d4280020bd2..73caf59dfee 100644 --- a/test/build/config/type/array-promises/b.js +++ b/test/build/config/type/array-promises/b.js @@ -1 +1 @@ -module.exports = 'b-promise'; +module.exports = "b-promise"; diff --git a/test/build/config/type/array-promises/webpack.config.js b/test/build/config/type/array-promises/webpack.config.js index 9456d7a6bbd..483521b0405 100644 --- a/test/build/config/type/array-promises/webpack.config.js +++ b/test/build/config/type/array-promises/webpack.config.js @@ -2,11 +2,11 @@ module.exports = [ new Promise((resolve) => { setTimeout(() => { resolve({ - entry: './a', - name: 'first', + entry: "./a", + name: "first", output: { - path: __dirname + '/binary', - filename: 'a-promise.js', + path: __dirname + "/binary", + filename: "a-promise.js", }, }); }, 0); @@ -14,11 +14,11 @@ module.exports = [ new Promise((resolve) => { setTimeout(() => { resolve({ - entry: './b', - name: 'second', + entry: "./b", + name: "second", output: { - path: __dirname + '/binary', - filename: 'b-promise.js', + path: __dirname + "/binary", + filename: "b-promise.js", }, }); }, 0); diff --git a/test/build/config/type/array/a.js b/test/build/config/type/array/a.js index 14801125031..9dd44bc2f35 100644 --- a/test/build/config/type/array/a.js +++ b/test/build/config/type/array/a.js @@ -1 +1 @@ -module.exports = 'a-array'; +module.exports = "a-array"; diff --git a/test/build/config/type/array/array.test.js b/test/build/config/type/array/array.test.js index 44d5f5dcef4..60e82208882 100644 --- a/test/build/config/type/array/array.test.js +++ b/test/build/config/type/array/array.test.js @@ -1,27 +1,30 @@ -'use strict'; -const { existsSync } = require('fs'); -const { resolve } = require('path'); -const { run } = require('../../../../utils/test-utils'); +"use strict"; +const { existsSync } = require("fs"); +const { resolve } = require("path"); +const { run } = require("../../../../utils/test-utils"); -describe('array config', () => { - it('is able to understand a configuration file in array format', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', resolve(__dirname, 'webpack.config.js')]); +describe("array config", () => { + it("is able to understand a configuration file in array format", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "-c", + resolve(__dirname, "webpack.config.js"), + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); - expect(existsSync(resolve(__dirname, './dist/dist-commonjs.js'))).toBeTruthy(); - expect(existsSync(resolve(__dirname, './dist/dist-amd.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./dist/dist-commonjs.js"))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./dist/dist-amd.js"))).toBeTruthy(); }); - it('respect cli args with config as an array', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--stats', 'none']); + it("respect cli args with config as an array", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--stats", "none"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); // should not print anything because of stats: none expect(stdout).toBeFalsy(); - expect(existsSync(resolve(__dirname, './dist/dist-commonjs.js'))).toBeTruthy(); - expect(existsSync(resolve(__dirname, './dist/dist-amd.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./dist/dist-commonjs.js"))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./dist/dist-amd.js"))).toBeTruthy(); }); }); diff --git a/test/build/config/type/array/webpack.config.js b/test/build/config/type/array/webpack.config.js index e8ca27db5fa..69bb0919988 100644 --- a/test/build/config/type/array/webpack.config.js +++ b/test/build/config/type/array/webpack.config.js @@ -1,24 +1,24 @@ module.exports = [ { output: { - filename: './dist-amd.js', - libraryTarget: 'amd', + filename: "./dist-amd.js", + libraryTarget: "amd", }, - name: 'amd', - entry: './a.js', - mode: 'development', - stats: 'verbose', - devtool: 'eval-cheap-module-source-map', + name: "amd", + entry: "./a.js", + mode: "development", + stats: "verbose", + devtool: "eval-cheap-module-source-map", }, { output: { - filename: './dist-commonjs.js', - libraryTarget: 'commonjs', + filename: "./dist-commonjs.js", + libraryTarget: "commonjs", }, - name: 'commonjs', - entry: './a.js', - mode: 'development', - stats: 'detailed', - target: 'node', + name: "commonjs", + entry: "./a.js", + mode: "development", + stats: "detailed", + target: "node", }, ]; diff --git a/test/build/config/type/function-array/a.js b/test/build/config/type/function-array/a.js index ea51098c48f..2e67d56775e 100644 --- a/test/build/config/type/function-array/a.js +++ b/test/build/config/type/function-array/a.js @@ -1 +1 @@ -module.exports = 'a-function'; +module.exports = "a-function"; diff --git a/test/build/config/type/function-array/b.js b/test/build/config/type/function-array/b.js index 5614cdc34c5..0553594c766 100644 --- a/test/build/config/type/function-array/b.js +++ b/test/build/config/type/function-array/b.js @@ -1 +1 @@ -module.exports = 'b-function'; +module.exports = "b-function"; diff --git a/test/build/config/type/function-array/function-array.test.js b/test/build/config/type/function-array/function-array.test.js index 12169a05639..92df4e46ed0 100644 --- a/test/build/config/type/function-array/function-array.test.js +++ b/test/build/config/type/function-array/function-array.test.js @@ -1,16 +1,19 @@ -'use strict'; -const { existsSync } = require('fs'); -const { resolve } = require('path'); -const { run } = require('../../../../utils/test-utils'); +"use strict"; +const { existsSync } = require("fs"); +const { resolve } = require("path"); +const { run } = require("../../../../utils/test-utils"); -describe('function array', () => { - it('is able to understand a configuration file as a function', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', resolve(__dirname, 'webpack.config.js')]); +describe("function array", () => { + it("is able to understand a configuration file as a function", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "-c", + resolve(__dirname, "webpack.config.js"), + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); - expect(existsSync(resolve(__dirname, './binary/a-functor.js'))).toBeTruthy(); - expect(existsSync(resolve(__dirname, './binary/b-functor.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./binary/a-functor.js"))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./binary/b-functor.js"))).toBeTruthy(); }); }); diff --git a/test/build/config/type/function-array/webpack.config.js b/test/build/config/type/function-array/webpack.config.js index 8e46701080a..eae05c3c191 100644 --- a/test/build/config/type/function-array/webpack.config.js +++ b/test/build/config/type/function-array/webpack.config.js @@ -1,18 +1,18 @@ module.exports = () => [ { - entry: './a', - name: 'first', + entry: "./a", + name: "first", output: { - path: __dirname + '/binary', - filename: 'a-functor.js', + path: __dirname + "/binary", + filename: "a-functor.js", }, }, { - entry: './b', - name: 'second', + entry: "./b", + name: "second", output: { - path: __dirname + '/binary', - filename: 'b-functor.js', + path: __dirname + "/binary", + filename: "b-functor.js", }, }, ]; diff --git a/test/build/config/type/function-async/a.js b/test/build/config/type/function-async/a.js index ea51098c48f..2e67d56775e 100644 --- a/test/build/config/type/function-async/a.js +++ b/test/build/config/type/function-async/a.js @@ -1 +1 @@ -module.exports = 'a-function'; +module.exports = "a-function"; diff --git a/test/build/config/type/function-async/function-async.test.js b/test/build/config/type/function-async/function-async.test.js index d3eb48eb837..29e27a7e789 100644 --- a/test/build/config/type/function-async/function-async.test.js +++ b/test/build/config/type/function-async/function-async.test.js @@ -1,15 +1,18 @@ -'use strict'; -const { existsSync } = require('fs'); -const { resolve } = require('path'); -const { run } = require('../../../../utils/test-utils'); +"use strict"; +const { existsSync } = require("fs"); +const { resolve } = require("path"); +const { run } = require("../../../../utils/test-utils"); -describe('function async', () => { - it('is able to understand a configuration file as a function', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', resolve(__dirname, 'webpack.config.js')]); +describe("function async", () => { + it("is able to understand a configuration file as a function", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "-c", + resolve(__dirname, "webpack.config.js"), + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); - expect(existsSync(resolve(__dirname, './binary/functor.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./binary/functor.js"))).toBeTruthy(); }); }); diff --git a/test/build/config/type/function-async/webpack.config.js b/test/build/config/type/function-async/webpack.config.js index 6457b889f8c..41f47ea6162 100644 --- a/test/build/config/type/function-async/webpack.config.js +++ b/test/build/config/type/function-async/webpack.config.js @@ -1,9 +1,9 @@ module.exports = async () => { return { - entry: './a', + entry: "./a", output: { - path: __dirname + '/binary', - filename: 'functor.js', + path: __dirname + "/binary", + filename: "functor.js", }, }; }; diff --git a/test/build/config/type/function-promise/a.js b/test/build/config/type/function-promise/a.js index ea51098c48f..2e67d56775e 100644 --- a/test/build/config/type/function-promise/a.js +++ b/test/build/config/type/function-promise/a.js @@ -1 +1 @@ -module.exports = 'a-function'; +module.exports = "a-function"; diff --git a/test/build/config/type/function-promise/function-promise.test.js b/test/build/config/type/function-promise/function-promise.test.js index 15bfa3c4abb..236c1edd1cc 100644 --- a/test/build/config/type/function-promise/function-promise.test.js +++ b/test/build/config/type/function-promise/function-promise.test.js @@ -1,15 +1,18 @@ -'use strict'; -const { existsSync } = require('fs'); -const { resolve } = require('path'); -const { run } = require('../../../../utils/test-utils'); +"use strict"; +const { existsSync } = require("fs"); +const { resolve } = require("path"); +const { run } = require("../../../../utils/test-utils"); -describe('function promise', () => { - it('is able to understand a configuration file as a function', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', resolve(__dirname, 'webpack.config.js')]); +describe("function promise", () => { + it("is able to understand a configuration file as a function", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "-c", + resolve(__dirname, "webpack.config.js"), + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); - expect(existsSync(resolve(__dirname, './binary/functor.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./binary/functor.js"))).toBeTruthy(); }); }); diff --git a/test/build/config/type/function-promise/webpack.config.js b/test/build/config/type/function-promise/webpack.config.js index 777459d6e0e..90723f2035c 100644 --- a/test/build/config/type/function-promise/webpack.config.js +++ b/test/build/config/type/function-promise/webpack.config.js @@ -2,10 +2,10 @@ module.exports = () => { return new Promise((resolve) => { setTimeout(() => { resolve({ - entry: './a', + entry: "./a", output: { - path: __dirname + '/binary', - filename: 'functor.js', + path: __dirname + "/binary", + filename: "functor.js", }, }); }); diff --git a/test/build/config/type/function-with-argv/a.js b/test/build/config/type/function-with-argv/a.js index d2525d8ea73..493137a97e1 100644 --- a/test/build/config/type/function-with-argv/a.js +++ b/test/build/config/type/function-with-argv/a.js @@ -1 +1 @@ -console.log('Dio'); +console.log("Dio"); diff --git a/test/build/config/type/function-with-argv/function-with-argv.test.js b/test/build/config/type/function-with-argv/function-with-argv.test.js index 1ad6ce20b6f..f9857bd5f65 100644 --- a/test/build/config/type/function-with-argv/function-with-argv.test.js +++ b/test/build/config/type/function-with-argv/function-with-argv.test.js @@ -1,18 +1,18 @@ -'use strict'; -const { existsSync } = require('fs'); -const { resolve } = require('path'); -const { run } = require('../../../../utils/test-utils'); +"use strict"; +const { existsSync } = require("fs"); +const { resolve } = require("path"); +const { run } = require("../../../../utils/test-utils"); -describe('function configuration', () => { - it('is able to understand a configuration file as a function', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--mode', 'development']); +describe("function configuration", () => { + it("is able to understand a configuration file as a function", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--mode", "development"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); - expect(stdout).toContain('WEBPACK_BUNDLE: true'); - expect(stdout).toContain('WEBPACK_BUILD: true'); + expect(stdout).toContain("WEBPACK_BUNDLE: true"); + expect(stdout).toContain("WEBPACK_BUILD: true"); expect(stdout).toContain("mode: 'development'"); - expect(existsSync(resolve(__dirname, './dist/dev.js'))); + expect(existsSync(resolve(__dirname, "./dist/dev.js"))); }); }); diff --git a/test/build/config/type/function-with-argv/webpack.config.js b/test/build/config/type/function-with-argv/webpack.config.js index 7c313379be8..15b337ac978 100644 --- a/test/build/config/type/function-with-argv/webpack.config.js +++ b/test/build/config/type/function-with-argv/webpack.config.js @@ -2,9 +2,9 @@ module.exports = (env, argv) => { console.log({ argv }); const { mode } = argv; return { - entry: './a.js', + entry: "./a.js", output: { - filename: mode === 'production' ? 'prod.js' : 'dev.js', + filename: mode === "production" ? "prod.js" : "dev.js", }, }; }; diff --git a/test/build/config/type/function-with-env/a.js b/test/build/config/type/function-with-env/a.js index 542cfb7c49e..95512b73637 100644 --- a/test/build/config/type/function-with-env/a.js +++ b/test/build/config/type/function-with-env/a.js @@ -1,5 +1,5 @@ -console.log('chuntaro'); +console.log("chuntaro"); // eslint-disable-next-line no-undef if (envMessage) { - console.log('env message present'); + console.log("env message present"); } diff --git a/test/build/config/type/function-with-env/function-with-env.test.js b/test/build/config/type/function-with-env/function-with-env.test.js index f5050d481c0..4ba8da5d904 100644 --- a/test/build/config/type/function-with-env/function-with-env.test.js +++ b/test/build/config/type/function-with-env/function-with-env.test.js @@ -1,189 +1,196 @@ -'use strict'; -const { existsSync } = require('fs'); -const { resolve } = require('path'); -const { run, readFile } = require('../../../../utils/test-utils'); +"use strict"; +const { existsSync } = require("fs"); +const { resolve } = require("path"); +const { run, readFile } = require("../../../../utils/test-utils"); -describe('function configuration', () => { - it('should throw when env is not supplied', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--env']); +describe("function configuration", () => { + it("should throw when env is not supplied", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--env"]); expect(exitCode).toBe(2); expect(stderr).toContain("Error: Option '--env ' argument missing"); expect(stdout).toBeFalsy(); }); - it('is able to understand a configuration file as a function', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--env', 'isProd']); + it("is able to understand a configuration file as a function", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--env", "isProd"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); // Should generate the appropriate files - expect(existsSync(resolve(__dirname, './dist/prod.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./dist/prod.js"))).toBeTruthy(); }); - it('is able to understand a configuration file as a function', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--env', 'isDev']); + it("is able to understand a configuration file as a function", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--env", "isDev"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); // Should generate the appropriate files - expect(existsSync(resolve(__dirname, './dist/dev.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./dist/dev.js"))).toBeTruthy(); }); - it('Supports passing string in env', async () => { + it("Supports passing string in env", async () => { const { exitCode, stderr, stdout } = await run(__dirname, [ - '--env', - 'environment=production', - '--env', - 'app.title=Luffy', - '-c', - 'webpack.env.config.js', + "--env", + "environment=production", + "--env", + "app.title=Luffy", + "-c", + "webpack.env.config.js", ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); // Should generate the appropriate files - expect(existsSync(resolve(__dirname, './dist/Luffy.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./dist/Luffy.js"))).toBeTruthy(); }); - it('Supports long nested values in env', async () => { + it("Supports long nested values in env", async () => { const { exitCode, stderr, stdout } = await run(__dirname, [ - '--env', - 'file.name.is.this=Atsumu', - '--env', - 'environment=production', - '-c', - 'webpack.env.config.js', + "--env", + "file.name.is.this=Atsumu", + "--env", + "environment=production", + "-c", + "webpack.env.config.js", ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); // Should generate the appropriate files - expect(existsSync(resolve(__dirname, './dist/Atsumu.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./dist/Atsumu.js"))).toBeTruthy(); }); - it('Supports multiple equal in a string', async () => { + it("Supports multiple equal in a string", async () => { const { exitCode, stderr, stdout } = await run(__dirname, [ - '--env', - 'file=name=is=Eren', - '--env', - 'environment=multipleq', - '-c', - 'webpack.env.config.js', + "--env", + "file=name=is=Eren", + "--env", + "environment=multipleq", + "-c", + "webpack.env.config.js", ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); // Should generate the appropriate files - expect(existsSync(resolve(__dirname, './dist/name=is=Eren.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./dist/name=is=Eren.js"))).toBeTruthy(); }); - it('Supports dot at the end', async () => { + it("Supports dot at the end", async () => { const { exitCode, stderr, stdout } = await run(__dirname, [ - '--env', - 'name.=Hisoka', - '--env', - 'environment=dot', - '-c', - 'webpack.env.config.js', + "--env", + "name.=Hisoka", + "--env", + "environment=dot", + "-c", + "webpack.env.config.js", ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); // Should generate the appropriate files - expect(existsSync(resolve(__dirname, './dist/Hisoka.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./dist/Hisoka.js"))).toBeTruthy(); }); - it('Supports dot at the end', async () => { + it("Supports dot at the end", async () => { const { exitCode, stderr, stdout } = await run(__dirname, [ - '--env', - 'name.', - '--env', - 'environment=dot', - '-c', - 'webpack.env.config.js', + "--env", + "name.", + "--env", + "environment=dot", + "-c", + "webpack.env.config.js", ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); // Should generate the appropriate files - expect(existsSync(resolve(__dirname, './dist/true.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./dist/true.js"))).toBeTruthy(); }); - it('Supports empty string', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--env', `foo=''`]); + it("Supports empty string", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--env", `foo=''`]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); // Should generate the appropriate files - expect(existsSync(resolve(__dirname, './dist/empty-string.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./dist/empty-string.js"))).toBeTruthy(); }); it('Supports empty string with multiple "="', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--env', `foo=bar=''`]); + const { exitCode, stderr, stdout } = await run(__dirname, ["--env", `foo=bar=''`]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); // Should generate the appropriate files - expect(existsSync(resolve(__dirname, './dist/new-empty-string.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./dist/new-empty-string.js"))).toBeTruthy(); }); it('Supports env variable with "=" at the end', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--env', `foo=`]); + const { exitCode, stderr, stdout } = await run(__dirname, ["--env", `foo=`]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); // Should generate the appropriate files - expect(existsSync(resolve(__dirname, './dist/equal-at-the-end.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./dist/equal-at-the-end.js"))).toBeTruthy(); }); - it('is able to understand multiple env flags', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--env', 'isDev', '--env', 'verboseStats', '--env', 'envMessage']); + it("is able to understand multiple env flags", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--env", + "isDev", + "--env", + "verboseStats", + "--env", + "envMessage", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); // check that the verbose env is respected - expect(stdout).toContain('LOG from webpack'); + expect(stdout).toContain("LOG from webpack"); let data; try { - data = await readFile(resolve(__dirname, './dist/dev.js'), 'utf-8'); + data = await readFile(resolve(__dirname, "./dist/dev.js"), "utf-8"); } catch (error) { expect(error).toBe(null); } // check if the values from DefinePlugin make it to the compiled code - expect(data).toContain('env message present'); + expect(data).toContain("env message present"); }); - it('is able to apply last flag with same name', async () => { + it("is able to apply last flag with same name", async () => { const { exitCode, stderr, stdout } = await run(__dirname, [ - '--env', - 'name.=foo', - '--env', - 'name.=baz', - '--env', - 'environment=dot', - '-c', - 'webpack.env.config.js', + "--env", + "name.=foo", + "--env", + "name.=baz", + "--env", + "environment=dot", + "-c", + "webpack.env.config.js", ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); // Should generate the appropriate files - expect(existsSync(resolve(__dirname, './dist/baz.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./dist/baz.js"))).toBeTruthy(); }); }); diff --git a/test/build/config/type/function-with-env/webpack.config.js b/test/build/config/type/function-with-env/webpack.config.js index 5a726c711f9..ecb9daebd6e 100644 --- a/test/build/config/type/function-with-env/webpack.config.js +++ b/test/build/config/type/function-with-env/webpack.config.js @@ -1,45 +1,49 @@ -const { DefinePlugin } = require('webpack'); +const { DefinePlugin } = require("webpack"); module.exports = (env) => { if (env.isProd) { return { - entry: './a.js', + entry: "./a.js", output: { - filename: 'prod.js', + filename: "prod.js", }, }; } if (env.foo === `''`) { return { - entry: './a.js', + entry: "./a.js", output: { - filename: 'empty-string.js', + filename: "empty-string.js", }, }; } if (env.foo === `bar=''`) { return { - entry: './a.js', + entry: "./a.js", output: { - filename: 'new-empty-string.js', + filename: "new-empty-string.js", }, }; } - if (env['foo=']) { + if (env["foo="]) { return { - entry: './a.js', + entry: "./a.js", output: { - filename: 'equal-at-the-end.js', + filename: "equal-at-the-end.js", }, }; } return { - entry: './a.js', - mode: 'development', - stats: env.verboseStats ? 'verbose' : 'normal', - plugins: [new DefinePlugin({ envMessage: env.envMessage ? JSON.stringify('env message present') : false })], + entry: "./a.js", + mode: "development", + stats: env.verboseStats ? "verbose" : "normal", + plugins: [ + new DefinePlugin({ + envMessage: env.envMessage ? JSON.stringify("env message present") : false, + }), + ], output: { - filename: 'dev.js', + filename: "dev.js", }, }; }; diff --git a/test/build/config/type/function-with-env/webpack.env.config.js b/test/build/config/type/function-with-env/webpack.env.config.js index b131cf9866d..3e789b2406e 100644 --- a/test/build/config/type/function-with-env/webpack.env.config.js +++ b/test/build/config/type/function-with-env/webpack.env.config.js @@ -2,27 +2,27 @@ module.exports = (env) => { const { environment, app, file } = env; const customName = file && file.name && file.name.is && file.name.is.this; const appTitle = app && app.title; - if (environment === 'production') { + if (environment === "production") { return { - entry: './a.js', + entry: "./a.js", output: { filename: `${customName ? customName : appTitle}.js`, }, }; } - if (environment === 'multipleq') { + if (environment === "multipleq") { const { file } = env; return { - entry: './a.js', + entry: "./a.js", output: { filename: `${file}.js`, }, }; } - if (environment === 'dot') { - const file = env['name.']; + if (environment === "dot") { + const file = env["name."]; return { - entry: './a.js', + entry: "./a.js", output: { filename: `${file}.js`, }, diff --git a/test/build/config/type/function/a.js b/test/build/config/type/function/a.js index ea51098c48f..2e67d56775e 100644 --- a/test/build/config/type/function/a.js +++ b/test/build/config/type/function/a.js @@ -1 +1 @@ -module.exports = 'a-function'; +module.exports = "a-function"; diff --git a/test/build/config/type/function/function.test.js b/test/build/config/type/function/function.test.js index 4f961672f8b..e507bddc6fb 100644 --- a/test/build/config/type/function/function.test.js +++ b/test/build/config/type/function/function.test.js @@ -1,15 +1,18 @@ -'use strict'; -const { existsSync } = require('fs'); -const { resolve } = require('path'); -const { run } = require('../../../../utils/test-utils'); +"use strict"; +const { existsSync } = require("fs"); +const { resolve } = require("path"); +const { run } = require("../../../../utils/test-utils"); -describe('function', () => { - it('is able to understand a configuration file as a function', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', resolve(__dirname, 'webpack.config.js')]); +describe("function", () => { + it("is able to understand a configuration file as a function", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "-c", + resolve(__dirname, "webpack.config.js"), + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); - expect(existsSync(resolve(__dirname, './binary/functor.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./binary/functor.js"))).toBeTruthy(); }); }); diff --git a/test/build/config/type/function/webpack.config.js b/test/build/config/type/function/webpack.config.js index e03949ce37e..b5bfe25cc36 100644 --- a/test/build/config/type/function/webpack.config.js +++ b/test/build/config/type/function/webpack.config.js @@ -1,9 +1,9 @@ module.exports = () => { return { - entry: './a', + entry: "./a", output: { - path: __dirname + '/binary', - filename: 'functor.js', + path: __dirname + "/binary", + filename: "functor.js", }, }; }; diff --git a/test/build/config/type/promise-array/a.js b/test/build/config/type/promise-array/a.js index 4f7f5db3d4c..312e630d83c 100644 --- a/test/build/config/type/promise-array/a.js +++ b/test/build/config/type/promise-array/a.js @@ -1 +1 @@ -module.exports = 'a-promise'; +module.exports = "a-promise"; diff --git a/test/build/config/type/promise-array/b.js b/test/build/config/type/promise-array/b.js index d4280020bd2..73caf59dfee 100644 --- a/test/build/config/type/promise-array/b.js +++ b/test/build/config/type/promise-array/b.js @@ -1 +1 @@ -module.exports = 'b-promise'; +module.exports = "b-promise"; diff --git a/test/build/config/type/promise-array/promise-array.test.js b/test/build/config/type/promise-array/promise-array.test.js index e2a2dc8dbde..930be8997d4 100644 --- a/test/build/config/type/promise-array/promise-array.test.js +++ b/test/build/config/type/promise-array/promise-array.test.js @@ -1,16 +1,16 @@ -'use strict'; -const { existsSync } = require('fs'); -const { resolve } = require('path'); -const { run } = require('../../../../utils/test-utils'); +"use strict"; +const { existsSync } = require("fs"); +const { resolve } = require("path"); +const { run } = require("../../../../utils/test-utils"); -describe('promise array', () => { - it('is able to understand a configuration file as a promise', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', './webpack.config.js']); +describe("promise array", () => { + it("is able to understand a configuration file as a promise", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["-c", "./webpack.config.js"]); expect(exitCode).toBe(0); expect(stdout).toBeTruthy(); expect(stderr).toBeFalsy(); - expect(existsSync(resolve(__dirname, './binary/a-promise.js'))).toBeTruthy(); - expect(existsSync(resolve(__dirname, './binary/a-promise.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./binary/a-promise.js"))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./binary/a-promise.js"))).toBeTruthy(); }); }); diff --git a/test/build/config/type/promise-array/webpack.config.js b/test/build/config/type/promise-array/webpack.config.js index 4779964e1af..36bcba559aa 100644 --- a/test/build/config/type/promise-array/webpack.config.js +++ b/test/build/config/type/promise-array/webpack.config.js @@ -2,17 +2,17 @@ module.exports = new Promise((resolve) => { setTimeout(() => { resolve([ { - entry: './a', + entry: "./a", output: { - path: __dirname + '/binary', - filename: 'a-promise.js', + path: __dirname + "/binary", + filename: "a-promise.js", }, }, { - entry: './b', + entry: "./b", output: { - path: __dirname + '/binary', - filename: 'b-promise.js', + path: __dirname + "/binary", + filename: "b-promise.js", }, }, ]); diff --git a/test/build/config/type/promise-function/a.js b/test/build/config/type/promise-function/a.js index 4f7f5db3d4c..312e630d83c 100644 --- a/test/build/config/type/promise-function/a.js +++ b/test/build/config/type/promise-function/a.js @@ -1 +1 @@ -module.exports = 'a-promise'; +module.exports = "a-promise"; diff --git a/test/build/config/type/promise-function/promise-function.test.js b/test/build/config/type/promise-function/promise-function.test.js index 74a44f2bf98..fb641cde158 100644 --- a/test/build/config/type/promise-function/promise-function.test.js +++ b/test/build/config/type/promise-function/promise-function.test.js @@ -1,16 +1,16 @@ -'use strict'; -const { existsSync } = require('fs'); -const { resolve } = require('path'); -const { run } = require('../../../../utils/test-utils'); +"use strict"; +const { existsSync } = require("fs"); +const { resolve } = require("path"); +const { run } = require("../../../../utils/test-utils"); -describe('promise function', () => { - it('is able to understand a configuration file as a promise', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', './webpack.config.js']); +describe("promise function", () => { + it("is able to understand a configuration file as a promise", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["-c", "./webpack.config.js"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); - expect(existsSync(resolve(__dirname, './binary/promise.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./binary/promise.js"))).toBeTruthy(); }); }); diff --git a/test/build/config/type/promise-function/webpack.config.js b/test/build/config/type/promise-function/webpack.config.js index f2881885ba2..88a78b1548f 100644 --- a/test/build/config/type/promise-function/webpack.config.js +++ b/test/build/config/type/promise-function/webpack.config.js @@ -1,10 +1,10 @@ module.exports = new Promise((resolve) => { setTimeout(() => { resolve(() => ({ - entry: './a', + entry: "./a", output: { - path: __dirname + '/binary', - filename: 'promise.js', + path: __dirname + "/binary", + filename: "promise.js", }, })); }, 0); diff --git a/test/build/config/type/promise/a.js b/test/build/config/type/promise/a.js index 4f7f5db3d4c..312e630d83c 100644 --- a/test/build/config/type/promise/a.js +++ b/test/build/config/type/promise/a.js @@ -1 +1 @@ -module.exports = 'a-promise'; +module.exports = "a-promise"; diff --git a/test/build/config/type/promise/promise.test.js b/test/build/config/type/promise/promise.test.js index e3b0ee3c1b2..7aa0d25cbbc 100644 --- a/test/build/config/type/promise/promise.test.js +++ b/test/build/config/type/promise/promise.test.js @@ -1,15 +1,15 @@ -'use strict'; -const { existsSync } = require('fs'); -const { resolve } = require('path'); -const { run } = require('../../../../utils/test-utils'); +"use strict"; +const { existsSync } = require("fs"); +const { resolve } = require("path"); +const { run } = require("../../../../utils/test-utils"); -describe('promise', () => { - it('is able to understand a configuration file as a promise', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', './webpack.config.js']); +describe("promise", () => { + it("is able to understand a configuration file as a promise", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["-c", "./webpack.config.js"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); - expect(existsSync(resolve(__dirname, './binary/promise.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./binary/promise.js"))).toBeTruthy(); }); }); diff --git a/test/build/config/type/promise/webpack.config.js b/test/build/config/type/promise/webpack.config.js index fdfbe448445..3e56fb16bf9 100644 --- a/test/build/config/type/promise/webpack.config.js +++ b/test/build/config/type/promise/webpack.config.js @@ -2,10 +2,10 @@ module.exports = () => new Promise((resolve) => { setTimeout(() => { resolve({ - entry: './a', + entry: "./a", output: { - path: __dirname + '/binary', - filename: 'promise.js', + path: __dirname + "/binary", + filename: "promise.js", }, }); }, 0); diff --git a/test/build/core-flags/amd-flag.test.js b/test/build/core-flags/amd-flag.test.js deleted file mode 100644 index e8702f51fcb..00000000000 --- a/test/build/core-flags/amd-flag.test.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -const { run } = require('../../utils/test-utils'); - -describe('--no-amd flag', () => { - it('should accept --no-amd', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--no-amd']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain('amd: false'); - }); -}); diff --git a/test/build/core-flags/bail-flag.test.js b/test/build/core-flags/bail-flag.test.js deleted file mode 100644 index d0166e8b759..00000000000 --- a/test/build/core-flags/bail-flag.test.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict'; - -const { run } = require('../../utils/test-utils'); - -describe('--bail flag', () => { - it('should set bail to true', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--bail']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain('bail: true'); - }); - - it('should set bail to false', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--no-bail']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain('bail: false'); - }); -}); diff --git a/test/build/core-flags/cache-flags.test.js b/test/build/core-flags/cache-flags.test.js deleted file mode 100644 index 1ca65eb7b88..00000000000 --- a/test/build/core-flags/cache-flags.test.js +++ /dev/null @@ -1,297 +0,0 @@ -'use strict'; - -const path = require('path'); -// eslint-disable-next-line node/no-unpublished-require -const rimraf = require('rimraf'); -const { run } = require('../../utils/test-utils'); -const { existsSync, writeFileSync, unlinkSync } = require('fs'); -const { resolve } = require('path'); - -describe('cache related flags from core', () => { - it('should be successful with --cache ', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--cache']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`type: 'memory'`); - }); - - it('should be successful with --no-cache ', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--no-cache']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain('cache: false'); - }); - - it('should set cache.type', async () => { - const cacheLocation = path.resolve(__dirname, '../../../node_modules/.cache/webpack/cache-core-flag-test-type'); - - rimraf.sync(cacheLocation); - - const { exitCode, stderr, stdout } = await run(__dirname, ['--cache-type', 'filesystem', '--cache-cache-location', cacheLocation]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`type: 'filesystem'`); - }); - - it('should set cache.cacheDirectory with --cache-cache-directory', async () => { - const cacheLocation = path.resolve(__dirname, '../../../node_modules/.cache/webpack/cache-core-flag-test-cache-directory'); - - rimraf.sync(cacheLocation); - - const { exitCode, stderr, stdout } = await run(__dirname, [ - '--cache-type', - 'filesystem', - '--cache-cache-directory', - './test-cache-path', - '--cache-cache-location', - cacheLocation, - ]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain("type: 'filesystem'"); - expect(stdout).toContain('test-cache-path'); - }); - - it('should set cache.cacheLocation with --cache-cache-locations', async () => { - const cacheLocation = path.resolve(__dirname, '../../../node_modules/.cache/webpack/cache-core-flag-test-cache-location'); - - rimraf.sync(cacheLocation); - - const { exitCode, stderr, stdout } = await run(__dirname, ['--cache-type', 'filesystem', '--cache-cache-location', cacheLocation]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain("type: 'filesystem'"); - expect(stdout).toContain('cache-core-flag-test-cache-location'); - expect(existsSync(cacheLocation)).toBeTruthy(); - }); - - it('should set cache.hashAlgorithm with --cache-hash-algorithm', async () => { - const cacheLocation = path.resolve(__dirname, '../../../node_modules/.cache/webpack/cache-core-flag-test-hash-algorithm'); - - rimraf.sync(cacheLocation); - - const { exitCode, stderr, stdout } = await run(__dirname, [ - '--cache-type', - 'filesystem', - '--cache-hash-algorithm', - 'sha256', - '--cache-cache-location', - cacheLocation, - ]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain("type: 'filesystem'"); - expect(stdout).toContain(`hashAlgorithm: 'sha256'`); - }); - - it('should set cache.name with --cache-name', async () => { - const cacheLocation = path.resolve(__dirname, '../../../node_modules/.cache/webpack/cache-core-flag-test-name'); - - rimraf.sync(cacheLocation); - - const { exitCode, stderr, stdout } = await run(__dirname, [ - '--cache-type', - 'filesystem', - '--cache-name', - 'cli-test', - '--cache-cache-location', - cacheLocation, - ]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain("type: 'filesystem'"); - expect(stdout).toContain(`name: 'cli-test'`); - }); - - it('should set cache.store with --cache-store', async () => { - const cacheLocation = path.resolve(__dirname, '../../../node_modules/.cache/webpack/cache-core-flag-test-store'); - - rimraf.sync(cacheLocation); - - const { exitCode, stderr, stdout } = await run(__dirname, [ - '--cache-type', - 'filesystem', - '--cache-store', - 'pack', - '--cache-cache-location', - cacheLocation, - ]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain("type: 'filesystem'"); - expect(stdout).toContain(`store: 'pack'`); - }); - - it('should set cache.version with --cache-version', async () => { - const cacheLocation = path.resolve(__dirname, '../../../node_modules/.cache/webpack/cache-core-flag-test-version'); - - rimraf.sync(cacheLocation); - - const { exitCode, stderr, stdout } = await run(__dirname, [ - '--cache-type', - 'filesystem', - '--cache-version', - '1.1.3', - '--cache-cache-location', - cacheLocation, - ]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain("type: 'filesystem'"); - expect(stdout).toContain(`version: '1.1.3'`); - }); - - it('should assign cache build dependencies correctly when cache type is filesystem', async () => { - const cacheLocation = path.resolve(__dirname, '../../../node_modules/.cache/webpack/cache-core-flag-test-build-dependencies'); - - rimraf.sync(cacheLocation); - - let { stderr, stdout, exitCode } = await run(__dirname, [ - '--cache-type', - 'filesystem', - '-c', - './webpack.config.js', - '--cache-cache-location', - cacheLocation, - ]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain("type: 'filesystem'"); - expect(stdout).toContain('buildDependencies'); - // expect(stdout).toContain(`'${path.join(__dirname, './webpack.config.js')}'`); - expect(stdout).not.toContain('[cached]'); - - // Run again to check for cache - ({ exitCode, stderr, stdout } = await run(__dirname, [ - '--cache-type', - 'filesystem', - '-c', - './webpack.config.js', - '--cache-cache-location', - cacheLocation, - ])); - - expect(exitCode).toEqual(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain('[cached]'); - }); - - it('should assign cache build dependencies correctly when cache type is filesystem in config', async () => { - const cacheLocation = path.resolve( - __dirname, - '../../../node_modules/.cache/webpack/cache-core-flag-test-build-dependencies-in-config', - ); - - rimraf.sync(cacheLocation); - - let { exitCode, stderr, stdout } = await run(__dirname, [ - '-c', - './webpack.cache.config.js', - '--cache-cache-location', - cacheLocation, - ]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain("type: 'filesystem'"); - expect(stdout).toContain('buildDependencies'); - // expect(stdout).toContain(`'${path.join(__dirname, './webpack.cache.config.js')}'`); - - // Run again to check for cache - ({ exitCode, stderr, stdout } = await run(__dirname, ['-c', './webpack.cache.config.js', '--cache-cache-location', cacheLocation])); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain('[cached]'); - }); - - it('should assign cache build dependencies with multiple configs', async () => { - rimraf.sync(path.join(__dirname, '../../../node_modules/.cache/webpack/config-cache')); - - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', './webpack.cache.config.js', '-c', './webpack.config.js']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain("type: 'filesystem'"); - expect(stdout).toContain('buildDependencies'); - // expect(stdout).toContain(`'${resolve(__dirname, 'webpack.cache.config.js')}'`); - expect(stdout).not.toContain(`'${resolve(__dirname, 'webpack.config.js')}'`); - }); - - it('should assign cache build dependencies with default config', async () => { - rimraf.sync(path.join(__dirname, '../../../node_modules/.cache/webpack/cache-core-flag-test-development')); - - const { exitCode, stderr, stdout } = await run(__dirname, ['--cache-type', 'filesystem', '--name', 'cache-core-flag-test']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain('buildDependencies'); - // expect(stdout).toContain(`'${path.join(__dirname, './webpack.config.js')}'`); - expect(stdout).toContain("type: 'filesystem'"); - }); - - it('should assign cache build dependencies with merged configs', async () => { - const cacheLocation = path.resolve(__dirname, '../../../node_modules/.cache/webpack/cache-core-flag-test-merge'); - - rimraf.sync(cacheLocation); - - const { exitCode, stderr, stdout } = await run(__dirname, [ - '-c', - './webpack.cache.config.js', - '-c', - './webpack.config.js', - '--merge', - '--cache-cache-location', - cacheLocation, - ]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain("type: 'filesystem'"); - expect(stdout).toContain('buildDependencies'); - // expect(stdout).toContain(`'${path.join(__dirname, './webpack.cache.config.js')}'`); - // expect(stdout).toContain(`'${path.join(__dirname, './webpack.config.js')}'`); - }); - - it('should invalidate cache when config changes', async () => { - rimraf.sync(path.join(__dirname, '../../../node_modules/.cache/webpack/default-development')); - rimraf.sync(path.join(__dirname, '../../../node_modules/.cache/webpack/default-production')); - - // Creating a temporary webpack config - writeFileSync(resolve(__dirname, './webpack.test.config.js'), 'module.exports = {mode: "development"}'); - - let { exitCode, stderr, stdout } = await run(__dirname, ['--cache-type', 'filesystem', '-c', './webpack.test.config.js']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).not.toContain('[cached]'); - - // Running again should use the cache - ({ exitCode, stderr, stdout } = await run(__dirname, ['--cache-type', 'filesystem', '-c', './webpack.test.config.js'])); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain('[cached]'); - - // Change config to invalidate cache - writeFileSync(resolve(__dirname, './webpack.test.config.js'), 'module.exports = {mode: "production"}'); - - ({ exitCode, stderr, stdout } = await run(__dirname, ['--cache-type', 'filesystem', '-c', './webpack.test.config.js'])); - - unlinkSync(resolve(__dirname, './webpack.test.config.js')); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).not.toContain('[cached]'); - }); -}); diff --git a/test/build/core-flags/context-flag.test.js b/test/build/core-flags/context-flag.test.js deleted file mode 100644 index 9e0784cb95c..00000000000 --- a/test/build/core-flags/context-flag.test.js +++ /dev/null @@ -1,28 +0,0 @@ -'use strict'; - -const { resolve } = require('path'); -const { run, isWindows } = require('../../utils/test-utils'); - -describe('--context flag', () => { - it('should allow to set context', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--context', './']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - - if (isWindows) { - const windowsPath = resolve(__dirname, './').replace(/\\/g, '\\\\'); - expect(stdout).toContain(`'${windowsPath}'`); - } else { - expect(stdout).toContain(`'${resolve(__dirname, './')}'`); - } - }); - - it('should throw module not found error for invalid context', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--context', '/invalid-context-path']); - - expect(exitCode).toBe(1); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`Module not found: Error: Can't resolve './src/main.js'`); - }); -}); diff --git a/test/build/core-flags/core-flags.test.js b/test/build/core-flags/core-flags.test.js new file mode 100644 index 00000000000..4ce5c0d9cbf --- /dev/null +++ b/test/build/core-flags/core-flags.test.js @@ -0,0 +1,250 @@ +"use strict"; + +const { resolve } = require("path"); +const { run, isWindows } = require("../../utils/test-utils"); + +describe("core flags", () => { + describe("boolean type flags", () => { + it("should set bail to true", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--bail"]); + + expect(exitCode).toBe(0); + expect(stderr).toBeFalsy(); + expect(stdout).toContain("bail: true"); + }); + + it("should set bail to false", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--no-bail"]); + + expect(exitCode).toBe(0); + expect(stderr).toBeFalsy(); + expect(stdout).toContain("bail: false"); + }); + }); + + describe("RegExp type flags", () => { + it("should ignore the warning emitted", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--ignore-warnings", + /Generated Warning/, + "--config", + "warning.config.js", + ]); + + expect(exitCode).toBe(0); + expect(stderr).toBeFalsy(); + expect(stdout).not.toContain("Module Warning (from ./my-warning-loader.js):"); + expect(stdout).not.toContain("Generated Warning"); + }); + + it("should reset options.ignoreWarnings", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--ignore-warnings", + /Generated Warning/, + "--ignore-warnings-reset", + "--config", + "warning.config.js", + ]); + + expect(exitCode).toBe(0); + expect(stderr).toBeFalsy(); + expect(stdout).toContain("Module Warning (from ./my-warning-loader.js):"); + expect(stdout).toContain("Generated Warning"); + }); + + it("should throw error for an invalid value", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--ignore-warnings", "abc"]); + + expect(exitCode).toBe(2); + expect(stderr).toContain(`Invalid value 'abc' for the '--ignore-warnings' option`); + expect(stderr).toContain(`Expected: 'regular expression (example: /ab?c*/)'`); + expect(stdout).toBeFalsy(); + }); + }); + + describe("reset type flags", () => { + it("should reset entry correctly", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--entry-reset", + "--entry", + "./src/entry.js", + ]); + + expect(exitCode).toBe(0); + expect(stderr).toBeFalsy(); + expect(stdout).toContain("src/entry.js"); + expect(stdout).not.toContain("src/main.js"); + }); + + it("should throw error if entry is an empty array", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--entry-reset"]); + + expect(exitCode).toBe(2); + expect(stderr).toContain("Invalid configuration object"); + expect(stdout).toBeFalsy(); + }); + }); + + describe("number type flags", () => { + it("should set parallelism option correctly", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--parallelism", 10]); + + expect(exitCode).toBe(0); + expect(stderr).toBeFalsy(); + expect(stdout).toContain("parallelism: 10"); + }); + }); + + describe("enum type flags", () => { + it("should not allow `true` for amd", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--amd"]); + + expect(exitCode).toBe(2); + expect(stderr).toContain(`Invalid value 'true' for the '--amd' option`); + expect(stderr).toContain(`Expected: 'false'`); + expect(stdout).toBeFalsy(); + }); + + it("should allow `false` for amd", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--no-amd"]); + + expect(exitCode).toBe(0); + expect(stderr).toBeFalsy(); + expect(stdout).toContain("amd: false"); + }); + + it("should correctly set `infrastructureLogging.level`", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--infrastructure-logging-level", + "verbose", + ]); + + expect(exitCode).toBe(0); + expect(stderr).toContain(`Compiler 'compiler' starting...`); + expect(stdout).toContain("level: 'verbose'"); + }); + + it("should throw error for invalid `infrastructureLogging.level`", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--infrastructure-logging-level", + "test", + ]); + + expect(exitCode).toBe(2); + expect(stderr).toContain( + `Invalid value 'test' for the '--infrastructure-logging-level' option`, + ); + expect(stderr).toContain(`Expected: 'none | error | warn | info | log | verbose'`); + expect(stdout).toBeFalsy(); + }); + }); + + describe("path type flags", () => { + it("should set context option correctly", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--context", "./"]); + + expect(exitCode).toBe(0); + expect(stderr).toBeFalsy(); + + if (isWindows) { + const windowsPath = resolve(__dirname, "./").replace(/\\/g, "\\\\"); + expect(stdout).toContain(`'${windowsPath}'`); + } else { + expect(stdout).toContain(`'${resolve(__dirname, "./")}'`); + } + }); + + it("should throw module not found error for invalid context", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--context", + "/invalid-context-path", + ]); + + expect(exitCode).toBe(1); + expect(stderr).toBeFalsy(); + expect(stdout).toContain(`Module not found: Error: Can't resolve './src/main.js'`); + }); + }); + + describe("string type flags", () => { + it("should set dependencies option correctly", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--dependencies", "lodash"]); + + expect(exitCode).toBe(0); + expect(stderr).toBeFalsy(); + expect(stdout).toContain(`dependencies: [ 'lodash' ]`); + }); + + it("should allow to set multiple dependencies", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--dependencies", + "lodash", + "react", + ]); + + expect(exitCode).toBe(0); + expect(stderr).toBeFalsy(); + expect(stdout).toContain(`dependencies: [ 'lodash', 'react' ]`); + }); + }); + + describe("flags with multiple types", () => { + it("should allow string value for `infrastructureLogging.debug`", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--infrastructure-logging-debug", + "MyPlugin", + ]); + + expect(exitCode).toBe(0); + expect(stderr).toBeFalsy(); + expect(stdout).toContain(`debug: [ 'MyPlugin' ]`); + }); + + it("should allow RegExp value for `infrastructureLogging.debug`", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--infrastructure-logging-debug", + /MyPlugin/, + ]); + + expect(exitCode).toBe(0); + expect(stderr).toBeFalsy(); + expect(stdout).toContain(`debug: [ /MyPlugin/ ],`); + }); + + it("should allow multiple values for `infrastructureLogging.debug`", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--infrastructure-logging-debug", + "MyPlugin", + /MyAnotherPlugin/, + ]); + + expect(exitCode).toBe(0); + expect(stderr).toBeFalsy(); + expect(stdout).toContain(`debug: [ 'MyPlugin', /MyAnotherPlugin/ ]`); + }); + + it("should allow string value devtool option", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--devtool", "source-map"]); + + expect(exitCode).toBe(0); + expect(stderr).toBeFalsy(); + expect(stdout).toContain(`devtool: 'source-map'`); + }); + + it("should allow --no-devtool", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--no-devtool"]); + + expect(exitCode).toBe(0); + expect(stderr).toBeFalsy(); + expect(stdout).toContain(`devtool: false`); + }); + + it("should log error for invalid devtool value", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--devtool", "invalid"]); + + expect(exitCode).toBe(2); + expect(stderr).toContain("Invalid configuration object"); + expect(stdout).toBeFalsy(); + }); + }); +}); diff --git a/test/build/core-flags/dependencies-flag.test.js b/test/build/core-flags/dependencies-flag.test.js deleted file mode 100644 index 2dbfdcff15f..00000000000 --- a/test/build/core-flags/dependencies-flag.test.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict'; - -const { run } = require('../../utils/test-utils'); - -describe('--dependencies and related flags', () => { - it('should allow to set dependencies option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--dependencies', 'lodash']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`dependencies: [ 'lodash' ]`); - }); - - it('should reset dependencies option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--dependencies-reset']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain('dependencies: []'); - }); -}); diff --git a/test/build/core-flags/devtool-flag.test.js b/test/build/core-flags/devtool-flag.test.js deleted file mode 100644 index ee3697a52b1..00000000000 --- a/test/build/core-flags/devtool-flag.test.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; - -const { run } = require('../../utils/test-utils'); - -describe('--devtool flag', () => { - it('should set devtool option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--devtool', 'source-map']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`devtool: 'source-map'`); - }); - - it('should set devtool option to false', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--no-devtool']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`devtool: false`); - }); - - it('should log error for invalid config', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--devtool', 'invalid']); - - expect(exitCode).toBe(2); - expect(stderr).toContain('Invalid configuration object'); - expect(stdout).toBeFalsy(); - }); -}); diff --git a/test/build/core-flags/entry-reset-flag.test.js b/test/build/core-flags/entry-reset-flag.test.js deleted file mode 100644 index 140cce8cff8..00000000000 --- a/test/build/core-flags/entry-reset-flag.test.js +++ /dev/null @@ -1,22 +0,0 @@ -'use strict'; - -const { run } = require('../../utils/test-utils'); - -describe('--entry-reset flag', () => { - it('should reset entry correctly', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--entry-reset', '--entry', './src/entry.js']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain('src/entry.js'); - expect(stdout).not.toContain('src/main.js'); - }); - - it('should throw error if entry is an empty array', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--entry-reset']); - - expect(exitCode).toBe(2); - expect(stderr).toContain('Invalid configuration object'); - expect(stdout).toBeFalsy(); - }); -}); diff --git a/test/build/core-flags/experiments-flag.test.js b/test/build/core-flags/experiments-flag.test.js deleted file mode 100644 index b083be50724..00000000000 --- a/test/build/core-flags/experiments-flag.test.js +++ /dev/null @@ -1,51 +0,0 @@ -'use strict'; - -const { run, hyphenToUpperCase, getWebpackCliArguments } = require('../../utils/test-utils'); -const experimentsFlags = getWebpackCliArguments('experiments-'); - -describe('experiments option related flag', () => { - for (const [name, value] of Object.entries(experimentsFlags)) { - // extract property name from flag name - let property; - - if (name.includes('-lazy-compilation-')) { - property = name.split('experiments-lazy-compilation-')[1]; - } else { - property = name.split('experiments-')[1]; - } - - const propName = hyphenToUpperCase(property); - - if (propName === 'client' || propName === 'test') { - return false; - } - - if (value.configs.filter((config) => config.type === 'boolean').length > 0) { - it(`should config --${name} correctly`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - - if (name.includes('-lazy-compilation-')) { - expect(stdout).toContain(`lazyCompilation: { ${propName}: true }`); - } else { - expect(stdout).toContain(`${propName}: true`); - } - }); - - it(`should config --no-${name} correctly`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [`--no-${name}`]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - - if (name.includes('-lazy-compilation-')) { - expect(stdout).toContain(`lazyCompilation: { ${propName}: false }`); - } else { - expect(stdout).toContain(`${propName}: false`); - } - }); - } - } -}); diff --git a/test/build/core-flags/externals-flags.test.js b/test/build/core-flags/externals-flags.test.js deleted file mode 100644 index 844c25e2ad9..00000000000 --- a/test/build/core-flags/externals-flags.test.js +++ /dev/null @@ -1,60 +0,0 @@ -'use strict'; - -const { run, hyphenToUpperCase, getWebpackCliArguments } = require('../../utils/test-utils'); -const externalsPresetsFlags = getWebpackCliArguments('externals-presets-'); - -describe('externals related flag', () => { - it('should set externals properly', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--externals', './main.js']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`externals: [ './main.js' ]`); - }); - - it('should set externalsType properly', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--externals', 'var']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`externalsType: 'var'`); - }); - - it('should accept --external-type values', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--externals-type', 'var']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`externalsType: 'var'`); - }); - - it('should reset externals', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--externals-reset']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`externals: []`); - }); - - for (const [name] of Object.entries(externalsPresetsFlags)) { - // extract property name from flag name - const property = name.split('externals-presets-')[1]; - const propName = hyphenToUpperCase(property); - - it(`should config --${name} correctly`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`${propName}: true`); - }); - - it(`should config --no-${name} correctly`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [`--no-${name}`]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`${propName}: false`); - }); - } -}); diff --git a/test/build/core-flags/ignore-warnings/ignore-warnings-flag.test.js b/test/build/core-flags/ignore-warnings/ignore-warnings-flag.test.js deleted file mode 100644 index 5dd613568d6..00000000000 --- a/test/build/core-flags/ignore-warnings/ignore-warnings-flag.test.js +++ /dev/null @@ -1,32 +0,0 @@ -'use strict'; - -const { run } = require('../../../utils/test-utils'); - -describe('ignore-warnings', () => { - it('should ignore the warning emitted', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--ignore-warnings', /Generated Warning/]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).not.toContain('Module Warning (from ./my-warning-loader.js):'); - expect(stdout).not.toContain('Generated Warning'); - }); - - it('should reset options.ignoreWarnings', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--ignore-warnings', /Generated Warning/, '--ignore-warnings-reset']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain('Module Warning (from ./my-warning-loader.js):'); - expect(stdout).toContain('Generated Warning'); - }); - - it('should throw error for an invalid value', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--ignore-warnings', 'abc']); - - expect(exitCode).toBe(2); - expect(stderr).toContain(`Invalid value 'abc' for the '--ignore-warnings' option`); - expect(stderr).toContain(`Expected: 'regular expression (example: /ab?c*/)'`); - expect(stdout).toBeFalsy(); - }); -}); diff --git a/test/build/core-flags/ignore-warnings/src/main.js b/test/build/core-flags/ignore-warnings/src/main.js deleted file mode 100644 index a136806e8f1..00000000000 --- a/test/build/core-flags/ignore-warnings/src/main.js +++ /dev/null @@ -1 +0,0 @@ -console.log('Entry'); diff --git a/test/build/core-flags/ignore-warnings/webpack.config.js b/test/build/core-flags/ignore-warnings/webpack.config.js deleted file mode 100644 index 521581d4a12..00000000000 --- a/test/build/core-flags/ignore-warnings/webpack.config.js +++ /dev/null @@ -1,24 +0,0 @@ -const path = require('path'); - -module.exports = { - mode: 'development', - entry: './src/main.js', - module: { - rules: [ - { - test: /.(js|jsx)?$/, - loader: 'my-warning-loader', - include: [path.resolve(__dirname, 'src')], - exclude: [/node_modules/], - }, - ], - }, - resolveLoader: { - alias: { - 'my-warning-loader': require.resolve('./my-warning-loader'), - }, - }, - performance: { - hints: 'warning', - }, -}; diff --git a/test/build/core-flags/infrastructure-logging.test.js b/test/build/core-flags/infrastructure-logging.test.js deleted file mode 100644 index 25aed04c93d..00000000000 --- a/test/build/core-flags/infrastructure-logging.test.js +++ /dev/null @@ -1,30 +0,0 @@ -'use strict'; - -const { run } = require('../../utils/test-utils'); - -describe('infrastructure logging related flag', () => { - it('should set infrastructureLogging.debug properly', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--infrastructure-logging-debug', 'myPlugin']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`debug: [ 'myPlugin' ]`); - }); - - it('should reset infrastructureLogging.debug to []', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--infrastructure-logging-debug-reset']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`debug: []`); - }); - - it('should set infrastructureLogging.level properly', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--infrastructure-logging-level', 'log']); - - expect(exitCode).toBe(0); - expect(stderr).toContain("Compiler 'compiler' starting..."); - expect(stderr).toContain("Compiler 'compiler' finished"); - expect(stdout).toContain(`level: 'log'`); - }); -}); diff --git a/test/build/core-flags/invalid-flag.test.js b/test/build/core-flags/invalid-flag.test.js deleted file mode 100644 index 3a06b2784b0..00000000000 --- a/test/build/core-flags/invalid-flag.test.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict'; - -const { run } = require('../../utils/test-utils'); - -describe('invalid flag value', () => { - it('should throw an error for the invalid value passed', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--output-script-type', 'unknown']); - - expect(exitCode).toBe(2); - expect(stderr).toContain("Invalid value 'unknown' for the '--output-script-type' option"); - expect(stderr).toContain("Expected: 'false | text/javascript | module'"); - expect(stdout).toBeFalsy(); - }); -}); diff --git a/test/build/core-flags/mock/mock.js b/test/build/core-flags/mock/mock.js index ca58180213d..f1e884cc25e 100644 --- a/test/build/core-flags/mock/mock.js +++ b/test/build/core-flags/mock/mock.js @@ -1 +1 @@ -console.log('MOCK'); +console.log("MOCK"); diff --git a/test/build/core-flags/module-flags.test.js b/test/build/core-flags/module-flags.test.js deleted file mode 100644 index 6b2f241ba6d..00000000000 --- a/test/build/core-flags/module-flags.test.js +++ /dev/null @@ -1,162 +0,0 @@ -'use strict'; - -const { run, hyphenToUpperCase, normalizeStdout, getWebpackCliArguments } = require('../../utils/test-utils'); -const moduleFlags = getWebpackCliArguments('module-'); - -describe('module config related flag', () => { - for (const [name, value] of Object.entries(moduleFlags)) { - // extract property name from flag name - let property = name.split('module-')[1]; - - if (property.includes('rules-') && property !== 'rules-reset') { - property = name.split('rules-')[1]; - } - - const propName = hyphenToUpperCase(property); - - if ( - value.configs.filter((config) => config.type === 'boolean').length > 0 && - !name.includes('module-no-parse') && - !name.includes('module-parser-') - ) { - it(`should config --${name} correctly`, async () => { - if (name.includes('-reset')) { - const { stderr, stdout } = await run(__dirname, [`--${name}`]); - const option = propName.split('Reset')[0]; - - expect(stderr).toBeFalsy(); - expect(normalizeStdout(stdout)).toContain(`${option}: []`); - } else if (name.includes('rules-')) { - const { exitCode, stderr, stdout } = await run(__dirname, [`--no-${name}`]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(normalizeStdout(stdout)).toContain("sideEffects: 'flag'"); - } else if (name.startsWith('module-generator-')) { - const { exitCode, stderr, stdout } = await run(__dirname, [ - `--module-generator-asset-emit`, - '--module-generator-asset-resource-emit', - ]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(normalizeStdout(stdout)).toContain("generator: { asset: { emit: true }, 'asset/resource': { emit: true } }"); - } else { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(normalizeStdout(stdout)).toContain(`${propName}: true`); - } - }); - - if (!name.endsWith('-reset')) { - it(`should config --no-${name} correctly`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [`--no-${name}`]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - - if (name.includes('rules-')) { - expect(normalizeStdout(stdout)).toContain('sideEffects: false'); - } else if (name.startsWith('module-generator-')) { - expect(normalizeStdout(stdout)).toContain('emit: false'); - } else { - expect(normalizeStdout(stdout)).toContain(`${propName}: false`); - } - }); - } - } - - if ( - value.configs.filter((config) => config.type === 'string').length > 0 && - !(name.includes('module-parser-') || name.startsWith('module-generator')) - ) { - it(`should config --${name} correctly`, async () => { - if (name === 'module-no-parse') { - let { stderr, stdout, exitCode } = await run(__dirname, [`--${name}`, 'value']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(normalizeStdout(stdout)).toContain('value'); - } else if (name.includes('reg-exp')) { - let { stdout, stderr, exitCode } = await run(__dirname, [`--${name}`, '/ab?c*/']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(normalizeStdout(stdout)).toContain(`${propName}: /ab?c*/`); - } else if (name.includes('module-rules-')) { - if (propName === 'use' || propName === 'type') { - let { stdout } = await run(__dirname, [`--${name}`, 'javascript/auto']); - - expect(normalizeStdout(stdout)).toContain(`${propName}: 'javascript/auto'`); - } else if (property.includes('use-')) { - let { stdout } = await run(__dirname, ['--module-rules-use-loader', 'myLoader']); - expect(normalizeStdout(stdout)).toContain(`use: [Object]`); - } else if (propName === 'enforce') { - let { stdout } = await run(__dirname, [`--${name}`, 'pre', '--module-rules-use-loader', 'myLoader']); - expect(normalizeStdout(stdout)).toContain(`${propName}: 'pre'`); - } else { - let { stdout } = await run(__dirname, [`--${name}`, '/rules-value']); - expect(normalizeStdout(stdout)).toContain('rules-value'); - } - } else { - let { stderr, stdout, exitCode } = await run(__dirname, [`--${name}`, 'value']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(normalizeStdout(stdout)).toContain(`${propName}: 'value'`); - } - }); - } - } - - it('should config module.generator flags coorectly', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [ - '--module-generator-asset-data-url-encoding', - 'base64', - '--module-generator-asset-data-url-mimetype', - 'application/node', - ]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(normalizeStdout(stdout)).toContain(`generator: { asset: { dataUrl: [Object] } }`); - }); - - it('should config module.parser flags correctly', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [ - '--module-parser-javascript-browserify', - '--module-parser-javascript-commonjs', - '--module-parser-javascript-harmony', - '--module-parser-javascript-import', - '--no-module-parser-javascript-node', - '--module-parser-javascript-require-include', - ]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(normalizeStdout(stdout)).toContain('browserify: true'); - expect(normalizeStdout(stdout)).toContain('commonjs: true'); - expect(normalizeStdout(stdout)).toContain('harmony: true'); - expect(normalizeStdout(stdout)).toContain('import: true'); - expect(normalizeStdout(stdout)).toContain('node: false'); - }); - - it('should accept --module-parser-javascript-url=relative', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--module-parser-javascript-url', 'relative']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(normalizeStdout(stdout)).toContain(`url: 'relative'`); - }); - - it('should throw an error for an invalid value of --module-parser-javascript-url', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--module-parser-javascript-url', 'test']); - - expect(exitCode).toBe(2); - expect(normalizeStdout(stderr)).toContain(`Invalid value 'test' for the '--module-parser-javascript-url' option`); - expect(normalizeStdout(stderr)).toContain(`Expected: 'relative'`); - expect(stdout).toBeFalsy(); - }); -}); diff --git a/test/build/core-flags/ignore-warnings/my-warning-loader.js b/test/build/core-flags/my-warning-loader.js similarity index 72% rename from test/build/core-flags/ignore-warnings/my-warning-loader.js rename to test/build/core-flags/my-warning-loader.js index dcf7db3737d..d72b4775718 100644 --- a/test/build/core-flags/ignore-warnings/my-warning-loader.js +++ b/test/build/core-flags/my-warning-loader.js @@ -1,5 +1,5 @@ module.exports = function loader(source) { const { emitWarning } = this; - emitWarning('Generated Warning'); + emitWarning("Generated Warning"); return source; }; diff --git a/test/build/core-flags/node-flags.test.js b/test/build/core-flags/node-flags.test.js deleted file mode 100644 index c70338cd011..00000000000 --- a/test/build/core-flags/node-flags.test.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; - -const { run } = require('../../utils/test-utils'); - -describe('node option related flags', () => { - it('should config node option to false', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--no-node']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain('node: false'); - }); - - it('should set node.filename correctly', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--node-filename', 'mock']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`__filename: 'mock'`); - }); - - it('should set node.filename correctly', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--node-dirname', 'mock']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`__dirname: 'mock'`); - }); -}); diff --git a/test/build/core-flags/optimization-flags.test.js b/test/build/core-flags/optimization-flags.test.js deleted file mode 100644 index 409daa10f4f..00000000000 --- a/test/build/core-flags/optimization-flags.test.js +++ /dev/null @@ -1,129 +0,0 @@ -'use strict'; - -const { run, hyphenToUpperCase, getWebpackCliArguments } = require('../../utils/test-utils'); -const optimizationFlags = getWebpackCliArguments('optimization-'); - -describe('optimization config related flag', () => { - for (const [name, value] of Object.entries(optimizationFlags)) { - // extract property name from flag name - let property = name.split('optimization-')[1]; - - if (name.includes('split-chunks')) { - property = name.split('optimization-split-chunks-')[1]; - } - - let propName = hyphenToUpperCase(property); - - if (name.includes('-reset')) { - propName = propName.split('Reset')[0]; - } - - if (value.configs.filter((config) => config.type === 'boolean').length > 0) { - it(`should config --${name} correctly`, async () => { - if (name === 'optimization-split-chunks') { - const { exitCode, stderr, stdout } = await run(__dirname, [`--no-${name}`]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`splitChunks: false`); - } else if (name.includes('reset')) { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`${propName}: []`); - } else if (name === 'optimization-runtime-chunk') { - const { exitCode, stderr } = await run(__dirname, [`--${name}`]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - } else { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`${propName}: true`); - } - }); - - if (!name.includes('reset')) { - it(`should config --no-${name} correctly`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [`--no-${name}`]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - - if (name === 'optimization-split-chunks') { - expect(stdout).toContain('splitChunks: false'); - } else { - expect(stdout).toContain(`${propName}: false`); - } - }); - } - } - - // ignoring optimization-runtime-* and split-chunks-fallback-* flags because WebpackClITestPlugin logs [Object] - // need improve the plugin to log for multi-level options i.e, optimization.runtime - if ( - value.configs.filter((config) => config.type === 'string').length > 0 && - !name.includes('runtime-') && - !name.includes('fallback-') - ) { - it(`should config --${name} correctly`, async () => { - if (name === 'optimization-split-chunks-chunks') { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`, 'initial']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`chunks: 'initial'`); - } else if (name === 'optimization-mangle-exports') { - const { exitCode, stderr, stdout } = await run(__dirname, ['--optimization-mangle-exports', 'size']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`mangleExports: 'size'`); - } else if (name === 'optimization-used-exports') { - const { exitCode, stderr, stdout } = await run(__dirname, ['--optimization-used-exports', 'global']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`usedExports: 'global'`); - } else if (name === 'optimization-split-chunks-default-size-types') { - const { exitCode, stderr, stdout } = await run(__dirname, ['--optimization-split-chunks-default-size-types', 'global']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`defaultSizeTypes: [Array]`); - } else if (name === 'optimization-side-effects') { - const { exitCode, stderr, stdout } = await run(__dirname, ['--optimization-side-effects', 'flag']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`${propName}: 'flag'`); - } else { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`, 'named']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`${propName}: 'named'`); - } - }); - } - - if (value.configs.filter((config) => config.type === 'number').length > 0 && !name.includes('fallback-')) { - it(`should config --${name} correctly`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`, '10']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - - if (name === 'optimization-split-chunks') { - expect(stdout).toContain(`chunks: 'async'`); - expect(stdout).toContain(`minChunks: 1`); - } else { - expect(stdout).toContain(`${propName}: 10`); - } - }); - } - } -}); diff --git a/test/build/core-flags/output-flags.test.js b/test/build/core-flags/output-flags.test.js deleted file mode 100644 index 9f43c4db418..00000000000 --- a/test/build/core-flags/output-flags.test.js +++ /dev/null @@ -1,184 +0,0 @@ -'use strict'; - -const { run, hyphenToUpperCase, getWebpackCliArguments } = require('../../utils/test-utils'); -const outputFlags = getWebpackCliArguments('output-'); - -describe('output config related flag', () => { - for (const [name, value] of Object.entries(outputFlags)) { - // extract property name from flag name - let property = name.split('output-')[1]; - - if (property.includes('environment-')) { - property = property.split('environment-')[1]; - } else if (property.includes('clean-')) { - property = property.split('clean-')[1]; - } - - const propName = hyphenToUpperCase(property); - - if (value.configs.filter((config) => config.type === 'boolean').length > 0 && !name.includes('output-library')) { - it(`should config --${name} correctly`, async () => { - let { stderr, stdout, exitCode } = await run(__dirname, [`--${name}`]); - - if (name === 'output-module') { - //'output.module: true' is only allowed when 'experiments.outputModule' is enabled - ({ exitCode, stderr, stdout } = await run(__dirname, [`--${name}`, '--experiments-output-module'])); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain('module: true'); - } else if (name === 'output-strict-module-error-handling') { - ({ exitCode, stderr, stdout } = await run(__dirname, [`--${name}`, '--hot'])); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`${propName}: true`); - } else if (name.includes('-reset')) { - const option = propName.split('Reset')[0]; - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`${option}: []`); - } else { - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`${propName}: true`); - } - }); - - if (!name.endsWith('-reset') && !name.includes('output-strict-module-error-handling')) { - it(`should config --no-${name} correctly`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [`--no-${name}`]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`${propName}: false`); - }); - } - } - - if (value.configs.filter((config) => config.type === 'number').length > 0) { - it(`should config --${name} correctly`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`, '10']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`${propName}: 10`); - }); - } - - if (value.configs.filter((config) => config.type === 'string').length > 0 && !name.includes('output-library')) { - it(`should config --${name} correctly`, async () => { - if (name === 'output-cross-origin-loading') { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`, 'anonymous']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`${propName}: 'anonymous'`); - } else if (name === 'output-chunk-format') { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`, 'commonjs']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`${propName}: 'commonjs'`); - } else if (name === 'output-chunk-loading') { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`, 'jsonp']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`${propName}: 'jsonp'`); - } else if (name === 'output-enabled-chunk-loading-types' || name === 'output-enabled-wasm-loading-types') { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`, 'async-node']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`${propName}: [ 'async-node' ]`); - } else if (name === 'output-enabled-library-type') { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`, 'amd']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`${propName}: 'amd'`); - } else if (name === 'output-hash-function') { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`, 'sha256']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`hashFunction: 'sha256'`); - } else if (name === 'output-script-type') { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`, 'module']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`${propName}: 'module'`); - } else if (name === 'output-enabled-library-types') { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`, 'var']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`${propName}: [ 'var' ]`); - } else if (name === 'output-path') { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`, 'test']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain('test'); - } else if (name === 'output-pathinfo') { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`, 'verbose']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`pathinfo: 'verbose'`); - } else if (name === 'output-worker-chunk-loading') { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`, 'async-node']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`${propName}: 'async-node'`); - } else if (name.includes('wasm')) { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`, 'async-node']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`${propName}: 'async-node'`); - } else { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`, 'test']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`${propName}: 'test'`); - } - }); - } - } - - it(`should config name, type and export correctly`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [ - '--output-library-name', - 'myLibrary', - '--output-library-type', - 'var', - '--output-library-export', - 'myExport', - '--output-library-auxiliary-comment', - 'comment', - '--output-library-umd-named-define', - ]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain('myLibrary'); - expect(stdout).toContain(`type: 'var'`); - expect(stdout).toContain('export: [Array]'); - expect(stdout).toContain(`auxiliaryComment: 'comment'`); - expect(stdout).toContain('umdNamedDefine: true'); - }); - - it('should be succesful with --output-library-reset correctly', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--output-library-reset', '--output-library', 'newLibrary']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain('newLibrary'); - }); -}); diff --git a/test/build/core-flags/parallelism-flag.test.js b/test/build/core-flags/parallelism-flag.test.js deleted file mode 100644 index 48c711a267b..00000000000 --- a/test/build/core-flags/parallelism-flag.test.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict'; - -const { run } = require('../../utils/test-utils'); - -describe('--parallelism flag', () => { - it('should set parallelism to the value passed', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--parallelism', '50']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain('parallelism: 50'); - }); - - it('should throw error for invalid parallelism value', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--parallelism', '0']); - - expect(exitCode).toBe(2); - expect(stderr).toContain('configuration.parallelism should be >= 1'); - expect(stdout).toBeFalsy(); - }); -}); diff --git a/test/build/core-flags/performance-flags.test.js b/test/build/core-flags/performance-flags.test.js deleted file mode 100644 index aec94cb16bf..00000000000 --- a/test/build/core-flags/performance-flags.test.js +++ /dev/null @@ -1,40 +0,0 @@ -'use strict'; - -const { run, hyphenToUpperCase, getWebpackCliArguments } = require('../../utils/test-utils'); -const performanceFlags = getWebpackCliArguments('performance-'); - -describe('module config related flag', () => { - it(`should config --performance option correctly`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [`--no-performance`]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain('performance: false'); - }); - - for (const [name, value] of Object.entries(performanceFlags)) { - // extract property name from flag name - const property = name.split('performance-')[1]; - const propName = hyphenToUpperCase(property); - - if (value.configs.filter((config) => config.type === 'number').length > 0) { - it(`should config --${name} correctly`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`, '10']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`${propName}: 10`); - }); - } - - if (value.configs.filter((config) => config.type === 'string').length > 0) { - it(`should config --${name} correctly`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`, 'warning']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`${propName}: 'warning'`); - }); - } - } -}); diff --git a/test/build/core-flags/profile-flag.test.js b/test/build/core-flags/profile-flag.test.js deleted file mode 100644 index 84148ead247..00000000000 --- a/test/build/core-flags/profile-flag.test.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict'; - -const { run } = require('../../utils/test-utils'); - -describe('--profile flag', () => { - it('should set profile to true', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--profile']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain('profile: true'); - }); - - it('should set profile to false', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--no-profile']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain('profile: false'); - }); -}); diff --git a/test/build/core-flags/records-flag.test.js b/test/build/core-flags/records-flag.test.js deleted file mode 100644 index 21d89336160..00000000000 --- a/test/build/core-flags/records-flag.test.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; - -const { run } = require('../../utils/test-utils'); - -describe('module config related flag', () => { - it('should config records-path correctly', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--records-path', './bin/records.json']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain('records.json'); - }); - - it('should config records-input-path correctly', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--records-input-path', './bin/records.json']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain('records.json'); - }); - - it('should config records-output-path correctly', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--records-output-path', './bin/records.json']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain('records.json'); - }); -}); diff --git a/test/build/core-flags/resolve-flags.test.js b/test/build/core-flags/resolve-flags.test.js deleted file mode 100644 index 3b00780c830..00000000000 --- a/test/build/core-flags/resolve-flags.test.js +++ /dev/null @@ -1,113 +0,0 @@ -'use strict'; - -const { run, hyphenToUpperCase, getWebpackCliArguments } = require('../../utils/test-utils'); -const resolveFlags = getWebpackCliArguments('resolve'); - -describe('resolve config related flags', () => { - for (const [name, value] of Object.entries(resolveFlags)) { - // extract property name from flag name - let property = name.split('resolve-')[1]; - - if (name.startsWith('resolve-loader')) { - property = name.split('resolve-loader-')[1]; - } - - const propName = hyphenToUpperCase(property); - - if ( - value.configs.filter((config) => config.type === 'boolean').length > 0 && - !name.includes('alias-') && - !name.includes('fallback-') - ) { - it(`should config --${name} correctly`, async () => { - const { stderr, stdout } = await run(__dirname, [`--${name}`]); - - // expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - - if (name.includes('reset')) { - const option = propName.split('Reset')[0]; - expect(stdout).toContain(`${option}: []`); - } else { - expect(stdout).toContain(`${propName}: true`); - } - }); - } - - if ( - value.configs.filter((config) => config.type === 'string').length > 0 && - !name.includes('alias-') && - !name.includes('fallback-') - ) { - it(`should config --${name} correctly`, async () => { - const { stderr, stdout } = await run(__dirname, [`--${name}`, 'browser']); - - // expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - - if (propName === 'restrictions') { - expect(stdout).toContain('browser'); - } else { - expect(stdout).toContain(`${propName}: [ 'browser' ]`); - } - }); - } - - if (name.includes('alias-') || name.includes('fallback-')) { - it(`should config --${name} correctly`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [ - `--resolve-alias-alias`, - 'alias', - '--resolve-alias-name', - 'name', - '--resolve-alias-fields', - 'aliasField', - '--resolve-loader-alias-alias', - 'loaderAlias', - '--resolve-loader-alias-name', - 'loaderName', - '--resolve-loader-alias-fields', - 'loader-field', - '--resolve-fallback-alias', - 'fall-alias', - '--resolve-fallback-name', - 'fall-name', - '--resolve-loader-fallback-alias', - 'loader-fall-alias', - '--resolve-loader-fallback-name', - 'loader-fall-name', - ]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`alias: [ { alias: 'alias', name: 'name' } ]`); - expect(stdout).toContain(`aliasFields: [ 'aliasField' ]`); - expect(stdout).toContain(`alias: [ { alias: 'loaderAlias', name: 'loaderName' } ]`); - expect(stdout).toContain(`aliasFields: [ 'loader-field' ]`); - expect(stdout).toContain('fall-name'); - expect(stdout).toContain('fall-alias'); - expect(stdout).toContain('loader-fall-name'); - expect(stdout).toContain('loader-fall-alias'); - }); - - if (name.includes('reset')) { - it(`should config --${name} alias-reset flags correctly`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [ - '--resolve-alias-reset', - '--resolve-fallback-reset', - '--resolve-alias-fields-reset', - '--resolve-loader-alias-reset', - '--resolve-loader-alias-fields-reset', - '--resolve-loader-fallback-reset', - ]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`alias: []`); - expect(stdout).toContain(`aliasFields: []`); - expect(stdout).toContain(`fallback: []`); - }); - } - } - } -}); diff --git a/test/build/core-flags/snapshot-flags.test.js b/test/build/core-flags/snapshot-flags.test.js deleted file mode 100644 index 44795b67699..00000000000 --- a/test/build/core-flags/snapshot-flags.test.js +++ /dev/null @@ -1,40 +0,0 @@ -'use strict'; - -const { run, hyphenToUpperCase, getWebpackCliArguments } = require('../../utils/test-utils'); -const snapshotFlags = getWebpackCliArguments('snapshot'); - -describe('snapshot config related flags', () => { - for (const [name, value] of Object.entries(snapshotFlags)) { - // extract property name from flag name - let property = name.split('snapshot-')[1]; - const propName = hyphenToUpperCase(property); - - if (value.configs.filter((config) => config.type === 'boolean').length > 0) { - it(`should config --${name} correctly`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - - if (name.includes('reset')) { - const option = propName.split('Reset')[0]; - expect(stdout).toContain(`${option}: []`); - } else if (name.includes('timestamp')) { - expect(stdout).toContain(`timestamp: true`); - } else if (name.includes('hash')) { - expect(stdout).toContain(`hash: true`); - } - }); - } - - if (value.configs.filter((config) => config.type === 'string').length > 0) { - it(`should config --${name} correctly`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`, './mock/mock.js']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain('./mock/mock.js'); - }); - } - } -}); diff --git a/test/build/core-flags/src/entry.js b/test/build/core-flags/src/entry.js index 944b40c99df..306235e5203 100644 --- a/test/build/core-flags/src/entry.js +++ b/test/build/core-flags/src/entry.js @@ -1 +1 @@ -console.log('another-entry'); +console.log("another-entry"); diff --git a/test/build/core-flags/src/main.js b/test/build/core-flags/src/main.js index dcab1dbfb46..61b567951ff 100644 --- a/test/build/core-flags/src/main.js +++ b/test/build/core-flags/src/main.js @@ -1 +1 @@ -console.log('core-flags tests'); +console.log("core-flags tests"); diff --git a/test/build/core-flags/stats-flags.test.js b/test/build/core-flags/stats-flags.test.js deleted file mode 100644 index 21b58777c5c..00000000000 --- a/test/build/core-flags/stats-flags.test.js +++ /dev/null @@ -1,87 +0,0 @@ -'use strict'; - -const { run, hyphenToUpperCase, getWebpackCliArguments } = require('../../utils/test-utils'); -const statsFlags = getWebpackCliArguments('stats-'); - -describe('stats config related flag', () => { - for (const [name, value] of Object.entries(statsFlags)) { - // extract property name from flag name - const property = name.split('stats-')[1]; - const propName = hyphenToUpperCase(property); - - if (value.configs.filter((config) => config.type === 'boolean').length > 0) { - it(`should config --${name} correctly`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - - if (name.includes('-reset')) { - const option = propName.split('Reset')[0]; - expect(stdout).toContain(`${option}: []`); - } else { - expect(stdout).toContain(`${propName}: true`); - } - }); - - if (!name.endsWith('-reset')) { - it(`should config --no-${name} correctly`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [`--no-${name}`]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`${propName}: false`); - }); - } - } - - if (value.configs.filter((config) => config.type === 'number').length > 0) { - it(`should config --${name} correctly`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`, '10']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`${propName}: 10`); - }); - } - - if (value.configs.filter((config) => config.type === 'string').length > 0) { - const acceptsSingleValue = ['preset', 'modulesSort', 'logging', 'chunksSort', 'assetsSort']; - - it(`should config --${name} correctly`, async () => { - if (name.includes('stats-colors')) { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`, 'u001b[32m']); - const option = name.split('stats-colors-')[1]; - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`colors: { ${option}: 'u001b[32m' }`); - } else if (acceptsSingleValue.includes(propName)) { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`, 'log']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`${propName}: 'log'`); - } else if (name === 'stats-context') { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`, 'log']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain('log'); - } else if (name === 'stats-entrypoints' || name === 'stats-error-details') { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`, 'auto']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`${propName}: 'auto'`); - } else { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`, 'log']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`${propName}: [ 'log' ]`); - } - }); - } - } -}); diff --git a/test/build/core-flags/warning.config.js b/test/build/core-flags/warning.config.js new file mode 100644 index 00000000000..8535fb996b6 --- /dev/null +++ b/test/build/core-flags/warning.config.js @@ -0,0 +1,24 @@ +const path = require("path"); + +module.exports = { + mode: "development", + entry: "./src/main.js", + module: { + rules: [ + { + test: /.(js|jsx)?$/, + loader: "my-warning-loader", + include: [path.resolve(__dirname, "src")], + exclude: [/node_modules/], + }, + ], + }, + resolveLoader: { + alias: { + "my-warning-loader": require.resolve("./my-warning-loader"), + }, + }, + performance: { + hints: "warning", + }, +}; diff --git a/test/build/core-flags/watch-flags.test.js b/test/build/core-flags/watch-flags.test.js deleted file mode 100644 index 1f9c3959467..00000000000 --- a/test/build/core-flags/watch-flags.test.js +++ /dev/null @@ -1,69 +0,0 @@ -'use strict'; - -const { run, hyphenToUpperCase, getWebpackCliArguments } = require('../../utils/test-utils'); -const watchFlags = getWebpackCliArguments('watch'); - -describe('watch config related flag', () => { - for (const [name, value] of Object.entries(watchFlags)) { - // extract property name from flag name - const property = name.split('watch-options-')[1]; - const propName = hyphenToUpperCase(property); - - if (propName === 'stdin') { - return; - } - - if (value.configs.filter((config) => config.type === 'boolean').length > 0 && name !== 'watch') { - it(`should config --${name} correctly`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - - if (name.includes('reset')) { - expect(stdout).toContain(`watchOptions: { ignored: [] }`); - } else { - expect(stdout).toContain(`watchOptions: { ${propName}: true }`); - } - }); - - if (!name.endsWith('-reset')) { - it(`should config --no-${name} correctly`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [`--no-${name}`]); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`watchOptions: { ${propName}: false }`); - }); - } - } - - if (value.configs.filter((config) => config.type === 'number').length > 0) { - it(`should config --${name} correctly`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`, '10']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`watchOptions: { ${propName}: 10 }`); - }); - } - - if (value.configs.filter((config) => config.type === 'string').length > 0) { - it(`should config --${name} correctly`, async () => { - if (propName === 'poll') { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`, '200']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`watchOptions: { ${propName}: 200 }`); - } else { - const { exitCode, stderr, stdout } = await run(__dirname, [`--${name}`, 'ignore.js']); - - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`watchOptions: { ${propName}: [ 'ignore.js' ] }`); - } - }); - } - } -}); diff --git a/test/build/core-flags/webpack.cache.config.js b/test/build/core-flags/webpack.cache.config.js index c8f315b98ee..cfeed391a1e 100644 --- a/test/build/core-flags/webpack.cache.config.js +++ b/test/build/core-flags/webpack.cache.config.js @@ -1,12 +1,12 @@ -const WebpackCLITestPlugin = require('../../utils/webpack-cli-test-plugin'); +const WebpackCLITestPlugin = require("../../utils/webpack-cli-test-plugin"); module.exports = { - entry: './src/main.js', - mode: 'development', + entry: "./src/main.js", + mode: "development", cache: { - type: 'filesystem', - name: 'config-cache', + type: "filesystem", + name: "config-cache", }, - name: 'compiler-cache', - plugins: [new WebpackCLITestPlugin(['cache'])], + name: "compiler-cache", + plugins: [new WebpackCLITestPlugin(["cache"])], }; diff --git a/test/build/core-flags/webpack.config.js b/test/build/core-flags/webpack.config.js index 44254055243..124ca164206 100644 --- a/test/build/core-flags/webpack.config.js +++ b/test/build/core-flags/webpack.config.js @@ -1,8 +1,8 @@ -const WebpackCLITestPlugin = require('../../utils/webpack-cli-test-plugin'); +const WebpackCLITestPlugin = require("../../utils/webpack-cli-test-plugin"); module.exports = { - entry: './src/main.js', - mode: 'development', - name: 'compiler', - plugins: [new WebpackCLITestPlugin(['module', 'entry', 'resolve', 'resolveLoader', 'cache'])], + entry: "./src/main.js", + mode: "development", + name: "compiler", + plugins: [new WebpackCLITestPlugin(["module", "entry", "resolve", "resolveLoader", "cache"])], }; diff --git a/test/build/custom-webpack/custom-webpack.js b/test/build/custom-webpack/custom-webpack.js index dfe19cee008..898d4002902 100644 --- a/test/build/custom-webpack/custom-webpack.js +++ b/test/build/custom-webpack/custom-webpack.js @@ -1 +1 @@ -module.exports = require('webpack'); +module.exports = require("webpack"); diff --git a/test/build/custom-webpack/custom-webpack.test.js b/test/build/custom-webpack/custom-webpack.test.js index ec57011ef31..92c8bd922de 100644 --- a/test/build/custom-webpack/custom-webpack.test.js +++ b/test/build/custom-webpack/custom-webpack.test.js @@ -1,22 +1,24 @@ -'use strict'; +"use strict"; -const { resolve } = require('path'); -const { run } = require('../../utils/test-utils'); +const { resolve } = require("path"); +const { run } = require("../../utils/test-utils"); -describe('custom-webpack', () => { - it('should use custom-webpack.js', async () => { +describe("custom-webpack", () => { + it("should use custom-webpack.js", async () => { const { exitCode, stderr, stdout } = await run(__dirname, [], { - env: { WEBPACK_PACKAGE: resolve(__dirname, './custom-webpack.js') }, + env: { WEBPACK_PACKAGE: resolve(__dirname, "./custom-webpack.js") }, }); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - expect(stdout).toContain('main.js'); + expect(stdout).toContain("main.js"); }); - it('should throw an error for invalid-webpack.js', async () => { + it("should throw an error for invalid-webpack.js", async () => { const { exitCode, stderr, stdout } = await run(__dirname, [], { - env: { WEBPACK_PACKAGE: resolve(__dirname, './invalid-webpack.js') }, + env: { + WEBPACK_PACKAGE: resolve(__dirname, "./invalid-webpack.js"), + }, }); expect(exitCode).toBe(2); diff --git a/test/build/custom-webpack/webpack.config.js b/test/build/custom-webpack/webpack.config.js index 5b69c702150..529ce401c0c 100644 --- a/test/build/custom-webpack/webpack.config.js +++ b/test/build/custom-webpack/webpack.config.js @@ -1,3 +1,3 @@ module.exports = { - mode: 'production', + mode: "production", }; diff --git a/test/build/defaults/a.js b/test/build/defaults/a.js index 51aa40ce33d..f4bee164a97 100644 --- a/test/build/defaults/a.js +++ b/test/build/defaults/a.js @@ -1 +1 @@ -module.export = 'output-flag-test'; +module.export = "output-flag-test"; diff --git a/test/build/defaults/output-defaults.test.js b/test/build/defaults/output-defaults.test.js index 1d8afe1ea7c..f4f2bff82b3 100644 --- a/test/build/defaults/output-defaults.test.js +++ b/test/build/defaults/output-defaults.test.js @@ -1,32 +1,41 @@ -'use strict'; +"use strict"; -const { existsSync } = require('fs'); -const { resolve } = require('path'); -const { run } = require('../../utils/test-utils'); +const { existsSync } = require("fs"); +const { resolve } = require("path"); +const { run } = require("../../utils/test-utils"); -describe('output flag defaults', () => { - it('should create default file for a given directory', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--entry', './a.js', '--output-path', './binary']); +describe("output flag defaults", () => { + it("should create default file for a given directory", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--entry", + "./a.js", + "--output-path", + "./binary", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); // Should print warning about config fallback - expect(stdout).toContain('option has not been set, webpack will fallback to'); + expect(stdout).toContain("option has not been set, webpack will fallback to"); - expect(existsSync(resolve(__dirname, './binary/main.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./binary/main.js"))).toBeTruthy(); }); - it('set default output directory on no output flag', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--entry', './a.js']); + it("set default output directory on no output flag", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--entry", "./a.js"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); - expect(existsSync(resolve(__dirname, './binary/main.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./binary/main.js"))).toBeTruthy(); }); - it('throw error on empty output flag', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--entry', './a.js', '--output-path']); + it("throw error on empty output flag", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--entry", + "./a.js", + "--output-path", + ]); expect(exitCode).toBe(2); expect(stderr).toContain("Error: Option '-o, --output-path ' argument missing"); diff --git a/test/build/devtool/array/source-map-array.test.js b/test/build/devtool/array/source-map-array.test.js index c15d94c0b5f..ee45e79dd06 100644 --- a/test/build/devtool/array/source-map-array.test.js +++ b/test/build/devtool/array/source-map-array.test.js @@ -1,10 +1,10 @@ -'use strict'; +"use strict"; -const { resolve } = require('path'); -const { run, readdir } = require('../../../utils/test-utils'); +const { resolve } = require("path"); +const { run, readdir } = require("../../../utils/test-utils"); -describe('source-map object', () => { - it('should treat source-map settings right', async () => { +describe("source-map object", () => { + it("should treat source-map settings right", async () => { const { exitCode, stderr, stdout } = await run(__dirname, []); expect(exitCode).toBe(0); @@ -16,7 +16,7 @@ describe('source-map object', () => { let files; try { - files = await readdir(resolve(__dirname, 'dist')); + files = await readdir(resolve(__dirname, "dist")); } catch (error) { expect(error).toBe(null); } @@ -24,8 +24,13 @@ describe('source-map object', () => { expect(files.length).toBe(3); }); - it('should override entire array on flag', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--devtool', 'source-map', '--output-path', './binary']); + it("should override entire array on flag", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--devtool", + "source-map", + "--output-path", + "./binary", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -34,7 +39,7 @@ describe('source-map object', () => { let files; try { - files = await readdir(resolve(__dirname, 'binary')); + files = await readdir(resolve(__dirname, "binary")); } catch (error) { expect(error).toBe(null); } diff --git a/test/build/devtool/array/webpack.config.js b/test/build/devtool/array/webpack.config.js index b43cebaa257..8e8d0582195 100644 --- a/test/build/devtool/array/webpack.config.js +++ b/test/build/devtool/array/webpack.config.js @@ -1,27 +1,27 @@ -const WebpackCLITestPlugin = require('../../../utils/webpack-cli-test-plugin'); +const WebpackCLITestPlugin = require("../../../utils/webpack-cli-test-plugin"); module.exports = [ { output: { - filename: './dist-amd.js', - libraryTarget: 'amd', + filename: "./dist-amd.js", + libraryTarget: "amd", }, - name: 'amd', - entry: './index.js', - mode: 'development', - devtool: 'eval-cheap-module-source-map', + name: "amd", + entry: "./index.js", + mode: "development", + devtool: "eval-cheap-module-source-map", plugins: [new WebpackCLITestPlugin()], }, { output: { - filename: './dist-commonjs.js', - libraryTarget: 'commonjs', + filename: "./dist-commonjs.js", + libraryTarget: "commonjs", }, - name: 'commonjs', - entry: './index.js', - mode: 'development', - devtool: 'source-map', - target: 'node', + name: "commonjs", + entry: "./index.js", + mode: "development", + devtool: "source-map", + target: "node", plugins: [new WebpackCLITestPlugin()], }, ]; diff --git a/test/build/devtool/object/source-map-object.test.js b/test/build/devtool/object/source-map-object.test.js index 33caeb866ee..77be45d52ac 100644 --- a/test/build/devtool/object/source-map-object.test.js +++ b/test/build/devtool/object/source-map-object.test.js @@ -1,11 +1,14 @@ -'use strict'; -const { existsSync } = require('fs'); -const { resolve } = require('path'); -const { run, readdir } = require('../../../utils/test-utils'); +"use strict"; +const { existsSync } = require("fs"); +const { resolve } = require("path"); +const { run, readdir } = require("../../../utils/test-utils"); -describe('source-map object', () => { - it('should not write a source map for obj config', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', './webpack.eval.config.js']); +describe("source-map object", () => { + it("should not write a source map for obj config", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "-c", + "./webpack.eval.config.js", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -14,7 +17,7 @@ describe('source-map object', () => { let files; try { - files = await readdir(resolve(__dirname, 'dist')); + files = await readdir(resolve(__dirname, "dist")); } catch (error) { expect(error).toBe(null); } @@ -22,38 +25,41 @@ describe('source-map object', () => { expect(files.length).toBeGreaterThanOrEqual(1); }); - it('should write a sourcemap file', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', './webpack.source.config.js']); + it("should write a sourcemap file", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "-c", + "./webpack.source.config.js", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toContain("devtool: 'source-map'"); - expect(existsSync(resolve(__dirname, 'dist/dist-amd.js.map'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "dist/dist-amd.js.map"))).toBeTruthy(); }); - it('should override config with source-map', async () => { + it("should override config with source-map", async () => { const { exitCode, stderr, stdout } = await run( __dirname, - ['-c', './webpack.eval.config.js', '--devtool', 'source-map', '-o', './binary'], + ["-c", "./webpack.eval.config.js", "--devtool", "source-map", "-o", "./binary"], false, ); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toContain("devtool: 'source-map'"); - expect(existsSync(resolve(__dirname, 'binary/dist-amd.js.map'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "binary/dist-amd.js.map"))).toBeTruthy(); }); - it('should override config with devtool false', async () => { + it("should override config with devtool false", async () => { const { exitCode, stderr, stdout } = await run( __dirname, - ['-c', './webpack.eval.config.js', '--no-devtool', '-o', './binary'], + ["-c", "./webpack.eval.config.js", "--no-devtool", "-o", "./binary"], false, ); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - expect(stdout).toContain('devtool: false'); - expect(existsSync(resolve(__dirname, 'binary/dist-amd.js.map'))).toBeTruthy(); + expect(stdout).toContain("devtool: false"); + expect(existsSync(resolve(__dirname, "binary/dist-amd.js.map"))).toBeTruthy(); }); }); diff --git a/test/build/devtool/object/webpack.eval.config.js b/test/build/devtool/object/webpack.eval.config.js index 7c2bec6f0d6..39643fefd9f 100644 --- a/test/build/devtool/object/webpack.eval.config.js +++ b/test/build/devtool/object/webpack.eval.config.js @@ -1,13 +1,13 @@ -const WebpackCLITestPlugin = require('../../../utils/webpack-cli-test-plugin'); +const WebpackCLITestPlugin = require("../../../utils/webpack-cli-test-plugin"); module.exports = { output: { - filename: './dist-amd.js', - libraryTarget: 'amd', + filename: "./dist-amd.js", + libraryTarget: "amd", }, - name: 'amd', - entry: './index.js', - mode: 'development', - devtool: 'eval-cheap-module-source-map', + name: "amd", + entry: "./index.js", + mode: "development", + devtool: "eval-cheap-module-source-map", plugins: [new WebpackCLITestPlugin()], }; diff --git a/test/build/devtool/object/webpack.source.config.js b/test/build/devtool/object/webpack.source.config.js index efb87fa2f90..2972b444959 100644 --- a/test/build/devtool/object/webpack.source.config.js +++ b/test/build/devtool/object/webpack.source.config.js @@ -1,13 +1,13 @@ -const WebpackCLITestPlugin = require('../../../utils/webpack-cli-test-plugin'); +const WebpackCLITestPlugin = require("../../../utils/webpack-cli-test-plugin"); module.exports = { output: { - filename: './dist-amd.js', - libraryTarget: 'amd', + filename: "./dist-amd.js", + libraryTarget: "amd", }, - name: 'amd', - entry: './index.js', - mode: 'development', - devtool: 'source-map', + name: "amd", + entry: "./index.js", + mode: "development", + devtool: "source-map", plugins: [new WebpackCLITestPlugin()], }; diff --git a/test/build/entry/config-entry/1.js b/test/build/entry/config-entry/1.js index f14be438871..fd01d9ae015 100644 --- a/test/build/entry/config-entry/1.js +++ b/test/build/entry/config-entry/1.js @@ -1,11 +1,11 @@ -const { resolve } = require('path'); +const { resolve } = require("path"); module.exports = { entry: { - index: '../a.js', + index: "../a.js", }, output: { - path: resolve(process.cwd(), 'binary'), - filename: '[name].bundle.js', + path: resolve(process.cwd(), "binary"), + filename: "[name].bundle.js", }, }; diff --git a/test/build/entry/config-entry/entry-with-config/entry-with-config.test.js b/test/build/entry/config-entry/entry-with-config/entry-with-config.test.js index ebf897aee24..c63e2723bf9 100644 --- a/test/build/entry/config-entry/entry-with-config/entry-with-config.test.js +++ b/test/build/entry/config-entry/entry-with-config/entry-with-config.test.js @@ -1,15 +1,15 @@ -'use strict'; -const { existsSync } = require('fs'); -const { resolve } = require('path'); -const { run } = require('../../../../utils/test-utils'); +"use strict"; +const { existsSync } = require("fs"); +const { resolve } = require("path"); +const { run } = require("../../../../utils/test-utils"); -describe('default entry and config entry all exist', () => { - it('should use config entry if config entry existed', async () => { - const { stdout, stderr, exitCode } = await run(__dirname, ['-c', '../1.js']); +describe("default entry and config entry all exist", () => { + it("should use config entry if config entry existed", async () => { + const { stdout, stderr, exitCode } = await run(__dirname, ["-c", "../1.js"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - expect(stdout).toContain('./a.js'); - expect(existsSync(resolve(__dirname, './binary/index.bundle.js'))).toBeTruthy(); + expect(stdout).toContain("./a.js"); + expect(existsSync(resolve(__dirname, "./binary/index.bundle.js"))).toBeTruthy(); }); }); diff --git a/test/build/entry/config-entry/entry-with-index/entry-with-config.test.js b/test/build/entry/config-entry/entry-with-index/entry-with-config.test.js index 685486c05be..b4de568e1e0 100644 --- a/test/build/entry/config-entry/entry-with-index/entry-with-config.test.js +++ b/test/build/entry/config-entry/entry-with-index/entry-with-config.test.js @@ -1,20 +1,20 @@ -'use strict'; +"use strict"; -const { run } = require('../../../../utils/test-utils'); +const { run } = require("../../../../utils/test-utils"); -describe('default entry and config entry all exist', () => { - it('should use config entry if config entry existed', async () => { +describe("default entry and config entry all exist", () => { + it("should use config entry if config entry existed", async () => { const { exitCode, stderr, stdout } = await run(__dirname, []); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); // Should contain the relevant entry - expect(stdout).toContain('./src/app.js'); - expect(stdout).toContain('./src/print.js'); + expect(stdout).toContain("./src/app.js"); + expect(stdout).toContain("./src/print.js"); // Should contain the relevant bundle - expect(stdout).toContain('app.bundle.js'); - expect(stdout).toContain('print.bundle.js'); - expect(stdout).not.toContain('index.js'); + expect(stdout).toContain("app.bundle.js"); + expect(stdout).toContain("print.bundle.js"); + expect(stdout).not.toContain("index.js"); }); }); diff --git a/test/build/entry/config-entry/entry-with-index/src/app.js b/test/build/entry/config-entry/entry-with-index/src/app.js index 071620eafba..702645f13de 100644 --- a/test/build/entry/config-entry/entry-with-index/src/app.js +++ b/test/build/entry/config-entry/entry-with-index/src/app.js @@ -1 +1 @@ -console.log('app'); +console.log("app"); diff --git a/test/build/entry/config-entry/entry-with-index/src/print.js b/test/build/entry/config-entry/entry-with-index/src/print.js index 3c34c1ca320..c27e5ca9466 100644 --- a/test/build/entry/config-entry/entry-with-index/src/print.js +++ b/test/build/entry/config-entry/entry-with-index/src/print.js @@ -1 +1 @@ -console.log('print'); +console.log("print"); diff --git a/test/build/entry/config-entry/entry-with-index/webpack.config.js b/test/build/entry/config-entry/entry-with-index/webpack.config.js index 5c48520f84b..daa57e5a211 100644 --- a/test/build/entry/config-entry/entry-with-index/webpack.config.js +++ b/test/build/entry/config-entry/entry-with-index/webpack.config.js @@ -1,13 +1,13 @@ -const path = require('path'); +const path = require("path"); module.exports = { - mode: 'development', + mode: "development", entry: { - app: './src/app.js', - print: './src/print.js', + app: "./src/app.js", + print: "./src/print.js", }, output: { - filename: '[name].bundle.js', - path: path.resolve(__dirname, 'dist'), + filename: "[name].bundle.js", + path: path.resolve(__dirname, "dist"), }, }; diff --git a/test/build/entry/defaults-empty/entry-single-arg.test.js b/test/build/entry/defaults-empty/entry-single-arg.test.js index a4c944ff67a..0d4deab2e67 100644 --- a/test/build/entry/defaults-empty/entry-single-arg.test.js +++ b/test/build/entry/defaults-empty/entry-single-arg.test.js @@ -1,9 +1,9 @@ -'use strict'; +"use strict"; -const { run } = require('../../../utils/test-utils'); +const { run } = require("../../../utils/test-utils"); -describe('single entry flag empty project', () => { - it('sets default entry, compiles but throw missing module error', async () => { +describe("single entry flag empty project", () => { + it("sets default entry, compiles but throw missing module error", async () => { const { exitCode, stderr, stdout } = await run(__dirname); expect(exitCode).toBe(1); diff --git a/test/build/entry/defaults-index/entry-multi-args.test.js b/test/build/entry/defaults-index/entry-multi-args.test.js index b99ecd35aad..eab4821ffd7 100644 --- a/test/build/entry/defaults-index/entry-multi-args.test.js +++ b/test/build/entry/defaults-index/entry-multi-args.test.js @@ -1,26 +1,26 @@ -'use strict'; +"use strict"; -const { existsSync } = require('fs'); -const { resolve } = require('path'); +const { existsSync } = require("fs"); +const { resolve } = require("path"); -const { run } = require('../../../utils/test-utils'); +const { run } = require("../../../utils/test-utils"); -describe('single entry flag index present', () => { - it('finds default index file and compiles successfully', async () => { +describe("single entry flag index present", () => { + it("finds default index file and compiles successfully", async () => { const { stderr, stdout, exitCode } = await run(__dirname); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - expect(stderr).not.toContain('Module not found'); + expect(stderr).not.toContain("Module not found"); expect(stdout).toBeTruthy(); }); - it('finds default index file, compiles and overrides with flags successfully', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--output-path', 'bin']); + it("finds default index file, compiles and overrides with flags successfully", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--output-path", "bin"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); - expect(existsSync(resolve(__dirname, './bin/main.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./bin/main.js"))).toBeTruthy(); }); }); diff --git a/test/build/entry/flag-entry/entry-with-flag.test.js b/test/build/entry/flag-entry/entry-with-flag.test.js index 0a75a5d3dad..aea0411bb0f 100644 --- a/test/build/entry/flag-entry/entry-with-flag.test.js +++ b/test/build/entry/flag-entry/entry-with-flag.test.js @@ -1,46 +1,51 @@ -'use strict'; +"use strict"; -const { run, readFile } = require('../../../utils/test-utils'); -const { existsSync } = require('fs'); -const { resolve } = require('path'); +const { run, readFile } = require("../../../utils/test-utils"); +const { existsSync } = require("fs"); +const { resolve } = require("path"); -describe('entry flag', () => { - it('should resolve the path to src/index.cjs', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--entry', './src/index.cjs', '-o', './dist/']); +describe("entry flag", () => { + it("should resolve the path to src/index.cjs", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--entry", + "./src/index.cjs", + "-o", + "./dist/", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); }); - it('should load ./src/a.js as entry', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--entry', './src/a.js']); + it("should load ./src/a.js as entry", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--entry", "./src/a.js"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); }); - it('should resolve the path to /src/a.js as ./src/a.js', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--entry', '/src/a.js']); + it("should resolve the path to /src/a.js as ./src/a.js", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--entry", "/src/a.js"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); - expect(existsSync(resolve(__dirname, './dist/main.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./dist/main.js"))).toBeTruthy(); let data; try { - data = await readFile(resolve(__dirname, './dist/main.js'), 'utf-8'); + data = await readFile(resolve(__dirname, "./dist/main.js"), "utf-8"); } catch (error) { expect(error).toBe(null); } - expect(data).toContain('Hello from a.js'); + expect(data).toContain("Hello from a.js"); }); - it('should throw error for invalid entry file', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--entry', './src/test.js']); + it("should throw error for invalid entry file", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--entry", "./src/test.js"]); expect(exitCode).toEqual(1); expect(stderr).toBeFalsy(); diff --git a/test/build/entry/flag-entry/src/a.js b/test/build/entry/flag-entry/src/a.js index 5b4dd8b52eb..8a700c3d098 100644 --- a/test/build/entry/flag-entry/src/a.js +++ b/test/build/entry/flag-entry/src/a.js @@ -1 +1 @@ -console.log('Hello from a.js'); +console.log("Hello from a.js"); diff --git a/test/build/entry/flag-entry/src/index.cjs b/test/build/entry/flag-entry/src/index.cjs index f96f188d697..a741ab3334d 100644 --- a/test/build/entry/flag-entry/src/index.cjs +++ b/test/build/entry/flag-entry/src/index.cjs @@ -1 +1 @@ -console.log('Kazuya Miyuki'); +console.log("Kazuya Miyuki"); diff --git a/test/build/entry/multiple-entries/multi-entries.test.js b/test/build/entry/multiple-entries/multi-entries.test.js index 5d70b2666c0..cbf765751ee 100644 --- a/test/build/entry/multiple-entries/multi-entries.test.js +++ b/test/build/entry/multiple-entries/multi-entries.test.js @@ -1,27 +1,32 @@ -'use strict'; +"use strict"; -const { run, readFile } = require('../../../utils/test-utils'); -const { existsSync } = require('fs'); -const { resolve } = require('path'); +const { run, readFile } = require("../../../utils/test-utils"); +const { existsSync } = require("fs"); +const { resolve } = require("path"); -describe(' multiple entries', () => { - it('should allow multiple entry flags', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--entry', './src/a.js', '--entry', './src/b.js']); +describe(" multiple entries", () => { + it("should allow multiple entry flags", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--entry", + "./src/a.js", + "--entry", + "./src/b.js", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); - expect(existsSync(resolve(__dirname, './dist/main.js'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./dist/main.js"))).toBeTruthy(); let data; try { - data = await readFile(resolve(__dirname, './dist/main.js'), 'utf-8'); + data = await readFile(resolve(__dirname, "./dist/main.js"), "utf-8"); } catch (error) { expect(error).toBe(null); } - expect(data).toContain('Hello from a.js'); - expect(data).toContain('Hello from b.js'); + expect(data).toContain("Hello from a.js"); + expect(data).toContain("Hello from b.js"); }); }); diff --git a/test/build/entry/multiple-entries/src/a.js b/test/build/entry/multiple-entries/src/a.js index 5b4dd8b52eb..8a700c3d098 100644 --- a/test/build/entry/multiple-entries/src/a.js +++ b/test/build/entry/multiple-entries/src/a.js @@ -1 +1 @@ -console.log('Hello from a.js'); +console.log("Hello from a.js"); diff --git a/test/build/entry/multiple-entries/src/b.js b/test/build/entry/multiple-entries/src/b.js index 4eb2d45c855..a5cc96f74cb 100644 --- a/test/build/entry/multiple-entries/src/b.js +++ b/test/build/entry/multiple-entries/src/b.js @@ -1 +1 @@ -console.log('Hello from b.js'); +console.log("Hello from b.js"); diff --git a/test/build/entry/multiple-entries/src/c.js b/test/build/entry/multiple-entries/src/c.js index 68ea4af8491..ae96e42b67a 100644 --- a/test/build/entry/multiple-entries/src/c.js +++ b/test/build/entry/multiple-entries/src/c.js @@ -1 +1 @@ -console.log('Hello from c.js'); +console.log("Hello from c.js"); diff --git a/test/build/entry/scss/home.js b/test/build/entry/scss/home.js index 2c794ff0941..4d24d7f91ca 100644 --- a/test/build/entry/scss/home.js +++ b/test/build/entry/scss/home.js @@ -1 +1 @@ -console.log('home'); +console.log("home"); diff --git a/test/build/entry/scss/package.json b/test/build/entry/scss/package.json index 11b90db6ca3..aa82e4028db 100644 --- a/test/build/entry/scss/package.json +++ b/test/build/entry/scss/package.json @@ -4,6 +4,6 @@ "style-loader": "^2.0.0", "sass-loader": "^10.1.1", "mini-css-extract-plugin": "^1.3.5", - "node-sass": "^5.0.0" + "sass": "^1.34.1" } } diff --git a/test/build/entry/scss/scss.test.js b/test/build/entry/scss/scss.test.js index c5406962f6f..52f609c136a 100644 --- a/test/build/entry/scss/scss.test.js +++ b/test/build/entry/scss/scss.test.js @@ -1,12 +1,12 @@ /* eslint-disable node/no-unpublished-require */ -const { run } = require('../../../utils/test-utils'); +const { run } = require("../../../utils/test-utils"); -describe('entry point', () => { - it('should support SCSS files', async () => { +describe("entry point", () => { + it("should support SCSS files", async () => { const { stdout } = await run(__dirname); expect(stdout).toBeTruthy(); - expect(stdout).toContain('home.scss'); - expect(stdout).toContain('home.js'); + expect(stdout).toContain("home.scss"); + expect(stdout).toContain("home.js"); }); }); diff --git a/test/build/entry/scss/webpack.config.js b/test/build/entry/scss/webpack.config.js index 5f80bebe789..265ae5f8c31 100644 --- a/test/build/entry/scss/webpack.config.js +++ b/test/build/entry/scss/webpack.config.js @@ -1,13 +1,13 @@ // eslint-disable-next-line node/no-missing-require -const MiniCssExtractPlugin = require('mini-css-extract-plugin'); +const MiniCssExtractPlugin = require("mini-css-extract-plugin"); module.exports = { - mode: 'development', + mode: "development", entry: { - home: ['./home.js', './home.scss'], + home: ["./home.js", "./home.scss"], }, output: { - filename: '[name].js', + filename: "[name].js", }, module: { rules: [ @@ -16,15 +16,15 @@ module.exports = { use: [ // fallback to style-loader in development MiniCssExtractPlugin.loader, - 'css-loader', - 'sass-loader', + "css-loader", + "sass-loader", ], }, ], }, plugins: [ new MiniCssExtractPlugin({ - filename: '[name].css', + filename: "[name].css", }), ], }; diff --git a/test/build/env/array/array-env.test.js b/test/build/env/array/array-env.test.js index 17c94642010..78e47247b77 100644 --- a/test/build/env/array/array-env.test.js +++ b/test/build/env/array/array-env.test.js @@ -1,17 +1,17 @@ -'use strict'; +"use strict"; -const path = require('path'); +const path = require("path"); // eslint-disable-next-line node/no-unpublished-require -const execa = require('execa'); +const execa = require("execa"); const { sync: spawnSync } = execa; -const { run, isWebpack5 } = require('../../../utils/test-utils'); +const { run, isWebpack5 } = require("../../../utils/test-utils"); -const devFile = path.join(__dirname, './dist/dev.js'); -const prodFile = path.join(__dirname, './dist/prod.js'); +const devFile = path.join(__dirname, "./dist/dev.js"); +const prodFile = path.join(__dirname, "./dist/prod.js"); -describe('env array', () => { - it('is able to set two different environments for an array configuration', async () => { +describe("env array", () => { + it("is able to set two different environments for an array configuration", async () => { const { exitCode, stderr, stdout } = await run(__dirname); expect(exitCode).toBe(0); @@ -19,11 +19,11 @@ describe('env array', () => { expect(stdout).toBeTruthy(); if (isWebpack5) { - const devScript = spawnSync('node', [devFile]); - const prodScript = spawnSync('node', [prodFile]); + const devScript = spawnSync("node", [devFile]); + const prodScript = spawnSync("node", [prodFile]); - expect(devScript.stdout).toBe('environment is development'); - expect(prodScript.stdout).toBe('environment is production'); + expect(devScript.stdout).toBe("environment is development"); + expect(prodScript.stdout).toBe("environment is production"); } }); }); diff --git a/test/build/env/array/webpack.config.js b/test/build/env/array/webpack.config.js index ec67e7da042..0e907ca83c0 100644 --- a/test/build/env/array/webpack.config.js +++ b/test/build/env/array/webpack.config.js @@ -1,13 +1,13 @@ -const webpack = require('webpack'); +const webpack = require("webpack"); module.exports = [ { output: { - filename: 'prod.js', + filename: "prod.js", }, - mode: 'production', - devtool: 'eval-cheap-module-source-map', - target: 'node', + mode: "production", + devtool: "eval-cheap-module-source-map", + target: "node", plugins: [ new webpack.DefinePlugin({ PRODUCTION: JSON.stringify(true), @@ -16,10 +16,10 @@ module.exports = [ }, { output: { - filename: 'dev.js', + filename: "dev.js", }, - mode: 'development', - target: 'node', + mode: "development", + target: "node", plugins: [ new webpack.DefinePlugin({ PRODUCTION: JSON.stringify(false), diff --git a/test/build/env/object/object-env.test.js b/test/build/env/object/object-env.test.js index cb100ee74fd..0a66e50fad5 100644 --- a/test/build/env/object/object-env.test.js +++ b/test/build/env/object/object-env.test.js @@ -1,14 +1,14 @@ -'use strict'; +"use strict"; -const path = require('path'); +const path = require("path"); // eslint-disable-next-line node/no-unpublished-require -const execa = require('execa'); +const execa = require("execa"); const { sync: spawnSync } = execa; -const { run, isWebpack5 } = require('../../../utils/test-utils'); +const { run, isWebpack5 } = require("../../../utils/test-utils"); -describe('env object', () => { - it('is able to set env for an object', async () => { +describe("env object", () => { + it("is able to set env for an object", async () => { const { exitCode, stderr, stdout } = await run(__dirname); expect(exitCode).toBe(0); @@ -16,9 +16,9 @@ describe('env object', () => { expect(stdout).toBeTruthy(); if (isWebpack5) { - const executable = path.join(__dirname, './dist/main.js'); - const bundledScript = spawnSync('node', [executable]); - expect(bundledScript.stdout).toBe('environment is development'); + const executable = path.join(__dirname, "./dist/main.js"); + const bundledScript = spawnSync("node", [executable]); + expect(bundledScript.stdout).toBe("environment is development"); } }); }); diff --git a/test/build/env/object/webpack.config.js b/test/build/env/object/webpack.config.js index 6298db87f9d..84e75adab17 100644 --- a/test/build/env/object/webpack.config.js +++ b/test/build/env/object/webpack.config.js @@ -1,9 +1,9 @@ -const webpack = require('webpack'); +const webpack = require("webpack"); module.exports = { - mode: 'development', - devtool: 'eval-cheap-module-source-map', - target: 'node', + mode: "development", + devtool: "eval-cheap-module-source-map", + target: "node", plugins: [ new webpack.DefinePlugin({ PRODUCTION: JSON.stringify(false), diff --git a/test/build/error/error-in-plugin/error.test.js b/test/build/error/error-in-plugin/error.test.js index 97233904e9c..e8951f69201 100644 --- a/test/build/error/error-in-plugin/error.test.js +++ b/test/build/error/error-in-plugin/error.test.js @@ -1,31 +1,31 @@ -'use strict'; +"use strict"; -const { run } = require('../../../utils/test-utils'); +const { run } = require("../../../utils/test-utils"); -describe('error', () => { - it('should log error with stacktrace', async () => { +describe("error", () => { + it("should log error with stacktrace", async () => { const { exitCode, stderr, stdout } = await run(__dirname); expect(exitCode).toBe(2); - expect(stderr).toContain('Error: test'); + expect(stderr).toContain("Error: test"); expect(stderr).toMatch(/at .+ (.+)/); expect(stdout).toBeFalsy(); }); it('should log error with stacktrace using the "bundle" command', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['bundle']); + const { exitCode, stderr, stdout } = await run(__dirname, ["bundle"]); expect(exitCode).toBe(2); - expect(stderr).toContain('Error: test'); + expect(stderr).toContain("Error: test"); expect(stderr).toMatch(/at .+ (.+)/); expect(stdout).toBeFalsy(); }); it('should log error with stacktrace using the "serve" command', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['serve']); + const { exitCode, stderr, stdout } = await run(__dirname, ["serve"]); expect(exitCode).toBe(2); - expect(stderr).toContain('Error: test'); + expect(stderr).toContain("Error: test"); expect(stderr).toMatch(/at .+ (.+)/); expect(stdout).toBeFalsy(); }); diff --git a/test/build/error/error-in-plugin/webpack.config.js b/test/build/error/error-in-plugin/webpack.config.js index 25018a41285..ce907f08a78 100644 --- a/test/build/error/error-in-plugin/webpack.config.js +++ b/test/build/error/error-in-plugin/webpack.config.js @@ -2,7 +2,7 @@ module.exports = { plugins: [ { apply() { - throw new Error('test'); + throw new Error("test"); }, }, ], diff --git a/test/build/error/invalid-schema/invalid-schema.test.js b/test/build/error/invalid-schema/invalid-schema.test.js index f54291cb7be..de901331213 100644 --- a/test/build/error/invalid-schema/invalid-schema.test.js +++ b/test/build/error/invalid-schema/invalid-schema.test.js @@ -1,41 +1,55 @@ -'use strict'; -const { run, isWebpack5 } = require('../../../utils/test-utils'); +"use strict"; +const { run, isWebpack5 } = require("../../../utils/test-utils"); -describe('invalid schema', () => { - it('should log error on invalid config', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--config', './webpack.mock.config.js']); +describe("invalid schema", () => { + it("should log error on invalid config", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--config", + "./webpack.mock.config.js", + ]); expect(exitCode).toEqual(2); - expect(stderr).toContain('Invalid configuration object'); + expect(stderr).toContain("Invalid configuration object"); expect(stdout).toBeFalsy(); }); - it('should log error on invalid plugin options', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--config', './webpack.plugin-mock.config.js']); + it("should log error on invalid plugin options", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--config", + "./webpack.plugin-mock.config.js", + ]); expect(exitCode).toEqual(2); - expect(stderr).toContain(isWebpack5 ? 'Invalid options object' : 'Invalid Options'); + expect(stderr).toContain(isWebpack5 ? "Invalid options object" : "Invalid Options"); expect(stdout).toBeFalsy(); }); it('should log error on invalid config using the "bundle" command', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['bundle', '--config', './webpack.mock.config.js']); + const { exitCode, stderr, stdout } = await run(__dirname, [ + "bundle", + "--config", + "./webpack.mock.config.js", + ]); expect(exitCode).toEqual(2); - expect(stderr).toContain('Invalid configuration object'); + expect(stderr).toContain("Invalid configuration object"); expect(stdout).toBeFalsy(); }); it('should log error on invalid config using the "serve" command', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['serve', '--config', './webpack.mock.config.js']); + const { exitCode, stderr, stdout } = await run(__dirname, [ + "serve", + "--config", + "./webpack.mock.config.js", + ]); expect(exitCode).toEqual(2); - expect(stderr).toContain('Invalid configuration object'); + expect(stderr).toContain("Invalid configuration object"); expect(stdout).toBeFalsy(); }); - it('should log error on invalid option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--mode', 'Yukihira']); + it("should log error on invalid option", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--mode", "Yukihira"]); expect(exitCode).toEqual(2); @@ -43,14 +57,14 @@ describe('invalid schema', () => { expect(stderr).toContain("Invalid value 'Yukihira' for the '--mode' option"); expect(stderr).toContain("Expected: 'development | production | none'"); } else { - expect(stderr).toContain('Invalid configuration object'); + expect(stderr).toContain("Invalid configuration object"); } expect(stdout).toBeFalsy(); }); it('should log error on invalid option using "build" command', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['build', '--mode', 'Yukihira']); + const { exitCode, stderr, stdout } = await run(__dirname, ["build", "--mode", "Yukihira"]); expect(exitCode).toEqual(2); @@ -58,14 +72,14 @@ describe('invalid schema', () => { expect(stderr).toContain("Invalid value 'Yukihira' for the '--mode' option"); expect(stderr).toContain("Expected: 'development | production | none'"); } else { - expect(stderr).toContain('Invalid configuration object'); + expect(stderr).toContain("Invalid configuration object"); } expect(stdout).toBeFalsy(); }); it('should log error on invalid option using "bundle" command', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['bundle', '--mode', 'Yukihira']); + const { exitCode, stderr, stdout } = await run(__dirname, ["bundle", "--mode", "Yukihira"]); expect(exitCode).toEqual(2); @@ -73,14 +87,14 @@ describe('invalid schema', () => { expect(stderr).toContain("Invalid value 'Yukihira' for the '--mode' option"); expect(stderr).toContain("Expected: 'development | production | none'"); } else { - expect(stderr).toContain('Invalid configuration object'); + expect(stderr).toContain("Invalid configuration object"); } expect(stdout).toBeFalsy(); }); it('should log error on invalid option using "b" command', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['b', '--mode', 'Yukihira']); + const { exitCode, stderr, stdout } = await run(__dirname, ["b", "--mode", "Yukihira"]); expect(exitCode).toEqual(2); @@ -88,14 +102,14 @@ describe('invalid schema', () => { expect(stderr).toContain("Invalid value 'Yukihira' for the '--mode' option"); expect(stderr).toContain("Expected: 'development | production | none'"); } else { - expect(stderr).toContain('Invalid configuration object'); + expect(stderr).toContain("Invalid configuration object"); } expect(stdout).toBeFalsy(); }); it('should log error on invalid option using "watch" command', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['watch', '--mode', 'Yukihira']); + const { exitCode, stderr, stdout } = await run(__dirname, ["watch", "--mode", "Yukihira"]); expect(exitCode).toEqual(2); @@ -103,14 +117,14 @@ describe('invalid schema', () => { expect(stderr).toContain("Invalid value 'Yukihira' for the '--mode' option"); expect(stderr).toContain("Expected: 'development | production | none'"); } else { - expect(stderr).toContain('Invalid configuration object'); + expect(stderr).toContain("Invalid configuration object"); } expect(stdout).toBeFalsy(); }); it('should log error on invalid option using "w" command', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['w', '--mode', 'Yukihira']); + const { exitCode, stderr, stdout } = await run(__dirname, ["w", "--mode", "Yukihira"]); expect(exitCode).toEqual(2); @@ -118,14 +132,14 @@ describe('invalid schema', () => { expect(stderr).toContain("Invalid value 'Yukihira' for the '--mode' option"); expect(stderr).toContain("Expected: 'development | production | none'"); } else { - expect(stderr).toContain('Invalid configuration object'); + expect(stderr).toContain("Invalid configuration object"); } expect(stdout).toBeFalsy(); }); it('should log error on invalid option using "server" command', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['serve', '--mode', 'Yukihira']); + const { exitCode, stderr, stdout } = await run(__dirname, ["serve", "--mode", "Yukihira"]); expect(exitCode).toEqual(2); @@ -133,14 +147,14 @@ describe('invalid schema', () => { expect(stderr).toContain("Invalid value 'Yukihira' for the '--mode' option"); expect(stderr).toContain("Expected: 'development | production | none'"); } else { - expect(stderr).toContain('Invalid configuration object'); + expect(stderr).toContain("Invalid configuration object"); } expect(stdout).toBeFalsy(); }); it('should log error on invalid option using "s" command', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['s', '--mode', 'Yukihira']); + const { exitCode, stderr, stdout } = await run(__dirname, ["s", "--mode", "Yukihira"]); expect(exitCode).toEqual(2); @@ -148,7 +162,7 @@ describe('invalid schema', () => { expect(stderr).toContain("Invalid value 'Yukihira' for the '--mode' option"); expect(stderr).toContain("Expected: 'development | production | none'"); } else { - expect(stderr).toContain('Invalid configuration object'); + expect(stderr).toContain("Invalid configuration object"); } expect(stdout).toBeFalsy(); diff --git a/test/build/error/invalid-schema/webpack.mock.config.js b/test/build/error/invalid-schema/webpack.mock.config.js index f6d8ff0ce80..d436ef9ecc5 100644 --- a/test/build/error/invalid-schema/webpack.mock.config.js +++ b/test/build/error/invalid-schema/webpack.mock.config.js @@ -1,3 +1,3 @@ module.exports = { - mode: 'Nishinoya Yuu', + mode: "Nishinoya Yuu", }; diff --git a/test/build/error/invalid-schema/webpack.plugin-mock.config.js b/test/build/error/invalid-schema/webpack.plugin-mock.config.js index 24a228b9d92..0505173c867 100644 --- a/test/build/error/invalid-schema/webpack.plugin-mock.config.js +++ b/test/build/error/invalid-schema/webpack.plugin-mock.config.js @@ -1,10 +1,10 @@ -const webpack = require('webpack'); +const webpack = require("webpack"); module.exports = { - mode: 'development', + mode: "development", plugins: [ new webpack.BannerPlugin({ - unknown: 'unknown', + unknown: "unknown", }), ], }; diff --git a/test/build/hot/hot-flag.test.js b/test/build/hot/hot-flag.test.js index 2ada45b259d..877973de9a5 100644 --- a/test/build/hot/hot-flag.test.js +++ b/test/build/hot/hot-flag.test.js @@ -1,41 +1,47 @@ -'use strict'; -const { run, normalizeStderr, normalizeStdout } = require('../../utils/test-utils'); -const { readFileSync } = require('fs'); -const { resolve } = require('path'); +"use strict"; +const { run, normalizeStderr, normalizeStdout } = require("../../utils/test-utils"); +const { readFileSync } = require("fs"); +const { resolve } = require("path"); -describe('--hot flag', () => { - it('should be successful when --hot is passed', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--hot']); +describe("--hot flag", () => { + it("should be successful when --hot is passed", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--hot"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); expect(stdout).toBeTruthy(); - expect(readFileSync(resolve(__dirname, './dist/main.js')).toString()).toContain('webpackHotUpdate'); + expect(readFileSync(resolve(__dirname, "./dist/main.js")).toString()).toContain( + "webpackHotUpdate", + ); }); - it('should be successful when --hot=only is passed', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--hot', 'only']); + it("should be successful when --hot=only is passed", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--hot", "only"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); expect(stdout).toBeTruthy(); - expect(readFileSync(resolve(__dirname, './dist/main.js')).toString()).toContain('webpackHotUpdate'); + expect(readFileSync(resolve(__dirname, "./dist/main.js")).toString()).toContain( + "webpackHotUpdate", + ); }); - it('should throw an error for invalid value', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--hot', 'unknown']); + it("should throw an error for invalid value", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--hot", "unknown"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should be successful when --no-hot is passed', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--no-hot']); + it("should be successful when --no-hot is passed", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--no-hot"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); expect(stdout).toBeTruthy(); - expect(readFileSync(resolve(__dirname, './dist/main.js')).toString()).not.toContain('webpackHotUpdate'); + expect(readFileSync(resolve(__dirname, "./dist/main.js")).toString()).not.toContain( + "webpackHotUpdate", + ); }); }); diff --git a/test/build/hot/webpack.config.js b/test/build/hot/webpack.config.js index 37c48e745b2..8bac08756f3 100644 --- a/test/build/hot/webpack.config.js +++ b/test/build/hot/webpack.config.js @@ -1,4 +1,4 @@ module.exports = { - mode: 'development', - stats: 'verbose', + mode: "development", + stats: "verbose", }; diff --git a/test/build/import-local/import-local.test.js b/test/build/import-local/import-local.test.js index 06536e7173a..37d1d110478 100644 --- a/test/build/import-local/import-local.test.js +++ b/test/build/import-local/import-local.test.js @@ -1,15 +1,15 @@ -'use strict'; +"use strict"; -const { run } = require('../../utils/test-utils'); +const { run } = require("../../utils/test-utils"); const importLocalMock = jest.fn(); -jest.setMock('import-local', importLocalMock); +jest.setMock("import-local", importLocalMock); -describe('import local', () => { +describe("import local", () => { beforeEach(() => { importLocalMock.mockClear(); }); - it('should skip import local when supplied', async () => { + it("should skip import local when supplied", async () => { const { exitCode, stderr, stdout } = await run(__dirname, [], { env: { WEBPACK_CLI_SKIP_IMPORT_LOCAL: true }, }); diff --git a/test/build/json/json.test.js b/test/build/json/json.test.js index f45d86e96b3..37294945fb6 100644 --- a/test/build/json/json.test.js +++ b/test/build/json/json.test.js @@ -1,160 +1,181 @@ -'use strict'; +"use strict"; -const { run, readFile } = require('../../utils/test-utils'); -const { existsSync } = require('fs'); -const { resolve } = require('path'); +const { run, readFile } = require("../../utils/test-utils"); +const { existsSync } = require("fs"); +const { resolve } = require("path"); -const successMessage = 'stats are successfully stored as json to stats.json'; +const successMessage = "stats are successfully stored as json to stats.json"; -describe('json', () => { - it('should work and output json stats', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--json']); +describe("json", () => { + it("should work and output json stats", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--json"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(() => JSON.parse(stdout)).not.toThrow(); - expect(JSON.parse(stdout)['hash']).toBeDefined(); + expect(JSON.parse(stdout)["hash"]).toBeDefined(); }); - it('should work and store json to a file', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--json', 'stats.json']); + it("should work and store json to a file", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--json", "stats.json"]); expect(exitCode).toBe(0); expect(stderr).toContain(successMessage); expect(stdout).toBeFalsy(); - expect(existsSync(resolve(__dirname, './stats.json'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./stats.json"))).toBeTruthy(); let data; try { - data = await readFile(resolve(__dirname, 'stats.json'), 'utf-8'); + data = await readFile(resolve(__dirname, "stats.json"), "utf-8"); } catch (error) { expect(error).toBe(null); } - expect(JSON.parse(data)['hash']).toBeTruthy(); - expect(JSON.parse(data)['version']).toBeTruthy(); - expect(JSON.parse(data)['time']).toBeTruthy(); + expect(JSON.parse(data)["hash"]).toBeTruthy(); + expect(JSON.parse(data)["version"]).toBeTruthy(); + expect(JSON.parse(data)["time"]).toBeTruthy(); expect(() => JSON.parse(data)).not.toThrow(); }); - it('should work and store json to a file and respect --color flag', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--json', 'stats.json', '--color'], { env: { FORCE_COLOR: true } }); + it("should work and store json to a file and respect --color flag", async () => { + const { exitCode, stderr, stdout } = await run( + __dirname, + ["--json", "stats.json", "--color"], + { env: { FORCE_COLOR: true } }, + ); expect(exitCode).toBe(0); expect(stderr).toContain(`\u001b[32m${successMessage}`); expect(stdout).toBeFalsy(); - expect(existsSync(resolve(__dirname, './stats.json'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./stats.json"))).toBeTruthy(); let data; try { - data = await readFile(resolve(__dirname, 'stats.json'), 'utf-8'); + data = await readFile(resolve(__dirname, "stats.json"), "utf-8"); } catch (error) { expect(error).toBe(null); } - expect(JSON.parse(data)['hash']).toBeTruthy(); - expect(JSON.parse(data)['version']).toBeTruthy(); - expect(JSON.parse(data)['time']).toBeTruthy(); + expect(JSON.parse(data)["hash"]).toBeTruthy(); + expect(JSON.parse(data)["version"]).toBeTruthy(); + expect(JSON.parse(data)["time"]).toBeTruthy(); expect(() => JSON.parse(data)).not.toThrow(); }); - it('should work and store json to a file and respect --no-color', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--json', 'stats.json', '--no-color']); + it("should work and store json to a file and respect --no-color", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--json", + "stats.json", + "--no-color", + ]); expect(exitCode).toBe(0); expect(stderr).not.toContain(`\u001b[32m${successMessage}`); expect(stderr).toContain(`${successMessage}`); expect(stdout).toBeFalsy(); - expect(existsSync(resolve(__dirname, './stats.json'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./stats.json"))).toBeTruthy(); let data; try { - data = await readFile(resolve(__dirname, 'stats.json'), 'utf-8'); + data = await readFile(resolve(__dirname, "stats.json"), "utf-8"); } catch (error) { expect(error).toBe(null); } - expect(JSON.parse(data)['hash']).toBeTruthy(); - expect(JSON.parse(data)['version']).toBeTruthy(); - expect(JSON.parse(data)['time']).toBeTruthy(); + expect(JSON.parse(data)["hash"]).toBeTruthy(); + expect(JSON.parse(data)["version"]).toBeTruthy(); + expect(JSON.parse(data)["time"]).toBeTruthy(); expect(() => JSON.parse(data)).not.toThrow(); }); it('should work using the "-j" option (alias)', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-j']); + const { exitCode, stderr, stdout } = await run(__dirname, ["-j"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(() => JSON.parse(stdout)).not.toThrow(); - expect(JSON.parse(stdout)['hash']).toBeDefined(); + expect(JSON.parse(stdout)["hash"]).toBeDefined(); }); it('should work and output json stats with the "--progress" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--json', '--progress']); + const { exitCode, stderr, stdout } = await run(__dirname, ["--json", "--progress"]); expect(exitCode).toBe(0); - expect(stderr).toContain('webpack.Progress'); + expect(stderr).toContain("webpack.Progress"); expect(() => JSON.parse(stdout)).not.toThrow(); - expect(JSON.parse(stdout)['hash']).toBeDefined(); + expect(JSON.parse(stdout)["hash"]).toBeDefined(); }); it('should work and store json to a file with the "--progress" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--json', 'stats.json', '--progress']); + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--json", + "stats.json", + "--progress", + ]); expect(exitCode).toBe(0); - expect(stderr).toContain('webpack.Progress'); + expect(stderr).toContain("webpack.Progress"); expect(stderr).toContain(successMessage); expect(stdout).toBeFalsy(); - expect(existsSync(resolve(__dirname, './stats.json'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./stats.json"))).toBeTruthy(); let data; try { - data = await readFile(resolve(__dirname, 'stats.json'), 'utf-8'); + data = await readFile(resolve(__dirname, "stats.json"), "utf-8"); } catch (error) { expect(error).toBe(null); } - expect(JSON.parse(data)['hash']).toBeTruthy(); - expect(JSON.parse(data)['version']).toBeTruthy(); - expect(JSON.parse(data)['time']).toBeTruthy(); + expect(JSON.parse(data)["hash"]).toBeTruthy(); + expect(JSON.parse(data)["version"]).toBeTruthy(); + expect(JSON.parse(data)["time"]).toBeTruthy(); expect(() => JSON.parse(data)).not.toThrow(); }); - it('should work and output json stats with cli logs', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--json', '--config', 'logging.config.js']); + it("should work and output json stats with cli logs", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--json", + "--config", + "logging.config.js", + ]); expect(exitCode).toBe(0); - expect(stderr).toContain('Compiler starting...'); - expect(stderr).toContain('Compiler finished'); + expect(stderr).toContain("Compiler starting..."); + expect(stderr).toContain("Compiler finished"); expect(() => JSON.parse(stdout)).not.toThrow(); - expect(JSON.parse(stdout)['hash']).toBeDefined(); + expect(JSON.parse(stdout)["hash"]).toBeDefined(); }); - it('should work and store json to a file with cli logs', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--json', 'stats.json', '--config', 'logging.config.js']); + it("should work and store json to a file with cli logs", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--json", + "stats.json", + "--config", + "logging.config.js", + ]); expect(exitCode).toBe(0); - expect(stderr).toContain('Compiler starting...'); - expect(stderr).toContain('Compiler finished'); + expect(stderr).toContain("Compiler starting..."); + expect(stderr).toContain("Compiler finished"); expect(stderr).toContain(successMessage); expect(stdout).toBeFalsy(); - expect(existsSync(resolve(__dirname, './stats.json'))).toBeTruthy(); + expect(existsSync(resolve(__dirname, "./stats.json"))).toBeTruthy(); let data; try { - data = await readFile(resolve(__dirname, 'stats.json'), 'utf-8'); + data = await readFile(resolve(__dirname, "stats.json"), "utf-8"); } catch (error) { expect(error).toBe(null); } - expect(JSON.parse(data)['hash']).toBeTruthy(); - expect(JSON.parse(data)['version']).toBeTruthy(); - expect(JSON.parse(data)['time']).toBeTruthy(); + expect(JSON.parse(data)["hash"]).toBeTruthy(); + expect(JSON.parse(data)["version"]).toBeTruthy(); + expect(JSON.parse(data)["time"]).toBeTruthy(); expect(() => JSON.parse(data)).not.toThrow(); }); }); diff --git a/test/build/json/logging.config.js b/test/build/json/logging.config.js index 481fe38bff4..d95eb5d6505 100644 --- a/test/build/json/logging.config.js +++ b/test/build/json/logging.config.js @@ -1,5 +1,5 @@ module.exports = { infrastructureLogging: { - level: 'log', + level: "log", }, }; diff --git a/test/build/merge/config-absent/1.js b/test/build/merge/config-absent/1.js index 133fc6944be..dd5fda8eb9b 100644 --- a/test/build/merge/config-absent/1.js +++ b/test/build/merge/config-absent/1.js @@ -1,3 +1,3 @@ module.exports = { - entry: './some_entry.js', + entry: "./some_entry.js", }; diff --git a/test/build/merge/config-absent/merge-config-absent.test.js b/test/build/merge/config-absent/merge-config-absent.test.js index f2ad6d92c7e..78a2dc4cdae 100644 --- a/test/build/merge/config-absent/merge-config-absent.test.js +++ b/test/build/merge/config-absent/merge-config-absent.test.js @@ -1,18 +1,24 @@ -'use strict'; +"use strict"; -const path = require('path'); +const path = require("path"); -const { run } = require('../../../utils/test-utils'); +const { run } = require("../../../utils/test-utils"); -describe('merge flag configuration', () => { - it('Show warning message when the merge config is absent', async () => { +describe("merge flag configuration", () => { + it("Show warning message when the merge config is absent", async () => { // 2.js doesn't exist, let's try merging with it - const { exitCode, stderr, stdout } = await run(__dirname, ['--config', './1.js', '--config', './2.js', '--merge']); + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--config", + "./1.js", + "--config", + "./2.js", + "--merge", + ]); expect(exitCode).toEqual(2); // Since the process will exit, nothing on stdout expect(stdout).toBeFalsy(); // Confirm that the user is notified - expect(stderr).toContain(`Failed to load '${path.resolve(__dirname, './2.js')}' config`); + expect(stderr).toContain(`Failed to load '${path.resolve(__dirname, "./2.js")}' config`); }); }); diff --git a/test/build/merge/config-absent/some_entry.js b/test/build/merge/config-absent/some_entry.js index cae68b1307a..3241ee52fce 100644 --- a/test/build/merge/config-absent/some_entry.js +++ b/test/build/merge/config-absent/some_entry.js @@ -1 +1 @@ -console.log('Oikawa'); +console.log("Oikawa"); diff --git a/test/build/merge/config/1.js b/test/build/merge/config/1.js index d625438dde2..75c2976b1f1 100644 --- a/test/build/merge/config/1.js +++ b/test/build/merge/config/1.js @@ -1,10 +1,10 @@ -const WebpackCLITestPlugin = require('../../../utils/webpack-cli-test-plugin'); +const WebpackCLITestPlugin = require("../../../utils/webpack-cli-test-plugin"); module.exports = { - entry: './first-entry.js', - mode: 'development', + entry: "./first-entry.js", + mode: "development", output: { - filename: 'first-output.js', + filename: "first-output.js", }, plugins: [new WebpackCLITestPlugin()], }; diff --git a/test/build/merge/config/2.js b/test/build/merge/config/2.js index cdf6f428467..74ca9242e4f 100644 --- a/test/build/merge/config/2.js +++ b/test/build/merge/config/2.js @@ -1,7 +1,7 @@ module.exports = { - entry: './second-entry.js', - target: 'node', + entry: "./second-entry.js", + target: "node", output: { - filename: 'second-output.js', + filename: "second-output.js", }, }; diff --git a/test/build/merge/config/3.js b/test/build/merge/config/3.js index eb2a7d3a6f5..2b511143d51 100644 --- a/test/build/merge/config/3.js +++ b/test/build/merge/config/3.js @@ -1,6 +1,6 @@ module.exports = { - entry: './third-entry.js', + entry: "./third-entry.js", output: { - filename: 'third-output.js', + filename: "third-output.js", }, }; diff --git a/test/build/merge/config/first-entry.js b/test/build/merge/config/first-entry.js index e5ba023838e..8a9423b5c10 100644 --- a/test/build/merge/config/first-entry.js +++ b/test/build/merge/config/first-entry.js @@ -1 +1 @@ -console.log('first'); +console.log("first"); diff --git a/test/build/merge/config/merge-config.test.js b/test/build/merge/config/merge-config.test.js index 7583fbd6940..53653068ca3 100644 --- a/test/build/merge/config/merge-config.test.js +++ b/test/build/merge/config/merge-config.test.js @@ -1,45 +1,61 @@ -'use strict'; +"use strict"; -const { run } = require('../../../utils/test-utils'); +const { run } = require("../../../utils/test-utils"); -describe('merge flag configuration', () => { - it('merges two configurations together', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--config', './1.js', '--config', './2.js', '--merge']); +describe("merge flag configuration", () => { + it("merges two configurations together", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--config", + "./1.js", + "--config", + "./2.js", + "--merge", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - expect(stdout).toContain('WebpackCLITestPlugin'); // from 1.js - expect(stdout).toContain('second-output.js'); // from 2.js + expect(stdout).toContain("WebpackCLITestPlugin"); // from 1.js + expect(stdout).toContain("second-output.js"); // from 2.js }); - it('merges more than two configurations together', async () => { + it("merges more than two configurations together", async () => { const { exitCode, stderr, stdout } = await run( __dirname, - ['--config', './1.js', '--config', './2.js', '--config', './3.js', '--merge'], + ["--config", "./1.js", "--config", "./2.js", "--config", "./3.js", "--merge"], false, ); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - expect(stdout).toContain('WebpackCLITestPlugin'); // from 1.js + expect(stdout).toContain("WebpackCLITestPlugin"); // from 1.js expect(stdout).toContain("target: 'node'"); // from 2.js - expect(stdout).toContain('third-output.js'); // from 3.js + expect(stdout).toContain("third-output.js"); // from 3.js }); - it('merges two configurations together with flag alias', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--config', './1.js', '--config', './2.js', '-m']); + it("merges two configurations together with flag alias", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--config", + "./1.js", + "--config", + "./2.js", + "-m", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - expect(stdout).toContain('WebpackCLITestPlugin'); // from 1.js - expect(stdout).toContain('second-output.js'); // from 2.js + expect(stdout).toContain("WebpackCLITestPlugin"); // from 1.js + expect(stdout).toContain("second-output.js"); // from 2.js }); - it('fails when there are less than 2 configurations to merge', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--config', './1.js', '--merge']); + it("fails when there are less than 2 configurations to merge", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--config", + "./1.js", + "--merge", + ]); expect(exitCode).toBe(2); - expect(stderr).toContain('At least two configurations are required for merge.'); + expect(stderr).toContain("At least two configurations are required for merge."); expect(stdout).toBeFalsy(); }); }); diff --git a/test/build/merge/config/second-entry.js b/test/build/merge/config/second-entry.js index e1595dffb00..5023a5896d0 100644 --- a/test/build/merge/config/second-entry.js +++ b/test/build/merge/config/second-entry.js @@ -1 +1 @@ -console.log('second'); +console.log("second"); diff --git a/test/build/merge/config/third-entry.js b/test/build/merge/config/third-entry.js index 29134430a5e..f532661b412 100644 --- a/test/build/merge/config/third-entry.js +++ b/test/build/merge/config/third-entry.js @@ -1 +1 @@ -console.log('third'); +console.log("third"); diff --git a/test/build/mode/mode-single-arg/mode-single-arg.test.js b/test/build/mode/mode-single-arg/mode-single-arg.test.js index c7bafa5670d..e96aad5796b 100644 --- a/test/build/mode/mode-single-arg/mode-single-arg.test.js +++ b/test/build/mode/mode-single-arg/mode-single-arg.test.js @@ -1,51 +1,55 @@ -'use strict'; +"use strict"; -const { run, isWebpack5 } = require('../../../utils/test-utils'); +const { run, isWebpack5 } = require("../../../utils/test-utils"); -describe('mode flags', () => { - it('should not set mode=production by default', async () => { +describe("mode flags", () => { + it("should not set mode=production by default", async () => { const { exitCode, stderr, stdout } = await run(__dirname); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).not.toContain(`mode: 'production'`); - expect(stdout).toContain(`The 'mode' option has not been set, webpack will fallback to 'production' for this value.`); + expect(stdout).toContain( + `The 'mode' option has not been set, webpack will fallback to 'production' for this value.`, + ); }); - it('should load a development config when --mode=development is passed', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--mode', 'development']); + it("should load a development config when --mode=development is passed", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--mode", "development"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toContain(`mode: 'development'`); }); - it('should load a production config when --mode=production is passed', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--mode', 'production']); + it("should load a production config when --mode=production is passed", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--mode", "production"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toContain(`mode: 'production'`); }); - it('should load a none config when --mode=none is passed', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--mode', 'none']); + it("should load a none config when --mode=none is passed", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--mode", "none"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toContain(`mode: 'none'`); }); - it('should pick mode form NODE_ENV', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [], { env: { NODE_ENV: 'development' } }); + it("should pick mode form NODE_ENV", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [], { + env: { NODE_ENV: "development" }, + }); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toContain(`mode: 'development'`); }); - it('should throw error when --mode=abcd is passed', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--mode', 'abcd']); + it("should throw error when --mode=abcd is passed", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--mode", "abcd"]); expect(exitCode).toBe(2); @@ -53,7 +57,7 @@ describe('mode flags', () => { expect(stderr).toContain("Invalid value 'abcd' for the '--mode' option"); expect(stderr).toContain("Expected: 'development | production | none'"); } else { - expect(stderr).toContain('configuration.mode should be one of these'); + expect(stderr).toContain("configuration.mode should be one of these"); expect(stderr).toContain(`"development" | "production" | "none"`); } diff --git a/test/build/mode/mode-single-arg/webpack.config.js b/test/build/mode/mode-single-arg/webpack.config.js index 92b325a3c41..59a9a8c360c 100644 --- a/test/build/mode/mode-single-arg/webpack.config.js +++ b/test/build/mode/mode-single-arg/webpack.config.js @@ -1,6 +1,6 @@ -const WebpackCLITestPlugin = require('../../../utils/webpack-cli-test-plugin'); +const WebpackCLITestPlugin = require("../../../utils/webpack-cli-test-plugin"); module.exports = { - entry: './src/index.js', + entry: "./src/index.js", plugins: [new WebpackCLITestPlugin()], }; diff --git a/test/build/mode/mode-with-config/mode-with-config.test.js b/test/build/mode/mode-with-config/mode-with-config.test.js index aa98f9cd9cc..9a611a314b2 100644 --- a/test/build/mode/mode-with-config/mode-with-config.test.js +++ b/test/build/mode/mode-with-config/mode-with-config.test.js @@ -1,10 +1,15 @@ -'use strict'; +"use strict"; -const { run } = require('../../../utils/test-utils'); +const { run } = require("../../../utils/test-utils"); -describe('mode flags with config', () => { - it('should run in production mode when --mode=production is passed', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--mode', 'production', '--config', './webpack.config.js']); +describe("mode flags with config", () => { + it("should run in production mode when --mode=production is passed", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--mode", + "production", + "--config", + "./webpack.config.js", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -12,8 +17,13 @@ describe('mode flags with config', () => { expect(stdout).toContain(`mode: 'production'`); }); - it('should run in development mode when --mode=development is passed', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--mode', 'development', '--config', './webpack.config.js']); + it("should run in development mode when --mode=development is passed", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--mode", + "development", + "--config", + "./webpack.config.js", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -21,8 +31,13 @@ describe('mode flags with config', () => { expect(stdout).toContain(`mode: 'development'`); }); - it('should run in none mode when --mode=none is passed', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--mode', 'none', '--config', './webpack.config.js']); + it("should run in none mode when --mode=none is passed", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--mode", + "none", + "--config", + "./webpack.config.js", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -31,60 +46,74 @@ describe('mode flags with config', () => { }); it('should use mode from flag over "process.env.NODE_ENV"', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--mode', 'none', '-c', 'webpack.config2.js'], [], { - NODE_ENV: 'production', - }); + const { exitCode, stderr, stdout } = await run( + __dirname, + ["--mode", "none", "-c", "webpack.config2.js"], + [], + { + NODE_ENV: "production", + }, + ); expect(exitCode).toEqual(0); expect(stderr).toBeFalsy(); expect(stdout).toContain(`mode: 'none'`); }); - it('should use mode from config over NODE_ENV', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', 'webpack.config2.js']); + it("should use mode from config over NODE_ENV", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["-c", "webpack.config2.js"]); expect(exitCode).toEqual(0); expect(stderr).toBeFalsy(); expect(stdout).toContain(`mode: 'development'`); }); - it('should use mode from config when multiple config are supplied', async () => { - const { exitCode, stdout, stderr } = await run(__dirname, ['-c', 'webpack.config3.js', '-c', 'webpack.config2.js']); + it("should use mode from config when multiple config are supplied", async () => { + const { exitCode, stdout, stderr } = await run(__dirname, [ + "-c", + "webpack.config3.js", + "-c", + "webpack.config2.js", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toContain(`mode: 'development'`); - expect(stdout.match(new RegExp("mode: 'development'", 'g')).length).toEqual(1); + expect(stdout.match(new RegExp("mode: 'development'", "g")).length).toEqual(1); }); - it('mode flag should apply to all configs', async () => { + it("mode flag should apply to all configs", async () => { const { exitCode, stderr, stdout } = await run(__dirname, [ - '--mode', - 'none', - '-c', - './webpack.config3.js', - '-c', - './webpack.config2.js', + "--mode", + "none", + "-c", + "./webpack.config3.js", + "-c", + "./webpack.config2.js", ]); expect(exitCode).toEqual(0); expect(stderr).toBeFalsy(); expect(stdout).toContain(`mode: 'none'`); - expect(stdout.match(new RegExp("mode: 'none'", 'g')).length).toEqual(2); + expect(stdout.match(new RegExp("mode: 'none'", "g")).length).toEqual(2); }); - it('only config where mode is absent pick up from NODE_ENV', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', './webpack.config3.js', '-c', './webpack.config2.js'], { - env: { - NODE_ENV: 'production', + it("only config where mode is absent pick up from NODE_ENV", async () => { + const { exitCode, stderr, stdout } = await run( + __dirname, + ["-c", "./webpack.config3.js", "-c", "./webpack.config2.js"], + { + env: { + NODE_ENV: "production", + }, }, - }); + ); expect(exitCode).toEqual(0); expect(stderr).toBeFalsy(); expect(stdout).toContain(`mode: 'production'`); expect(stdout).toContain(`mode: 'development'`); - expect(stdout.match(new RegExp("mode: 'production'", 'g')).length).toEqual(1); - expect(stdout.match(new RegExp("mode: 'development'", 'g')).length).toEqual(1); + expect(stdout.match(new RegExp("mode: 'production'", "g")).length).toEqual(1); + expect(stdout.match(new RegExp("mode: 'development'", "g")).length).toEqual(1); }); }); diff --git a/test/build/mode/mode-with-config/webpack.config.js b/test/build/mode/mode-with-config/webpack.config.js index 938c3552a34..d54eae282f5 100644 --- a/test/build/mode/mode-with-config/webpack.config.js +++ b/test/build/mode/mode-with-config/webpack.config.js @@ -1,10 +1,10 @@ -const path = require('path'); -const WebpackCLITestPlugin = require('../../../utils/webpack-cli-test-plugin'); +const path = require("path"); +const WebpackCLITestPlugin = require("../../../utils/webpack-cli-test-plugin"); module.exports = { output: { - path: path.join(__dirname, 'dist'), - filename: '[name].js', + path: path.join(__dirname, "dist"), + filename: "[name].js", }, plugins: [new WebpackCLITestPlugin()], }; diff --git a/test/build/mode/mode-with-config/webpack.config2.js b/test/build/mode/mode-with-config/webpack.config2.js index f06b817c4bf..56e4d9fe88e 100644 --- a/test/build/mode/mode-with-config/webpack.config2.js +++ b/test/build/mode/mode-with-config/webpack.config2.js @@ -1,6 +1,6 @@ -const WebpackCLITestPlugin = require('../../../utils/webpack-cli-test-plugin'); +const WebpackCLITestPlugin = require("../../../utils/webpack-cli-test-plugin"); module.exports = { - mode: 'development', + mode: "development", plugins: [new WebpackCLITestPlugin()], }; diff --git a/test/build/mode/mode-with-config/webpack.config3.js b/test/build/mode/mode-with-config/webpack.config3.js index 996241cb577..dca1bf8e00c 100644 --- a/test/build/mode/mode-with-config/webpack.config3.js +++ b/test/build/mode/mode-with-config/webpack.config3.js @@ -1,4 +1,4 @@ -const WebpackCLITestPlugin = require('../../../utils/webpack-cli-test-plugin'); +const WebpackCLITestPlugin = require("../../../utils/webpack-cli-test-plugin"); module.exports = { plugins: [new WebpackCLITestPlugin()], diff --git a/test/build/name/name.test.js b/test/build/name/name.test.js index e937735a610..9b07d0bb58d 100644 --- a/test/build/name/name.test.js +++ b/test/build/name/name.test.js @@ -1,9 +1,9 @@ -'use strict'; -const { run } = require('../../utils/test-utils'); +"use strict"; +const { run } = require("../../utils/test-utils"); -describe('name flag', () => { - it('should set the flag in the config', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--name', 'config-name']); +describe("name flag", () => { + it("should set the flag in the config", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--name", "config-name"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); diff --git a/test/build/name/webpack.config.js b/test/build/name/webpack.config.js index 7e2e7a43158..5f26f45fe05 100644 --- a/test/build/name/webpack.config.js +++ b/test/build/name/webpack.config.js @@ -1,4 +1,4 @@ -const WebpackCLITestPlugin = require('../../utils/webpack-cli-test-plugin'); +const WebpackCLITestPlugin = require("../../utils/webpack-cli-test-plugin"); module.exports = { plugins: [new WebpackCLITestPlugin()], diff --git a/test/build/node-env/auto-mode.config.js b/test/build/node-env/auto-mode.config.js index 7e2e7a43158..5f26f45fe05 100644 --- a/test/build/node-env/auto-mode.config.js +++ b/test/build/node-env/auto-mode.config.js @@ -1,4 +1,4 @@ -const WebpackCLITestPlugin = require('../../utils/webpack-cli-test-plugin'); +const WebpackCLITestPlugin = require("../../utils/webpack-cli-test-plugin"); module.exports = { plugins: [new WebpackCLITestPlugin()], diff --git a/test/build/node-env/node-env.test.js b/test/build/node-env/node-env.test.js index 9d4869d4053..479c1d90d7f 100644 --- a/test/build/node-env/node-env.test.js +++ b/test/build/node-env/node-env.test.js @@ -1,10 +1,10 @@ -'use strict'; +"use strict"; -const { run } = require('../../utils/test-utils'); +const { run } = require("../../utils/test-utils"); -describe('--node-env flag', () => { +describe("--node-env flag", () => { it('should set "process.env.NODE_ENV" to "development"', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--node-env', 'development']); + const { exitCode, stderr, stdout } = await run(__dirname, ["--node-env", "development"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -12,7 +12,7 @@ describe('--node-env flag', () => { }); it('should set "process.env.NODE_ENV" to "production"', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--node-env', 'production']); + const { exitCode, stderr, stdout } = await run(__dirname, ["--node-env", "production"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -20,7 +20,7 @@ describe('--node-env flag', () => { }); it('should set "process.env.NODE_ENV" to "none"', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--node-env', 'none']); + const { exitCode, stderr, stdout } = await run(__dirname, ["--node-env", "none"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -28,7 +28,12 @@ describe('--node-env flag', () => { }); it('should set "process.env.NODE_ENV" and the "mode" option to "development"', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--node-env', 'development', '--config', './auto-mode.config.js']); + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--node-env", + "development", + "--config", + "./auto-mode.config.js", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -36,7 +41,12 @@ describe('--node-env flag', () => { }); it('should set "process.env.NODE_ENV" and the "mode" option to "production"', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--node-env', 'production', '--config', './auto-mode.config.js']); + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--node-env", + "production", + "--config", + "./auto-mode.config.js", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -44,7 +54,12 @@ describe('--node-env flag', () => { }); it('should set "process.env.NODE_ENV" and the "mode" option to "none"', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--node-env', 'none', '--config', './auto-mode.config.js']); + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--node-env", + "none", + "--config", + "./auto-mode.config.js", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); diff --git a/test/build/node-env/webpack.config.js b/test/build/node-env/webpack.config.js index 7b4174b3f64..0c4532b82cd 100644 --- a/test/build/node-env/webpack.config.js +++ b/test/build/node-env/webpack.config.js @@ -1,4 +1,4 @@ -const WebpackCLITestPlugin = require('../../utils/webpack-cli-test-plugin'); +const WebpackCLITestPlugin = require("../../utils/webpack-cli-test-plugin"); module.exports = { mode: process.env.NODE_ENV, diff --git a/test/build/node/a.js b/test/build/node/a.js index 735d820f253..0e9a8dc5145 100644 --- a/test/build/node/a.js +++ b/test/build/node/a.js @@ -1 +1 @@ -module.exports = 'a.js'; +module.exports = "a.js"; diff --git a/test/build/node/bootstrap.js b/test/build/node/bootstrap.js index 0980f54d442..93d93cf74cf 100644 --- a/test/build/node/bootstrap.js +++ b/test/build/node/bootstrap.js @@ -1 +1 @@ -console.log('---from bootstrap.js---'); +console.log("---from bootstrap.js---"); diff --git a/test/build/node/bootstrap2.js b/test/build/node/bootstrap2.js index 5105ea40c01..4d1743d6349 100644 --- a/test/build/node/bootstrap2.js +++ b/test/build/node/bootstrap2.js @@ -1 +1 @@ -console.log('---from bootstrap2.js---'); +console.log("---from bootstrap2.js---"); diff --git a/test/build/node/node.test.js b/test/build/node/node.test.js index a062d06656b..5689d97b95b 100644 --- a/test/build/node/node.test.js +++ b/test/build/node/node.test.js @@ -1,40 +1,51 @@ -'use strict'; -const { resolve } = require('path'); -const { run } = require('../../utils/test-utils'); - -describe('node flags', () => { - it('is able to pass the options flags to node js', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--output-path', './bin'], { - nodeOptions: [`--require=${resolve(__dirname, 'bootstrap.js')}`, `--require=${resolve(__dirname, 'bootstrap2.js')}`], +"use strict"; +const { resolve } = require("path"); +const { run } = require("../../utils/test-utils"); + +describe("node flags", () => { + it("is able to pass the options flags to node js", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--output-path", "./bin"], { + nodeOptions: [ + `--require=${resolve(__dirname, "bootstrap.js")}`, + `--require=${resolve(__dirname, "bootstrap2.js")}`, + ], }); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - expect(stdout).toContain('---from bootstrap.js---'); - expect(stdout).toContain('---from bootstrap2.js---'); + expect(stdout).toContain("---from bootstrap.js---"); + expect(stdout).toContain("---from bootstrap2.js---"); }); - it('throws an error on supplying unknown flags', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [], { nodeOptions: ['--unknown'] }); + it("throws an error on supplying unknown flags", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [], { + nodeOptions: ["--unknown"], + }); expect(exitCode).not.toBe(0); - expect(stderr).toContain('bad option'); + expect(stderr).toContain("bad option"); expect(stdout).toBeFalsy(); }); - it('throws an error if no values were supplied with --max-old-space-size', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [], { nodeOptions: ['--max-old-space-size'] }); + it("throws an error if no values were supplied with --max-old-space-size", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [], { + nodeOptions: ["--max-old-space-size"], + }); expect(exitCode).not.toBe(0); - expect(stderr).toContain('value for flag --max-old-space-size'); + expect(stderr).toContain("value for flag --max-old-space-size"); expect(stdout).toBeFalsy(); }); - it('throws an error if an illegal value was supplied with --max-old-space-size', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [], { nodeOptions: ['--max_old_space_size=1024a'] }); + it("throws an error if an illegal value was supplied with --max-old-space-size", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [], { + nodeOptions: ["--max_old_space_size=1024a"], + }); expect(exitCode).not.toBe(0); - expect(stderr).toContain('Error: illegal value for flag --max_old_space_size=1024a of type size_t'); + expect(stderr).toContain( + "Error: illegal value for flag --max_old_space_size=1024a of type size_t", + ); expect(stdout).toBeFalsy(); }); }); diff --git a/test/build/node/webpack.config.js b/test/build/node/webpack.config.js index 4913dff71b6..2ba79e7a44a 100644 --- a/test/build/node/webpack.config.js +++ b/test/build/node/webpack.config.js @@ -1,9 +1,9 @@ -const { resolve } = require('path'); +const { resolve } = require("path"); module.exports = { - entry: './a.js', + entry: "./a.js", output: { - path: resolve(__dirname, 'binary'), - filename: '[name].bundle.js', + path: resolve(__dirname, "binary"), + filename: "[name].bundle.js", }, }; diff --git a/test/build/output/a.js b/test/build/output/a.js index 8f17634893a..5af61abbbef 100644 --- a/test/build/output/a.js +++ b/test/build/output/a.js @@ -1 +1 @@ -module.export = 'output-flag-test-overwrite-a.js'; +module.export = "output-flag-test-overwrite-a.js"; diff --git a/test/build/output/b.js b/test/build/output/b.js index a80d9d5559a..cdf5f144c61 100644 --- a/test/build/output/b.js +++ b/test/build/output/b.js @@ -1 +1 @@ -module.export = 'output-flag-test-overwrite-b.js'; +module.export = "output-flag-test-overwrite-b.js"; diff --git a/test/build/output/c.js b/test/build/output/c.js index 4bedd16bc01..8924478406f 100644 --- a/test/build/output/c.js +++ b/test/build/output/c.js @@ -1 +1 @@ -module.export = 'output-flag-test-overwrite-c.js'; +module.export = "output-flag-test-overwrite-c.js"; diff --git a/test/build/output/output-named-bundles.test.js b/test/build/output/output-named-bundles.test.js index 23cafb259fd..f872fef7790 100644 --- a/test/build/output/output-named-bundles.test.js +++ b/test/build/output/output-named-bundles.test.js @@ -1,13 +1,13 @@ -'use strict'; +"use strict"; -const { resolve } = require('path'); -const { run, normalizeStdout, normalizeStderr } = require('../../utils/test-utils'); +const { resolve } = require("path"); +const { run, normalizeStdout, normalizeStderr } = require("../../utils/test-utils"); -describe('output flag named bundles', () => { - it('should output file given as flag instead of in configuration', async () => { +describe("output flag named bundles", () => { + it("should output file given as flag instead of in configuration", async () => { const { exitCode, stderr, stdout } = await run( __dirname, - ['-c', resolve(__dirname, 'webpack.config.js'), '--output-path', './binary'], + ["-c", resolve(__dirname, "webpack.config.js"), "--output-path", "./binary"], false, ); @@ -16,10 +16,10 @@ describe('output flag named bundles', () => { expect(stdout).toBeTruthy(); }); - it('should resolve the path to binary/a.bundle.js as ./binary/a.bundle.js', async () => { + it("should resolve the path to binary/a.bundle.js as ./binary/a.bundle.js", async () => { const { exitCode, stderr, stdout } = await run( __dirname, - ['-c', resolve(__dirname, 'webpack.config.js'), '--output-path', 'binary'], + ["-c", resolve(__dirname, "webpack.config.js"), "--output-path", "binary"], false, ); @@ -28,10 +28,10 @@ describe('output flag named bundles', () => { expect(stdout).toBeTruthy(); }); - it('should create multiple bundles with an overriding flag', async () => { + it("should create multiple bundles with an overriding flag", async () => { const { exitCode, stderr, stdout } = await run( __dirname, - ['-c', resolve(__dirname, 'webpack.single.config.js'), '--output-path', './bin'], + ["-c", resolve(__dirname, "webpack.single.config.js"), "--output-path", "./bin"], false, ); @@ -40,19 +40,22 @@ describe('output flag named bundles', () => { expect(stdout).toBeTruthy(); }); - it('should successfully compile multiple entries', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', resolve(__dirname, 'webpack.multiple.config.js')]); + it("should successfully compile multiple entries", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "-c", + resolve(__dirname, "webpack.multiple.config.js"), + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); }); - it('should output file in bin directory using default webpack config with warning for empty output value', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--output-path']); + it("should output file in bin directory using default webpack config with warning for empty output value", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--output-path"]); expect(exitCode).toEqual(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); }); diff --git a/test/build/output/webpack.config.js b/test/build/output/webpack.config.js index f1be65a15cc..14b4f23506b 100644 --- a/test/build/output/webpack.config.js +++ b/test/build/output/webpack.config.js @@ -1,10 +1,10 @@ -const { resolve } = require('path'); +const { resolve } = require("path"); module.exports = { - entry: './a.js', - mode: 'development', + entry: "./a.js", + mode: "development", output: { - path: resolve(__dirname, 'bin'), - filename: 'a.bundle.js', + path: resolve(__dirname, "bin"), + filename: "a.bundle.js", }, }; diff --git a/test/build/output/webpack.defaults.config.js b/test/build/output/webpack.defaults.config.js index 69a38fff1c5..08608192ceb 100644 --- a/test/build/output/webpack.defaults.config.js +++ b/test/build/output/webpack.defaults.config.js @@ -1,7 +1,7 @@ module.exports = { entry: { - b: './b.js', - c: './c.js', + b: "./b.js", + c: "./c.js", }, - mode: 'development', + mode: "development", }; diff --git a/test/build/output/webpack.multiple.config.js b/test/build/output/webpack.multiple.config.js index a047b31864d..af105fab019 100644 --- a/test/build/output/webpack.multiple.config.js +++ b/test/build/output/webpack.multiple.config.js @@ -1,13 +1,13 @@ -const { resolve } = require('path'); +const { resolve } = require("path"); module.exports = { entry: { - b: './b.js', - c: './c.js', + b: "./b.js", + c: "./c.js", }, output: { - path: resolve(__dirname, 'bin'), - filename: '[name].bundle.js', + path: resolve(__dirname, "bin"), + filename: "[name].bundle.js", }, - mode: 'development', + mode: "development", }; diff --git a/test/build/output/webpack.single.config.js b/test/build/output/webpack.single.config.js index a047b31864d..af105fab019 100644 --- a/test/build/output/webpack.single.config.js +++ b/test/build/output/webpack.single.config.js @@ -1,13 +1,13 @@ -const { resolve } = require('path'); +const { resolve } = require("path"); module.exports = { entry: { - b: './b.js', - c: './c.js', + b: "./b.js", + c: "./c.js", }, output: { - path: resolve(__dirname, 'bin'), - filename: '[name].bundle.js', + path: resolve(__dirname, "bin"), + filename: "[name].bundle.js", }, - mode: 'development', + mode: "development", }; diff --git a/test/build/prefetch/prefetch.test.js b/test/build/prefetch/prefetch.test.js index 3f4547daa9a..8a9b7c91fe7 100644 --- a/test/build/prefetch/prefetch.test.js +++ b/test/build/prefetch/prefetch.test.js @@ -1,29 +1,37 @@ -'use strict'; +"use strict"; -const { join } = require('path'); -const { run, readFile } = require('../../utils/test-utils'); +const { join } = require("path"); +const { run, readFile } = require("../../utils/test-utils"); // eslint-disable-next-line node/no-unpublished-require -const rimraf = require('rimraf'); +const rimraf = require("rimraf"); -describe('prefetch', () => { +describe("prefetch", () => { afterEach(() => { - rimraf.sync(join(__dirname, 'dist')); + rimraf.sync(join(__dirname, "dist")); }); - it('should load the prefetched file', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--prefetch', './src/p.js', '--mode', 'development']); + it("should load the prefetched file", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--prefetch", + "./src/p.js", + "--mode", + "development", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); - const content = await readFile(join(__dirname, '/dist/main.js'), 'utf-8'); + const content = await readFile(join(__dirname, "/dist/main.js"), "utf-8"); - expect(content).not.toContain('// no prefetching'); + expect(content).not.toContain("// no prefetching"); }); - it('should log error when the prefetched file is absent', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--prefetch', './src/somefile.js']); + it("should log error when the prefetched file is absent", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--prefetch", + "./src/somefile.js", + ]); expect(exitCode).toBe(1); expect(stderr).toBeFalsy(); @@ -31,8 +39,8 @@ describe('prefetch', () => { expect(stdout).toContain(`Error: Can't resolve './src/somefile.js'`); }); - it('should log error when flag value is not supplied', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--prefetch']); + it("should log error when flag value is not supplied", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--prefetch"]); expect(exitCode).toBe(2); expect(stderr).toContain(`Error: Option '--prefetch ' argument missing`); diff --git a/test/build/prefetch/src/p.js b/test/build/prefetch/src/p.js index 3bf8b892c52..cc132d2393a 100644 --- a/test/build/prefetch/src/p.js +++ b/test/build/prefetch/src/p.js @@ -1,3 +1,3 @@ -console.log('HERE'); +console.log("HERE"); -module.exports = 'async-value'; +module.exports = "async-value"; diff --git a/test/build/progress/progress-flag.test.js b/test/build/progress/progress-flag.test.js index 8a008e7b01f..3ddaf4003f2 100644 --- a/test/build/progress/progress-flag.test.js +++ b/test/build/progress/progress-flag.test.js @@ -1,19 +1,19 @@ -'use strict'; +"use strict"; -const { run, isWebpack5 } = require('../../utils/test-utils'); +const { run, isWebpack5 } = require("../../utils/test-utils"); -describe('progress flag', () => { - it('should show progress', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--progress']); +describe("progress flag", () => { + it("should show progress", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--progress"]); expect(exitCode).toBe(0); expect(stderr).not.toMatch(/\[webpack\.Progress] \d+ ms setup/); - expect(stderr).toContain('[webpack.Progress] 100%'); - expect(stdout).toContain('main.js'); + expect(stderr).toContain("[webpack.Progress] 100%"); + expect(stdout).toContain("main.js"); }); it('should support the "profile" value', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--progress=profile']); + const { exitCode, stderr, stdout } = await run(__dirname, ["--progress=profile"]); expect(exitCode).toBe(0); @@ -21,25 +21,31 @@ describe('progress flag', () => { expect(stderr).toMatch(/\[webpack\.Progress] \d+ ms setup/); } - expect(stderr).toContain('[webpack.Progress] 100%'); - expect(stdout).toContain('main.js'); + expect(stderr).toContain("[webpack.Progress] 100%"); + expect(stdout).toContain("main.js"); }); - it('should not support invalid value', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--progress=unknown']); + it("should not support invalid value", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--progress=unknown"]); expect(exitCode).toBe(2); - expect(stderr).toContain(`'unknown' is an invalid value for the --progress option. Only 'profile' is allowed.`); + expect(stderr).toContain( + `'unknown' is an invalid value for the --progress option. Only 'profile' is allowed.`, + ); expect(stdout).toBeFalsy(); }); - it('should not add duplicate plugins', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', 'webpack.progress.config.js', '--progress']); + it("should not add duplicate plugins", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "-c", + "webpack.progress.config.js", + "--progress", + ]); expect(exitCode).toEqual(0); expect(stderr).not.toMatch(/\[webpack\.Progress] \d+ ms setup/); - expect(stderr).toContain('[webpack.Progress] 100%'); - expect(stdout).toContain('main.js'); + expect(stderr).toContain("[webpack.Progress] 100%"); + expect(stdout).toContain("main.js"); expect(stdout.match(/ProgressPlugin/g)).toHaveLength(1); }); }); diff --git a/test/build/progress/webpack.progress.config.js b/test/build/progress/webpack.progress.config.js index d376de11e67..f5d1aba13c7 100644 --- a/test/build/progress/webpack.progress.config.js +++ b/test/build/progress/webpack.progress.config.js @@ -1,5 +1,5 @@ -const { ProgressPlugin } = require('webpack'); -const WebpackCLITestPlugin = require('../../utils/webpack-cli-test-plugin'); +const { ProgressPlugin } = require("webpack"); +const WebpackCLITestPlugin = require("../../utils/webpack-cli-test-plugin"); module.exports = { plugins: [new ProgressPlugin({}), new WebpackCLITestPlugin()], diff --git a/test/build/start-finish-force-log/start-finish-force-log.test.js b/test/build/start-finish-force-log/start-finish-force-log.test.js index 5e24d17d2d3..c3d79d7c9e6 100644 --- a/test/build/start-finish-force-log/start-finish-force-log.test.js +++ b/test/build/start-finish-force-log/start-finish-force-log.test.js @@ -1,51 +1,55 @@ -'use strict'; +"use strict"; -const { run, runWatch, isWebpack5 } = require('../../utils/test-utils'); +const { run, runWatch, isWebpack5 } = require("../../utils/test-utils"); -describe('start finish force log', () => { - it('start finish force log when env is set', async () => { +describe("start finish force log", () => { + it("start finish force log when env is set", async () => { const { exitCode, stderr, stdout } = await run(__dirname, [], { env: { WEBPACK_CLI_START_FINISH_FORCE_LOG: true }, }); expect(exitCode).toBe(0); - expect(stderr).toContain('Compiler starting...'); - expect(stderr).toContain('Compiler finished'); - const output = isWebpack5 ? 'compiled successfully' : 'main.js'; + expect(stderr).toContain("Compiler starting..."); + expect(stderr).toContain("Compiler finished"); + const output = isWebpack5 ? "compiled successfully" : "main.js"; expect(stdout).toContain(output); }); - it('should show name of the config', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--name', 'log config'], { + it("should show name of the config", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--name", "log config"], { env: { WEBPACK_CLI_START_FINISH_FORCE_LOG: true }, }); expect(exitCode).toBe(0); expect(stderr).toContain("Compiler 'log config' starting..."); expect(stderr).toContain("Compiler 'log config' finished"); - const output = isWebpack5 ? 'compiled successfully' : 'main.js'; + const output = isWebpack5 ? "compiled successfully" : "main.js"; expect(stdout).toContain(output); }); - it('should work with watch', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['watch'], { + it("should work with watch", async () => { + const { stderr, stdout } = await runWatch(__dirname, ["watch"], { env: { WEBPACK_CLI_START_FINISH_FORCE_LOG: true }, killString: /Compiler finished/, }); - expect(stderr).toContain('Compiler starting...'); - expect(stderr).toContain('Compiler finished'); - const output = isWebpack5 ? 'compiled successfully' : 'main.js'; + expect(stderr).toContain("Compiler starting..."); + expect(stderr).toContain("Compiler finished"); + const output = isWebpack5 ? "compiled successfully" : "main.js"; expect(stdout).toContain(output); }); - it('should work with multi compiler', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--config', './webpack.config.array.js'], { - env: { WEBPACK_CLI_START_FINISH_FORCE_LOG: true }, - }); + it("should work with multi compiler", async () => { + const { exitCode, stderr, stdout } = await run( + __dirname, + ["--config", "./webpack.config.array.js"], + { + env: { WEBPACK_CLI_START_FINISH_FORCE_LOG: true }, + }, + ); expect(exitCode).toBe(0); expect(stderr).toContain("Compiler 'Gojou' starting..."); expect(stderr).toContain("Compiler 'Satoru' starting..."); expect(stderr).toContain("Compiler 'Gojou' finished"); expect(stderr).toContain("Compiler 'Satoru' finished"); - const output = isWebpack5 ? 'compiled successfully' : 'main.js'; + const output = isWebpack5 ? "compiled successfully" : "main.js"; expect(stdout).toContain(output); }); }); diff --git a/test/build/start-finish-force-log/webpack.config.array.js b/test/build/start-finish-force-log/webpack.config.array.js index 14738c20f1b..f7313b8da56 100644 --- a/test/build/start-finish-force-log/webpack.config.array.js +++ b/test/build/start-finish-force-log/webpack.config.array.js @@ -1,10 +1,10 @@ module.exports = [ { - name: 'Gojou', - mode: 'development', + name: "Gojou", + mode: "development", }, { - name: 'Satoru', - mode: 'development', + name: "Satoru", + mode: "development", }, ]; diff --git a/test/build/start-finish-force-log/webpack.config.js b/test/build/start-finish-force-log/webpack.config.js index f2c3976d5d3..11623bb6280 100644 --- a/test/build/start-finish-force-log/webpack.config.js +++ b/test/build/start-finish-force-log/webpack.config.js @@ -1,3 +1,3 @@ module.exports = { - mode: 'development', + mode: "development", }; diff --git a/test/build/stats/config-no/main.js b/test/build/stats/config-no/main.js index a0a157ceeef..2aabf698f8d 100644 --- a/test/build/stats/config-no/main.js +++ b/test/build/stats/config-no/main.js @@ -1 +1 @@ -console.log('--no-stats with config test'); +console.log("--no-stats with config test"); diff --git a/test/build/stats/config-no/no-stats-with-config.test.js b/test/build/stats/config-no/no-stats-with-config.test.js index 3b4d28c7343..d42a1f63fff 100644 --- a/test/build/stats/config-no/no-stats-with-config.test.js +++ b/test/build/stats/config-no/no-stats-with-config.test.js @@ -1,8 +1,8 @@ -'use strict'; +"use strict"; -const { run, isWebpack5 } = require('../../../utils/test-utils'); +const { run, isWebpack5 } = require("../../../utils/test-utils"); -describe('stats flag', () => { +describe("stats flag", () => { it(`should use stats 'detailed' as defined in webpack config`, async () => { const { exitCode, stderr, stdout } = await run(__dirname, []); @@ -12,14 +12,14 @@ describe('stats flag', () => { if (isWebpack5) { expect(stdout).toContain("preset: 'detailed'"); } else { - expect(stdout).toContain('entrypoints: true'); - expect(stdout).toContain('logging: true'); - expect(stdout).toContain('maxModules: Infinity'); + expect(stdout).toContain("entrypoints: true"); + expect(stdout).toContain("logging: true"); + expect(stdout).toContain("maxModules: Infinity"); } }); it(`should use --no-stats and override value in config`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--no-stats']); + const { exitCode, stderr, stdout } = await run(__dirname, ["--no-stats"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -27,7 +27,7 @@ describe('stats flag', () => { if (isWebpack5) { expect(stdout).toContain("preset: 'none'"); } else { - expect(stdout).toContain('all: false'); + expect(stdout).toContain("all: false"); } }); }); diff --git a/test/build/stats/config-no/webpack.config.js b/test/build/stats/config-no/webpack.config.js index 36d2ce45fae..f4eea6318f7 100644 --- a/test/build/stats/config-no/webpack.config.js +++ b/test/build/stats/config-no/webpack.config.js @@ -1,8 +1,8 @@ -const WebpackCLITestPlugin = require('../../../utils/webpack-cli-test-plugin'); +const WebpackCLITestPlugin = require("../../../utils/webpack-cli-test-plugin"); module.exports = { - mode: 'development', - entry: './main.js', - stats: 'detailed', + mode: "development", + entry: "./main.js", + stats: "detailed", plugins: [new WebpackCLITestPlugin()], }; diff --git a/test/build/stats/config/stats.test.js b/test/build/stats/config/stats.test.js index 9fb653bbe01..912c10f38d3 100644 --- a/test/build/stats/config/stats.test.js +++ b/test/build/stats/config/stats.test.js @@ -1,16 +1,16 @@ -'use strict'; +"use strict"; -const { run, isWebpack5 } = require('../../../utils/test-utils'); +const { run, isWebpack5 } = require("../../../utils/test-utils"); // 'normal' is used in webpack.config.js -const statsPresets = ['detailed', 'errors-only', 'errors-warnings', 'minimal', 'verbose', 'none']; +const statsPresets = ["detailed", "errors-only", "errors-warnings", "minimal", "verbose", "none"]; if (isWebpack5) { - statsPresets.push('summary'); + statsPresets.push("summary"); } -describe('stats flag with config', () => { - it('should compile without stats flag', async () => { +describe("stats flag with config", () => { + it("should compile without stats flag", async () => { const { exitCode, stderr, stdout } = await run(__dirname, []); expect(exitCode).toBe(0); @@ -25,7 +25,7 @@ describe('stats flag with config', () => { for (const preset of statsPresets) { it(`should override 'noramal' value in config with "${preset}"`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--stats', `${preset}`]); + const { exitCode, stderr, stdout } = await run(__dirname, ["--stats", `${preset}`]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -34,31 +34,31 @@ describe('stats flag with config', () => { expect(stdout).toContain(`preset: '${preset}'`); } else { switch (preset) { - case 'normal': - expect(stdout).toContain('stats:'); + case "normal": + expect(stdout).toContain("stats:"); break; - case 'detailed': - expect(stdout).toContain('entrypoints: true'); - expect(stdout).toContain('errorDetails: true'); + case "detailed": + expect(stdout).toContain("entrypoints: true"); + expect(stdout).toContain("errorDetails: true"); break; - case 'errors-only': - expect(stdout).toContain('all: false'); - expect(stdout).toContain('errors: true'); + case "errors-only": + expect(stdout).toContain("all: false"); + expect(stdout).toContain("errors: true"); break; - case 'errors-warnings': - expect(stdout).toContain('all: false'); - expect(stdout).toContain('errors: true'); - expect(stdout).toContain('warnings: true'); + case "errors-warnings": + expect(stdout).toContain("all: false"); + expect(stdout).toContain("errors: true"); + expect(stdout).toContain("warnings: true"); break; - case 'minimal': - expect(stdout).toContain('modules: true'); - expect(stdout).toContain('maxModules: 0'); + case "minimal": + expect(stdout).toContain("modules: true"); + expect(stdout).toContain("maxModules: 0"); break; - case 'verbose': + case "verbose": expect(stdout).toContain("logging: 'verbose'"); break; - case 'none': - expect(stdout).toContain('all: false'); + case "none": + expect(stdout).toContain("all: false"); break; default: expect(stdout).toContain(`preset: '${preset}'`); diff --git a/test/build/stats/config/webpack.config.js b/test/build/stats/config/webpack.config.js index f4cce3b8d56..be63b5f8d22 100644 --- a/test/build/stats/config/webpack.config.js +++ b/test/build/stats/config/webpack.config.js @@ -1,8 +1,8 @@ -const WebpackCLITestPlugin = require('../../../utils/webpack-cli-test-plugin'); +const WebpackCLITestPlugin = require("../../../utils/webpack-cli-test-plugin"); module.exports = { - mode: 'development', - entry: './index.js', - stats: 'normal', + mode: "development", + entry: "./index.js", + stats: "normal", plugins: [new WebpackCLITestPlugin()], }; diff --git a/test/build/stats/flags/stats.test.js b/test/build/stats/flags/stats.test.js index fee38ce4e70..5f2e652ee98 100644 --- a/test/build/stats/flags/stats.test.js +++ b/test/build/stats/flags/stats.test.js @@ -1,17 +1,25 @@ -'use strict'; +"use strict"; -const { run, isWebpack5, normalizeStderr, normalizeStdout } = require('../../../utils/test-utils'); +const { run, isWebpack5, normalizeStderr, normalizeStdout } = require("../../../utils/test-utils"); -const presets = ['normal', 'detailed', 'errors-only', 'errors-warnings', 'minimal', 'verbose', 'none']; +const presets = [ + "normal", + "detailed", + "errors-only", + "errors-warnings", + "minimal", + "verbose", + "none", +]; if (isWebpack5) { - presets.push('summary'); + presets.push("summary"); } -describe('stats flag', () => { +describe("stats flag", () => { for (const preset of presets) { it(`should accept --stats "${preset}"`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--stats', `${preset}`]); + const { exitCode, stderr, stdout } = await run(__dirname, ["--stats", `${preset}`]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -20,31 +28,31 @@ describe('stats flag', () => { expect(stdout).toContain(`preset: '${preset}'`); } else { switch (preset) { - case 'normal': - expect(stdout).toContain('stats:'); + case "normal": + expect(stdout).toContain("stats:"); break; - case 'detailed': - expect(stdout).toContain('entrypoints: true'); - expect(stdout).toContain('errorDetails: true'); + case "detailed": + expect(stdout).toContain("entrypoints: true"); + expect(stdout).toContain("errorDetails: true"); break; - case 'errors-only': - expect(stdout).toContain('all: false'); - expect(stdout).toContain('errors: true'); + case "errors-only": + expect(stdout).toContain("all: false"); + expect(stdout).toContain("errors: true"); break; - case 'errors-warnings': - expect(stdout).toContain('all: false'); - expect(stdout).toContain('errors: true'); - expect(stdout).toContain('warnings: true'); + case "errors-warnings": + expect(stdout).toContain("all: false"); + expect(stdout).toContain("errors: true"); + expect(stdout).toContain("warnings: true"); break; - case 'minimal': - expect(stdout).toContain('modules: true'); - expect(stdout).toContain('maxModules: 0'); + case "minimal": + expect(stdout).toContain("modules: true"); + expect(stdout).toContain("maxModules: 0"); break; - case 'verbose': + case "verbose": expect(stdout).toContain("logging: 'verbose'"); break; - case 'none': - expect(stdout).toContain('all: false'); + case "none": + expect(stdout).toContain("all: false"); break; default: expect(stdout).toContain(`preset: '${preset}'`); @@ -53,8 +61,8 @@ describe('stats flag', () => { }); } - it('should accept stats as boolean', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--stats']); + it("should accept stats as boolean", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--stats"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -62,12 +70,12 @@ describe('stats flag', () => { if (isWebpack5) { expect(stdout).toContain("preset: 'normal'"); } else { - expect(stdout).toContain('stats:'); + expect(stdout).toContain("stats:"); } }); - it('should accept --no-stats as boolean', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--no-stats']); + it("should accept --no-stats as boolean", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--no-stats"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -75,15 +83,15 @@ describe('stats flag', () => { if (isWebpack5) { expect(stdout).toContain("preset: 'none'"); } else { - expect(stdout).toContain('all: false'); + expect(stdout).toContain("all: false"); } }); - it('should log error when an unknown flag stats value is passed', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--stats', 'foo']); + it("should log error when an unknown flag stats value is passed", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--stats", "foo"]); expect(exitCode).toEqual(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); }); diff --git a/test/build/stats/flags/webpack.config.js b/test/build/stats/flags/webpack.config.js index 90a7f8873af..eb5656d862a 100644 --- a/test/build/stats/flags/webpack.config.js +++ b/test/build/stats/flags/webpack.config.js @@ -1,7 +1,7 @@ -const WebpackCLITestPlugin = require('../../../utils/webpack-cli-test-plugin'); +const WebpackCLITestPlugin = require("../../../utils/webpack-cli-test-plugin"); module.exports = { - mode: 'development', - entry: './index.js', + mode: "development", + entry: "./index.js", plugins: [new WebpackCLITestPlugin()], }; diff --git a/test/build/target/flag-test/target-flag.test.js b/test/build/target/flag-test/target-flag.test.js index 1846fe0db73..71b53e3515f 100644 --- a/test/build/target/flag-test/target-flag.test.js +++ b/test/build/target/flag-test/target-flag.test.js @@ -1,12 +1,21 @@ -'use strict'; -const { run, isWebpack5, normalizeStdout, normalizeStderr } = require('../../../utils/test-utils'); - -const targetValues = ['web', 'webworker', 'node', 'async-node', 'node-webkit', 'electron-main', 'electron-renderer', 'electron-preload']; - -describe('--target flag', () => { +"use strict"; +const { run, isWebpack5, normalizeStdout, normalizeStderr } = require("../../../utils/test-utils"); + +const targetValues = [ + "web", + "webworker", + "node", + "async-node", + "node-webkit", + "electron-main", + "electron-renderer", + "electron-preload", +]; + +describe("--target flag", () => { targetValues.forEach((val) => { it(`should accept ${val} with --target flag`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--target', `${val}`]); + const { exitCode, stderr, stdout } = await run(__dirname, ["--target", `${val}`]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -19,7 +28,7 @@ describe('--target flag', () => { }); it(`should accept ${val} with -t alias`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-t', `${val}`]); + const { exitCode, stderr, stdout } = await run(__dirname, ["-t", `${val}`]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -33,52 +42,71 @@ describe('--target flag', () => { }); it(`should throw error with invalid value for --target`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--target', 'invalid']); + const { exitCode, stderr, stdout } = await run(__dirname, ["--target", "invalid"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); if (isWebpack5) { - it('should allow multiple targets', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--target', 'node', '--target', 'async-node']); + it("should allow multiple targets", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--target", + "node", + "--target", + "async-node", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toContain(`target: [ 'node', 'async-node' ]`); }); - it('should throw an error for invalid target in multiple syntax', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--target', 'node', '--target', 'invalid']); + it("should throw an error for invalid target in multiple syntax", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--target", + "node", + "--target", + "invalid", + ]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should throw an error for incompatible multiple targets', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--target', 'node', '--target', 'web']); + it("should throw an error for incompatible multiple targets", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--target", + "node", + "--target", + "web", + ]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should reset target from node to async-node with --target-reset', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--target-reset', '--target', 'async-node']); + it("should reset target from node to async-node with --target-reset", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--target-reset", + "--target", + "async-node", + ]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); expect(stdout).toContain(`target: [ 'async-node' ]`); }); - it('should throw error if target is an empty array', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--target-reset']); + it("should throw error if target is an empty array", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--target-reset"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); } }); diff --git a/test/build/target/flag-test/webpack.config.js b/test/build/target/flag-test/webpack.config.js index 9e6e41805bf..3ef6a20b72d 100644 --- a/test/build/target/flag-test/webpack.config.js +++ b/test/build/target/flag-test/webpack.config.js @@ -1,8 +1,8 @@ -const WebpackCLITestPlugin = require('../../../utils/webpack-cli-test-plugin'); +const WebpackCLITestPlugin = require("../../../utils/webpack-cli-test-plugin"); module.exports = { - entry: './index.js', - mode: 'development', - target: 'node', + entry: "./index.js", + mode: "development", + target: "node", plugins: [new WebpackCLITestPlugin()], }; diff --git a/test/build/target/node/main.js b/test/build/target/node/main.js index 2f859905116..4ef6e73abaa 100644 --- a/test/build/target/node/main.js +++ b/test/build/target/node/main.js @@ -1,2 +1,2 @@ -const url = require('url'); +const url = require("url"); console.log(url); diff --git a/test/build/target/node/new.js b/test/build/target/node/new.js index 2f859905116..4ef6e73abaa 100644 --- a/test/build/target/node/new.js +++ b/test/build/target/node/new.js @@ -1,2 +1,2 @@ -const url = require('url'); +const url = require("url"); console.log(url); diff --git a/test/build/target/node/node-test.test.js b/test/build/target/node/node-test.test.js index ff458dfc377..95dcc929d54 100644 --- a/test/build/target/node/node-test.test.js +++ b/test/build/target/node/node-test.test.js @@ -1,12 +1,12 @@ -'use strict'; -const { run, normalizeStderr } = require('../../../utils/test-utils'); +"use strict"; +const { run, normalizeStderr } = require("../../../utils/test-utils"); -describe('Node target', () => { - it('should emit the correct code', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', './webpack.config.js']); +describe("Node target", () => { + it("should emit the correct code", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["-c", "./webpack.config.js"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); expect(stdout).toBeTruthy(); }); }); diff --git a/test/build/target/node/webpack.config.js b/test/build/target/node/webpack.config.js index 59b1da703f8..5742478fdf2 100644 --- a/test/build/target/node/webpack.config.js +++ b/test/build/target/node/webpack.config.js @@ -1,5 +1,5 @@ module.exports = { - entry: './main.js', - mode: 'development', - target: 'node', + entry: "./main.js", + mode: "development", + target: "node", }; diff --git a/test/build/unknown/unknown.test.js b/test/build/unknown/unknown.test.js index 68ca63b2864..5569953bd61 100644 --- a/test/build/unknown/unknown.test.js +++ b/test/build/unknown/unknown.test.js @@ -1,189 +1,202 @@ -'use strict'; +"use strict"; -const { run, normalizeStdout, normalizeStderr } = require('../../utils/test-utils'); +const { run, normalizeStdout, normalizeStderr } = require("../../utils/test-utils"); -describe('unknown behaviour', () => { - it('should log an error if an unknown flag is passed', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--unknown']); +describe("unknown behaviour", () => { + it("should log an error if an unknown flag is passed", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--unknown"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should log an error if an unknown flag is passed #2', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-u']); + it("should log an error if an unknown flag is passed #2", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["-u"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should log an error if an unknown flag is passed and includes =', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--unknown=foo']); + it("should log an error if an unknown flag is passed and includes =", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--unknown=foo"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should log an error if an unknown flag is passed #3', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-u', '--unknown']); + it("should log an error if an unknown flag is passed #3", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["-u", "--unknown"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should log an error if an unknown flag is passed #4', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-u', '-u']); + it("should log an error if an unknown flag is passed #4", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["-u", "-u"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should log an error if an unknown flag is passed #5', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-u', 'foo']); + it("should log an error if an unknown flag is passed #5", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["-u", "foo"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should log an error if an unknown flag is passed using "bundle" command', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['bundle', '--unknown']); + const { exitCode, stderr, stdout } = await run(__dirname, ["bundle", "--unknown"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should log an error if an unknown flag is passed using "b" command', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['b', '--unknown']); + const { exitCode, stderr, stdout } = await run(__dirname, ["b", "--unknown"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should log an error if an unknown flag is passed using "bundle" command #2', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--unknown', 'bundle']); + const { exitCode, stderr, stdout } = await run(__dirname, ["--unknown", "bundle"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should log an error if an unknown flag is passed using "info" command', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['info', '--unknown']); + const { exitCode, stderr, stdout } = await run(__dirname, ["info", "--unknown"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should log an error if an unknown flag is passed using "i" command', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['i', '--unknown']); + const { exitCode, stderr, stdout } = await run(__dirname, ["i", "--unknown"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should log an error if an unknown flag is passed using "i" command', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--unknown', 'i']); + const { exitCode, stderr, stdout } = await run(__dirname, ["--unknown", "i"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should log error and respect --color flag', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--unknown', '--color'], { env: { FORCE_COLOR: true } }); + it("should log error and respect --color flag", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--unknown", "--color"], { + env: { FORCE_COLOR: true }, + }); expect(exitCode).toBe(2); - expect(stderr).toMatchSnapshot('stderr'); - expect(stdout).toMatchSnapshot('stdout'); + expect(stderr).toMatchSnapshot("stderr"); + expect(stdout).toMatchSnapshot("stdout"); }); - it('should log error for unknown flag and respect --no-color', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--unknown', '--no-color'], { env: { FORCE_COLOR: true } }); + it("should log error for unknown flag and respect --no-color", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--unknown", "--no-color"], { + env: { FORCE_COLOR: true }, + }); expect(exitCode).toBe(2); - expect(stderr).toMatchSnapshot('stderr'); - expect(stdout).toMatchSnapshot('stdout'); + expect(stderr).toMatchSnapshot("stderr"); + expect(stdout).toMatchSnapshot("stdout"); }); - it('should log an error if an unknown flag is passed and suggests the closest match to an unknown flag', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--entyr', './a.js']); + it("should log an error if an unknown flag is passed and suggests the closest match to an unknown flag", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--entyr", "./a.js"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should log an error if an unknown flag is passed and suggests the closest match to an unknown flag #2', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--output-fileneme', '[name].js']); + it("should log an error if an unknown flag is passed and suggests the closest match to an unknown flag #2", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--output-fileneme", + "[name].js", + ]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should log an error if an unknown flag is passed and suggests the closest match to an unknown flag #3', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--output-library-auxiliary-comment-commnjs']); + it("should log an error if an unknown flag is passed and suggests the closest match to an unknown flag #3", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "--output-library-auxiliary-comment-commnjs", + ]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should log an error if an unknown flag is passed and suggests the closest match to an unknown flag using "bundle" command', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['bundle', '--entyr', './a.js']); + const { exitCode, stderr, stdout } = await run(__dirname, ["bundle", "--entyr", "./a.js"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should log an error if an unknown flag is passed and suggests the closest match to an unknown flag using "b" command', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['b', '--entyr', './a.js']); + const { exitCode, stderr, stdout } = await run(__dirname, ["b", "--entyr", "./a.js"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should log an error if an unknown flag is passed and suggests the closest match to an unknown flag using "info" command', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['info', '--outpyt']); + const { exitCode, stderr, stdout } = await run(__dirname, ["info", "--outpyt"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should log an error if an unknown flag is passed and suggests the closest match to an unknown flag using "i" command', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['i', '--outpyt']); + const { exitCode, stderr, stdout } = await run(__dirname, ["i", "--outpyt"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should log error if an unknown command passed', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['qqq'], true, [], { TERM_PROGRAM: false }); + it("should log error if an unknown command passed", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["qqq"], true, [], { + TERM_PROGRAM: false, + }); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should log error and provide suggestion if an unknown command passed', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['serverr'], true, [], { TERM_PROGRAM: false }); + it("should log error and provide suggestion if an unknown command passed", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["serverr"], true, [], { + TERM_PROGRAM: false, + }); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); }); diff --git a/test/build/zero-config/entry-absent/zero-config.test.js b/test/build/zero-config/entry-absent/zero-config.test.js index 8b3bf361318..715f360a0dd 100644 --- a/test/build/zero-config/entry-absent/zero-config.test.js +++ b/test/build/zero-config/entry-absent/zero-config.test.js @@ -1,9 +1,9 @@ -'use strict'; +"use strict"; -const { run } = require('../../../utils/test-utils'); +const { run } = require("../../../utils/test-utils"); -describe('Zero Config tests', () => { - it('runs when config and entry are both absent', async () => { +describe("Zero Config tests", () => { + it("runs when config and entry are both absent", async () => { const { exitCode, stderr, stdout } = await run(__dirname, []); expect(exitCode).toBe(1); diff --git a/test/build/zero-config/entry-present/zero-config.test.js b/test/build/zero-config/entry-present/zero-config.test.js index 4597d246009..65520333582 100644 --- a/test/build/zero-config/entry-present/zero-config.test.js +++ b/test/build/zero-config/entry-present/zero-config.test.js @@ -1,14 +1,14 @@ -const { run } = require('../../../utils/test-utils'); +const { run } = require("../../../utils/test-utils"); -describe('Zero Config tests', () => { - it('runs when no config is supplied but entry is present', async () => { +describe("Zero Config tests", () => { + it("runs when no config is supplied but entry is present", async () => { const { exitCode, stderr, stdout } = await run(__dirname, []); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); // Should be able to find the entry file - expect(stdout).toContain('./src/index.js'); + expect(stdout).toContain("./src/index.js"); // Should output at the default output dir and filename - expect(stdout).toContain('main.js'); + expect(stdout).toContain("main.js"); }); }); diff --git a/test/configtest/with-config-path/basic.config.js b/test/configtest/with-config-path/basic.config.js index bdaebdb6f26..a700197b9ca 100644 --- a/test/configtest/with-config-path/basic.config.js +++ b/test/configtest/with-config-path/basic.config.js @@ -1,5 +1,5 @@ module.exports = { - mode: 'development', - target: 'node', - stats: 'verbose', + mode: "development", + target: "node", + stats: "verbose", }; diff --git a/test/configtest/with-config-path/error.config.js b/test/configtest/with-config-path/error.config.js index 8e614cbed23..d4b60668433 100644 --- a/test/configtest/with-config-path/error.config.js +++ b/test/configtest/with-config-path/error.config.js @@ -1,5 +1,5 @@ module.exports = { - mode: 'dev', // error - target: 'node', - stats: 'normal', + mode: "dev", // error + target: "node", + stats: "normal", }; diff --git a/test/configtest/with-config-path/with-config-path.test.js b/test/configtest/with-config-path/with-config-path.test.js index a18a5877adc..530ce490fee 100644 --- a/test/configtest/with-config-path/with-config-path.test.js +++ b/test/configtest/with-config-path/with-config-path.test.js @@ -1,45 +1,54 @@ -'use strict'; +"use strict"; -const { run, normalizeStderr, normalizeStdout } = require('../../utils/test-utils'); +const { run, normalizeStderr, normalizeStdout } = require("../../utils/test-utils"); describe("'configtest' command with the configuration path option", () => { - it('should validate webpack config successfully', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['configtest', './basic.config.js']); + it("should validate webpack config successfully", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "configtest", + "./basic.config.js", + ]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should throw validation error', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['configtest', './error.config.js']); + it("should throw validation error", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "configtest", + "./error.config.js", + ]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should throw syntax error', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['configtest', './syntax-error.config.js']); + it("should throw syntax error", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "configtest", + "./syntax-error.config.js", + ]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it(`should validate the config with alias 't'`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['t', './error.config.js']); + const { exitCode, stderr, stdout } = await run(__dirname, ["t", "./error.config.js"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should throw error if configuration does not exist', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['configtest', './a.js']); + it("should throw error if configuration does not exist", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["configtest", "./a.js"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr).split('\n')[0]).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr).split("\n")[0]).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); }); diff --git a/test/configtest/without-config-path-custom-extension/without-config-path.test.js b/test/configtest/without-config-path-custom-extension/without-config-path.test.js index a03239c9807..e0e61700a66 100644 --- a/test/configtest/without-config-path-custom-extension/without-config-path.test.js +++ b/test/configtest/without-config-path-custom-extension/without-config-path.test.js @@ -1,13 +1,13 @@ -'use strict'; +"use strict"; -const { run, normalizeStderr, normalizeStdout } = require('../../utils/test-utils'); +const { run, normalizeStderr, normalizeStdout } = require("../../utils/test-utils"); describe("'configtest' command without the configuration path option", () => { - it.only('should validate default configuration', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['configtest']); + it.only("should validate default configuration", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["configtest"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); }); diff --git a/test/configtest/without-config-path-error/webpack.config.js b/test/configtest/without-config-path-error/webpack.config.js index 5dbbd664f31..4d2f03d5c8c 100644 --- a/test/configtest/without-config-path-error/webpack.config.js +++ b/test/configtest/without-config-path-error/webpack.config.js @@ -1,5 +1,5 @@ module.exports = { - mode: 'invalid', - target: 'node', - stats: 'verbose', + mode: "invalid", + target: "node", + stats: "verbose", }; diff --git a/test/configtest/without-config-path-error/without-config-path-error.test.js b/test/configtest/without-config-path-error/without-config-path-error.test.js index 4b1cec50515..a5502bc2622 100644 --- a/test/configtest/without-config-path-error/without-config-path-error.test.js +++ b/test/configtest/without-config-path-error/without-config-path-error.test.js @@ -1,13 +1,13 @@ -'use strict'; +"use strict"; -const { run, normalizeStderr, normalizeStdout } = require('../../utils/test-utils'); +const { run, normalizeStderr, normalizeStdout } = require("../../utils/test-utils"); describe("'configtest' command without the configuration path option", () => { - it.only('should validate default configuration', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['configtest']); + it.only("should validate default configuration", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["configtest"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); }); diff --git a/test/configtest/without-config-path-multi-compiler-mode/webpack.config.js b/test/configtest/without-config-path-multi-compiler-mode/webpack.config.js index e198b8625cb..7390a6c5edd 100644 --- a/test/configtest/without-config-path-multi-compiler-mode/webpack.config.js +++ b/test/configtest/without-config-path-multi-compiler-mode/webpack.config.js @@ -1,12 +1,12 @@ module.exports = [ { - mode: 'development', - target: 'node', - stats: 'verbose', + mode: "development", + target: "node", + stats: "verbose", }, { - mode: 'development', - target: 'node', - stats: 'verbose', + mode: "development", + target: "node", + stats: "verbose", }, ]; diff --git a/test/configtest/without-config-path-multi-compiler-mode/without-config-path-multi-compiler-mode.test.js b/test/configtest/without-config-path-multi-compiler-mode/without-config-path-multi-compiler-mode.test.js index a03239c9807..e0e61700a66 100644 --- a/test/configtest/without-config-path-multi-compiler-mode/without-config-path-multi-compiler-mode.test.js +++ b/test/configtest/without-config-path-multi-compiler-mode/without-config-path-multi-compiler-mode.test.js @@ -1,13 +1,13 @@ -'use strict'; +"use strict"; -const { run, normalizeStderr, normalizeStdout } = require('../../utils/test-utils'); +const { run, normalizeStderr, normalizeStdout } = require("../../utils/test-utils"); describe("'configtest' command without the configuration path option", () => { - it.only('should validate default configuration', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['configtest']); + it.only("should validate default configuration", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["configtest"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); }); diff --git a/test/configtest/without-config-path-no-configuration/without-config-path-no-configuration.test.js b/test/configtest/without-config-path-no-configuration/without-config-path-no-configuration.test.js index 4b1cec50515..a5502bc2622 100644 --- a/test/configtest/without-config-path-no-configuration/without-config-path-no-configuration.test.js +++ b/test/configtest/without-config-path-no-configuration/without-config-path-no-configuration.test.js @@ -1,13 +1,13 @@ -'use strict'; +"use strict"; -const { run, normalizeStderr, normalizeStdout } = require('../../utils/test-utils'); +const { run, normalizeStderr, normalizeStdout } = require("../../utils/test-utils"); describe("'configtest' command without the configuration path option", () => { - it.only('should validate default configuration', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['configtest']); + it.only("should validate default configuration", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["configtest"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); }); diff --git a/test/configtest/without-config-path/webpack.config.js b/test/configtest/without-config-path/webpack.config.js index bdaebdb6f26..a700197b9ca 100644 --- a/test/configtest/without-config-path/webpack.config.js +++ b/test/configtest/without-config-path/webpack.config.js @@ -1,5 +1,5 @@ module.exports = { - mode: 'development', - target: 'node', - stats: 'verbose', + mode: "development", + target: "node", + stats: "verbose", }; diff --git a/test/configtest/without-config-path/without-config-path.test.js b/test/configtest/without-config-path/without-config-path.test.js index a03239c9807..e0e61700a66 100644 --- a/test/configtest/without-config-path/without-config-path.test.js +++ b/test/configtest/without-config-path/without-config-path.test.js @@ -1,13 +1,13 @@ -'use strict'; +"use strict"; -const { run, normalizeStderr, normalizeStdout } = require('../../utils/test-utils'); +const { run, normalizeStderr, normalizeStdout } = require("../../utils/test-utils"); describe("'configtest' command without the configuration path option", () => { - it.only('should validate default configuration', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['configtest']); + it.only("should validate default configuration", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["configtest"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); }); diff --git a/test/help/__snapshots__/help.test.js.snap.devServer3.webpack4 b/test/help/__snapshots__/help.test.js.snap.devServer3.webpack4 index 22f0fa47246..5e9c6cb436b 100644 --- a/test/help/__snapshots__/help.test.js.snap.devServer3.webpack4 +++ b/test/help/__snapshots__/help.test.js.snap.devServer3.webpack4 @@ -531,17 +531,17 @@ exports[`help should show help information for 'c' command using command syntax: Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -558,17 +558,17 @@ exports[`help should show help information for 'c' command using the "--help" op Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -667,17 +667,17 @@ exports[`help should show help information for 'create' command using command sy Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -694,17 +694,17 @@ exports[`help should show help information for 'create' command using the "--hel Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -721,7 +721,7 @@ exports[`help should show help information for 'i' command using command syntax: Outputs information about your system. Options: - --output To get the output in a specified format ( accept json or markdown ) + -o, --output To get the output in a specified format ( accept json or markdown ) Global options: --color Enable colors on console. @@ -744,7 +744,7 @@ exports[`help should show help information for 'i' command using the "--help" op Outputs information about your system. Options: - --output To get the output in a specified format ( accept json or markdown ) + -o, --output To get the output in a specified format ( accept json or markdown ) Global options: --color Enable colors on console. @@ -767,7 +767,7 @@ exports[`help should show help information for 'info' and respect the "--color" Outputs information about your system. Options: - --output To get the output in a specified format ( accept json + -o, --output To get the output in a specified format ( accept json or markdown ) Global options: @@ -792,7 +792,7 @@ exports[`help should show help information for 'info' and respect the "--no-colo Outputs information about your system. Options: - --output To get the output in a specified format ( accept json + -o, --output To get the output in a specified format ( accept json or markdown ) Global options: @@ -817,7 +817,7 @@ exports[`help should show help information for 'info' command using command synt Outputs information about your system. Options: - --output To get the output in a specified format ( accept json or markdown ) + -o, --output To get the output in a specified format ( accept json or markdown ) Global options: --color Enable colors on console. @@ -840,7 +840,7 @@ exports[`help should show help information for 'info' command using the "--help" Outputs information about your system. Options: - --output To get the output in a specified format ( accept json or markdown ) + -o, --output To get the output in a specified format ( accept json or markdown ) Global options: --color Enable colors on console. @@ -863,19 +863,20 @@ exports[`help should show help information for 'init' and respect the "--color" Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. + ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default - answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default + answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' - and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' + and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -892,19 +893,20 @@ exports[`help should show help information for 'init' and respect the "--no-colo Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. + ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default - answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default + answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' - and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' + and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -921,17 +923,17 @@ exports[`help should show help information for 'init' command using command synt Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -948,17 +950,17 @@ exports[`help should show help information for 'init' command using the "--help" Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -975,16 +977,16 @@ exports[`help should show help information for 'l' command using command syntax: Scaffold a loader. Arguments: - output-path Path to the output directory, e.g. ./loaderName + output-path Path to the output directory, e.g. ./loaderName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1001,16 +1003,16 @@ exports[`help should show help information for 'l' command using the "--help" op Scaffold a loader. Arguments: - output-path Path to the output directory, e.g. ./loaderName + output-path Path to the output directory, e.g. ./loaderName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1027,17 +1029,17 @@ exports[`help should show help information for 'loader' and respect the "--color Scaffold a loader. Arguments: - output-path Path to the output directory, e.g. ./loaderName + output-path Path to the output directory, e.g. ./loaderName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' - and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' + and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1054,17 +1056,17 @@ exports[`help should show help information for 'loader' and respect the "--no-co Scaffold a loader. Arguments: - output-path Path to the output directory, e.g. ./loaderName + output-path Path to the output directory, e.g. ./loaderName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' - and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' + and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1081,16 +1083,16 @@ exports[`help should show help information for 'loader' command using command sy Scaffold a loader. Arguments: - output-path Path to the output directory, e.g. ./loaderName + output-path Path to the output directory, e.g. ./loaderName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1107,16 +1109,16 @@ exports[`help should show help information for 'loader' command using the "--hel Scaffold a loader. Arguments: - output-path Path to the output directory, e.g. ./loaderName + output-path Path to the output directory, e.g. ./loaderName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1255,17 +1257,17 @@ exports[`help should show help information for 'n' command using command syntax: Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1282,17 +1284,17 @@ exports[`help should show help information for 'n' command using the "--help" op Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1309,17 +1311,17 @@ exports[`help should show help information for 'new' command using command synta Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1336,17 +1338,17 @@ exports[`help should show help information for 'new' command using the "--help" Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1363,16 +1365,16 @@ exports[`help should show help information for 'p' command using command syntax: Scaffold a plugin. Arguments: - output-path Path to the output directory, e.g. ./pluginName + output-path Path to the output directory, e.g. ./pluginName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1389,16 +1391,16 @@ exports[`help should show help information for 'p' command using the "--help" op Scaffold a plugin. Arguments: - output-path Path to the output directory, e.g. ./pluginName + output-path Path to the output directory, e.g. ./pluginName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1415,17 +1417,17 @@ exports[`help should show help information for 'plugin' and respect the "--color Scaffold a plugin. Arguments: - output-path Path to the output directory, e.g. ./pluginName + output-path Path to the output directory, e.g. ./pluginName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' - and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' + and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1442,17 +1444,17 @@ exports[`help should show help information for 'plugin' and respect the "--no-co Scaffold a plugin. Arguments: - output-path Path to the output directory, e.g. ./pluginName + output-path Path to the output directory, e.g. ./pluginName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' - and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' + and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1469,16 +1471,16 @@ exports[`help should show help information for 'plugin' command using command sy Scaffold a plugin. Arguments: - output-path Path to the output directory, e.g. ./pluginName + output-path Path to the output directory, e.g. ./pluginName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1495,16 +1497,16 @@ exports[`help should show help information for 'plugin' command using the "--hel Scaffold a plugin. Arguments: - output-path Path to the output directory, e.g. ./pluginName + output-path Path to the output directory, e.g. ./pluginName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -2680,7 +2682,7 @@ exports[`help should show help information with options for sub commands: stdout Outputs information about your system. Options: - --output To get the output in a specified format ( accept json or markdown ) + -o, --output To get the output in a specified format ( accept json or markdown ) Global options: --color Enable colors on console. diff --git a/test/help/__snapshots__/help.test.js.snap.devServer3.webpack5 b/test/help/__snapshots__/help.test.js.snap.devServer3.webpack5 index ace44a2d488..e64ba7ddde2 100644 --- a/test/help/__snapshots__/help.test.js.snap.devServer3.webpack5 +++ b/test/help/__snapshots__/help.test.js.snap.devServer3.webpack5 @@ -540,17 +540,17 @@ exports[`help should show help information for 'c' command using command syntax: Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -567,17 +567,17 @@ exports[`help should show help information for 'c' command using the "--help" op Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -676,17 +676,17 @@ exports[`help should show help information for 'create' command using command sy Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -703,17 +703,17 @@ exports[`help should show help information for 'create' command using the "--hel Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -730,7 +730,7 @@ exports[`help should show help information for 'i' command using command syntax: Outputs information about your system. Options: - --output To get the output in a specified format ( accept json or markdown ) + -o, --output To get the output in a specified format ( accept json or markdown ) Global options: --color Enable colors on console. @@ -753,7 +753,7 @@ exports[`help should show help information for 'i' command using the "--help" op Outputs information about your system. Options: - --output To get the output in a specified format ( accept json or markdown ) + -o, --output To get the output in a specified format ( accept json or markdown ) Global options: --color Enable colors on console. @@ -776,7 +776,7 @@ exports[`help should show help information for 'info' and respect the "--color" Outputs information about your system. Options: - --output To get the output in a specified format ( accept json + -o, --output To get the output in a specified format ( accept json or markdown ) Global options: @@ -801,7 +801,7 @@ exports[`help should show help information for 'info' and respect the "--no-colo Outputs information about your system. Options: - --output To get the output in a specified format ( accept json + -o, --output To get the output in a specified format ( accept json or markdown ) Global options: @@ -826,7 +826,7 @@ exports[`help should show help information for 'info' command using command synt Outputs information about your system. Options: - --output To get the output in a specified format ( accept json or markdown ) + -o, --output To get the output in a specified format ( accept json or markdown ) Global options: --color Enable colors on console. @@ -849,7 +849,7 @@ exports[`help should show help information for 'info' command using the "--help" Outputs information about your system. Options: - --output To get the output in a specified format ( accept json or markdown ) + -o, --output To get the output in a specified format ( accept json or markdown ) Global options: --color Enable colors on console. @@ -872,19 +872,20 @@ exports[`help should show help information for 'init' and respect the "--color" Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. + ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default - answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default + answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' - and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' + and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -901,19 +902,20 @@ exports[`help should show help information for 'init' and respect the "--no-colo Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. + ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default - answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default + answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' - and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' + and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -930,17 +932,17 @@ exports[`help should show help information for 'init' command using command synt Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -957,17 +959,17 @@ exports[`help should show help information for 'init' command using the "--help" Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -984,16 +986,16 @@ exports[`help should show help information for 'l' command using command syntax: Scaffold a loader. Arguments: - output-path Path to the output directory, e.g. ./loaderName + output-path Path to the output directory, e.g. ./loaderName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1010,16 +1012,16 @@ exports[`help should show help information for 'l' command using the "--help" op Scaffold a loader. Arguments: - output-path Path to the output directory, e.g. ./loaderName + output-path Path to the output directory, e.g. ./loaderName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1036,17 +1038,17 @@ exports[`help should show help information for 'loader' and respect the "--color Scaffold a loader. Arguments: - output-path Path to the output directory, e.g. ./loaderName + output-path Path to the output directory, e.g. ./loaderName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' - and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' + and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1063,17 +1065,17 @@ exports[`help should show help information for 'loader' and respect the "--no-co Scaffold a loader. Arguments: - output-path Path to the output directory, e.g. ./loaderName + output-path Path to the output directory, e.g. ./loaderName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' - and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' + and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1090,16 +1092,16 @@ exports[`help should show help information for 'loader' command using command sy Scaffold a loader. Arguments: - output-path Path to the output directory, e.g. ./loaderName + output-path Path to the output directory, e.g. ./loaderName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1116,16 +1118,16 @@ exports[`help should show help information for 'loader' command using the "--hel Scaffold a loader. Arguments: - output-path Path to the output directory, e.g. ./loaderName + output-path Path to the output directory, e.g. ./loaderName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1264,17 +1266,17 @@ exports[`help should show help information for 'n' command using command syntax: Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1291,17 +1293,17 @@ exports[`help should show help information for 'n' command using the "--help" op Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1318,17 +1320,17 @@ exports[`help should show help information for 'new' command using command synta Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1345,17 +1347,17 @@ exports[`help should show help information for 'new' command using the "--help" Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1372,16 +1374,16 @@ exports[`help should show help information for 'p' command using command syntax: Scaffold a plugin. Arguments: - output-path Path to the output directory, e.g. ./pluginName + output-path Path to the output directory, e.g. ./pluginName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1398,16 +1400,16 @@ exports[`help should show help information for 'p' command using the "--help" op Scaffold a plugin. Arguments: - output-path Path to the output directory, e.g. ./pluginName + output-path Path to the output directory, e.g. ./pluginName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1424,17 +1426,17 @@ exports[`help should show help information for 'plugin' and respect the "--color Scaffold a plugin. Arguments: - output-path Path to the output directory, e.g. ./pluginName + output-path Path to the output directory, e.g. ./pluginName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' - and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' + and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1451,17 +1453,17 @@ exports[`help should show help information for 'plugin' and respect the "--no-co Scaffold a plugin. Arguments: - output-path Path to the output directory, e.g. ./pluginName + output-path Path to the output directory, e.g. ./pluginName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' - and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' + and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1478,16 +1480,16 @@ exports[`help should show help information for 'plugin' command using command sy Scaffold a plugin. Arguments: - output-path Path to the output directory, e.g. ./pluginName + output-path Path to the output directory, e.g. ./pluginName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1504,16 +1506,16 @@ exports[`help should show help information for 'plugin' command using the "--hel Scaffold a plugin. Arguments: - output-path Path to the output directory, e.g. ./pluginName + output-path Path to the output directory, e.g. ./pluginName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -2705,7 +2707,7 @@ exports[`help should show help information with options for sub commands: stdout Outputs information about your system. Options: - --output To get the output in a specified format ( accept json or markdown ) + -o, --output To get the output in a specified format ( accept json or markdown ) Global options: --color Enable colors on console. diff --git a/test/help/__snapshots__/help.test.js.snap.devServer4.webpack4 b/test/help/__snapshots__/help.test.js.snap.devServer4.webpack4 index d05143bbc5a..170369e3ff3 100644 --- a/test/help/__snapshots__/help.test.js.snap.devServer4.webpack4 +++ b/test/help/__snapshots__/help.test.js.snap.devServer4.webpack4 @@ -531,17 +531,17 @@ exports[`help should show help information for 'c' command using command syntax: Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -558,17 +558,17 @@ exports[`help should show help information for 'c' command using the "--help" op Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -667,17 +667,17 @@ exports[`help should show help information for 'create' command using command sy Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -694,17 +694,17 @@ exports[`help should show help information for 'create' command using the "--hel Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -721,7 +721,7 @@ exports[`help should show help information for 'i' command using command syntax: Outputs information about your system. Options: - --output To get the output in a specified format ( accept json or markdown ) + -o, --output To get the output in a specified format ( accept json or markdown ) Global options: --color Enable colors on console. @@ -744,7 +744,7 @@ exports[`help should show help information for 'i' command using the "--help" op Outputs information about your system. Options: - --output To get the output in a specified format ( accept json or markdown ) + -o, --output To get the output in a specified format ( accept json or markdown ) Global options: --color Enable colors on console. @@ -767,7 +767,7 @@ exports[`help should show help information for 'info' and respect the "--color" Outputs information about your system. Options: - --output To get the output in a specified format ( accept json + -o, --output To get the output in a specified format ( accept json or markdown ) Global options: @@ -792,7 +792,7 @@ exports[`help should show help information for 'info' and respect the "--no-colo Outputs information about your system. Options: - --output To get the output in a specified format ( accept json + -o, --output To get the output in a specified format ( accept json or markdown ) Global options: @@ -817,7 +817,7 @@ exports[`help should show help information for 'info' command using command synt Outputs information about your system. Options: - --output To get the output in a specified format ( accept json or markdown ) + -o, --output To get the output in a specified format ( accept json or markdown ) Global options: --color Enable colors on console. @@ -840,7 +840,7 @@ exports[`help should show help information for 'info' command using the "--help" Outputs information about your system. Options: - --output To get the output in a specified format ( accept json or markdown ) + -o, --output To get the output in a specified format ( accept json or markdown ) Global options: --color Enable colors on console. @@ -863,19 +863,20 @@ exports[`help should show help information for 'init' and respect the "--color" Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. + ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default - answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default + answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' - and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' + and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -892,19 +893,20 @@ exports[`help should show help information for 'init' and respect the "--no-colo Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. + ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default - answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default + answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' - and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' + and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -921,17 +923,17 @@ exports[`help should show help information for 'init' command using command synt Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -948,17 +950,17 @@ exports[`help should show help information for 'init' command using the "--help" Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -975,16 +977,16 @@ exports[`help should show help information for 'l' command using command syntax: Scaffold a loader. Arguments: - output-path Path to the output directory, e.g. ./loaderName + output-path Path to the output directory, e.g. ./loaderName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1001,16 +1003,16 @@ exports[`help should show help information for 'l' command using the "--help" op Scaffold a loader. Arguments: - output-path Path to the output directory, e.g. ./loaderName + output-path Path to the output directory, e.g. ./loaderName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1027,17 +1029,17 @@ exports[`help should show help information for 'loader' and respect the "--color Scaffold a loader. Arguments: - output-path Path to the output directory, e.g. ./loaderName + output-path Path to the output directory, e.g. ./loaderName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' - and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' + and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1054,17 +1056,17 @@ exports[`help should show help information for 'loader' and respect the "--no-co Scaffold a loader. Arguments: - output-path Path to the output directory, e.g. ./loaderName + output-path Path to the output directory, e.g. ./loaderName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' - and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' + and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1081,16 +1083,16 @@ exports[`help should show help information for 'loader' command using command sy Scaffold a loader. Arguments: - output-path Path to the output directory, e.g. ./loaderName + output-path Path to the output directory, e.g. ./loaderName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1107,16 +1109,16 @@ exports[`help should show help information for 'loader' command using the "--hel Scaffold a loader. Arguments: - output-path Path to the output directory, e.g. ./loaderName + output-path Path to the output directory, e.g. ./loaderName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1255,17 +1257,17 @@ exports[`help should show help information for 'n' command using command syntax: Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1282,17 +1284,17 @@ exports[`help should show help information for 'n' command using the "--help" op Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1309,17 +1311,17 @@ exports[`help should show help information for 'new' command using command synta Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1336,17 +1338,17 @@ exports[`help should show help information for 'new' command using the "--help" Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1363,16 +1365,16 @@ exports[`help should show help information for 'p' command using command syntax: Scaffold a plugin. Arguments: - output-path Path to the output directory, e.g. ./pluginName + output-path Path to the output directory, e.g. ./pluginName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1389,16 +1391,16 @@ exports[`help should show help information for 'p' command using the "--help" op Scaffold a plugin. Arguments: - output-path Path to the output directory, e.g. ./pluginName + output-path Path to the output directory, e.g. ./pluginName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1415,17 +1417,17 @@ exports[`help should show help information for 'plugin' and respect the "--color Scaffold a plugin. Arguments: - output-path Path to the output directory, e.g. ./pluginName + output-path Path to the output directory, e.g. ./pluginName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' - and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' + and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1442,17 +1444,17 @@ exports[`help should show help information for 'plugin' and respect the "--no-co Scaffold a plugin. Arguments: - output-path Path to the output directory, e.g. ./pluginName + output-path Path to the output directory, e.g. ./pluginName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' - and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' + and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1469,16 +1471,16 @@ exports[`help should show help information for 'plugin' command using command sy Scaffold a plugin. Arguments: - output-path Path to the output directory, e.g. ./pluginName + output-path Path to the output directory, e.g. ./pluginName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1495,16 +1497,16 @@ exports[`help should show help information for 'plugin' command using the "--hel Scaffold a plugin. Arguments: - output-path Path to the output directory, e.g. ./pluginName + output-path Path to the output directory, e.g. ./pluginName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1521,62 +1523,73 @@ exports[`help should show help information for 's' command using command syntax: Run the webpack dev server. Options: - -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. - --config-name Name of the configuration to use. - -m, --merge Merge two or more configurations using 'webpack-merge'. - --env Environment passed to the configuration when it is a function. - --node-env Sets process.env.NODE_ENV to the specified value. - --progress [value] Print compilation progress during build. - -j, --json [value] Prints result as JSON or store it in a file. - --entry The entry point(s) of your application e.g. ./src/main.js. - -o, --output-path Output location of the file generated by webpack e.g. ./dist/. - -t, --target Sets the build target e.g. node. - -d, --devtool Determine source maps to use. - --no-devtool Do not generate source maps. - --mode Defines the mode to pass to webpack. - --name Name of the configuration. Used when loading multiple configurations. - --stats [value] It instructs webpack on how to treat the stats e.g. verbose. - --no-stats Disable stats output. - --watch-options-stdin Stop watching when stdin stream has ended. - --no-watch-options-stdin Do not stop watching when stdin stream has ended. - --host The hostname/ip address the server will bind to. - --port The port server will listen to. - --static [value...] A directory to serve static content from. - --no-static Negative 'static' option. - --live-reload Enables live reloading on changing files. - --no-live-reload Disables live reloading on changing files. - --https Use HTTPS protocol. - --no-https Do not use HTTPS protocol. - --http2 Use HTTP/2, must be used with HTTPS. - --no-http2 Do not use HTTP/2. - --bonjour Broadcasts the server via ZeroConf networking on start. - --no-bonjour Do not broadcast the server via ZeroConf networking on start. - --client-progress Print compilation progress in percentage in the browser. - --no-client-progress Do not print compilation progress in percentage in the browser. - --client-overlay Show a full-screen overlay in the browser when there are compiler errors or warnings. - --no-client-overlay Do not show a full-screen overlay in the browser when there are compiler errors or warnings. - --setup-exit-signals Close and exit the process on SIGINT and SIGTERM. - --no-setup-exit-signals Do not close and exit the process on SIGNIT and SIGTERM. - --open [value...] Open the default browser. - --no-open Do not open the default browser. - --open-app Open specified browser. - --open-target [value...] Open specified route in browser. - --no-open-target Do not open specified route in browser. - --client-logging Log level in the browser (none, error, warn, info, log, verbose). - --history-api-fallback Fallback to /index.html for Single Page Applications. - --no-history-api-fallback Do not fallback to /index.html for Single Page Applications. - --compress Enable gzip compression. - --no-compress Disable gzip compression. - --public The public hostname/ip address of the server. - --firewall [value...] Enable firewall or set hosts that are allowed to access the dev server. - --no-firewall Disable firewall. - --watch-files Watch static files for file changes. - -Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. + --config-name Name of the configuration to use. + -m, --merge Merge two or more configurations using 'webpack-merge'. + --env Environment passed to the configuration when it is a function. + --node-env Sets process.env.NODE_ENV to the specified value. + --progress [value] Print compilation progress during build. + -j, --json [value] Prints result as JSON or store it in a file. + --entry The entry point(s) of your application e.g. ./src/main.js. + -o, --output-path Output location of the file generated by webpack e.g. ./dist/. + -t, --target Sets the build target e.g. node. + -d, --devtool Determine source maps to use. + --no-devtool Do not generate source maps. + --mode Defines the mode to pass to webpack. + --name Name of the configuration. Used when loading multiple configurations. + --stats [value] It instructs webpack on how to treat the stats e.g. verbose. + --no-stats Disable stats output. + --watch-options-stdin Stop watching when stdin stream has ended. + --no-watch-options-stdin Do not stop watching when stdin stream has ended. + --host The hostname/ip address the server will bind to. + --port The port server will listen to. + --static [value...] A directory to serve static content from. + --no-static Negative 'static' option. + --static-directory Directory for static contents. + --static-public-path The bundled files will be available in the browser under this path. + --static-serve-index Tells dev-server to use serveIndex middleware. + --no-static-serve-index Do not tell dev-server to use serveIndex middleware. + --static-watch Watch for files in static content directory. + --no-static-watch Do not watch for files in static content directory. + --live-reload Enables live reloading on changing files. + --no-live-reload Disables live reloading on changing files. + --https Use HTTPS protocol. + --no-https Do not use HTTPS protocol. + --https-passphrase Passphrase for a pfx file. + --https-key Path to an SSL key. + --https-pfx Path to an SSL pfx file. + --https-cert Path to an SSL certificate. + --https-cacert Path to an SSL CA certificate. + --https-request-cert Request for an SSL certificate. + --no-https-request-cert Do not request for an SSL certificate. + --http2 Use HTTP/2, must be used with HTTPS. + --no-http2 Do not use HTTP/2. + --bonjour Broadcasts the server via ZeroConf networking on start. + --no-bonjour Do not broadcast the server via ZeroConf networking on start. + --client-progress Print compilation progress in percentage in the browser. + --no-client-progress Do not print compilation progress in percentage in the browser. + --client-overlay Show a full-screen overlay in the browser when there are compiler errors or warnings. + --no-client-overlay Do not show a full-screen overlay in the browser when there are compiler errors or warnings. + --open [value...] Open the default browser. + --no-open Do not open the default browser. + --open-app Open specified browser. + --open-target [value...] Open specified route in browser. + --no-open-target Do not open specified route in browser. + --client-logging Log level in the browser (none, error, warn, info, log, verbose). + --history-api-fallback Fallback to /index.html for Single Page Applications. + --no-history-api-fallback Do not fallback to /index.html for Single Page Applications. + --compress Enable gzip compression. + --no-compress Disable gzip compression. + --public The public hostname/ip address of the server. + --firewall [value...] Enable firewall or set hosts that are allowed to access the dev server. + --no-firewall Disable firewall. + --watch-files Watch static files for file changes. + +Global options: + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1593,62 +1606,73 @@ exports[`help should show help information for 's' command using the "--help" op Run the webpack dev server. Options: - -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. - --config-name Name of the configuration to use. - -m, --merge Merge two or more configurations using 'webpack-merge'. - --env Environment passed to the configuration when it is a function. - --node-env Sets process.env.NODE_ENV to the specified value. - --progress [value] Print compilation progress during build. - -j, --json [value] Prints result as JSON or store it in a file. - --entry The entry point(s) of your application e.g. ./src/main.js. - -o, --output-path Output location of the file generated by webpack e.g. ./dist/. - -t, --target Sets the build target e.g. node. - -d, --devtool Determine source maps to use. - --no-devtool Do not generate source maps. - --mode Defines the mode to pass to webpack. - --name Name of the configuration. Used when loading multiple configurations. - --stats [value] It instructs webpack on how to treat the stats e.g. verbose. - --no-stats Disable stats output. - --watch-options-stdin Stop watching when stdin stream has ended. - --no-watch-options-stdin Do not stop watching when stdin stream has ended. - --host The hostname/ip address the server will bind to. - --port The port server will listen to. - --static [value...] A directory to serve static content from. - --no-static Negative 'static' option. - --live-reload Enables live reloading on changing files. - --no-live-reload Disables live reloading on changing files. - --https Use HTTPS protocol. - --no-https Do not use HTTPS protocol. - --http2 Use HTTP/2, must be used with HTTPS. - --no-http2 Do not use HTTP/2. - --bonjour Broadcasts the server via ZeroConf networking on start. - --no-bonjour Do not broadcast the server via ZeroConf networking on start. - --client-progress Print compilation progress in percentage in the browser. - --no-client-progress Do not print compilation progress in percentage in the browser. - --client-overlay Show a full-screen overlay in the browser when there are compiler errors or warnings. - --no-client-overlay Do not show a full-screen overlay in the browser when there are compiler errors or warnings. - --setup-exit-signals Close and exit the process on SIGINT and SIGTERM. - --no-setup-exit-signals Do not close and exit the process on SIGNIT and SIGTERM. - --open [value...] Open the default browser. - --no-open Do not open the default browser. - --open-app Open specified browser. - --open-target [value...] Open specified route in browser. - --no-open-target Do not open specified route in browser. - --client-logging Log level in the browser (none, error, warn, info, log, verbose). - --history-api-fallback Fallback to /index.html for Single Page Applications. - --no-history-api-fallback Do not fallback to /index.html for Single Page Applications. - --compress Enable gzip compression. - --no-compress Disable gzip compression. - --public The public hostname/ip address of the server. - --firewall [value...] Enable firewall or set hosts that are allowed to access the dev server. - --no-firewall Disable firewall. - --watch-files Watch static files for file changes. - -Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. + --config-name Name of the configuration to use. + -m, --merge Merge two or more configurations using 'webpack-merge'. + --env Environment passed to the configuration when it is a function. + --node-env Sets process.env.NODE_ENV to the specified value. + --progress [value] Print compilation progress during build. + -j, --json [value] Prints result as JSON or store it in a file. + --entry The entry point(s) of your application e.g. ./src/main.js. + -o, --output-path Output location of the file generated by webpack e.g. ./dist/. + -t, --target Sets the build target e.g. node. + -d, --devtool Determine source maps to use. + --no-devtool Do not generate source maps. + --mode Defines the mode to pass to webpack. + --name Name of the configuration. Used when loading multiple configurations. + --stats [value] It instructs webpack on how to treat the stats e.g. verbose. + --no-stats Disable stats output. + --watch-options-stdin Stop watching when stdin stream has ended. + --no-watch-options-stdin Do not stop watching when stdin stream has ended. + --host The hostname/ip address the server will bind to. + --port The port server will listen to. + --static [value...] A directory to serve static content from. + --no-static Negative 'static' option. + --static-directory Directory for static contents. + --static-public-path The bundled files will be available in the browser under this path. + --static-serve-index Tells dev-server to use serveIndex middleware. + --no-static-serve-index Do not tell dev-server to use serveIndex middleware. + --static-watch Watch for files in static content directory. + --no-static-watch Do not watch for files in static content directory. + --live-reload Enables live reloading on changing files. + --no-live-reload Disables live reloading on changing files. + --https Use HTTPS protocol. + --no-https Do not use HTTPS protocol. + --https-passphrase Passphrase for a pfx file. + --https-key Path to an SSL key. + --https-pfx Path to an SSL pfx file. + --https-cert Path to an SSL certificate. + --https-cacert Path to an SSL CA certificate. + --https-request-cert Request for an SSL certificate. + --no-https-request-cert Do not request for an SSL certificate. + --http2 Use HTTP/2, must be used with HTTPS. + --no-http2 Do not use HTTP/2. + --bonjour Broadcasts the server via ZeroConf networking on start. + --no-bonjour Do not broadcast the server via ZeroConf networking on start. + --client-progress Print compilation progress in percentage in the browser. + --no-client-progress Do not print compilation progress in percentage in the browser. + --client-overlay Show a full-screen overlay in the browser when there are compiler errors or warnings. + --no-client-overlay Do not show a full-screen overlay in the browser when there are compiler errors or warnings. + --open [value...] Open the default browser. + --no-open Do not open the default browser. + --open-app Open specified browser. + --open-target [value...] Open specified route in browser. + --no-open-target Do not open specified route in browser. + --client-logging Log level in the browser (none, error, warn, info, log, verbose). + --history-api-fallback Fallback to /index.html for Single Page Applications. + --no-history-api-fallback Do not fallback to /index.html for Single Page Applications. + --compress Enable gzip compression. + --no-compress Disable gzip compression. + --public The public hostname/ip address of the server. + --firewall [value...] Enable firewall or set hosts that are allowed to access the dev server. + --no-firewall Disable firewall. + --watch-files Watch static files for file changes. + +Global options: + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1665,82 +1689,101 @@ exports[`help should show help information for 'serve' and respect the "--color" Run the webpack dev server. Options: - -c, --config Provide path to a webpack configuration file e.g. - ./webpack.config.js. - --config-name Name of the configuration to use. - -m, --merge Merge two or more configurations using - 'webpack-merge'. - --env Environment passed to the configuration when it is - a function. - --node-env Sets process.env.NODE_ENV to the specified value. - --progress [value] Print compilation progress during build. - -j, --json [value] Prints result as JSON or store it in a file. - --entry The entry point(s) of your application e.g. - ./src/main.js. - -o, --output-path Output location of the file generated by webpack - e.g. ./dist/. - -t, --target Sets the build target e.g. node. - -d, --devtool Determine source maps to use. - --no-devtool Do not generate source maps. - --mode Defines the mode to pass to webpack. - --name Name of the configuration. Used when loading - multiple configurations. - --stats [value] It instructs webpack on how to treat the stats - e.g. verbose. - --no-stats Disable stats output. - --watch-options-stdin Stop watching when stdin stream has ended. - --no-watch-options-stdin Do not stop watching when stdin stream has ended. - --host The hostname/ip address the server will bind to. - --port The port server will listen to. - --static [value...] A directory to serve static content from. - --no-static Negative 'static' option. - --live-reload Enables live reloading on changing files. - --no-live-reload Disables live reloading on changing files. - --https Use HTTPS protocol. - --no-https Do not use HTTPS protocol. - --http2 Use HTTP/2, must be used with HTTPS. - --no-http2 Do not use HTTP/2. - --bonjour Broadcasts the server via ZeroConf networking on - start. - --no-bonjour Do not broadcast the server via ZeroConf - networking on start. - --client-progress Print compilation progress in percentage in the - browser. - --no-client-progress Do not print compilation progress in percentage in - the browser. - --client-overlay Show a full-screen overlay in the browser when - there are compiler errors or warnings. - --no-client-overlay Do not show a full-screen overlay in the browser - when there are compiler errors or warnings. - --setup-exit-signals Close and exit the process on SIGINT and SIGTERM. - --no-setup-exit-signals Do not close and exit the process on SIGNIT and - SIGTERM. - --open [value...] Open the default browser. - --no-open Do not open the default browser. - --open-app Open specified browser. - --open-target [value...] Open specified route in browser. - --no-open-target Do not open specified route in browser. - --client-logging Log level in the browser (none, error, warn, info, - log, verbose). - --history-api-fallback Fallback to /index.html for Single Page - Applications. - --no-history-api-fallback Do not fallback to /index.html for Single Page - Applications. - --compress Enable gzip compression. - --no-compress Disable gzip compression. - --public The public hostname/ip address of the server. - --firewall [value...] Enable firewall or set hosts that are allowed to - access the dev server. - --no-firewall Disable firewall. - --watch-files Watch static files for file changes. - -Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', - 'webpack-cli' and 'webpack-dev-server' and - commands. - -h, --help [verbose] Display help for commands and options. + -c, --config Provide path to a webpack configuration file + e.g. ./webpack.config.js. + --config-name Name of the configuration to use. + -m, --merge Merge two or more configurations using + 'webpack-merge'. + --env Environment passed to the configuration when + it is a function. + --node-env Sets process.env.NODE_ENV to the specified + value. + --progress [value] Print compilation progress during build. + -j, --json [value] Prints result as JSON or store it in a file. + --entry The entry point(s) of your application e.g. + ./src/main.js. + -o, --output-path Output location of the file generated by + webpack e.g. ./dist/. + -t, --target Sets the build target e.g. node. + -d, --devtool Determine source maps to use. + --no-devtool Do not generate source maps. + --mode Defines the mode to pass to webpack. + --name Name of the configuration. Used when loading + multiple configurations. + --stats [value] It instructs webpack on how to treat the + stats e.g. verbose. + --no-stats Disable stats output. + --watch-options-stdin Stop watching when stdin stream has ended. + --no-watch-options-stdin Do not stop watching when stdin stream has + ended. + --host The hostname/ip address the server will bind + to. + --port The port server will listen to. + --static [value...] A directory to serve static content from. + --no-static Negative 'static' option. + --static-directory Directory for static contents. + --static-public-path The bundled files will be available in the + browser under this path. + --static-serve-index Tells dev-server to use serveIndex + middleware. + --no-static-serve-index Do not tell dev-server to use serveIndex + middleware. + --static-watch Watch for files in static content directory. + --no-static-watch Do not watch for files in static content + directory. + --live-reload Enables live reloading on changing files. + --no-live-reload Disables live reloading on changing files. + --https Use HTTPS protocol. + --no-https Do not use HTTPS protocol. + --https-passphrase Passphrase for a pfx file. + --https-key Path to an SSL key. + --https-pfx Path to an SSL pfx file. + --https-cert Path to an SSL certificate. + --https-cacert Path to an SSL CA certificate. + --https-request-cert Request for an SSL certificate. + --no-https-request-cert Do not request for an SSL certificate. + --http2 Use HTTP/2, must be used with HTTPS. + --no-http2 Do not use HTTP/2. + --bonjour Broadcasts the server via ZeroConf + networking on start. + --no-bonjour Do not broadcast the server via ZeroConf + networking on start. + --client-progress Print compilation progress in percentage in + the browser. + --no-client-progress Do not print compilation progress in + percentage in the browser. + --client-overlay Show a full-screen overlay in the browser + when there are compiler errors or warnings. + --no-client-overlay Do not show a full-screen overlay in the + browser when there are compiler errors or + warnings. + --open [value...] Open the default browser. + --no-open Do not open the default browser. + --open-app Open specified browser. + --open-target [value...] Open specified route in browser. + --no-open-target Do not open specified route in browser. + --client-logging Log level in the browser (none, error, warn, + info, log, verbose). + --history-api-fallback Fallback to /index.html for Single Page + Applications. + --no-history-api-fallback Do not fallback to /index.html for Single + Page Applications. + --compress Enable gzip compression. + --no-compress Disable gzip compression. + --public The public hostname/ip address of the + server. + --firewall [value...] Enable firewall or set hosts that are + allowed to access the dev server. + --no-firewall Disable firewall. + --watch-files Watch static files for file changes. + +Global options: + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', + 'webpack-cli' and 'webpack-dev-server' and + commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1757,82 +1800,101 @@ exports[`help should show help information for 'serve' and respect the "--no-col Run the webpack dev server. Options: - -c, --config Provide path to a webpack configuration file e.g. - ./webpack.config.js. - --config-name Name of the configuration to use. - -m, --merge Merge two or more configurations using - 'webpack-merge'. - --env Environment passed to the configuration when it is - a function. - --node-env Sets process.env.NODE_ENV to the specified value. - --progress [value] Print compilation progress during build. - -j, --json [value] Prints result as JSON or store it in a file. - --entry The entry point(s) of your application e.g. - ./src/main.js. - -o, --output-path Output location of the file generated by webpack - e.g. ./dist/. - -t, --target Sets the build target e.g. node. - -d, --devtool Determine source maps to use. - --no-devtool Do not generate source maps. - --mode Defines the mode to pass to webpack. - --name Name of the configuration. Used when loading - multiple configurations. - --stats [value] It instructs webpack on how to treat the stats - e.g. verbose. - --no-stats Disable stats output. - --watch-options-stdin Stop watching when stdin stream has ended. - --no-watch-options-stdin Do not stop watching when stdin stream has ended. - --host The hostname/ip address the server will bind to. - --port The port server will listen to. - --static [value...] A directory to serve static content from. - --no-static Negative 'static' option. - --live-reload Enables live reloading on changing files. - --no-live-reload Disables live reloading on changing files. - --https Use HTTPS protocol. - --no-https Do not use HTTPS protocol. - --http2 Use HTTP/2, must be used with HTTPS. - --no-http2 Do not use HTTP/2. - --bonjour Broadcasts the server via ZeroConf networking on - start. - --no-bonjour Do not broadcast the server via ZeroConf - networking on start. - --client-progress Print compilation progress in percentage in the - browser. - --no-client-progress Do not print compilation progress in percentage in - the browser. - --client-overlay Show a full-screen overlay in the browser when - there are compiler errors or warnings. - --no-client-overlay Do not show a full-screen overlay in the browser - when there are compiler errors or warnings. - --setup-exit-signals Close and exit the process on SIGINT and SIGTERM. - --no-setup-exit-signals Do not close and exit the process on SIGNIT and - SIGTERM. - --open [value...] Open the default browser. - --no-open Do not open the default browser. - --open-app Open specified browser. - --open-target [value...] Open specified route in browser. - --no-open-target Do not open specified route in browser. - --client-logging Log level in the browser (none, error, warn, info, - log, verbose). - --history-api-fallback Fallback to /index.html for Single Page - Applications. - --no-history-api-fallback Do not fallback to /index.html for Single Page - Applications. - --compress Enable gzip compression. - --no-compress Disable gzip compression. - --public The public hostname/ip address of the server. - --firewall [value...] Enable firewall or set hosts that are allowed to - access the dev server. - --no-firewall Disable firewall. - --watch-files Watch static files for file changes. - -Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', - 'webpack-cli' and 'webpack-dev-server' and - commands. - -h, --help [verbose] Display help for commands and options. + -c, --config Provide path to a webpack configuration file + e.g. ./webpack.config.js. + --config-name Name of the configuration to use. + -m, --merge Merge two or more configurations using + 'webpack-merge'. + --env Environment passed to the configuration when + it is a function. + --node-env Sets process.env.NODE_ENV to the specified + value. + --progress [value] Print compilation progress during build. + -j, --json [value] Prints result as JSON or store it in a file. + --entry The entry point(s) of your application e.g. + ./src/main.js. + -o, --output-path Output location of the file generated by + webpack e.g. ./dist/. + -t, --target Sets the build target e.g. node. + -d, --devtool Determine source maps to use. + --no-devtool Do not generate source maps. + --mode Defines the mode to pass to webpack. + --name Name of the configuration. Used when loading + multiple configurations. + --stats [value] It instructs webpack on how to treat the + stats e.g. verbose. + --no-stats Disable stats output. + --watch-options-stdin Stop watching when stdin stream has ended. + --no-watch-options-stdin Do not stop watching when stdin stream has + ended. + --host The hostname/ip address the server will bind + to. + --port The port server will listen to. + --static [value...] A directory to serve static content from. + --no-static Negative 'static' option. + --static-directory Directory for static contents. + --static-public-path The bundled files will be available in the + browser under this path. + --static-serve-index Tells dev-server to use serveIndex + middleware. + --no-static-serve-index Do not tell dev-server to use serveIndex + middleware. + --static-watch Watch for files in static content directory. + --no-static-watch Do not watch for files in static content + directory. + --live-reload Enables live reloading on changing files. + --no-live-reload Disables live reloading on changing files. + --https Use HTTPS protocol. + --no-https Do not use HTTPS protocol. + --https-passphrase Passphrase for a pfx file. + --https-key Path to an SSL key. + --https-pfx Path to an SSL pfx file. + --https-cert Path to an SSL certificate. + --https-cacert Path to an SSL CA certificate. + --https-request-cert Request for an SSL certificate. + --no-https-request-cert Do not request for an SSL certificate. + --http2 Use HTTP/2, must be used with HTTPS. + --no-http2 Do not use HTTP/2. + --bonjour Broadcasts the server via ZeroConf + networking on start. + --no-bonjour Do not broadcast the server via ZeroConf + networking on start. + --client-progress Print compilation progress in percentage in + the browser. + --no-client-progress Do not print compilation progress in + percentage in the browser. + --client-overlay Show a full-screen overlay in the browser + when there are compiler errors or warnings. + --no-client-overlay Do not show a full-screen overlay in the + browser when there are compiler errors or + warnings. + --open [value...] Open the default browser. + --no-open Do not open the default browser. + --open-app Open specified browser. + --open-target [value...] Open specified route in browser. + --no-open-target Do not open specified route in browser. + --client-logging Log level in the browser (none, error, warn, + info, log, verbose). + --history-api-fallback Fallback to /index.html for Single Page + Applications. + --no-history-api-fallback Do not fallback to /index.html for Single + Page Applications. + --compress Enable gzip compression. + --no-compress Disable gzip compression. + --public The public hostname/ip address of the + server. + --firewall [value...] Enable firewall or set hosts that are + allowed to access the dev server. + --no-firewall Disable firewall. + --watch-files Watch static files for file changes. + +Global options: + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', + 'webpack-cli' and 'webpack-dev-server' and + commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1849,62 +1911,73 @@ exports[`help should show help information for 'serve' command using command syn Run the webpack dev server. Options: - -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. - --config-name Name of the configuration to use. - -m, --merge Merge two or more configurations using 'webpack-merge'. - --env Environment passed to the configuration when it is a function. - --node-env Sets process.env.NODE_ENV to the specified value. - --progress [value] Print compilation progress during build. - -j, --json [value] Prints result as JSON or store it in a file. - --entry The entry point(s) of your application e.g. ./src/main.js. - -o, --output-path Output location of the file generated by webpack e.g. ./dist/. - -t, --target Sets the build target e.g. node. - -d, --devtool Determine source maps to use. - --no-devtool Do not generate source maps. - --mode Defines the mode to pass to webpack. - --name Name of the configuration. Used when loading multiple configurations. - --stats [value] It instructs webpack on how to treat the stats e.g. verbose. - --no-stats Disable stats output. - --watch-options-stdin Stop watching when stdin stream has ended. - --no-watch-options-stdin Do not stop watching when stdin stream has ended. - --host The hostname/ip address the server will bind to. - --port The port server will listen to. - --static [value...] A directory to serve static content from. - --no-static Negative 'static' option. - --live-reload Enables live reloading on changing files. - --no-live-reload Disables live reloading on changing files. - --https Use HTTPS protocol. - --no-https Do not use HTTPS protocol. - --http2 Use HTTP/2, must be used with HTTPS. - --no-http2 Do not use HTTP/2. - --bonjour Broadcasts the server via ZeroConf networking on start. - --no-bonjour Do not broadcast the server via ZeroConf networking on start. - --client-progress Print compilation progress in percentage in the browser. - --no-client-progress Do not print compilation progress in percentage in the browser. - --client-overlay Show a full-screen overlay in the browser when there are compiler errors or warnings. - --no-client-overlay Do not show a full-screen overlay in the browser when there are compiler errors or warnings. - --setup-exit-signals Close and exit the process on SIGINT and SIGTERM. - --no-setup-exit-signals Do not close and exit the process on SIGNIT and SIGTERM. - --open [value...] Open the default browser. - --no-open Do not open the default browser. - --open-app Open specified browser. - --open-target [value...] Open specified route in browser. - --no-open-target Do not open specified route in browser. - --client-logging Log level in the browser (none, error, warn, info, log, verbose). - --history-api-fallback Fallback to /index.html for Single Page Applications. - --no-history-api-fallback Do not fallback to /index.html for Single Page Applications. - --compress Enable gzip compression. - --no-compress Disable gzip compression. - --public The public hostname/ip address of the server. - --firewall [value...] Enable firewall or set hosts that are allowed to access the dev server. - --no-firewall Disable firewall. - --watch-files Watch static files for file changes. - -Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. + --config-name Name of the configuration to use. + -m, --merge Merge two or more configurations using 'webpack-merge'. + --env Environment passed to the configuration when it is a function. + --node-env Sets process.env.NODE_ENV to the specified value. + --progress [value] Print compilation progress during build. + -j, --json [value] Prints result as JSON or store it in a file. + --entry The entry point(s) of your application e.g. ./src/main.js. + -o, --output-path Output location of the file generated by webpack e.g. ./dist/. + -t, --target Sets the build target e.g. node. + -d, --devtool Determine source maps to use. + --no-devtool Do not generate source maps. + --mode Defines the mode to pass to webpack. + --name Name of the configuration. Used when loading multiple configurations. + --stats [value] It instructs webpack on how to treat the stats e.g. verbose. + --no-stats Disable stats output. + --watch-options-stdin Stop watching when stdin stream has ended. + --no-watch-options-stdin Do not stop watching when stdin stream has ended. + --host The hostname/ip address the server will bind to. + --port The port server will listen to. + --static [value...] A directory to serve static content from. + --no-static Negative 'static' option. + --static-directory Directory for static contents. + --static-public-path The bundled files will be available in the browser under this path. + --static-serve-index Tells dev-server to use serveIndex middleware. + --no-static-serve-index Do not tell dev-server to use serveIndex middleware. + --static-watch Watch for files in static content directory. + --no-static-watch Do not watch for files in static content directory. + --live-reload Enables live reloading on changing files. + --no-live-reload Disables live reloading on changing files. + --https Use HTTPS protocol. + --no-https Do not use HTTPS protocol. + --https-passphrase Passphrase for a pfx file. + --https-key Path to an SSL key. + --https-pfx Path to an SSL pfx file. + --https-cert Path to an SSL certificate. + --https-cacert Path to an SSL CA certificate. + --https-request-cert Request for an SSL certificate. + --no-https-request-cert Do not request for an SSL certificate. + --http2 Use HTTP/2, must be used with HTTPS. + --no-http2 Do not use HTTP/2. + --bonjour Broadcasts the server via ZeroConf networking on start. + --no-bonjour Do not broadcast the server via ZeroConf networking on start. + --client-progress Print compilation progress in percentage in the browser. + --no-client-progress Do not print compilation progress in percentage in the browser. + --client-overlay Show a full-screen overlay in the browser when there are compiler errors or warnings. + --no-client-overlay Do not show a full-screen overlay in the browser when there are compiler errors or warnings. + --open [value...] Open the default browser. + --no-open Do not open the default browser. + --open-app Open specified browser. + --open-target [value...] Open specified route in browser. + --no-open-target Do not open specified route in browser. + --client-logging Log level in the browser (none, error, warn, info, log, verbose). + --history-api-fallback Fallback to /index.html for Single Page Applications. + --no-history-api-fallback Do not fallback to /index.html for Single Page Applications. + --compress Enable gzip compression. + --no-compress Disable gzip compression. + --public The public hostname/ip address of the server. + --firewall [value...] Enable firewall or set hosts that are allowed to access the dev server. + --no-firewall Disable firewall. + --watch-files Watch static files for file changes. + +Global options: + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1921,62 +1994,73 @@ exports[`help should show help information for 'serve' command using the "--help Run the webpack dev server. Options: - -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. - --config-name Name of the configuration to use. - -m, --merge Merge two or more configurations using 'webpack-merge'. - --env Environment passed to the configuration when it is a function. - --node-env Sets process.env.NODE_ENV to the specified value. - --progress [value] Print compilation progress during build. - -j, --json [value] Prints result as JSON or store it in a file. - --entry The entry point(s) of your application e.g. ./src/main.js. - -o, --output-path Output location of the file generated by webpack e.g. ./dist/. - -t, --target Sets the build target e.g. node. - -d, --devtool Determine source maps to use. - --no-devtool Do not generate source maps. - --mode Defines the mode to pass to webpack. - --name Name of the configuration. Used when loading multiple configurations. - --stats [value] It instructs webpack on how to treat the stats e.g. verbose. - --no-stats Disable stats output. - --watch-options-stdin Stop watching when stdin stream has ended. - --no-watch-options-stdin Do not stop watching when stdin stream has ended. - --host The hostname/ip address the server will bind to. - --port The port server will listen to. - --static [value...] A directory to serve static content from. - --no-static Negative 'static' option. - --live-reload Enables live reloading on changing files. - --no-live-reload Disables live reloading on changing files. - --https Use HTTPS protocol. - --no-https Do not use HTTPS protocol. - --http2 Use HTTP/2, must be used with HTTPS. - --no-http2 Do not use HTTP/2. - --bonjour Broadcasts the server via ZeroConf networking on start. - --no-bonjour Do not broadcast the server via ZeroConf networking on start. - --client-progress Print compilation progress in percentage in the browser. - --no-client-progress Do not print compilation progress in percentage in the browser. - --client-overlay Show a full-screen overlay in the browser when there are compiler errors or warnings. - --no-client-overlay Do not show a full-screen overlay in the browser when there are compiler errors or warnings. - --setup-exit-signals Close and exit the process on SIGINT and SIGTERM. - --no-setup-exit-signals Do not close and exit the process on SIGNIT and SIGTERM. - --open [value...] Open the default browser. - --no-open Do not open the default browser. - --open-app Open specified browser. - --open-target [value...] Open specified route in browser. - --no-open-target Do not open specified route in browser. - --client-logging Log level in the browser (none, error, warn, info, log, verbose). - --history-api-fallback Fallback to /index.html for Single Page Applications. - --no-history-api-fallback Do not fallback to /index.html for Single Page Applications. - --compress Enable gzip compression. - --no-compress Disable gzip compression. - --public The public hostname/ip address of the server. - --firewall [value...] Enable firewall or set hosts that are allowed to access the dev server. - --no-firewall Disable firewall. - --watch-files Watch static files for file changes. - -Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. + --config-name Name of the configuration to use. + -m, --merge Merge two or more configurations using 'webpack-merge'. + --env Environment passed to the configuration when it is a function. + --node-env Sets process.env.NODE_ENV to the specified value. + --progress [value] Print compilation progress during build. + -j, --json [value] Prints result as JSON or store it in a file. + --entry The entry point(s) of your application e.g. ./src/main.js. + -o, --output-path Output location of the file generated by webpack e.g. ./dist/. + -t, --target Sets the build target e.g. node. + -d, --devtool Determine source maps to use. + --no-devtool Do not generate source maps. + --mode Defines the mode to pass to webpack. + --name Name of the configuration. Used when loading multiple configurations. + --stats [value] It instructs webpack on how to treat the stats e.g. verbose. + --no-stats Disable stats output. + --watch-options-stdin Stop watching when stdin stream has ended. + --no-watch-options-stdin Do not stop watching when stdin stream has ended. + --host The hostname/ip address the server will bind to. + --port The port server will listen to. + --static [value...] A directory to serve static content from. + --no-static Negative 'static' option. + --static-directory Directory for static contents. + --static-public-path The bundled files will be available in the browser under this path. + --static-serve-index Tells dev-server to use serveIndex middleware. + --no-static-serve-index Do not tell dev-server to use serveIndex middleware. + --static-watch Watch for files in static content directory. + --no-static-watch Do not watch for files in static content directory. + --live-reload Enables live reloading on changing files. + --no-live-reload Disables live reloading on changing files. + --https Use HTTPS protocol. + --no-https Do not use HTTPS protocol. + --https-passphrase Passphrase for a pfx file. + --https-key Path to an SSL key. + --https-pfx Path to an SSL pfx file. + --https-cert Path to an SSL certificate. + --https-cacert Path to an SSL CA certificate. + --https-request-cert Request for an SSL certificate. + --no-https-request-cert Do not request for an SSL certificate. + --http2 Use HTTP/2, must be used with HTTPS. + --no-http2 Do not use HTTP/2. + --bonjour Broadcasts the server via ZeroConf networking on start. + --no-bonjour Do not broadcast the server via ZeroConf networking on start. + --client-progress Print compilation progress in percentage in the browser. + --no-client-progress Do not print compilation progress in percentage in the browser. + --client-overlay Show a full-screen overlay in the browser when there are compiler errors or warnings. + --no-client-overlay Do not show a full-screen overlay in the browser when there are compiler errors or warnings. + --open [value...] Open the default browser. + --no-open Do not open the default browser. + --open-app Open specified browser. + --open-target [value...] Open specified route in browser. + --no-open-target Do not open specified route in browser. + --client-logging Log level in the browser (none, error, warn, info, log, verbose). + --history-api-fallback Fallback to /index.html for Single Page Applications. + --no-history-api-fallback Do not fallback to /index.html for Single Page Applications. + --compress Enable gzip compression. + --no-compress Disable gzip compression. + --public The public hostname/ip address of the server. + --firewall [value...] Enable firewall or set hosts that are allowed to access the dev server. + --no-firewall Disable firewall. + --watch-files Watch static files for file changes. + +Global options: + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1993,62 +2077,73 @@ exports[`help should show help information for 'server' command using command sy Run the webpack dev server. Options: - -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. - --config-name Name of the configuration to use. - -m, --merge Merge two or more configurations using 'webpack-merge'. - --env Environment passed to the configuration when it is a function. - --node-env Sets process.env.NODE_ENV to the specified value. - --progress [value] Print compilation progress during build. - -j, --json [value] Prints result as JSON or store it in a file. - --entry The entry point(s) of your application e.g. ./src/main.js. - -o, --output-path Output location of the file generated by webpack e.g. ./dist/. - -t, --target Sets the build target e.g. node. - -d, --devtool Determine source maps to use. - --no-devtool Do not generate source maps. - --mode Defines the mode to pass to webpack. - --name Name of the configuration. Used when loading multiple configurations. - --stats [value] It instructs webpack on how to treat the stats e.g. verbose. - --no-stats Disable stats output. - --watch-options-stdin Stop watching when stdin stream has ended. - --no-watch-options-stdin Do not stop watching when stdin stream has ended. - --host The hostname/ip address the server will bind to. - --port The port server will listen to. - --static [value...] A directory to serve static content from. - --no-static Negative 'static' option. - --live-reload Enables live reloading on changing files. - --no-live-reload Disables live reloading on changing files. - --https Use HTTPS protocol. - --no-https Do not use HTTPS protocol. - --http2 Use HTTP/2, must be used with HTTPS. - --no-http2 Do not use HTTP/2. - --bonjour Broadcasts the server via ZeroConf networking on start. - --no-bonjour Do not broadcast the server via ZeroConf networking on start. - --client-progress Print compilation progress in percentage in the browser. - --no-client-progress Do not print compilation progress in percentage in the browser. - --client-overlay Show a full-screen overlay in the browser when there are compiler errors or warnings. - --no-client-overlay Do not show a full-screen overlay in the browser when there are compiler errors or warnings. - --setup-exit-signals Close and exit the process on SIGINT and SIGTERM. - --no-setup-exit-signals Do not close and exit the process on SIGNIT and SIGTERM. - --open [value...] Open the default browser. - --no-open Do not open the default browser. - --open-app Open specified browser. - --open-target [value...] Open specified route in browser. - --no-open-target Do not open specified route in browser. - --client-logging Log level in the browser (none, error, warn, info, log, verbose). - --history-api-fallback Fallback to /index.html for Single Page Applications. - --no-history-api-fallback Do not fallback to /index.html for Single Page Applications. - --compress Enable gzip compression. - --no-compress Disable gzip compression. - --public The public hostname/ip address of the server. - --firewall [value...] Enable firewall or set hosts that are allowed to access the dev server. - --no-firewall Disable firewall. - --watch-files Watch static files for file changes. - -Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. + --config-name Name of the configuration to use. + -m, --merge Merge two or more configurations using 'webpack-merge'. + --env Environment passed to the configuration when it is a function. + --node-env Sets process.env.NODE_ENV to the specified value. + --progress [value] Print compilation progress during build. + -j, --json [value] Prints result as JSON or store it in a file. + --entry The entry point(s) of your application e.g. ./src/main.js. + -o, --output-path Output location of the file generated by webpack e.g. ./dist/. + -t, --target Sets the build target e.g. node. + -d, --devtool Determine source maps to use. + --no-devtool Do not generate source maps. + --mode Defines the mode to pass to webpack. + --name Name of the configuration. Used when loading multiple configurations. + --stats [value] It instructs webpack on how to treat the stats e.g. verbose. + --no-stats Disable stats output. + --watch-options-stdin Stop watching when stdin stream has ended. + --no-watch-options-stdin Do not stop watching when stdin stream has ended. + --host The hostname/ip address the server will bind to. + --port The port server will listen to. + --static [value...] A directory to serve static content from. + --no-static Negative 'static' option. + --static-directory Directory for static contents. + --static-public-path The bundled files will be available in the browser under this path. + --static-serve-index Tells dev-server to use serveIndex middleware. + --no-static-serve-index Do not tell dev-server to use serveIndex middleware. + --static-watch Watch for files in static content directory. + --no-static-watch Do not watch for files in static content directory. + --live-reload Enables live reloading on changing files. + --no-live-reload Disables live reloading on changing files. + --https Use HTTPS protocol. + --no-https Do not use HTTPS protocol. + --https-passphrase Passphrase for a pfx file. + --https-key Path to an SSL key. + --https-pfx Path to an SSL pfx file. + --https-cert Path to an SSL certificate. + --https-cacert Path to an SSL CA certificate. + --https-request-cert Request for an SSL certificate. + --no-https-request-cert Do not request for an SSL certificate. + --http2 Use HTTP/2, must be used with HTTPS. + --no-http2 Do not use HTTP/2. + --bonjour Broadcasts the server via ZeroConf networking on start. + --no-bonjour Do not broadcast the server via ZeroConf networking on start. + --client-progress Print compilation progress in percentage in the browser. + --no-client-progress Do not print compilation progress in percentage in the browser. + --client-overlay Show a full-screen overlay in the browser when there are compiler errors or warnings. + --no-client-overlay Do not show a full-screen overlay in the browser when there are compiler errors or warnings. + --open [value...] Open the default browser. + --no-open Do not open the default browser. + --open-app Open specified browser. + --open-target [value...] Open specified route in browser. + --no-open-target Do not open specified route in browser. + --client-logging Log level in the browser (none, error, warn, info, log, verbose). + --history-api-fallback Fallback to /index.html for Single Page Applications. + --no-history-api-fallback Do not fallback to /index.html for Single Page Applications. + --compress Enable gzip compression. + --no-compress Disable gzip compression. + --public The public hostname/ip address of the server. + --firewall [value...] Enable firewall or set hosts that are allowed to access the dev server. + --no-firewall Disable firewall. + --watch-files Watch static files for file changes. + +Global options: + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -2065,62 +2160,73 @@ exports[`help should show help information for 'server' command using the "--hel Run the webpack dev server. Options: - -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. - --config-name Name of the configuration to use. - -m, --merge Merge two or more configurations using 'webpack-merge'. - --env Environment passed to the configuration when it is a function. - --node-env Sets process.env.NODE_ENV to the specified value. - --progress [value] Print compilation progress during build. - -j, --json [value] Prints result as JSON or store it in a file. - --entry The entry point(s) of your application e.g. ./src/main.js. - -o, --output-path Output location of the file generated by webpack e.g. ./dist/. - -t, --target Sets the build target e.g. node. - -d, --devtool Determine source maps to use. - --no-devtool Do not generate source maps. - --mode Defines the mode to pass to webpack. - --name Name of the configuration. Used when loading multiple configurations. - --stats [value] It instructs webpack on how to treat the stats e.g. verbose. - --no-stats Disable stats output. - --watch-options-stdin Stop watching when stdin stream has ended. - --no-watch-options-stdin Do not stop watching when stdin stream has ended. - --host The hostname/ip address the server will bind to. - --port The port server will listen to. - --static [value...] A directory to serve static content from. - --no-static Negative 'static' option. - --live-reload Enables live reloading on changing files. - --no-live-reload Disables live reloading on changing files. - --https Use HTTPS protocol. - --no-https Do not use HTTPS protocol. - --http2 Use HTTP/2, must be used with HTTPS. - --no-http2 Do not use HTTP/2. - --bonjour Broadcasts the server via ZeroConf networking on start. - --no-bonjour Do not broadcast the server via ZeroConf networking on start. - --client-progress Print compilation progress in percentage in the browser. - --no-client-progress Do not print compilation progress in percentage in the browser. - --client-overlay Show a full-screen overlay in the browser when there are compiler errors or warnings. - --no-client-overlay Do not show a full-screen overlay in the browser when there are compiler errors or warnings. - --setup-exit-signals Close and exit the process on SIGINT and SIGTERM. - --no-setup-exit-signals Do not close and exit the process on SIGNIT and SIGTERM. - --open [value...] Open the default browser. - --no-open Do not open the default browser. - --open-app Open specified browser. - --open-target [value...] Open specified route in browser. - --no-open-target Do not open specified route in browser. - --client-logging Log level in the browser (none, error, warn, info, log, verbose). - --history-api-fallback Fallback to /index.html for Single Page Applications. - --no-history-api-fallback Do not fallback to /index.html for Single Page Applications. - --compress Enable gzip compression. - --no-compress Disable gzip compression. - --public The public hostname/ip address of the server. - --firewall [value...] Enable firewall or set hosts that are allowed to access the dev server. - --no-firewall Disable firewall. - --watch-files Watch static files for file changes. - -Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. + --config-name Name of the configuration to use. + -m, --merge Merge two or more configurations using 'webpack-merge'. + --env Environment passed to the configuration when it is a function. + --node-env Sets process.env.NODE_ENV to the specified value. + --progress [value] Print compilation progress during build. + -j, --json [value] Prints result as JSON or store it in a file. + --entry The entry point(s) of your application e.g. ./src/main.js. + -o, --output-path Output location of the file generated by webpack e.g. ./dist/. + -t, --target Sets the build target e.g. node. + -d, --devtool Determine source maps to use. + --no-devtool Do not generate source maps. + --mode Defines the mode to pass to webpack. + --name Name of the configuration. Used when loading multiple configurations. + --stats [value] It instructs webpack on how to treat the stats e.g. verbose. + --no-stats Disable stats output. + --watch-options-stdin Stop watching when stdin stream has ended. + --no-watch-options-stdin Do not stop watching when stdin stream has ended. + --host The hostname/ip address the server will bind to. + --port The port server will listen to. + --static [value...] A directory to serve static content from. + --no-static Negative 'static' option. + --static-directory Directory for static contents. + --static-public-path The bundled files will be available in the browser under this path. + --static-serve-index Tells dev-server to use serveIndex middleware. + --no-static-serve-index Do not tell dev-server to use serveIndex middleware. + --static-watch Watch for files in static content directory. + --no-static-watch Do not watch for files in static content directory. + --live-reload Enables live reloading on changing files. + --no-live-reload Disables live reloading on changing files. + --https Use HTTPS protocol. + --no-https Do not use HTTPS protocol. + --https-passphrase Passphrase for a pfx file. + --https-key Path to an SSL key. + --https-pfx Path to an SSL pfx file. + --https-cert Path to an SSL certificate. + --https-cacert Path to an SSL CA certificate. + --https-request-cert Request for an SSL certificate. + --no-https-request-cert Do not request for an SSL certificate. + --http2 Use HTTP/2, must be used with HTTPS. + --no-http2 Do not use HTTP/2. + --bonjour Broadcasts the server via ZeroConf networking on start. + --no-bonjour Do not broadcast the server via ZeroConf networking on start. + --client-progress Print compilation progress in percentage in the browser. + --no-client-progress Do not print compilation progress in percentage in the browser. + --client-overlay Show a full-screen overlay in the browser when there are compiler errors or warnings. + --no-client-overlay Do not show a full-screen overlay in the browser when there are compiler errors or warnings. + --open [value...] Open the default browser. + --no-open Do not open the default browser. + --open-app Open specified browser. + --open-target [value...] Open specified route in browser. + --no-open-target Do not open specified route in browser. + --client-logging Log level in the browser (none, error, warn, info, log, verbose). + --history-api-fallback Fallback to /index.html for Single Page Applications. + --no-history-api-fallback Do not fallback to /index.html for Single Page Applications. + --compress Enable gzip compression. + --no-compress Disable gzip compression. + --public The public hostname/ip address of the server. + --firewall [value...] Enable firewall or set hosts that are allowed to access the dev server. + --no-firewall Disable firewall. + --watch-files Watch static files for file changes. + +Global options: + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -2706,7 +2812,7 @@ exports[`help should show help information with options for sub commands: stdout Outputs information about your system. Options: - --output To get the output in a specified format ( accept json or markdown ) + -o, --output To get the output in a specified format ( accept json or markdown ) Global options: --color Enable colors on console. diff --git a/test/help/__snapshots__/help.test.js.snap.devServer4.webpack5 b/test/help/__snapshots__/help.test.js.snap.devServer4.webpack5 index 41daf2d2042..3fa2c24e7bb 100644 --- a/test/help/__snapshots__/help.test.js.snap.devServer4.webpack5 +++ b/test/help/__snapshots__/help.test.js.snap.devServer4.webpack5 @@ -540,17 +540,17 @@ exports[`help should show help information for 'c' command using command syntax: Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -567,17 +567,17 @@ exports[`help should show help information for 'c' command using the "--help" op Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -676,17 +676,17 @@ exports[`help should show help information for 'create' command using command sy Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -703,17 +703,17 @@ exports[`help should show help information for 'create' command using the "--hel Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -730,7 +730,7 @@ exports[`help should show help information for 'i' command using command syntax: Outputs information about your system. Options: - --output To get the output in a specified format ( accept json or markdown ) + -o, --output To get the output in a specified format ( accept json or markdown ) Global options: --color Enable colors on console. @@ -753,7 +753,7 @@ exports[`help should show help information for 'i' command using the "--help" op Outputs information about your system. Options: - --output To get the output in a specified format ( accept json or markdown ) + -o, --output To get the output in a specified format ( accept json or markdown ) Global options: --color Enable colors on console. @@ -776,7 +776,7 @@ exports[`help should show help information for 'info' and respect the "--color" Outputs information about your system. Options: - --output To get the output in a specified format ( accept json + -o, --output To get the output in a specified format ( accept json or markdown ) Global options: @@ -801,7 +801,7 @@ exports[`help should show help information for 'info' and respect the "--no-colo Outputs information about your system. Options: - --output To get the output in a specified format ( accept json + -o, --output To get the output in a specified format ( accept json or markdown ) Global options: @@ -826,7 +826,7 @@ exports[`help should show help information for 'info' command using command synt Outputs information about your system. Options: - --output To get the output in a specified format ( accept json or markdown ) + -o, --output To get the output in a specified format ( accept json or markdown ) Global options: --color Enable colors on console. @@ -849,7 +849,7 @@ exports[`help should show help information for 'info' command using the "--help" Outputs information about your system. Options: - --output To get the output in a specified format ( accept json or markdown ) + -o, --output To get the output in a specified format ( accept json or markdown ) Global options: --color Enable colors on console. @@ -872,19 +872,20 @@ exports[`help should show help information for 'init' and respect the "--color" Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. + ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default - answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default + answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' - and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' + and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -901,19 +902,20 @@ exports[`help should show help information for 'init' and respect the "--no-colo Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. + ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default - answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default + answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' - and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' + and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -930,17 +932,17 @@ exports[`help should show help information for 'init' command using command synt Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -957,17 +959,17 @@ exports[`help should show help information for 'init' command using the "--help" Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -984,16 +986,16 @@ exports[`help should show help information for 'l' command using command syntax: Scaffold a loader. Arguments: - output-path Path to the output directory, e.g. ./loaderName + output-path Path to the output directory, e.g. ./loaderName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1010,16 +1012,16 @@ exports[`help should show help information for 'l' command using the "--help" op Scaffold a loader. Arguments: - output-path Path to the output directory, e.g. ./loaderName + output-path Path to the output directory, e.g. ./loaderName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1036,17 +1038,17 @@ exports[`help should show help information for 'loader' and respect the "--color Scaffold a loader. Arguments: - output-path Path to the output directory, e.g. ./loaderName + output-path Path to the output directory, e.g. ./loaderName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' - and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' + and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1063,17 +1065,17 @@ exports[`help should show help information for 'loader' and respect the "--no-co Scaffold a loader. Arguments: - output-path Path to the output directory, e.g. ./loaderName + output-path Path to the output directory, e.g. ./loaderName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' - and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' + and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1090,16 +1092,16 @@ exports[`help should show help information for 'loader' command using command sy Scaffold a loader. Arguments: - output-path Path to the output directory, e.g. ./loaderName + output-path Path to the output directory, e.g. ./loaderName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1116,16 +1118,16 @@ exports[`help should show help information for 'loader' command using the "--hel Scaffold a loader. Arguments: - output-path Path to the output directory, e.g. ./loaderName + output-path Path to the output directory, e.g. ./loaderName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1264,17 +1266,17 @@ exports[`help should show help information for 'n' command using command syntax: Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1291,17 +1293,17 @@ exports[`help should show help information for 'n' command using the "--help" op Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1318,17 +1320,17 @@ exports[`help should show help information for 'new' command using command synta Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1345,17 +1347,17 @@ exports[`help should show help information for 'new' command using the "--help" Initialize a new webpack project. Arguments: - generation-path Path to the installation directory, e.g. ./projectName + generation-path Path to the installation directory, e.g. ./projectName Options: - --template Type of template (default: \\"default\\") - --force Generate without questions (ideally) using default answers + -t, --template Type of template (default: \\"default\\") + -f, --force Generate without questions (ideally) using default answers Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1372,16 +1374,16 @@ exports[`help should show help information for 'p' command using command syntax: Scaffold a plugin. Arguments: - output-path Path to the output directory, e.g. ./pluginName + output-path Path to the output directory, e.g. ./pluginName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1398,16 +1400,16 @@ exports[`help should show help information for 'p' command using the "--help" op Scaffold a plugin. Arguments: - output-path Path to the output directory, e.g. ./pluginName + output-path Path to the output directory, e.g. ./pluginName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1424,17 +1426,17 @@ exports[`help should show help information for 'plugin' and respect the "--color Scaffold a plugin. Arguments: - output-path Path to the output directory, e.g. ./pluginName + output-path Path to the output directory, e.g. ./pluginName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' - and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' + and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1451,17 +1453,17 @@ exports[`help should show help information for 'plugin' and respect the "--no-co Scaffold a plugin. Arguments: - output-path Path to the output directory, e.g. ./pluginName + output-path Path to the output directory, e.g. ./pluginName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' - and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' + and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1478,16 +1480,16 @@ exports[`help should show help information for 'plugin' command using command sy Scaffold a plugin. Arguments: - output-path Path to the output directory, e.g. ./pluginName + output-path Path to the output directory, e.g. ./pluginName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1504,16 +1506,16 @@ exports[`help should show help information for 'plugin' command using the "--hel Scaffold a plugin. Arguments: - output-path Path to the output directory, e.g. ./pluginName + output-path Path to the output directory, e.g. ./pluginName Options: - --template Type of template (default: \\"default\\") + -t, --template Type of template (default: \\"default\\") Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1530,63 +1532,74 @@ exports[`help should show help information for 's' command using command syntax: Run the webpack dev server. Options: - -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. - --config-name Name of the configuration to use. - -m, --merge Merge two or more configurations using 'webpack-merge'. - --env Environment passed to the configuration when it is a function. - --node-env Sets process.env.NODE_ENV to the specified value. - --progress [value] Print compilation progress during build. - -j, --json [value] Prints result as JSON or store it in a file. - -d, --devtool Determine source maps to use. - --no-devtool Do not generate source maps. - --entry The entry point(s) of your application e.g. ./src/main.js. - --mode Defines the mode to pass to webpack. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path Output location of the file generated by webpack e.g. ./dist/. - --stats [value] It instructs webpack on how to treat the stats e.g. verbose. - --no-stats Disable stats output. - -t, --target Sets the build target e.g. node. - --no-target Negative 'target' option. - --watch-options-stdin Stop watching when stdin stream has ended. - --no-watch-options-stdin Do not stop watching when stdin stream has ended. - --host The hostname/ip address the server will bind to. - --port The port server will listen to. - --static [value...] A directory to serve static content from. - --no-static Negative 'static' option. - --live-reload Enables live reloading on changing files. - --no-live-reload Disables live reloading on changing files. - --https Use HTTPS protocol. - --no-https Do not use HTTPS protocol. - --http2 Use HTTP/2, must be used with HTTPS. - --no-http2 Do not use HTTP/2. - --bonjour Broadcasts the server via ZeroConf networking on start. - --no-bonjour Do not broadcast the server via ZeroConf networking on start. - --client-progress Print compilation progress in percentage in the browser. - --no-client-progress Do not print compilation progress in percentage in the browser. - --client-overlay Show a full-screen overlay in the browser when there are compiler errors or warnings. - --no-client-overlay Do not show a full-screen overlay in the browser when there are compiler errors or warnings. - --setup-exit-signals Close and exit the process on SIGINT and SIGTERM. - --no-setup-exit-signals Do not close and exit the process on SIGNIT and SIGTERM. - --open [value...] Open the default browser. - --no-open Do not open the default browser. - --open-app Open specified browser. - --open-target [value...] Open specified route in browser. - --no-open-target Do not open specified route in browser. - --client-logging Log level in the browser (none, error, warn, info, log, verbose). - --history-api-fallback Fallback to /index.html for Single Page Applications. - --no-history-api-fallback Do not fallback to /index.html for Single Page Applications. - --compress Enable gzip compression. - --no-compress Disable gzip compression. - --public The public hostname/ip address of the server. - --firewall [value...] Enable firewall or set hosts that are allowed to access the dev server. - --no-firewall Disable firewall. - --watch-files Watch static files for file changes. - -Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. + --config-name Name of the configuration to use. + -m, --merge Merge two or more configurations using 'webpack-merge'. + --env Environment passed to the configuration when it is a function. + --node-env Sets process.env.NODE_ENV to the specified value. + --progress [value] Print compilation progress during build. + -j, --json [value] Prints result as JSON or store it in a file. + -d, --devtool Determine source maps to use. + --no-devtool Do not generate source maps. + --entry The entry point(s) of your application e.g. ./src/main.js. + --mode Defines the mode to pass to webpack. + --name Name of the configuration. Used when loading multiple configurations. + -o, --output-path Output location of the file generated by webpack e.g. ./dist/. + --stats [value] It instructs webpack on how to treat the stats e.g. verbose. + --no-stats Disable stats output. + -t, --target Sets the build target e.g. node. + --no-target Negative 'target' option. + --watch-options-stdin Stop watching when stdin stream has ended. + --no-watch-options-stdin Do not stop watching when stdin stream has ended. + --host The hostname/ip address the server will bind to. + --port The port server will listen to. + --static [value...] A directory to serve static content from. + --no-static Negative 'static' option. + --static-directory Directory for static contents. + --static-public-path The bundled files will be available in the browser under this path. + --static-serve-index Tells dev-server to use serveIndex middleware. + --no-static-serve-index Do not tell dev-server to use serveIndex middleware. + --static-watch Watch for files in static content directory. + --no-static-watch Do not watch for files in static content directory. + --live-reload Enables live reloading on changing files. + --no-live-reload Disables live reloading on changing files. + --https Use HTTPS protocol. + --no-https Do not use HTTPS protocol. + --https-passphrase Passphrase for a pfx file. + --https-key Path to an SSL key. + --https-pfx Path to an SSL pfx file. + --https-cert Path to an SSL certificate. + --https-cacert Path to an SSL CA certificate. + --https-request-cert Request for an SSL certificate. + --no-https-request-cert Do not request for an SSL certificate. + --http2 Use HTTP/2, must be used with HTTPS. + --no-http2 Do not use HTTP/2. + --bonjour Broadcasts the server via ZeroConf networking on start. + --no-bonjour Do not broadcast the server via ZeroConf networking on start. + --client-progress Print compilation progress in percentage in the browser. + --no-client-progress Do not print compilation progress in percentage in the browser. + --client-overlay Show a full-screen overlay in the browser when there are compiler errors or warnings. + --no-client-overlay Do not show a full-screen overlay in the browser when there are compiler errors or warnings. + --open [value...] Open the default browser. + --no-open Do not open the default browser. + --open-app Open specified browser. + --open-target [value...] Open specified route in browser. + --no-open-target Do not open specified route in browser. + --client-logging Log level in the browser (none, error, warn, info, log, verbose). + --history-api-fallback Fallback to /index.html for Single Page Applications. + --no-history-api-fallback Do not fallback to /index.html for Single Page Applications. + --compress Enable gzip compression. + --no-compress Disable gzip compression. + --public The public hostname/ip address of the server. + --firewall [value...] Enable firewall or set hosts that are allowed to access the dev server. + --no-firewall Disable firewall. + --watch-files Watch static files for file changes. + +Global options: + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1603,63 +1616,74 @@ exports[`help should show help information for 's' command using the "--help" op Run the webpack dev server. Options: - -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. - --config-name Name of the configuration to use. - -m, --merge Merge two or more configurations using 'webpack-merge'. - --env Environment passed to the configuration when it is a function. - --node-env Sets process.env.NODE_ENV to the specified value. - --progress [value] Print compilation progress during build. - -j, --json [value] Prints result as JSON or store it in a file. - -d, --devtool Determine source maps to use. - --no-devtool Do not generate source maps. - --entry The entry point(s) of your application e.g. ./src/main.js. - --mode Defines the mode to pass to webpack. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path Output location of the file generated by webpack e.g. ./dist/. - --stats [value] It instructs webpack on how to treat the stats e.g. verbose. - --no-stats Disable stats output. - -t, --target Sets the build target e.g. node. - --no-target Negative 'target' option. - --watch-options-stdin Stop watching when stdin stream has ended. - --no-watch-options-stdin Do not stop watching when stdin stream has ended. - --host The hostname/ip address the server will bind to. - --port The port server will listen to. - --static [value...] A directory to serve static content from. - --no-static Negative 'static' option. - --live-reload Enables live reloading on changing files. - --no-live-reload Disables live reloading on changing files. - --https Use HTTPS protocol. - --no-https Do not use HTTPS protocol. - --http2 Use HTTP/2, must be used with HTTPS. - --no-http2 Do not use HTTP/2. - --bonjour Broadcasts the server via ZeroConf networking on start. - --no-bonjour Do not broadcast the server via ZeroConf networking on start. - --client-progress Print compilation progress in percentage in the browser. - --no-client-progress Do not print compilation progress in percentage in the browser. - --client-overlay Show a full-screen overlay in the browser when there are compiler errors or warnings. - --no-client-overlay Do not show a full-screen overlay in the browser when there are compiler errors or warnings. - --setup-exit-signals Close and exit the process on SIGINT and SIGTERM. - --no-setup-exit-signals Do not close and exit the process on SIGNIT and SIGTERM. - --open [value...] Open the default browser. - --no-open Do not open the default browser. - --open-app Open specified browser. - --open-target [value...] Open specified route in browser. - --no-open-target Do not open specified route in browser. - --client-logging Log level in the browser (none, error, warn, info, log, verbose). - --history-api-fallback Fallback to /index.html for Single Page Applications. - --no-history-api-fallback Do not fallback to /index.html for Single Page Applications. - --compress Enable gzip compression. - --no-compress Disable gzip compression. - --public The public hostname/ip address of the server. - --firewall [value...] Enable firewall or set hosts that are allowed to access the dev server. - --no-firewall Disable firewall. - --watch-files Watch static files for file changes. - -Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. + --config-name Name of the configuration to use. + -m, --merge Merge two or more configurations using 'webpack-merge'. + --env Environment passed to the configuration when it is a function. + --node-env Sets process.env.NODE_ENV to the specified value. + --progress [value] Print compilation progress during build. + -j, --json [value] Prints result as JSON or store it in a file. + -d, --devtool Determine source maps to use. + --no-devtool Do not generate source maps. + --entry The entry point(s) of your application e.g. ./src/main.js. + --mode Defines the mode to pass to webpack. + --name Name of the configuration. Used when loading multiple configurations. + -o, --output-path Output location of the file generated by webpack e.g. ./dist/. + --stats [value] It instructs webpack on how to treat the stats e.g. verbose. + --no-stats Disable stats output. + -t, --target Sets the build target e.g. node. + --no-target Negative 'target' option. + --watch-options-stdin Stop watching when stdin stream has ended. + --no-watch-options-stdin Do not stop watching when stdin stream has ended. + --host The hostname/ip address the server will bind to. + --port The port server will listen to. + --static [value...] A directory to serve static content from. + --no-static Negative 'static' option. + --static-directory Directory for static contents. + --static-public-path The bundled files will be available in the browser under this path. + --static-serve-index Tells dev-server to use serveIndex middleware. + --no-static-serve-index Do not tell dev-server to use serveIndex middleware. + --static-watch Watch for files in static content directory. + --no-static-watch Do not watch for files in static content directory. + --live-reload Enables live reloading on changing files. + --no-live-reload Disables live reloading on changing files. + --https Use HTTPS protocol. + --no-https Do not use HTTPS protocol. + --https-passphrase Passphrase for a pfx file. + --https-key Path to an SSL key. + --https-pfx Path to an SSL pfx file. + --https-cert Path to an SSL certificate. + --https-cacert Path to an SSL CA certificate. + --https-request-cert Request for an SSL certificate. + --no-https-request-cert Do not request for an SSL certificate. + --http2 Use HTTP/2, must be used with HTTPS. + --no-http2 Do not use HTTP/2. + --bonjour Broadcasts the server via ZeroConf networking on start. + --no-bonjour Do not broadcast the server via ZeroConf networking on start. + --client-progress Print compilation progress in percentage in the browser. + --no-client-progress Do not print compilation progress in percentage in the browser. + --client-overlay Show a full-screen overlay in the browser when there are compiler errors or warnings. + --no-client-overlay Do not show a full-screen overlay in the browser when there are compiler errors or warnings. + --open [value...] Open the default browser. + --no-open Do not open the default browser. + --open-app Open specified browser. + --open-target [value...] Open specified route in browser. + --no-open-target Do not open specified route in browser. + --client-logging Log level in the browser (none, error, warn, info, log, verbose). + --history-api-fallback Fallback to /index.html for Single Page Applications. + --no-history-api-fallback Do not fallback to /index.html for Single Page Applications. + --compress Enable gzip compression. + --no-compress Disable gzip compression. + --public The public hostname/ip address of the server. + --firewall [value...] Enable firewall or set hosts that are allowed to access the dev server. + --no-firewall Disable firewall. + --watch-files Watch static files for file changes. + +Global options: + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1676,83 +1700,102 @@ exports[`help should show help information for 'serve' and respect the "--color" Run the webpack dev server. Options: - -c, --config Provide path to a webpack configuration file e.g. - ./webpack.config.js. - --config-name Name of the configuration to use. - -m, --merge Merge two or more configurations using - 'webpack-merge'. - --env Environment passed to the configuration when it is - a function. - --node-env Sets process.env.NODE_ENV to the specified value. - --progress [value] Print compilation progress during build. - -j, --json [value] Prints result as JSON or store it in a file. - -d, --devtool Determine source maps to use. - --no-devtool Do not generate source maps. - --entry The entry point(s) of your application e.g. - ./src/main.js. - --mode Defines the mode to pass to webpack. - --name Name of the configuration. Used when loading - multiple configurations. - -o, --output-path Output location of the file generated by webpack - e.g. ./dist/. - --stats [value] It instructs webpack on how to treat the stats - e.g. verbose. - --no-stats Disable stats output. - -t, --target Sets the build target e.g. node. - --no-target Negative 'target' option. - --watch-options-stdin Stop watching when stdin stream has ended. - --no-watch-options-stdin Do not stop watching when stdin stream has ended. - --host The hostname/ip address the server will bind to. - --port The port server will listen to. - --static [value...] A directory to serve static content from. - --no-static Negative 'static' option. - --live-reload Enables live reloading on changing files. - --no-live-reload Disables live reloading on changing files. - --https Use HTTPS protocol. - --no-https Do not use HTTPS protocol. - --http2 Use HTTP/2, must be used with HTTPS. - --no-http2 Do not use HTTP/2. - --bonjour Broadcasts the server via ZeroConf networking on - start. - --no-bonjour Do not broadcast the server via ZeroConf - networking on start. - --client-progress Print compilation progress in percentage in the - browser. - --no-client-progress Do not print compilation progress in percentage in - the browser. - --client-overlay Show a full-screen overlay in the browser when - there are compiler errors or warnings. - --no-client-overlay Do not show a full-screen overlay in the browser - when there are compiler errors or warnings. - --setup-exit-signals Close and exit the process on SIGINT and SIGTERM. - --no-setup-exit-signals Do not close and exit the process on SIGNIT and - SIGTERM. - --open [value...] Open the default browser. - --no-open Do not open the default browser. - --open-app Open specified browser. - --open-target [value...] Open specified route in browser. - --no-open-target Do not open specified route in browser. - --client-logging Log level in the browser (none, error, warn, info, - log, verbose). - --history-api-fallback Fallback to /index.html for Single Page - Applications. - --no-history-api-fallback Do not fallback to /index.html for Single Page - Applications. - --compress Enable gzip compression. - --no-compress Disable gzip compression. - --public The public hostname/ip address of the server. - --firewall [value...] Enable firewall or set hosts that are allowed to - access the dev server. - --no-firewall Disable firewall. - --watch-files Watch static files for file changes. - -Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', - 'webpack-cli' and 'webpack-dev-server' and - commands. - -h, --help [verbose] Display help for commands and options. + -c, --config Provide path to a webpack configuration file + e.g. ./webpack.config.js. + --config-name Name of the configuration to use. + -m, --merge Merge two or more configurations using + 'webpack-merge'. + --env Environment passed to the configuration when + it is a function. + --node-env Sets process.env.NODE_ENV to the specified + value. + --progress [value] Print compilation progress during build. + -j, --json [value] Prints result as JSON or store it in a file. + -d, --devtool Determine source maps to use. + --no-devtool Do not generate source maps. + --entry The entry point(s) of your application e.g. + ./src/main.js. + --mode Defines the mode to pass to webpack. + --name Name of the configuration. Used when loading + multiple configurations. + -o, --output-path Output location of the file generated by + webpack e.g. ./dist/. + --stats [value] It instructs webpack on how to treat the + stats e.g. verbose. + --no-stats Disable stats output. + -t, --target Sets the build target e.g. node. + --no-target Negative 'target' option. + --watch-options-stdin Stop watching when stdin stream has ended. + --no-watch-options-stdin Do not stop watching when stdin stream has + ended. + --host The hostname/ip address the server will bind + to. + --port The port server will listen to. + --static [value...] A directory to serve static content from. + --no-static Negative 'static' option. + --static-directory Directory for static contents. + --static-public-path The bundled files will be available in the + browser under this path. + --static-serve-index Tells dev-server to use serveIndex + middleware. + --no-static-serve-index Do not tell dev-server to use serveIndex + middleware. + --static-watch Watch for files in static content directory. + --no-static-watch Do not watch for files in static content + directory. + --live-reload Enables live reloading on changing files. + --no-live-reload Disables live reloading on changing files. + --https Use HTTPS protocol. + --no-https Do not use HTTPS protocol. + --https-passphrase Passphrase for a pfx file. + --https-key Path to an SSL key. + --https-pfx Path to an SSL pfx file. + --https-cert Path to an SSL certificate. + --https-cacert Path to an SSL CA certificate. + --https-request-cert Request for an SSL certificate. + --no-https-request-cert Do not request for an SSL certificate. + --http2 Use HTTP/2, must be used with HTTPS. + --no-http2 Do not use HTTP/2. + --bonjour Broadcasts the server via ZeroConf + networking on start. + --no-bonjour Do not broadcast the server via ZeroConf + networking on start. + --client-progress Print compilation progress in percentage in + the browser. + --no-client-progress Do not print compilation progress in + percentage in the browser. + --client-overlay Show a full-screen overlay in the browser + when there are compiler errors or warnings. + --no-client-overlay Do not show a full-screen overlay in the + browser when there are compiler errors or + warnings. + --open [value...] Open the default browser. + --no-open Do not open the default browser. + --open-app Open specified browser. + --open-target [value...] Open specified route in browser. + --no-open-target Do not open specified route in browser. + --client-logging Log level in the browser (none, error, warn, + info, log, verbose). + --history-api-fallback Fallback to /index.html for Single Page + Applications. + --no-history-api-fallback Do not fallback to /index.html for Single + Page Applications. + --compress Enable gzip compression. + --no-compress Disable gzip compression. + --public The public hostname/ip address of the + server. + --firewall [value...] Enable firewall or set hosts that are + allowed to access the dev server. + --no-firewall Disable firewall. + --watch-files Watch static files for file changes. + +Global options: + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', + 'webpack-cli' and 'webpack-dev-server' and + commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1769,83 +1812,102 @@ exports[`help should show help information for 'serve' and respect the "--no-col Run the webpack dev server. Options: - -c, --config Provide path to a webpack configuration file e.g. - ./webpack.config.js. - --config-name Name of the configuration to use. - -m, --merge Merge two or more configurations using - 'webpack-merge'. - --env Environment passed to the configuration when it is - a function. - --node-env Sets process.env.NODE_ENV to the specified value. - --progress [value] Print compilation progress during build. - -j, --json [value] Prints result as JSON or store it in a file. - -d, --devtool Determine source maps to use. - --no-devtool Do not generate source maps. - --entry The entry point(s) of your application e.g. - ./src/main.js. - --mode Defines the mode to pass to webpack. - --name Name of the configuration. Used when loading - multiple configurations. - -o, --output-path Output location of the file generated by webpack - e.g. ./dist/. - --stats [value] It instructs webpack on how to treat the stats - e.g. verbose. - --no-stats Disable stats output. - -t, --target Sets the build target e.g. node. - --no-target Negative 'target' option. - --watch-options-stdin Stop watching when stdin stream has ended. - --no-watch-options-stdin Do not stop watching when stdin stream has ended. - --host The hostname/ip address the server will bind to. - --port The port server will listen to. - --static [value...] A directory to serve static content from. - --no-static Negative 'static' option. - --live-reload Enables live reloading on changing files. - --no-live-reload Disables live reloading on changing files. - --https Use HTTPS protocol. - --no-https Do not use HTTPS protocol. - --http2 Use HTTP/2, must be used with HTTPS. - --no-http2 Do not use HTTP/2. - --bonjour Broadcasts the server via ZeroConf networking on - start. - --no-bonjour Do not broadcast the server via ZeroConf - networking on start. - --client-progress Print compilation progress in percentage in the - browser. - --no-client-progress Do not print compilation progress in percentage in - the browser. - --client-overlay Show a full-screen overlay in the browser when - there are compiler errors or warnings. - --no-client-overlay Do not show a full-screen overlay in the browser - when there are compiler errors or warnings. - --setup-exit-signals Close and exit the process on SIGINT and SIGTERM. - --no-setup-exit-signals Do not close and exit the process on SIGNIT and - SIGTERM. - --open [value...] Open the default browser. - --no-open Do not open the default browser. - --open-app Open specified browser. - --open-target [value...] Open specified route in browser. - --no-open-target Do not open specified route in browser. - --client-logging Log level in the browser (none, error, warn, info, - log, verbose). - --history-api-fallback Fallback to /index.html for Single Page - Applications. - --no-history-api-fallback Do not fallback to /index.html for Single Page - Applications. - --compress Enable gzip compression. - --no-compress Disable gzip compression. - --public The public hostname/ip address of the server. - --firewall [value...] Enable firewall or set hosts that are allowed to - access the dev server. - --no-firewall Disable firewall. - --watch-files Watch static files for file changes. - -Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', - 'webpack-cli' and 'webpack-dev-server' and - commands. - -h, --help [verbose] Display help for commands and options. + -c, --config Provide path to a webpack configuration file + e.g. ./webpack.config.js. + --config-name Name of the configuration to use. + -m, --merge Merge two or more configurations using + 'webpack-merge'. + --env Environment passed to the configuration when + it is a function. + --node-env Sets process.env.NODE_ENV to the specified + value. + --progress [value] Print compilation progress during build. + -j, --json [value] Prints result as JSON or store it in a file. + -d, --devtool Determine source maps to use. + --no-devtool Do not generate source maps. + --entry The entry point(s) of your application e.g. + ./src/main.js. + --mode Defines the mode to pass to webpack. + --name Name of the configuration. Used when loading + multiple configurations. + -o, --output-path Output location of the file generated by + webpack e.g. ./dist/. + --stats [value] It instructs webpack on how to treat the + stats e.g. verbose. + --no-stats Disable stats output. + -t, --target Sets the build target e.g. node. + --no-target Negative 'target' option. + --watch-options-stdin Stop watching when stdin stream has ended. + --no-watch-options-stdin Do not stop watching when stdin stream has + ended. + --host The hostname/ip address the server will bind + to. + --port The port server will listen to. + --static [value...] A directory to serve static content from. + --no-static Negative 'static' option. + --static-directory Directory for static contents. + --static-public-path The bundled files will be available in the + browser under this path. + --static-serve-index Tells dev-server to use serveIndex + middleware. + --no-static-serve-index Do not tell dev-server to use serveIndex + middleware. + --static-watch Watch for files in static content directory. + --no-static-watch Do not watch for files in static content + directory. + --live-reload Enables live reloading on changing files. + --no-live-reload Disables live reloading on changing files. + --https Use HTTPS protocol. + --no-https Do not use HTTPS protocol. + --https-passphrase Passphrase for a pfx file. + --https-key Path to an SSL key. + --https-pfx Path to an SSL pfx file. + --https-cert Path to an SSL certificate. + --https-cacert Path to an SSL CA certificate. + --https-request-cert Request for an SSL certificate. + --no-https-request-cert Do not request for an SSL certificate. + --http2 Use HTTP/2, must be used with HTTPS. + --no-http2 Do not use HTTP/2. + --bonjour Broadcasts the server via ZeroConf + networking on start. + --no-bonjour Do not broadcast the server via ZeroConf + networking on start. + --client-progress Print compilation progress in percentage in + the browser. + --no-client-progress Do not print compilation progress in + percentage in the browser. + --client-overlay Show a full-screen overlay in the browser + when there are compiler errors or warnings. + --no-client-overlay Do not show a full-screen overlay in the + browser when there are compiler errors or + warnings. + --open [value...] Open the default browser. + --no-open Do not open the default browser. + --open-app Open specified browser. + --open-target [value...] Open specified route in browser. + --no-open-target Do not open specified route in browser. + --client-logging Log level in the browser (none, error, warn, + info, log, verbose). + --history-api-fallback Fallback to /index.html for Single Page + Applications. + --no-history-api-fallback Do not fallback to /index.html for Single + Page Applications. + --compress Enable gzip compression. + --no-compress Disable gzip compression. + --public The public hostname/ip address of the + server. + --firewall [value...] Enable firewall or set hosts that are + allowed to access the dev server. + --no-firewall Disable firewall. + --watch-files Watch static files for file changes. + +Global options: + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', + 'webpack-cli' and 'webpack-dev-server' and + commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1862,63 +1924,74 @@ exports[`help should show help information for 'serve' command using command syn Run the webpack dev server. Options: - -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. - --config-name Name of the configuration to use. - -m, --merge Merge two or more configurations using 'webpack-merge'. - --env Environment passed to the configuration when it is a function. - --node-env Sets process.env.NODE_ENV to the specified value. - --progress [value] Print compilation progress during build. - -j, --json [value] Prints result as JSON or store it in a file. - -d, --devtool Determine source maps to use. - --no-devtool Do not generate source maps. - --entry The entry point(s) of your application e.g. ./src/main.js. - --mode Defines the mode to pass to webpack. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path Output location of the file generated by webpack e.g. ./dist/. - --stats [value] It instructs webpack on how to treat the stats e.g. verbose. - --no-stats Disable stats output. - -t, --target Sets the build target e.g. node. - --no-target Negative 'target' option. - --watch-options-stdin Stop watching when stdin stream has ended. - --no-watch-options-stdin Do not stop watching when stdin stream has ended. - --host The hostname/ip address the server will bind to. - --port The port server will listen to. - --static [value...] A directory to serve static content from. - --no-static Negative 'static' option. - --live-reload Enables live reloading on changing files. - --no-live-reload Disables live reloading on changing files. - --https Use HTTPS protocol. - --no-https Do not use HTTPS protocol. - --http2 Use HTTP/2, must be used with HTTPS. - --no-http2 Do not use HTTP/2. - --bonjour Broadcasts the server via ZeroConf networking on start. - --no-bonjour Do not broadcast the server via ZeroConf networking on start. - --client-progress Print compilation progress in percentage in the browser. - --no-client-progress Do not print compilation progress in percentage in the browser. - --client-overlay Show a full-screen overlay in the browser when there are compiler errors or warnings. - --no-client-overlay Do not show a full-screen overlay in the browser when there are compiler errors or warnings. - --setup-exit-signals Close and exit the process on SIGINT and SIGTERM. - --no-setup-exit-signals Do not close and exit the process on SIGNIT and SIGTERM. - --open [value...] Open the default browser. - --no-open Do not open the default browser. - --open-app Open specified browser. - --open-target [value...] Open specified route in browser. - --no-open-target Do not open specified route in browser. - --client-logging Log level in the browser (none, error, warn, info, log, verbose). - --history-api-fallback Fallback to /index.html for Single Page Applications. - --no-history-api-fallback Do not fallback to /index.html for Single Page Applications. - --compress Enable gzip compression. - --no-compress Disable gzip compression. - --public The public hostname/ip address of the server. - --firewall [value...] Enable firewall or set hosts that are allowed to access the dev server. - --no-firewall Disable firewall. - --watch-files Watch static files for file changes. - -Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. + --config-name Name of the configuration to use. + -m, --merge Merge two or more configurations using 'webpack-merge'. + --env Environment passed to the configuration when it is a function. + --node-env Sets process.env.NODE_ENV to the specified value. + --progress [value] Print compilation progress during build. + -j, --json [value] Prints result as JSON or store it in a file. + -d, --devtool Determine source maps to use. + --no-devtool Do not generate source maps. + --entry The entry point(s) of your application e.g. ./src/main.js. + --mode Defines the mode to pass to webpack. + --name Name of the configuration. Used when loading multiple configurations. + -o, --output-path Output location of the file generated by webpack e.g. ./dist/. + --stats [value] It instructs webpack on how to treat the stats e.g. verbose. + --no-stats Disable stats output. + -t, --target Sets the build target e.g. node. + --no-target Negative 'target' option. + --watch-options-stdin Stop watching when stdin stream has ended. + --no-watch-options-stdin Do not stop watching when stdin stream has ended. + --host The hostname/ip address the server will bind to. + --port The port server will listen to. + --static [value...] A directory to serve static content from. + --no-static Negative 'static' option. + --static-directory Directory for static contents. + --static-public-path The bundled files will be available in the browser under this path. + --static-serve-index Tells dev-server to use serveIndex middleware. + --no-static-serve-index Do not tell dev-server to use serveIndex middleware. + --static-watch Watch for files in static content directory. + --no-static-watch Do not watch for files in static content directory. + --live-reload Enables live reloading on changing files. + --no-live-reload Disables live reloading on changing files. + --https Use HTTPS protocol. + --no-https Do not use HTTPS protocol. + --https-passphrase Passphrase for a pfx file. + --https-key Path to an SSL key. + --https-pfx Path to an SSL pfx file. + --https-cert Path to an SSL certificate. + --https-cacert Path to an SSL CA certificate. + --https-request-cert Request for an SSL certificate. + --no-https-request-cert Do not request for an SSL certificate. + --http2 Use HTTP/2, must be used with HTTPS. + --no-http2 Do not use HTTP/2. + --bonjour Broadcasts the server via ZeroConf networking on start. + --no-bonjour Do not broadcast the server via ZeroConf networking on start. + --client-progress Print compilation progress in percentage in the browser. + --no-client-progress Do not print compilation progress in percentage in the browser. + --client-overlay Show a full-screen overlay in the browser when there are compiler errors or warnings. + --no-client-overlay Do not show a full-screen overlay in the browser when there are compiler errors or warnings. + --open [value...] Open the default browser. + --no-open Do not open the default browser. + --open-app Open specified browser. + --open-target [value...] Open specified route in browser. + --no-open-target Do not open specified route in browser. + --client-logging Log level in the browser (none, error, warn, info, log, verbose). + --history-api-fallback Fallback to /index.html for Single Page Applications. + --no-history-api-fallback Do not fallback to /index.html for Single Page Applications. + --compress Enable gzip compression. + --no-compress Disable gzip compression. + --public The public hostname/ip address of the server. + --firewall [value...] Enable firewall or set hosts that are allowed to access the dev server. + --no-firewall Disable firewall. + --watch-files Watch static files for file changes. + +Global options: + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -1935,63 +2008,74 @@ exports[`help should show help information for 'serve' command using the "--help Run the webpack dev server. Options: - -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. - --config-name Name of the configuration to use. - -m, --merge Merge two or more configurations using 'webpack-merge'. - --env Environment passed to the configuration when it is a function. - --node-env Sets process.env.NODE_ENV to the specified value. - --progress [value] Print compilation progress during build. - -j, --json [value] Prints result as JSON or store it in a file. - -d, --devtool Determine source maps to use. - --no-devtool Do not generate source maps. - --entry The entry point(s) of your application e.g. ./src/main.js. - --mode Defines the mode to pass to webpack. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path Output location of the file generated by webpack e.g. ./dist/. - --stats [value] It instructs webpack on how to treat the stats e.g. verbose. - --no-stats Disable stats output. - -t, --target Sets the build target e.g. node. - --no-target Negative 'target' option. - --watch-options-stdin Stop watching when stdin stream has ended. - --no-watch-options-stdin Do not stop watching when stdin stream has ended. - --host The hostname/ip address the server will bind to. - --port The port server will listen to. - --static [value...] A directory to serve static content from. - --no-static Negative 'static' option. - --live-reload Enables live reloading on changing files. - --no-live-reload Disables live reloading on changing files. - --https Use HTTPS protocol. - --no-https Do not use HTTPS protocol. - --http2 Use HTTP/2, must be used with HTTPS. - --no-http2 Do not use HTTP/2. - --bonjour Broadcasts the server via ZeroConf networking on start. - --no-bonjour Do not broadcast the server via ZeroConf networking on start. - --client-progress Print compilation progress in percentage in the browser. - --no-client-progress Do not print compilation progress in percentage in the browser. - --client-overlay Show a full-screen overlay in the browser when there are compiler errors or warnings. - --no-client-overlay Do not show a full-screen overlay in the browser when there are compiler errors or warnings. - --setup-exit-signals Close and exit the process on SIGINT and SIGTERM. - --no-setup-exit-signals Do not close and exit the process on SIGNIT and SIGTERM. - --open [value...] Open the default browser. - --no-open Do not open the default browser. - --open-app Open specified browser. - --open-target [value...] Open specified route in browser. - --no-open-target Do not open specified route in browser. - --client-logging Log level in the browser (none, error, warn, info, log, verbose). - --history-api-fallback Fallback to /index.html for Single Page Applications. - --no-history-api-fallback Do not fallback to /index.html for Single Page Applications. - --compress Enable gzip compression. - --no-compress Disable gzip compression. - --public The public hostname/ip address of the server. - --firewall [value...] Enable firewall or set hosts that are allowed to access the dev server. - --no-firewall Disable firewall. - --watch-files Watch static files for file changes. - -Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. + --config-name Name of the configuration to use. + -m, --merge Merge two or more configurations using 'webpack-merge'. + --env Environment passed to the configuration when it is a function. + --node-env Sets process.env.NODE_ENV to the specified value. + --progress [value] Print compilation progress during build. + -j, --json [value] Prints result as JSON or store it in a file. + -d, --devtool Determine source maps to use. + --no-devtool Do not generate source maps. + --entry The entry point(s) of your application e.g. ./src/main.js. + --mode Defines the mode to pass to webpack. + --name Name of the configuration. Used when loading multiple configurations. + -o, --output-path Output location of the file generated by webpack e.g. ./dist/. + --stats [value] It instructs webpack on how to treat the stats e.g. verbose. + --no-stats Disable stats output. + -t, --target Sets the build target e.g. node. + --no-target Negative 'target' option. + --watch-options-stdin Stop watching when stdin stream has ended. + --no-watch-options-stdin Do not stop watching when stdin stream has ended. + --host The hostname/ip address the server will bind to. + --port The port server will listen to. + --static [value...] A directory to serve static content from. + --no-static Negative 'static' option. + --static-directory Directory for static contents. + --static-public-path The bundled files will be available in the browser under this path. + --static-serve-index Tells dev-server to use serveIndex middleware. + --no-static-serve-index Do not tell dev-server to use serveIndex middleware. + --static-watch Watch for files in static content directory. + --no-static-watch Do not watch for files in static content directory. + --live-reload Enables live reloading on changing files. + --no-live-reload Disables live reloading on changing files. + --https Use HTTPS protocol. + --no-https Do not use HTTPS protocol. + --https-passphrase Passphrase for a pfx file. + --https-key Path to an SSL key. + --https-pfx Path to an SSL pfx file. + --https-cert Path to an SSL certificate. + --https-cacert Path to an SSL CA certificate. + --https-request-cert Request for an SSL certificate. + --no-https-request-cert Do not request for an SSL certificate. + --http2 Use HTTP/2, must be used with HTTPS. + --no-http2 Do not use HTTP/2. + --bonjour Broadcasts the server via ZeroConf networking on start. + --no-bonjour Do not broadcast the server via ZeroConf networking on start. + --client-progress Print compilation progress in percentage in the browser. + --no-client-progress Do not print compilation progress in percentage in the browser. + --client-overlay Show a full-screen overlay in the browser when there are compiler errors or warnings. + --no-client-overlay Do not show a full-screen overlay in the browser when there are compiler errors or warnings. + --open [value...] Open the default browser. + --no-open Do not open the default browser. + --open-app Open specified browser. + --open-target [value...] Open specified route in browser. + --no-open-target Do not open specified route in browser. + --client-logging Log level in the browser (none, error, warn, info, log, verbose). + --history-api-fallback Fallback to /index.html for Single Page Applications. + --no-history-api-fallback Do not fallback to /index.html for Single Page Applications. + --compress Enable gzip compression. + --no-compress Disable gzip compression. + --public The public hostname/ip address of the server. + --firewall [value...] Enable firewall or set hosts that are allowed to access the dev server. + --no-firewall Disable firewall. + --watch-files Watch static files for file changes. + +Global options: + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -2008,63 +2092,74 @@ exports[`help should show help information for 'server' command using command sy Run the webpack dev server. Options: - -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. - --config-name Name of the configuration to use. - -m, --merge Merge two or more configurations using 'webpack-merge'. - --env Environment passed to the configuration when it is a function. - --node-env Sets process.env.NODE_ENV to the specified value. - --progress [value] Print compilation progress during build. - -j, --json [value] Prints result as JSON or store it in a file. - -d, --devtool Determine source maps to use. - --no-devtool Do not generate source maps. - --entry The entry point(s) of your application e.g. ./src/main.js. - --mode Defines the mode to pass to webpack. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path Output location of the file generated by webpack e.g. ./dist/. - --stats [value] It instructs webpack on how to treat the stats e.g. verbose. - --no-stats Disable stats output. - -t, --target Sets the build target e.g. node. - --no-target Negative 'target' option. - --watch-options-stdin Stop watching when stdin stream has ended. - --no-watch-options-stdin Do not stop watching when stdin stream has ended. - --host The hostname/ip address the server will bind to. - --port The port server will listen to. - --static [value...] A directory to serve static content from. - --no-static Negative 'static' option. - --live-reload Enables live reloading on changing files. - --no-live-reload Disables live reloading on changing files. - --https Use HTTPS protocol. - --no-https Do not use HTTPS protocol. - --http2 Use HTTP/2, must be used with HTTPS. - --no-http2 Do not use HTTP/2. - --bonjour Broadcasts the server via ZeroConf networking on start. - --no-bonjour Do not broadcast the server via ZeroConf networking on start. - --client-progress Print compilation progress in percentage in the browser. - --no-client-progress Do not print compilation progress in percentage in the browser. - --client-overlay Show a full-screen overlay in the browser when there are compiler errors or warnings. - --no-client-overlay Do not show a full-screen overlay in the browser when there are compiler errors or warnings. - --setup-exit-signals Close and exit the process on SIGINT and SIGTERM. - --no-setup-exit-signals Do not close and exit the process on SIGNIT and SIGTERM. - --open [value...] Open the default browser. - --no-open Do not open the default browser. - --open-app Open specified browser. - --open-target [value...] Open specified route in browser. - --no-open-target Do not open specified route in browser. - --client-logging Log level in the browser (none, error, warn, info, log, verbose). - --history-api-fallback Fallback to /index.html for Single Page Applications. - --no-history-api-fallback Do not fallback to /index.html for Single Page Applications. - --compress Enable gzip compression. - --no-compress Disable gzip compression. - --public The public hostname/ip address of the server. - --firewall [value...] Enable firewall or set hosts that are allowed to access the dev server. - --no-firewall Disable firewall. - --watch-files Watch static files for file changes. - -Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. + --config-name Name of the configuration to use. + -m, --merge Merge two or more configurations using 'webpack-merge'. + --env Environment passed to the configuration when it is a function. + --node-env Sets process.env.NODE_ENV to the specified value. + --progress [value] Print compilation progress during build. + -j, --json [value] Prints result as JSON or store it in a file. + -d, --devtool Determine source maps to use. + --no-devtool Do not generate source maps. + --entry The entry point(s) of your application e.g. ./src/main.js. + --mode Defines the mode to pass to webpack. + --name Name of the configuration. Used when loading multiple configurations. + -o, --output-path Output location of the file generated by webpack e.g. ./dist/. + --stats [value] It instructs webpack on how to treat the stats e.g. verbose. + --no-stats Disable stats output. + -t, --target Sets the build target e.g. node. + --no-target Negative 'target' option. + --watch-options-stdin Stop watching when stdin stream has ended. + --no-watch-options-stdin Do not stop watching when stdin stream has ended. + --host The hostname/ip address the server will bind to. + --port The port server will listen to. + --static [value...] A directory to serve static content from. + --no-static Negative 'static' option. + --static-directory Directory for static contents. + --static-public-path The bundled files will be available in the browser under this path. + --static-serve-index Tells dev-server to use serveIndex middleware. + --no-static-serve-index Do not tell dev-server to use serveIndex middleware. + --static-watch Watch for files in static content directory. + --no-static-watch Do not watch for files in static content directory. + --live-reload Enables live reloading on changing files. + --no-live-reload Disables live reloading on changing files. + --https Use HTTPS protocol. + --no-https Do not use HTTPS protocol. + --https-passphrase Passphrase for a pfx file. + --https-key Path to an SSL key. + --https-pfx Path to an SSL pfx file. + --https-cert Path to an SSL certificate. + --https-cacert Path to an SSL CA certificate. + --https-request-cert Request for an SSL certificate. + --no-https-request-cert Do not request for an SSL certificate. + --http2 Use HTTP/2, must be used with HTTPS. + --no-http2 Do not use HTTP/2. + --bonjour Broadcasts the server via ZeroConf networking on start. + --no-bonjour Do not broadcast the server via ZeroConf networking on start. + --client-progress Print compilation progress in percentage in the browser. + --no-client-progress Do not print compilation progress in percentage in the browser. + --client-overlay Show a full-screen overlay in the browser when there are compiler errors or warnings. + --no-client-overlay Do not show a full-screen overlay in the browser when there are compiler errors or warnings. + --open [value...] Open the default browser. + --no-open Do not open the default browser. + --open-app Open specified browser. + --open-target [value...] Open specified route in browser. + --no-open-target Do not open specified route in browser. + --client-logging Log level in the browser (none, error, warn, info, log, verbose). + --history-api-fallback Fallback to /index.html for Single Page Applications. + --no-history-api-fallback Do not fallback to /index.html for Single Page Applications. + --compress Enable gzip compression. + --no-compress Disable gzip compression. + --public The public hostname/ip address of the server. + --firewall [value...] Enable firewall or set hosts that are allowed to access the dev server. + --no-firewall Disable firewall. + --watch-files Watch static files for file changes. + +Global options: + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -2081,63 +2176,74 @@ exports[`help should show help information for 'server' command using the "--hel Run the webpack dev server. Options: - -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. - --config-name Name of the configuration to use. - -m, --merge Merge two or more configurations using 'webpack-merge'. - --env Environment passed to the configuration when it is a function. - --node-env Sets process.env.NODE_ENV to the specified value. - --progress [value] Print compilation progress during build. - -j, --json [value] Prints result as JSON or store it in a file. - -d, --devtool Determine source maps to use. - --no-devtool Do not generate source maps. - --entry The entry point(s) of your application e.g. ./src/main.js. - --mode Defines the mode to pass to webpack. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path Output location of the file generated by webpack e.g. ./dist/. - --stats [value] It instructs webpack on how to treat the stats e.g. verbose. - --no-stats Disable stats output. - -t, --target Sets the build target e.g. node. - --no-target Negative 'target' option. - --watch-options-stdin Stop watching when stdin stream has ended. - --no-watch-options-stdin Do not stop watching when stdin stream has ended. - --host The hostname/ip address the server will bind to. - --port The port server will listen to. - --static [value...] A directory to serve static content from. - --no-static Negative 'static' option. - --live-reload Enables live reloading on changing files. - --no-live-reload Disables live reloading on changing files. - --https Use HTTPS protocol. - --no-https Do not use HTTPS protocol. - --http2 Use HTTP/2, must be used with HTTPS. - --no-http2 Do not use HTTP/2. - --bonjour Broadcasts the server via ZeroConf networking on start. - --no-bonjour Do not broadcast the server via ZeroConf networking on start. - --client-progress Print compilation progress in percentage in the browser. - --no-client-progress Do not print compilation progress in percentage in the browser. - --client-overlay Show a full-screen overlay in the browser when there are compiler errors or warnings. - --no-client-overlay Do not show a full-screen overlay in the browser when there are compiler errors or warnings. - --setup-exit-signals Close and exit the process on SIGINT and SIGTERM. - --no-setup-exit-signals Do not close and exit the process on SIGNIT and SIGTERM. - --open [value...] Open the default browser. - --no-open Do not open the default browser. - --open-app Open specified browser. - --open-target [value...] Open specified route in browser. - --no-open-target Do not open specified route in browser. - --client-logging Log level in the browser (none, error, warn, info, log, verbose). - --history-api-fallback Fallback to /index.html for Single Page Applications. - --no-history-api-fallback Do not fallback to /index.html for Single Page Applications. - --compress Enable gzip compression. - --no-compress Disable gzip compression. - --public The public hostname/ip address of the server. - --firewall [value...] Enable firewall or set hosts that are allowed to access the dev server. - --no-firewall Disable firewall. - --watch-files Watch static files for file changes. - -Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. + --config-name Name of the configuration to use. + -m, --merge Merge two or more configurations using 'webpack-merge'. + --env Environment passed to the configuration when it is a function. + --node-env Sets process.env.NODE_ENV to the specified value. + --progress [value] Print compilation progress during build. + -j, --json [value] Prints result as JSON or store it in a file. + -d, --devtool Determine source maps to use. + --no-devtool Do not generate source maps. + --entry The entry point(s) of your application e.g. ./src/main.js. + --mode Defines the mode to pass to webpack. + --name Name of the configuration. Used when loading multiple configurations. + -o, --output-path Output location of the file generated by webpack e.g. ./dist/. + --stats [value] It instructs webpack on how to treat the stats e.g. verbose. + --no-stats Disable stats output. + -t, --target Sets the build target e.g. node. + --no-target Negative 'target' option. + --watch-options-stdin Stop watching when stdin stream has ended. + --no-watch-options-stdin Do not stop watching when stdin stream has ended. + --host The hostname/ip address the server will bind to. + --port The port server will listen to. + --static [value...] A directory to serve static content from. + --no-static Negative 'static' option. + --static-directory Directory for static contents. + --static-public-path The bundled files will be available in the browser under this path. + --static-serve-index Tells dev-server to use serveIndex middleware. + --no-static-serve-index Do not tell dev-server to use serveIndex middleware. + --static-watch Watch for files in static content directory. + --no-static-watch Do not watch for files in static content directory. + --live-reload Enables live reloading on changing files. + --no-live-reload Disables live reloading on changing files. + --https Use HTTPS protocol. + --no-https Do not use HTTPS protocol. + --https-passphrase Passphrase for a pfx file. + --https-key Path to an SSL key. + --https-pfx Path to an SSL pfx file. + --https-cert Path to an SSL certificate. + --https-cacert Path to an SSL CA certificate. + --https-request-cert Request for an SSL certificate. + --no-https-request-cert Do not request for an SSL certificate. + --http2 Use HTTP/2, must be used with HTTPS. + --no-http2 Do not use HTTP/2. + --bonjour Broadcasts the server via ZeroConf networking on start. + --no-bonjour Do not broadcast the server via ZeroConf networking on start. + --client-progress Print compilation progress in percentage in the browser. + --no-client-progress Do not print compilation progress in percentage in the browser. + --client-overlay Show a full-screen overlay in the browser when there are compiler errors or warnings. + --no-client-overlay Do not show a full-screen overlay in the browser when there are compiler errors or warnings. + --open [value...] Open the default browser. + --no-open Do not open the default browser. + --open-app Open specified browser. + --open-target [value...] Open specified route in browser. + --no-open-target Do not open specified route in browser. + --client-logging Log level in the browser (none, error, warn, info, log, verbose). + --history-api-fallback Fallback to /index.html for Single Page Applications. + --no-history-api-fallback Do not fallback to /index.html for Single Page Applications. + --compress Enable gzip compression. + --no-compress Disable gzip compression. + --public The public hostname/ip address of the server. + --firewall [value...] Enable firewall or set hosts that are allowed to access the dev server. + --no-firewall Disable firewall. + --watch-files Watch static files for file changes. + +Global options: + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. @@ -2731,7 +2837,7 @@ exports[`help should show help information with options for sub commands: stdout Outputs information about your system. Options: - --output To get the output in a specified format ( accept json or markdown ) + -o, --output To get the output in a specified format ( accept json or markdown ) Global options: --color Enable colors on console. diff --git a/test/help/help.test.js b/test/help/help.test.js index 61add1d701e..627a1ab9929 100644 --- a/test/help/help.test.js +++ b/test/help/help.test.js @@ -1,397 +1,430 @@ -'use strict'; +"use strict"; -const { run, normalizeStderr, normalizeStdout } = require('../utils/test-utils'); +const { run, normalizeStderr, normalizeStdout } = require("../utils/test-utils"); -describe('help', () => { +describe("help", () => { it('should show help information using the "--help" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--help']); + const { exitCode, stderr, stdout } = await run(__dirname, ["--help"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it.skip('should show help information using the "--help" option with the "verbose" value', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--help', 'verbose']); + const { exitCode, stderr, stdout } = await run(__dirname, ["--help", "verbose"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it.skip('should show help information using the "--help" option with the "verbose" value #2', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--help=verbose']); + const { exitCode, stderr, stdout } = await run(__dirname, ["--help=verbose"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should show help information using command syntax', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['help']); + it("should show help information using command syntax", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["help"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should show the same information using the "--help" option and command syntax', async () => { - const { exitCode: exitCodeFromOption, stderr: stderrFromOption, stdout: stdoutFromOption } = await run(__dirname, ['--help']); + const { + exitCode: exitCodeFromOption, + stderr: stderrFromOption, + stdout: stdoutFromOption, + } = await run(__dirname, ["--help"]); const { exitCode: exitCodeFromCommandSyntax, stderr: stderrFromCommandSyntax, stdout: stdoutFromCommandSyntax, - } = await run(__dirname, ['help']); + } = await run(__dirname, ["help"]); expect(exitCodeFromOption).toBe(0); expect(exitCodeFromCommandSyntax).toBe(0); - expect(normalizeStderr(stderrFromOption)).toMatchSnapshot('stderr from option'); - expect(normalizeStderr(stderrFromCommandSyntax)).toMatchSnapshot('stderr from command syntax'); + expect(normalizeStderr(stderrFromOption)).toMatchSnapshot("stderr from option"); + expect(normalizeStderr(stderrFromCommandSyntax)).toMatchSnapshot( + "stderr from command syntax", + ); expect(stdoutFromOption).toBe(stdoutFromCommandSyntax); - expect(normalizeStdout(stdoutFromOption)).toMatchSnapshot('stdout from option'); - expect(normalizeStdout(stdoutFromCommandSyntax)).toMatchSnapshot('stdout from command sytnax'); + expect(normalizeStdout(stdoutFromOption)).toMatchSnapshot("stdout from option"); + expect(normalizeStdout(stdoutFromCommandSyntax)).toMatchSnapshot( + "stdout from command sytnax", + ); }); it('should show help information and respect the "--color" flag using the "--help" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--help', '--color'], { env: { FORCE_COLOR: true } }); + const { exitCode, stderr, stdout } = await run(__dirname, ["--help", "--color"], { + env: { FORCE_COLOR: true }, + }); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(stdout).toContain('\x1b[1m'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(stdout).toContain("\x1b[1m"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should show help information and respect the "--no-color" flag using the "--help" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--help', '--no-color'], { env: { FORCE_COLOR: true } }); + const { exitCode, stderr, stdout } = await run(__dirname, ["--help", "--no-color"], { + env: { FORCE_COLOR: true }, + }); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); const commands = [ { - name: 'init', - alias: ['create', 'new', 'c', 'n'], + name: "init", + alias: ["create", "new", "c", "n"], }, { - name: 'info', - alias: 'i', + name: "info", + alias: "i", }, { - name: 'loader', - alias: 'l', + name: "loader", + alias: "l", }, { - name: 'migrate', - alias: 'm', + name: "migrate", + alias: "m", }, { - name: 'plugin', - alias: 'p', + name: "plugin", + alias: "p", }, { - name: 'configtest', - alias: 't', + name: "configtest", + alias: "t", }, { - name: 'watch', - alias: 'w', + name: "watch", + alias: "w", }, { - name: 'serve', - alias: ['server', 's'], + name: "serve", + alias: ["server", "s"], }, { - name: 'build', - alias: 'b', + name: "build", + alias: "b", }, ]; commands.forEach(({ name, alias }) => { it(`should show help information for '${name}' command using the "--help" option`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [name, '--help']); + const { exitCode, stderr, stdout } = await run(__dirname, [name, "--help"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it.skip(`should show help information for '${name}' command using the "--help verbose" option`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [name, '--help', 'verbose']); + const { exitCode, stderr, stdout } = await run(__dirname, [name, "--help", "verbose"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it(`should show help information for '${name}' command using command syntax`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['help', name]); + const { exitCode, stderr, stdout } = await run(__dirname, ["help", name]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it(`should show help information for '${name}' and respect the "--color" flag using the "--help" option`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [name, '--help', '--color'], { env: { FORCE_COLOR: true } }); + const { exitCode, stderr, stdout } = await run(__dirname, [name, "--help", "--color"], { + env: { FORCE_COLOR: true }, + }); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(stdout).toContain('\x1b[1m'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(stdout).toContain("\x1b[1m"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it(`should show help information for '${name}' and respect the "--no-color" flag using the "--help" option`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [name, '--help', '--no-color'], { env: { FORCE_COLOR: true } }); + const { exitCode, stderr, stdout } = await run( + __dirname, + [name, "--help", "--no-color"], + { env: { FORCE_COLOR: true } }, + ); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(stdout).not.toContain('\x1b[1m'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(stdout).not.toContain("\x1b[1m"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); const alises = Array.isArray(alias) ? alias : [alias]; alises.forEach((alias) => { it(`should show help information for '${alias}' command using the "--help" option`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [alias, '--help']); + const { exitCode, stderr, stdout } = await run(__dirname, [alias, "--help"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it.skip(`should show help information for '${alias}' command using the "--help verbose" option`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, [alias, '--help', 'verbose']); + const { exitCode, stderr, stdout } = await run(__dirname, [ + alias, + "--help", + "verbose", + ]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it(`should show help information for '${alias}' command using command syntax`, async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['help', alias]); + const { exitCode, stderr, stdout } = await run(__dirname, ["help", alias]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); }); }); - it('should show help information with options for sub commands', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['info', '--help']); + it("should show help information with options for sub commands", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["info", "--help"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should show help information and taking precedence when "--help" and "--version" option using together', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--help', '--version']); + const { exitCode, stderr, stdout } = await run(__dirname, ["--help", "--version"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should show help information using the "help --mode" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['help', '--mode']); + const { exitCode, stderr, stdout } = await run(__dirname, ["help", "--mode"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should show help information using the "help --target" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['help', '--target']); + const { exitCode, stderr, stdout } = await run(__dirname, ["help", "--target"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should show help information using the "help --stats" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['help', '--stats']); + const { exitCode, stderr, stdout } = await run(__dirname, ["help", "--stats"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should show help information using the "help --no-stats" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['help', '--no-stats']); + const { exitCode, stderr, stdout } = await run(__dirname, ["help", "--no-stats"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should show help information using the "help --mode" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['help', '--mode']); + const { exitCode, stderr, stdout } = await run(__dirname, ["help", "--mode"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should show help information using the "help serve --mode" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['help', 'serve', '--mode']); + const { exitCode, stderr, stdout } = await run(__dirname, ["help", "serve", "--mode"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should show help information using the "help --color" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['help', '--color'], { env: { FORCE_COLOR: true } }); + const { exitCode, stderr, stdout } = await run(__dirname, ["help", "--color"], { + env: { FORCE_COLOR: true }, + }); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(stdout).toContain('\x1b[1m'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(stdout).toContain("\x1b[1m"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should show help information using the "help --no-color" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['help', '--no-color'], { env: { FORCE_COLOR: true } }); + const { exitCode, stderr, stdout } = await run(__dirname, ["help", "--no-color"], { + env: { FORCE_COLOR: true }, + }); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should show help information using the "help serve --color" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['help', 'serve', '--color'], { env: { FORCE_COLOR: true } }); + const { exitCode, stderr, stdout } = await run(__dirname, ["help", "serve", "--color"], { + env: { FORCE_COLOR: true }, + }); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(stdout).toContain('\x1b[1m'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(stdout).toContain("\x1b[1m"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should show help information using the "help serve --no-color" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['help', 'serve', '--no-color']); + const { exitCode, stderr, stdout } = await run(__dirname, ["help", "serve", "--no-color"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should show help information using the "help --version" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['help', '--version']); + const { exitCode, stderr, stdout } = await run(__dirname, ["help", "--version"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should show help information using the "help -v" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['help', '-v']); + const { exitCode, stderr, stdout } = await run(__dirname, ["help", "-v"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should log error for invalid command using the "--help" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--help', 'myCommand']); + const { exitCode, stderr, stdout } = await run(__dirname, ["--help", "myCommand"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should log error for invalid command using the "--help" option #2', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--flag', '--help']); + const { exitCode, stderr, stdout } = await run(__dirname, ["--flag", "--help"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should log error for invalid command using the "--help" option #3', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['serve', '--flag', '--help']); + const { exitCode, stderr, stdout } = await run(__dirname, ["serve", "--flag", "--help"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should log error for unknown command using command syntax', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['help', 'myCommand']); + it("should log error for unknown command using command syntax", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["help", "myCommand"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should log error for unknown command using command syntax #2', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['help', 'verbose']); + it("should log error for unknown command using command syntax #2", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["help", "verbose"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should log error for unknown option using command syntax #2', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['help', '--made']); + it("should log error for unknown option using command syntax #2", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["help", "--made"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should log error for unknown option using command syntax #3', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['help', 'serve', '--made']); + it("should log error for unknown option using command syntax #3", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["help", "serve", "--made"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should log error for unknown option using command syntax #4', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['help', 'bui', '--mode']); + it("should log error for unknown option using command syntax #4", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["help", "bui", "--mode"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should log error for invalid command using command syntax #3', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['help', '--mode', 'serve']); + it("should log error for invalid command using command syntax #3", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["help", "--mode", "serve"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should log error for invalid command using command syntax #4', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['help', 'serve', '--mode', '--mode']); + it("should log error for invalid command using command syntax #4", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "help", + "serve", + "--mode", + "--mode", + ]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should log error for invalid flag with the "--help" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--help', '--my-flag']); + const { exitCode, stderr, stdout } = await run(__dirname, ["--help", "--my-flag"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should log error for invalid flag with the "--help" option #2', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--help', 'init', 'info']); + const { exitCode, stderr, stdout } = await run(__dirname, ["--help", "init", "info"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should log error for invalid flag with the "--help" option #2', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--help=']); + const { exitCode, stderr, stdout } = await run(__dirname, ["--help="]); expect(exitCode).toBe(2); expect(stderr).toMatchSnapshot(); diff --git a/test/info/info-output.test.js b/test/info/info-output.test.js index 5105f6c2d75..ddc1b083af5 100644 --- a/test/info/info-output.test.js +++ b/test/info/info-output.test.js @@ -1,35 +1,35 @@ -'use strict'; +"use strict"; -const { join } = require('path'); -const { run } = require('../utils/test-utils'); +const { join } = require("path"); +const { run } = require("../utils/test-utils"); -describe('basic info usage', () => { - it('gets info without flags', async () => { - const { exitCode, stdout, stderr } = await run(__dirname, ['info']); +describe("basic info usage", () => { + it("gets info without flags", async () => { + const { exitCode, stdout, stderr } = await run(__dirname, ["info"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - expect(stdout).toContain('System:'); - expect(stdout).toContain('Node'); - expect(stdout).toContain('npm'); - expect(stdout).toContain('Yarn'); + expect(stdout).toContain("System:"); + expect(stdout).toContain("Node"); + expect(stdout).toContain("npm"); + expect(stdout).toContain("Yarn"); }); - it('gets more info in project root', async () => { - const { exitCode, stderr, stdout } = await run(join(__dirname, '../../'), ['info']); + it("gets more info in project root", async () => { + const { exitCode, stderr, stdout } = await run(join(__dirname, "../../"), ["info"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - expect(stdout).toContain('System:'); - expect(stdout).toContain('Monorepos:'); - expect(stdout).toContain('Packages:'); - expect(stdout).toContain('Node'); - expect(stdout).toContain('npm'); - expect(stdout).toContain('Yarn'); + expect(stdout).toContain("System:"); + expect(stdout).toContain("Monorepos:"); + expect(stdout).toContain("Packages:"); + expect(stdout).toContain("Node"); + expect(stdout).toContain("npm"); + expect(stdout).toContain("Yarn"); }); - it('gets info as json', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['info', '--output=json']); + it("gets info as json", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["info", "--output=json"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -37,28 +37,36 @@ describe('basic info usage', () => { const parse = () => { const output = JSON.parse(stdout); - expect(output['System']).toBeTruthy(); - expect(output['Binaries']).toBeTruthy(); - expect(output['System']['OS']).toBeTruthy(); - expect(output['System']['CPU']).toBeTruthy(); + expect(output["System"]).toBeTruthy(); + expect(output["Binaries"]).toBeTruthy(); + expect(output["System"]["OS"]).toBeTruthy(); + expect(output["System"]["CPU"]).toBeTruthy(); }; expect(parse).not.toThrow(); }); - it('gets info as markdown', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['info', '--output', 'markdown']); + it("gets info as markdown", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["info", "--output", "markdown"]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - expect(stdout).toContain('## System:'); + expect(stdout).toContain("## System:"); }); - it('shows a warning if an invalid value is supplied', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['info', '--output', 'unknown']); + it("shows a warning if an invalid value is supplied", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["info", "--output", "unknown"]); expect(exitCode).toBe(2); expect(stderr).toContain(`'unknown' is not a valid value for output`); expect(stdout).toBeFalsy(); }); + + it("recognizes '-o' as an alias for '--output'", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["info", "-o", "markdown"]); + + expect(exitCode).toBe(0); + expect(stderr).toBeFalsy(); + expect(stdout).toContain("## System:"); + }); }); diff --git a/test/info/info-unknown.test.js b/test/info/info-unknown.test.js index 2599a8083f2..81f3be30819 100644 --- a/test/info/info-unknown.test.js +++ b/test/info/info-unknown.test.js @@ -1,8 +1,8 @@ -const { run } = require('../utils/test-utils'); +const { run } = require("../utils/test-utils"); -describe('should handle unknown args', () => { - it('shows an appropriate warning on supplying unknown args', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['info', '--unknown']); +describe("should handle unknown args", () => { + it("shows an appropriate warning on supplying unknown args", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["info", "--unknown"]); expect(exitCode).toBe(2); expect(stderr).toContain("Error: Unknown option '--unknown'"); diff --git a/test/init/__snapshots__/init.test.js.snap.webpack4 b/test/init/__snapshots__/init.test.js.snap.webpack4 index 6688dabb001..3964b35e9bf 100644 --- a/test/init/__snapshots__/init.test.js.snap.webpack4 +++ b/test/init/__snapshots__/init.test.js.snap.webpack4 @@ -1,5 +1,49 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`init command recognizes '-f' as an alias for '--force' 1`] = ` +Object { + "description": "My webpack project", + "devDependencies": Object { + "html-webpack-plugin": "x.x.x", + "webpack": "x.x.x", + "webpack-cli": "x.x.x", + "webpack-dev-server": "x.x.x", + "workbox-webpack-plugin": "x.x.x", + }, + "name": "my-webpack-project", + "scripts": Object { + "build": "webpack --mode=production --node-env=production", + "build:dev": "webpack --mode=development", + "build:prod": "webpack --mode=production --node-env=production", + "serve": "webpack serve", + "watch": "webpack --watch", + }, + "version": "1.0.0", +} +`; + +exports[`init command recognizes '-t' as an alias for '--template' 1`] = ` +Object { + "description": "My webpack project", + "devDependencies": Object { + "html-webpack-plugin": "x.x.x", + "webpack": "x.x.x", + "webpack-cli": "x.x.x", + "webpack-dev-server": "x.x.x", + "workbox-webpack-plugin": "x.x.x", + }, + "name": "my-webpack-project", + "scripts": Object { + "build": "webpack --mode=production --node-env=production", + "build:dev": "webpack --mode=development", + "build:prod": "webpack --mode=production --node-env=production", + "serve": "webpack serve", + "watch": "webpack --watch", + }, + "version": "1.0.0", +} +`; + exports[`init command should ask question when wrong template is supplied 1`] = ` Object { "description": "My webpack project", @@ -8,6 +52,7 @@ Object { "webpack": "x.x.x", "webpack-cli": "x.x.x", "webpack-dev-server": "x.x.x", + "workbox-webpack-plugin": "x.x.x", }, "name": "my-webpack-project", "scripts": Object { @@ -93,6 +138,7 @@ Object { "webpack": "x.x.x", "webpack-cli": "x.x.x", "webpack-dev-server": "x.x.x", + "workbox-webpack-plugin": "x.x.x", }, "name": "my-webpack-project", "scripts": Object { @@ -111,6 +157,7 @@ exports[`init command should configure assets modules by default 2`] = ` const path = require(\\"path\\"); const HtmlWebpackPlugin = require(\\"html-webpack-plugin\\"); +const WorkboxWebpackPlugin = require(\\"workbox-webpack-plugin\\"); const isProduction = process.env.NODE_ENV == \\"production\\"; @@ -147,6 +194,8 @@ const config = { module.exports = () => { if (isProduction) { config.mode = \\"production\\"; + + config.plugins.push(new WorkboxWebpackPlugin.GenerateSW()); } else { config.mode = \\"development\\"; } @@ -219,6 +268,74 @@ module.exports = () => { " `; +exports[`init command should configure workbox-webpack-plugin as opted 1`] = ` +Object { + "description": "My webpack project", + "devDependencies": Object { + "html-webpack-plugin": "x.x.x", + "webpack": "x.x.x", + "webpack-cli": "x.x.x", + "workbox-webpack-plugin": "x.x.x", + }, + "name": "my-webpack-project", + "scripts": Object { + "build": "webpack --mode=production --node-env=production", + "build:dev": "webpack --mode=development", + "build:prod": "webpack --mode=production --node-env=production", + "watch": "webpack --watch", + }, + "version": "1.0.0", +} +`; + +exports[`init command should configure workbox-webpack-plugin as opted 2`] = ` +"// Generated using webpack-cli https://github.com/webpack/webpack-cli + +const path = require(\\"path\\"); +const HtmlWebpackPlugin = require(\\"html-webpack-plugin\\"); +const WorkboxWebpackPlugin = require(\\"workbox-webpack-plugin\\"); + +const isProduction = process.env.NODE_ENV == \\"production\\"; + +const config = { + entry: \\"./src/index.js\\", + output: { + path: path.resolve(__dirname, \\"dist\\"), + }, + plugins: [ + new HtmlWebpackPlugin({ + template: \\"index.html\\", + }), + + // Add your plugins here + // Learn more about plugins from https://webpack.js.org/configuration/plugins/ + ], + module: { + rules: [ + { + test: /\\\\.(eot|svg|ttf|woff|woff2|png|jpg|gif)$/i, + type: \\"asset\\", + }, + + // Add your rules for custom modules here + // Learn more about loaders from https://webpack.js.org/loaders/ + ], + }, +}; + +module.exports = () => { + if (isProduction) { + config.mode = \\"production\\"; + + config.plugins.push(new WorkboxWebpackPlugin.GenerateSW()); + } else { + config.mode = \\"development\\"; + } + return config; +}; +" +`; + exports[`init command should generate ES6 project correctly 1`] = ` Object { "description": "My webpack project", @@ -292,6 +409,7 @@ Object { "webpack": "x.x.x", "webpack-cli": "x.x.x", "webpack-dev-server": "x.x.x", + "workbox-webpack-plugin": "x.x.x", }, "name": "my-webpack-project", "scripts": Object { @@ -313,6 +431,7 @@ Object { "webpack": "x.x.x", "webpack-cli": "x.x.x", "webpack-dev-server": "x.x.x", + "workbox-webpack-plugin": "x.x.x", }, "name": "my-webpack-project", "scripts": Object { @@ -334,6 +453,7 @@ Object { "webpack": "x.x.x", "webpack-cli": "x.x.x", "webpack-dev-server": "x.x.x", + "workbox-webpack-plugin": "x.x.x", }, "name": "my-webpack-project", "scripts": Object { @@ -415,90 +535,6 @@ module.exports = () => { " `; -exports[`init command should should work with 'c' alias 1`] = ` -Object { - "description": "My webpack project", - "devDependencies": Object { - "html-webpack-plugin": "x.x.x", - "webpack": "x.x.x", - "webpack-cli": "x.x.x", - "webpack-dev-server": "x.x.x", - }, - "name": "my-webpack-project", - "scripts": Object { - "build": "webpack --mode=production --node-env=production", - "build:dev": "webpack --mode=development", - "build:prod": "webpack --mode=production --node-env=production", - "serve": "webpack serve", - "watch": "webpack --watch", - }, - "version": "1.0.0", -} -`; - -exports[`init command should should work with 'create' alias 1`] = ` -Object { - "description": "My webpack project", - "devDependencies": Object { - "html-webpack-plugin": "x.x.x", - "webpack": "x.x.x", - "webpack-cli": "x.x.x", - "webpack-dev-server": "x.x.x", - }, - "name": "my-webpack-project", - "scripts": Object { - "build": "webpack --mode=production --node-env=production", - "build:dev": "webpack --mode=development", - "build:prod": "webpack --mode=production --node-env=production", - "serve": "webpack serve", - "watch": "webpack --watch", - }, - "version": "1.0.0", -} -`; - -exports[`init command should should work with 'n' alias 1`] = ` -Object { - "description": "My webpack project", - "devDependencies": Object { - "html-webpack-plugin": "x.x.x", - "webpack": "x.x.x", - "webpack-cli": "x.x.x", - "webpack-dev-server": "x.x.x", - }, - "name": "my-webpack-project", - "scripts": Object { - "build": "webpack --mode=production --node-env=production", - "build:dev": "webpack --mode=development", - "build:prod": "webpack --mode=production --node-env=production", - "serve": "webpack serve", - "watch": "webpack --watch", - }, - "version": "1.0.0", -} -`; - -exports[`init command should should work with 'new' alias 1`] = ` -Object { - "description": "My webpack project", - "devDependencies": Object { - "html-webpack-plugin": "x.x.x", - "webpack": "x.x.x", - "webpack-cli": "x.x.x", - "webpack-dev-server": "x.x.x", - }, - "name": "my-webpack-project", - "scripts": Object { - "build": "webpack --mode=production --node-env=production", - "build:dev": "webpack --mode=development", - "build:prod": "webpack --mode=production --node-env=production", - "serve": "webpack serve", - "watch": "webpack --watch", - }, - "version": "1.0.0", -} -`; - exports[`init command should use less in project when selected 1`] = ` Object { "description": "My webpack project", @@ -965,3 +1001,91 @@ module.exports = () => { }; " `; + +exports[`init command should work with 'c' alias 1`] = ` +Object { + "description": "My webpack project", + "devDependencies": Object { + "html-webpack-plugin": "x.x.x", + "webpack": "x.x.x", + "webpack-cli": "x.x.x", + "webpack-dev-server": "x.x.x", + "workbox-webpack-plugin": "x.x.x", + }, + "name": "my-webpack-project", + "scripts": Object { + "build": "webpack --mode=production --node-env=production", + "build:dev": "webpack --mode=development", + "build:prod": "webpack --mode=production --node-env=production", + "serve": "webpack serve", + "watch": "webpack --watch", + }, + "version": "1.0.0", +} +`; + +exports[`init command should work with 'create' alias 1`] = ` +Object { + "description": "My webpack project", + "devDependencies": Object { + "html-webpack-plugin": "x.x.x", + "webpack": "x.x.x", + "webpack-cli": "x.x.x", + "webpack-dev-server": "x.x.x", + "workbox-webpack-plugin": "x.x.x", + }, + "name": "my-webpack-project", + "scripts": Object { + "build": "webpack --mode=production --node-env=production", + "build:dev": "webpack --mode=development", + "build:prod": "webpack --mode=production --node-env=production", + "serve": "webpack serve", + "watch": "webpack --watch", + }, + "version": "1.0.0", +} +`; + +exports[`init command should work with 'n' alias 1`] = ` +Object { + "description": "My webpack project", + "devDependencies": Object { + "html-webpack-plugin": "x.x.x", + "webpack": "x.x.x", + "webpack-cli": "x.x.x", + "webpack-dev-server": "x.x.x", + "workbox-webpack-plugin": "x.x.x", + }, + "name": "my-webpack-project", + "scripts": Object { + "build": "webpack --mode=production --node-env=production", + "build:dev": "webpack --mode=development", + "build:prod": "webpack --mode=production --node-env=production", + "serve": "webpack serve", + "watch": "webpack --watch", + }, + "version": "1.0.0", +} +`; + +exports[`init command should work with 'new' alias 1`] = ` +Object { + "description": "My webpack project", + "devDependencies": Object { + "html-webpack-plugin": "x.x.x", + "webpack": "x.x.x", + "webpack-cli": "x.x.x", + "webpack-dev-server": "x.x.x", + "workbox-webpack-plugin": "x.x.x", + }, + "name": "my-webpack-project", + "scripts": Object { + "build": "webpack --mode=production --node-env=production", + "build:dev": "webpack --mode=development", + "build:prod": "webpack --mode=production --node-env=production", + "serve": "webpack serve", + "watch": "webpack --watch", + }, + "version": "1.0.0", +} +`; diff --git a/test/init/__snapshots__/init.test.js.snap.webpack5 b/test/init/__snapshots__/init.test.js.snap.webpack5 index 6688dabb001..3964b35e9bf 100644 --- a/test/init/__snapshots__/init.test.js.snap.webpack5 +++ b/test/init/__snapshots__/init.test.js.snap.webpack5 @@ -1,5 +1,49 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`init command recognizes '-f' as an alias for '--force' 1`] = ` +Object { + "description": "My webpack project", + "devDependencies": Object { + "html-webpack-plugin": "x.x.x", + "webpack": "x.x.x", + "webpack-cli": "x.x.x", + "webpack-dev-server": "x.x.x", + "workbox-webpack-plugin": "x.x.x", + }, + "name": "my-webpack-project", + "scripts": Object { + "build": "webpack --mode=production --node-env=production", + "build:dev": "webpack --mode=development", + "build:prod": "webpack --mode=production --node-env=production", + "serve": "webpack serve", + "watch": "webpack --watch", + }, + "version": "1.0.0", +} +`; + +exports[`init command recognizes '-t' as an alias for '--template' 1`] = ` +Object { + "description": "My webpack project", + "devDependencies": Object { + "html-webpack-plugin": "x.x.x", + "webpack": "x.x.x", + "webpack-cli": "x.x.x", + "webpack-dev-server": "x.x.x", + "workbox-webpack-plugin": "x.x.x", + }, + "name": "my-webpack-project", + "scripts": Object { + "build": "webpack --mode=production --node-env=production", + "build:dev": "webpack --mode=development", + "build:prod": "webpack --mode=production --node-env=production", + "serve": "webpack serve", + "watch": "webpack --watch", + }, + "version": "1.0.0", +} +`; + exports[`init command should ask question when wrong template is supplied 1`] = ` Object { "description": "My webpack project", @@ -8,6 +52,7 @@ Object { "webpack": "x.x.x", "webpack-cli": "x.x.x", "webpack-dev-server": "x.x.x", + "workbox-webpack-plugin": "x.x.x", }, "name": "my-webpack-project", "scripts": Object { @@ -93,6 +138,7 @@ Object { "webpack": "x.x.x", "webpack-cli": "x.x.x", "webpack-dev-server": "x.x.x", + "workbox-webpack-plugin": "x.x.x", }, "name": "my-webpack-project", "scripts": Object { @@ -111,6 +157,7 @@ exports[`init command should configure assets modules by default 2`] = ` const path = require(\\"path\\"); const HtmlWebpackPlugin = require(\\"html-webpack-plugin\\"); +const WorkboxWebpackPlugin = require(\\"workbox-webpack-plugin\\"); const isProduction = process.env.NODE_ENV == \\"production\\"; @@ -147,6 +194,8 @@ const config = { module.exports = () => { if (isProduction) { config.mode = \\"production\\"; + + config.plugins.push(new WorkboxWebpackPlugin.GenerateSW()); } else { config.mode = \\"development\\"; } @@ -219,6 +268,74 @@ module.exports = () => { " `; +exports[`init command should configure workbox-webpack-plugin as opted 1`] = ` +Object { + "description": "My webpack project", + "devDependencies": Object { + "html-webpack-plugin": "x.x.x", + "webpack": "x.x.x", + "webpack-cli": "x.x.x", + "workbox-webpack-plugin": "x.x.x", + }, + "name": "my-webpack-project", + "scripts": Object { + "build": "webpack --mode=production --node-env=production", + "build:dev": "webpack --mode=development", + "build:prod": "webpack --mode=production --node-env=production", + "watch": "webpack --watch", + }, + "version": "1.0.0", +} +`; + +exports[`init command should configure workbox-webpack-plugin as opted 2`] = ` +"// Generated using webpack-cli https://github.com/webpack/webpack-cli + +const path = require(\\"path\\"); +const HtmlWebpackPlugin = require(\\"html-webpack-plugin\\"); +const WorkboxWebpackPlugin = require(\\"workbox-webpack-plugin\\"); + +const isProduction = process.env.NODE_ENV == \\"production\\"; + +const config = { + entry: \\"./src/index.js\\", + output: { + path: path.resolve(__dirname, \\"dist\\"), + }, + plugins: [ + new HtmlWebpackPlugin({ + template: \\"index.html\\", + }), + + // Add your plugins here + // Learn more about plugins from https://webpack.js.org/configuration/plugins/ + ], + module: { + rules: [ + { + test: /\\\\.(eot|svg|ttf|woff|woff2|png|jpg|gif)$/i, + type: \\"asset\\", + }, + + // Add your rules for custom modules here + // Learn more about loaders from https://webpack.js.org/loaders/ + ], + }, +}; + +module.exports = () => { + if (isProduction) { + config.mode = \\"production\\"; + + config.plugins.push(new WorkboxWebpackPlugin.GenerateSW()); + } else { + config.mode = \\"development\\"; + } + return config; +}; +" +`; + exports[`init command should generate ES6 project correctly 1`] = ` Object { "description": "My webpack project", @@ -292,6 +409,7 @@ Object { "webpack": "x.x.x", "webpack-cli": "x.x.x", "webpack-dev-server": "x.x.x", + "workbox-webpack-plugin": "x.x.x", }, "name": "my-webpack-project", "scripts": Object { @@ -313,6 +431,7 @@ Object { "webpack": "x.x.x", "webpack-cli": "x.x.x", "webpack-dev-server": "x.x.x", + "workbox-webpack-plugin": "x.x.x", }, "name": "my-webpack-project", "scripts": Object { @@ -334,6 +453,7 @@ Object { "webpack": "x.x.x", "webpack-cli": "x.x.x", "webpack-dev-server": "x.x.x", + "workbox-webpack-plugin": "x.x.x", }, "name": "my-webpack-project", "scripts": Object { @@ -415,90 +535,6 @@ module.exports = () => { " `; -exports[`init command should should work with 'c' alias 1`] = ` -Object { - "description": "My webpack project", - "devDependencies": Object { - "html-webpack-plugin": "x.x.x", - "webpack": "x.x.x", - "webpack-cli": "x.x.x", - "webpack-dev-server": "x.x.x", - }, - "name": "my-webpack-project", - "scripts": Object { - "build": "webpack --mode=production --node-env=production", - "build:dev": "webpack --mode=development", - "build:prod": "webpack --mode=production --node-env=production", - "serve": "webpack serve", - "watch": "webpack --watch", - }, - "version": "1.0.0", -} -`; - -exports[`init command should should work with 'create' alias 1`] = ` -Object { - "description": "My webpack project", - "devDependencies": Object { - "html-webpack-plugin": "x.x.x", - "webpack": "x.x.x", - "webpack-cli": "x.x.x", - "webpack-dev-server": "x.x.x", - }, - "name": "my-webpack-project", - "scripts": Object { - "build": "webpack --mode=production --node-env=production", - "build:dev": "webpack --mode=development", - "build:prod": "webpack --mode=production --node-env=production", - "serve": "webpack serve", - "watch": "webpack --watch", - }, - "version": "1.0.0", -} -`; - -exports[`init command should should work with 'n' alias 1`] = ` -Object { - "description": "My webpack project", - "devDependencies": Object { - "html-webpack-plugin": "x.x.x", - "webpack": "x.x.x", - "webpack-cli": "x.x.x", - "webpack-dev-server": "x.x.x", - }, - "name": "my-webpack-project", - "scripts": Object { - "build": "webpack --mode=production --node-env=production", - "build:dev": "webpack --mode=development", - "build:prod": "webpack --mode=production --node-env=production", - "serve": "webpack serve", - "watch": "webpack --watch", - }, - "version": "1.0.0", -} -`; - -exports[`init command should should work with 'new' alias 1`] = ` -Object { - "description": "My webpack project", - "devDependencies": Object { - "html-webpack-plugin": "x.x.x", - "webpack": "x.x.x", - "webpack-cli": "x.x.x", - "webpack-dev-server": "x.x.x", - }, - "name": "my-webpack-project", - "scripts": Object { - "build": "webpack --mode=production --node-env=production", - "build:dev": "webpack --mode=development", - "build:prod": "webpack --mode=production --node-env=production", - "serve": "webpack serve", - "watch": "webpack --watch", - }, - "version": "1.0.0", -} -`; - exports[`init command should use less in project when selected 1`] = ` Object { "description": "My webpack project", @@ -965,3 +1001,91 @@ module.exports = () => { }; " `; + +exports[`init command should work with 'c' alias 1`] = ` +Object { + "description": "My webpack project", + "devDependencies": Object { + "html-webpack-plugin": "x.x.x", + "webpack": "x.x.x", + "webpack-cli": "x.x.x", + "webpack-dev-server": "x.x.x", + "workbox-webpack-plugin": "x.x.x", + }, + "name": "my-webpack-project", + "scripts": Object { + "build": "webpack --mode=production --node-env=production", + "build:dev": "webpack --mode=development", + "build:prod": "webpack --mode=production --node-env=production", + "serve": "webpack serve", + "watch": "webpack --watch", + }, + "version": "1.0.0", +} +`; + +exports[`init command should work with 'create' alias 1`] = ` +Object { + "description": "My webpack project", + "devDependencies": Object { + "html-webpack-plugin": "x.x.x", + "webpack": "x.x.x", + "webpack-cli": "x.x.x", + "webpack-dev-server": "x.x.x", + "workbox-webpack-plugin": "x.x.x", + }, + "name": "my-webpack-project", + "scripts": Object { + "build": "webpack --mode=production --node-env=production", + "build:dev": "webpack --mode=development", + "build:prod": "webpack --mode=production --node-env=production", + "serve": "webpack serve", + "watch": "webpack --watch", + }, + "version": "1.0.0", +} +`; + +exports[`init command should work with 'n' alias 1`] = ` +Object { + "description": "My webpack project", + "devDependencies": Object { + "html-webpack-plugin": "x.x.x", + "webpack": "x.x.x", + "webpack-cli": "x.x.x", + "webpack-dev-server": "x.x.x", + "workbox-webpack-plugin": "x.x.x", + }, + "name": "my-webpack-project", + "scripts": Object { + "build": "webpack --mode=production --node-env=production", + "build:dev": "webpack --mode=development", + "build:prod": "webpack --mode=production --node-env=production", + "serve": "webpack serve", + "watch": "webpack --watch", + }, + "version": "1.0.0", +} +`; + +exports[`init command should work with 'new' alias 1`] = ` +Object { + "description": "My webpack project", + "devDependencies": Object { + "html-webpack-plugin": "x.x.x", + "webpack": "x.x.x", + "webpack-cli": "x.x.x", + "webpack-dev-server": "x.x.x", + "workbox-webpack-plugin": "x.x.x", + }, + "name": "my-webpack-project", + "scripts": Object { + "build": "webpack --mode=production --node-env=production", + "build:dev": "webpack --mode=development", + "build:prod": "webpack --mode=production --node-env=production", + "serve": "webpack serve", + "watch": "webpack --watch", + }, + "version": "1.0.0", +} +`; diff --git a/test/init/init.test.js b/test/init/init.test.js index 14840bc5b5b..a8ef6cca672 100644 --- a/test/init/init.test.js +++ b/test/init/init.test.js @@ -1,44 +1,49 @@ -const os = require('os'); -const path = require('path'); -const { mkdirSync, existsSync, readFileSync } = require('fs'); -const { join, resolve } = require('path'); -const { isWindows, run, runPromptWithAnswers, uniqueDirectoryForTest } = require('../utils/test-utils'); +const os = require("os"); +const path = require("path"); +const { mkdirSync, existsSync, readFileSync } = require("fs"); +const { join, resolve } = require("path"); +const { + isWindows, + run, + runPromptWithAnswers, + uniqueDirectoryForTest, +} = require("../utils/test-utils"); jest.setTimeout(480000); -const ENTER = '\x0D'; -const DOWN = '\x1B\x5B\x42'; +const ENTER = "\x0D"; +const DOWN = "\x1B\x5B\x42"; // Helper to read from package.json in a given path const readFromPkgJSON = (path) => { - const pkgJSONPath = join(path, 'package.json'); + const pkgJSONPath = join(path, "package.json"); if (!existsSync(pkgJSONPath)) { return {}; } - const pkgJSON = JSON.parse(readFileSync(pkgJSONPath, 'utf8')); + const pkgJSON = JSON.parse(readFileSync(pkgJSONPath, "utf8")); const { devDependencies: devDeps } = pkgJSON; // Update devDeps versions to be x.x.x to prevent frequent snapshot updates - Object.keys(devDeps).forEach((dep) => (devDeps[dep] = 'x.x.x')); + Object.keys(devDeps).forEach((dep) => (devDeps[dep] = "x.x.x")); return { ...pkgJSON, devDependencies: devDeps }; }; // Helper to read from webpack.config.js in a given path -const readFromWebpackConfig = (path) => readFileSync(join(path, 'webpack.config.js'), 'utf8'); +const readFromWebpackConfig = (path) => readFileSync(join(path, "webpack.config.js"), "utf8"); -describe('init command', () => { - it('should generate default project when nothing is passed', async () => { +describe("init command", () => { + it("should generate default project when nothing is passed", async () => { const assetsPath = await uniqueDirectoryForTest(); - const { stdout, stderr } = await run(assetsPath, ['init', '--force']); + const { stdout, stderr } = await run(assetsPath, ["init", "--force"]); - expect(stdout).toContain('Project has been initialised with webpack!'); - expect(stderr).toContain('webpack.config.js'); + expect(stdout).toContain("Project has been initialised with webpack!"); + expect(stderr).toContain("webpack.config.js"); // Test files - const files = ['package.json', 'src', 'src/index.js', 'webpack.config.js']; + const files = ["package.json", "src", "src/index.js", "webpack.config.js"]; files.forEach((file) => { expect(existsSync(resolve(assetsPath, file))).toBeTruthy(); @@ -48,15 +53,15 @@ describe('init command', () => { expect(readFromPkgJSON(assetsPath)).toMatchSnapshot(); }); - it('should generate project when generationPath is supplied', async () => { + it("should generate project when generationPath is supplied", async () => { const assetsPath = await uniqueDirectoryForTest(); - const { stdout, stderr } = await run(__dirname, ['init', assetsPath, '--force']); + const { stdout, stderr } = await run(__dirname, ["init", assetsPath, "--force"]); - expect(stdout).toContain('Project has been initialised with webpack!'); - expect(stderr).toContain('webpack.config.js'); + expect(stdout).toContain("Project has been initialised with webpack!"); + expect(stderr).toContain("webpack.config.js"); // Test files - const files = ['package.json', 'src', 'src/index.js', 'webpack.config.js']; + const files = ["package.json", "src", "src/index.js", "webpack.config.js"]; files.forEach((file) => { expect(existsSync(resolve(assetsPath, file))).toBeTruthy(); @@ -66,16 +71,18 @@ describe('init command', () => { expect(readFromPkgJSON(assetsPath)).toMatchSnapshot(); }); - it('should generate folders if non existing generation path is given', async () => { + it("should generate folders if non existing generation path is given", async () => { const assetsPath = path.resolve(os.tmpdir(), Date.now().toString()); - const { stdout, stderr } = await run(__dirname, ['init', assetsPath, '--force']); + const { stdout, stderr } = await run(__dirname, ["init", assetsPath, "--force"]); - expect(stdout).toContain("generation path doesn't exist, required folders will be created."); - expect(stdout).toContain('Project has been initialised with webpack!'); - expect(stderr).toContain('webpack.config.js'); + expect(stdout).toContain( + "generation path doesn't exist, required folders will be created.", + ); + expect(stdout).toContain("Project has been initialised with webpack!"); + expect(stderr).toContain("webpack.config.js"); // Test files - const files = ['package.json', 'src', 'src/index.js', 'webpack.config.js']; + const files = ["package.json", "src", "src/index.js", "webpack.config.js"]; files.forEach((file) => { expect(existsSync(resolve(assetsPath, file))).toBeTruthy(); @@ -85,16 +92,18 @@ describe('init command', () => { expect(readFromPkgJSON(assetsPath)).toMatchSnapshot(); }); - it('should configure assets modules by default', async () => { + it("should configure assets modules by default", async () => { const assetsPath = path.resolve(os.tmpdir(), Date.now().toString()); - const { stdout, stderr } = await run(__dirname, ['init', assetsPath, '--force']); + const { stdout, stderr } = await run(__dirname, ["init", assetsPath, "--force"]); - expect(stdout).toContain("generation path doesn't exist, required folders will be created."); - expect(stdout).toContain('Project has been initialised with webpack!'); - expect(stderr).toContain('webpack.config.js'); + expect(stdout).toContain( + "generation path doesn't exist, required folders will be created.", + ); + expect(stdout).toContain("Project has been initialised with webpack!"); + expect(stderr).toContain("webpack.config.js"); // Test files - const files = ['package.json', 'src', 'src/index.js', 'webpack.config.js']; + const files = ["package.json", "src", "src/index.js", "webpack.config.js"]; files.forEach((file) => { expect(existsSync(resolve(assetsPath, file))).toBeTruthy(); @@ -107,16 +116,20 @@ describe('init command', () => { expect(readFromWebpackConfig(assetsPath)).toMatchSnapshot(); }); - it('should ask question when wrong template is supplied', async () => { + it("should ask question when wrong template is supplied", async () => { const assetsPath = await uniqueDirectoryForTest(); - const { stdout, stderr } = await runPromptWithAnswers(assetsPath, ['init', '--force', '--template=apple'], [`${ENTER}`]); + const { stdout, stderr } = await runPromptWithAnswers( + assetsPath, + ["init", "--force", "--template=apple"], + [`${ENTER}`], + ); - expect(stdout).toContain('Project has been initialised with webpack!'); - expect(stderr).toContain('apple is not a valid template, please select one from below'); - expect(stderr).toContain('webpack.config.js'); + expect(stdout).toContain("Project has been initialised with webpack!"); + expect(stderr).toContain("apple is not a valid template, please select one from below"); + expect(stderr).toContain("webpack.config.js"); // Test files - const files = ['package.json', 'src', 'src/index.js', 'webpack.config.js']; + const files = ["package.json", "src", "src/index.js", "webpack.config.js"]; files.forEach((file) => { expect(existsSync(resolve(assetsPath, file))).toBeTruthy(); @@ -126,20 +139,20 @@ describe('init command', () => { expect(readFromPkgJSON(assetsPath)).toMatchSnapshot(); }); - it('should generate typescript project correctly', async () => { + it("should generate typescript project correctly", async () => { const assetsPath = await uniqueDirectoryForTest(); const { stdout, stderr } = await runPromptWithAnswers( assetsPath, - ['init'], - [`${DOWN}${DOWN}${ENTER}`, `n${ENTER}`, `n${ENTER}`, `${ENTER}`], + ["init"], + [`${DOWN}${DOWN}${ENTER}`, `n${ENTER}`, `n${ENTER}`, `n${ENTER}`, ENTER], ); - expect(stdout).toContain('Project has been initialised with webpack!'); - expect(stderr).toContain('webpack.config.js'); - expect(stderr).toContain('tsconfig.json'); + expect(stdout).toContain("Project has been initialised with webpack!"); + expect(stderr).toContain("webpack.config.js"); + expect(stderr).toContain("tsconfig.json"); // Test files - const files = ['package.json', 'src', 'src/index.ts', 'webpack.config.js', 'tsconfig.json']; + const files = ["package.json", "src", "src/index.ts", "webpack.config.js", "tsconfig.json"]; files.forEach((file) => { expect(existsSync(resolve(assetsPath, file))).toBeTruthy(); @@ -152,20 +165,20 @@ describe('init command', () => { expect(readFromWebpackConfig(assetsPath)).toMatchSnapshot(); }); - it('should generate ES6 project correctly', async () => { + it("should generate ES6 project correctly", async () => { const assetsPath = await uniqueDirectoryForTest(); const { stdout, stderr } = await runPromptWithAnswers( assetsPath, - ['init'], - [`${DOWN}${ENTER}`, `n${ENTER}`, `n${ENTER}`, `${ENTER}`], + ["init"], + [`${DOWN}${ENTER}`, `n${ENTER}`, `n${ENTER}`, `n${ENTER}`, ENTER], ); - expect(stdout).toContain('Project has been initialised with webpack!'); - expect(stderr).toContain('webpack.config.js'); - expect(stderr).toContain('.babelrc'); + expect(stdout).toContain("Project has been initialised with webpack!"); + expect(stderr).toContain("webpack.config.js"); + expect(stderr).toContain(".babelrc"); // Test files - const files = ['package.json', 'src', 'src/index.js', 'webpack.config.js', '.babelrc']; + const files = ["package.json", "src", "src/index.js", "webpack.config.js", ".babelrc"]; files.forEach((file) => { expect(existsSync(resolve(assetsPath, file))).toBeTruthy(); @@ -178,19 +191,28 @@ describe('init command', () => { expect(readFromWebpackConfig(assetsPath)).toMatchSnapshot(); }); - it('should use sass in project when selected', async () => { + it("should use sass in project when selected", async () => { const assetsPath = await uniqueDirectoryForTest(); const { stdout, stderr } = await runPromptWithAnswers( assetsPath, - ['init'], - [`${ENTER}`, `n${ENTER}`, `n${ENTER}`, `${DOWN}${DOWN}${ENTER}`, `n${ENTER}`, `n${ENTER}`, `n${ENTER}`], + ["init"], + [ + `${ENTER}`, + `n${ENTER}`, + `n${ENTER}`, + `n${ENTER}`, + `${DOWN}${DOWN}${ENTER}`, + `n${ENTER}`, + `n${ENTER}`, + `n${ENTER}`, + ], ); - expect(stdout).toContain('Project has been initialised with webpack!'); - expect(stderr).toContain('webpack.config.js'); + expect(stdout).toContain("Project has been initialised with webpack!"); + expect(stderr).toContain("webpack.config.js"); // Test files - const files = ['package.json', 'src', 'src/index.js', 'webpack.config.js']; + const files = ["package.json", "src", "src/index.js", "webpack.config.js"]; files.forEach((file) => { expect(existsSync(resolve(assetsPath, file))).toBeTruthy(); @@ -203,19 +225,34 @@ describe('init command', () => { expect(readFromWebpackConfig(assetsPath)).toMatchSnapshot(); }); - it('should use sass with postcss in project when selected', async () => { + it("should use sass with postcss in project when selected", async () => { const assetsPath = await uniqueDirectoryForTest(); const { stdout, stderr } = await runPromptWithAnswers( assetsPath, - ['init'], - [`${ENTER}`, `n${ENTER}`, `n${ENTER}`, `${DOWN}${DOWN}${ENTER}`, `n${ENTER}`, `y${ENTER}`, `n${ENTER}`], + ["init"], + [ + `${ENTER}`, + `n${ENTER}`, + `n${ENTER}`, + `n${ENTER}`, + `${DOWN}${DOWN}${ENTER}`, + `n${ENTER}`, + `y${ENTER}`, + `n${ENTER}`, + ], ); - expect(stdout).toContain('Project has been initialised with webpack!'); - expect(stderr).toContain('webpack.config.js'); + expect(stdout).toContain("Project has been initialised with webpack!"); + expect(stderr).toContain("webpack.config.js"); // Test files - const files = ['package.json', 'src', 'src/index.js', 'webpack.config.js', 'postcss.config.js']; + const files = [ + "package.json", + "src", + "src/index.js", + "webpack.config.js", + "postcss.config.js", + ]; files.forEach((file) => { expect(existsSync(resolve(assetsPath, file))).toBeTruthy(); @@ -228,19 +265,28 @@ describe('init command', () => { expect(readFromWebpackConfig(assetsPath)).toMatchSnapshot(); }); - it('should use mini-css-extract-plugin when selected', async () => { + it("should use mini-css-extract-plugin when selected", async () => { const assetsPath = await uniqueDirectoryForTest(); const { stdout, stderr } = await runPromptWithAnswers( assetsPath, - ['init'], - [`${ENTER}`, `n${ENTER}`, `n${ENTER}`, `${DOWN}${DOWN}${ENTER}`, `n${ENTER}`, `n${ENTER}`, `y${ENTER}`], + ["init"], + [ + `${ENTER}`, + `n${ENTER}`, + `n${ENTER}`, + `n${ENTER}`, + `${DOWN}${DOWN}${ENTER}`, + `n${ENTER}`, + `n${ENTER}`, + `y${ENTER}`, + ], ); - expect(stdout).toContain('Project has been initialised with webpack!'); - expect(stderr).toContain('webpack.config.js'); + expect(stdout).toContain("Project has been initialised with webpack!"); + expect(stderr).toContain("webpack.config.js"); // Test files - const files = ['package.json', 'src', 'src/index.js', 'webpack.config.js']; + const files = ["package.json", "src", "src/index.js", "webpack.config.js"]; files.forEach((file) => { expect(existsSync(resolve(assetsPath, file))).toBeTruthy(); @@ -253,19 +299,34 @@ describe('init command', () => { expect(readFromWebpackConfig(assetsPath)).toMatchSnapshot(); }); - it('should use sass and css with postcss in project when selected', async () => { + it("should use sass and css with postcss in project when selected", async () => { const assetsPath = await uniqueDirectoryForTest(); const { stdout, stderr } = await runPromptWithAnswers( assetsPath, - ['init'], - [`${ENTER}`, `n${ENTER}`, `n${ENTER}`, `${DOWN}${DOWN}${ENTER}`, `y${ENTER}`, `y${ENTER}`, `n${ENTER}`], + ["init"], + [ + `${ENTER}`, + `n${ENTER}`, + `n${ENTER}`, + `n${ENTER}`, + `${DOWN}${DOWN}${ENTER}`, + `y${ENTER}`, + `y${ENTER}`, + `n${ENTER}`, + ], ); - expect(stdout).toContain('Project has been initialised with webpack!'); - expect(stderr).toContain('webpack.config.js'); + expect(stdout).toContain("Project has been initialised with webpack!"); + expect(stderr).toContain("webpack.config.js"); // Test files - const files = ['package.json', 'src', 'src/index.js', 'webpack.config.js', 'postcss.config.js']; + const files = [ + "package.json", + "src", + "src/index.js", + "webpack.config.js", + "postcss.config.js", + ]; files.forEach((file) => { expect(existsSync(resolve(assetsPath, file))).toBeTruthy(); @@ -278,19 +339,28 @@ describe('init command', () => { expect(readFromWebpackConfig(assetsPath)).toMatchSnapshot(); }); - it('should use less in project when selected', async () => { + it("should use less in project when selected", async () => { const assetsPath = await uniqueDirectoryForTest(); const { stdout, stderr } = await runPromptWithAnswers( assetsPath, - ['init'], - [`${ENTER}`, `n${ENTER}`, `n${ENTER}`, `${DOWN}${DOWN}${DOWN}${ENTER}`, `n${ENTER}`, `n${ENTER}`, `n${ENTER}`], + ["init"], + [ + `${ENTER}`, + `n${ENTER}`, + `n${ENTER}`, + `n${ENTER}`, + `${DOWN}${DOWN}${DOWN}${ENTER}`, + `n${ENTER}`, + `n${ENTER}`, + `n${ENTER}`, + ], ); - expect(stdout).toContain('Project has been initialised with webpack!'); - expect(stderr).toContain('webpack.config.js'); + expect(stdout).toContain("Project has been initialised with webpack!"); + expect(stderr).toContain("webpack.config.js"); // Test files - const files = ['package.json', 'src', 'src/index.js', 'webpack.config.js']; + const files = ["package.json", "src", "src/index.js", "webpack.config.js"]; files.forEach((file) => { expect(existsSync(resolve(assetsPath, file))).toBeTruthy(); @@ -303,19 +373,28 @@ describe('init command', () => { expect(readFromWebpackConfig(assetsPath)).toMatchSnapshot(); }); - it('should use stylus in project when selected', async () => { + it("should use stylus in project when selected", async () => { const assetsPath = await uniqueDirectoryForTest(); const { stdout, stderr } = await runPromptWithAnswers( assetsPath, - ['init'], - [`${ENTER}`, `n${ENTER}`, `n${ENTER}`, `${DOWN}${DOWN}${DOWN}${DOWN}${ENTER}`, `n${ENTER}`, `n${ENTER}`, `n${ENTER}`], + ["init"], + [ + `${ENTER}`, + `n${ENTER}`, + `n${ENTER}`, + `n${ENTER}`, + `${DOWN}${DOWN}${DOWN}${DOWN}${ENTER}`, + `n${ENTER}`, + `n${ENTER}`, + `n${ENTER}`, + ], ); - expect(stdout).toContain('Project has been initialised with webpack!'); - expect(stderr).toContain('webpack.config.js'); + expect(stdout).toContain("Project has been initialised with webpack!"); + expect(stderr).toContain("webpack.config.js"); // Test files - const files = ['package.json', 'src', 'src/index.js', 'webpack.config.js']; + const files = ["package.json", "src", "src/index.js", "webpack.config.js"]; files.forEach((file) => { expect(existsSync(resolve(assetsPath, file))).toBeTruthy(); @@ -328,16 +407,20 @@ describe('init command', () => { expect(readFromWebpackConfig(assetsPath)).toMatchSnapshot(); }); - it('should configure WDS as opted', async () => { + it("should configure WDS as opted", async () => { const assetsPath = await uniqueDirectoryForTest(); - const { stdout, stderr } = await runPromptWithAnswers(assetsPath, ['init'], [ENTER, ENTER, `n${ENTER}`, ENTER]); + const { stdout, stderr } = await runPromptWithAnswers( + assetsPath, + ["init"], + [ENTER, ENTER, `n${ENTER}`, `n${ENTER}`, ENTER], + ); - expect(stdout).toContain('Do you want to use webpack-dev-server?'); - expect(stdout).toContain('Project has been initialised with webpack!'); - expect(stderr).toContain('webpack.config.js'); + expect(stdout).toContain("Do you want to use webpack-dev-server?"); + expect(stdout).toContain("Project has been initialised with webpack!"); + expect(stderr).toContain("webpack.config.js"); // Test files - const files = ['package.json', 'src', 'src/index.js', 'webpack.config.js']; + const files = ["package.json", "src", "src/index.js", "webpack.config.js"]; files.forEach((file) => { expect(existsSync(resolve(assetsPath, file))).toBeTruthy(); }); @@ -349,19 +432,33 @@ describe('init command', () => { expect(readFromWebpackConfig(assetsPath)).toMatchSnapshot(); }); - it('should use postcss in project when selected', async () => { + it("should use postcss in project when selected", async () => { const assetsPath = await uniqueDirectoryForTest(); const { stdout, stderr } = await runPromptWithAnswers( assetsPath, - ['init'], - [`${ENTER}`, `n${ENTER}`, `n${ENTER}`, `${DOWN}${ENTER}`, ENTER, `n${ENTER}`], + ["init"], + [ + `${ENTER}`, + `n${ENTER}`, + `n${ENTER}`, + `n${ENTER}`, + `${DOWN}${ENTER}`, + ENTER, + `n${ENTER}`, + ], ); - expect(stdout).toContain('Project has been initialised with webpack!'); - expect(stderr).toContain('webpack.config.js'); + expect(stdout).toContain("Project has been initialised with webpack!"); + expect(stderr).toContain("webpack.config.js"); // Test files - const files = ['package.json', 'src', 'src/index.js', 'webpack.config.js', 'postcss.config.js']; + const files = [ + "package.json", + "src", + "src/index.js", + "webpack.config.js", + "postcss.config.js", + ]; files.forEach((file) => { expect(existsSync(resolve(assetsPath, file))).toBeTruthy(); @@ -374,16 +471,22 @@ describe('init command', () => { expect(readFromWebpackConfig(assetsPath)).toMatchSnapshot(); }); - it('should configure html-webpack-plugin as opted', async () => { + it("should configure html-webpack-plugin as opted", async () => { const assetsPath = await uniqueDirectoryForTest(); - const { stdout, stderr } = await runPromptWithAnswers(assetsPath, ['init'], [ENTER, `n${ENTER}`, ENTER, ENTER]); + const { stdout, stderr } = await runPromptWithAnswers( + assetsPath, + ["init"], + [ENTER, `n${ENTER}`, ENTER, `n${ENTER}`, ENTER], + ); - expect(stdout).toContain('Do you want to simplify the creation of HTML files for your bundle?'); - expect(stdout).toContain('Project has been initialised with webpack!'); - expect(stderr).toContain('webpack.config.js'); + expect(stdout).toContain( + "Do you want to simplify the creation of HTML files for your bundle?", + ); + expect(stdout).toContain("Project has been initialised with webpack!"); + expect(stderr).toContain("webpack.config.js"); // Test files - const files = ['package.json', 'src', 'src/index.js', 'webpack.config.js']; + const files = ["package.json", "src", "src/index.js", "webpack.config.js"]; files.forEach((file) => { expect(existsSync(resolve(assetsPath, file))).toBeTruthy(); @@ -396,31 +499,93 @@ describe('init command', () => { expect(readFromWebpackConfig(assetsPath)).toMatchSnapshot(); }); - it('should throw if the current path is not writable', async () => { + it("should configure workbox-webpack-plugin as opted", async () => { + const assetsPath = await uniqueDirectoryForTest(); + const { stdout, stderr } = await runPromptWithAnswers( + assetsPath, + ["init"], + [ENTER, `n${ENTER}`, ENTER, ENTER, ENTER], + ); + + expect(stdout).toContain("Do you want to add PWA support?"); + expect(stdout).toContain("Project has been initialised with webpack!"); + expect(stderr).toContain("webpack.config.js"); + + // Test files + const files = ["package.json", "src", "src/index.js", "webpack.config.js"]; + + files.forEach((file) => { + expect(existsSync(resolve(assetsPath, file))).toBeTruthy(); + }); + + // Check if the generated package.json file content matches the snapshot + expect(readFromPkgJSON(assetsPath)).toMatchSnapshot(); + + // Check if the generated webpack configuration matches the snapshot + expect(readFromWebpackConfig(assetsPath)).toMatchSnapshot(); + }); + + it("should throw if the current path is not writable", async () => { if (isWindows) { return; } const assetsPath = await uniqueDirectoryForTest(); - const projectPath = join(assetsPath, 'non-writable-path'); + const projectPath = join(assetsPath, "non-writable-path"); mkdirSync(projectPath, 0o500); - const { exitCode, stderr } = await run(projectPath, ['init', 'my-app'], { reject: false }); + const { exitCode, stderr } = await run(projectPath, ["init", "my-app"], { reject: false }); expect(exitCode).toBe(2); - expect(stderr).toContain('Failed to create directory'); + expect(stderr).toContain("Failed to create directory"); + }); + + it("should work with 'new' alias", async () => { + const assetsPath = await uniqueDirectoryForTest(); + const { stdout, stderr } = await run(assetsPath, ["new", "--force"]); + + expect(stdout).toContain("Project has been initialised with webpack!"); + expect(stderr).toContain("webpack.config.js"); + + // Test files + const files = ["package.json", "src", "src/index.js", "webpack.config.js"]; + + files.forEach((file) => { + expect(existsSync(resolve(assetsPath, file))).toBeTruthy(); + }); + + // Check if the generated package.json file content matches the snapshot + expect(readFromPkgJSON(assetsPath)).toMatchSnapshot(); + }); + + it("should work with 'create' alias", async () => { + const assetsPath = await uniqueDirectoryForTest(); + const { stdout, stderr } = await run(assetsPath, ["create", "--force"]); + + expect(stdout).toContain("Project has been initialised with webpack!"); + expect(stderr).toContain("webpack.config.js"); + + // Test files + const files = ["package.json", "src", "src/index.js", "webpack.config.js"]; + + files.forEach((file) => { + expect(existsSync(resolve(assetsPath, file))).toBeTruthy(); + }); + + // Check if the generated package.json file content matches the snapshot + expect(readFromPkgJSON(assetsPath)).toMatchSnapshot(); }); - it("should should work with 'new' alias", async () => { + it("should work with 'c' alias", async () => { const assetsPath = await uniqueDirectoryForTest(); - const { stdout, stderr } = await run(assetsPath, ['new', '--force']); + const { stdout, stderr } = await run(assetsPath, ["c", "--force"]); - expect(stdout).toContain('Project has been initialised with webpack!'); - expect(stderr).toContain('webpack.config.js'); + expect(stdout).toContain("Project has been initialised with webpack!"); + expect(stderr).toContain("webpack.config.js"); // Test files - const files = ['package.json', 'src', 'src/index.js', 'webpack.config.js']; + const files = ["package.json", "src", "src/index.js", "webpack.config.js"]; files.forEach((file) => { expect(existsSync(resolve(assetsPath, file))).toBeTruthy(); @@ -430,15 +595,15 @@ describe('init command', () => { expect(readFromPkgJSON(assetsPath)).toMatchSnapshot(); }); - it("should should work with 'create' alias", async () => { + it("should work with 'n' alias", async () => { const assetsPath = await uniqueDirectoryForTest(); - const { stdout, stderr } = await run(assetsPath, ['create', '--force']); + const { stdout, stderr } = await run(assetsPath, ["n", "--force"]); - expect(stdout).toContain('Project has been initialised with webpack!'); - expect(stderr).toContain('webpack.config.js'); + expect(stdout).toContain("Project has been initialised with webpack!"); + expect(stderr).toContain("webpack.config.js"); // Test files - const files = ['package.json', 'src', 'src/index.js', 'webpack.config.js']; + const files = ["package.json", "src", "src/index.js", "webpack.config.js"]; files.forEach((file) => { expect(existsSync(resolve(assetsPath, file))).toBeTruthy(); @@ -448,15 +613,15 @@ describe('init command', () => { expect(readFromPkgJSON(assetsPath)).toMatchSnapshot(); }); - it("should should work with 'c' alias", async () => { + it("recognizes '-t' as an alias for '--template'", async () => { const assetsPath = await uniqueDirectoryForTest(); - const { stdout, stderr } = await run(assetsPath, ['c', '--force']); + const { stdout, stderr } = await run(assetsPath, ["init", "-t", "default", "--force"]); - expect(stdout).toContain('Project has been initialised with webpack!'); - expect(stderr).toContain('webpack.config.js'); + expect(stdout).toContain("Project has been initialised with webpack!"); + expect(stderr).toContain("webpack.config.js"); // Test files - const files = ['package.json', 'src', 'src/index.js', 'webpack.config.js']; + const files = ["package.json", "src", "src/index.js", "webpack.config.js"]; files.forEach((file) => { expect(existsSync(resolve(assetsPath, file))).toBeTruthy(); @@ -466,15 +631,15 @@ describe('init command', () => { expect(readFromPkgJSON(assetsPath)).toMatchSnapshot(); }); - it("should should work with 'n' alias", async () => { + it("recognizes '-f' as an alias for '--force'", async () => { const assetsPath = await uniqueDirectoryForTest(); - const { stdout, stderr } = await run(assetsPath, ['n', '--force']); + const { stdout, stderr } = await run(assetsPath, ["init", "-f"]); - expect(stdout).toContain('Project has been initialised with webpack!'); - expect(stderr).toContain('webpack.config.js'); + expect(stdout).toContain("Project has been initialised with webpack!"); + expect(stderr).toContain("webpack.config.js"); // Test files - const files = ['package.json', 'src', 'src/index.js', 'webpack.config.js']; + const files = ["package.json", "src", "src/index.js", "webpack.config.js"]; files.forEach((file) => { expect(existsSync(resolve(assetsPath, file))).toBeTruthy(); diff --git a/test/loader/error-test/loader-error.test.js b/test/loader/error-test/loader-error.test.js index 36b700de781..80c402a27cf 100644 --- a/test/loader/error-test/loader-error.test.js +++ b/test/loader/error-test/loader-error.test.js @@ -1,15 +1,15 @@ -'use strict'; +"use strict"; // eslint-disable-next-line node/no-unpublished-require -const { run } = require('../../utils/test-utils'); +const { run } = require("../../utils/test-utils"); -describe('loader error regression test for #1581', () => { +describe("loader error regression test for #1581", () => { it(`should not ignore loader's error produce a failing build`, async () => { // Ignoring assertion on stderr because ts-loader is producing depreciation warnings // with webpack@v5.0.0-beta.24 -> https://github.com/TypeStrong/ts-loader/issues/1169 const { stdout, exitCode } = await run(__dirname, []); expect(exitCode).not.toEqual(0); - expect(stdout).toContain('[1 error]'); + expect(stdout).toContain("[1 error]"); expect(stdout).toContain(`Cannot assign to 'foobar' because it is a constant`); }); }); diff --git a/test/loader/error-test/src/index.ts b/test/loader/error-test/src/index.ts index 39967926fa2..f7c6b335f8e 100644 --- a/test/loader/error-test/src/index.ts +++ b/test/loader/error-test/src/index.ts @@ -1,4 +1,4 @@ -const foobar = 'foobar'; +const foobar = "foobar"; // eslint-disable-next-line no-const-assign -foobar = 'barbaz'; // Error! +foobar = "barbaz"; // Error! console.log(foobar); diff --git a/test/loader/error-test/webpack.config.js b/test/loader/error-test/webpack.config.js index 5aca8bbcd77..8c50d352ad7 100644 --- a/test/loader/error-test/webpack.config.js +++ b/test/loader/error-test/webpack.config.js @@ -1,23 +1,23 @@ -const path = require('path'); +const path = require("path"); module.exports = { - mode: 'development', + mode: "development", entry: { - bundle: './src/index.ts', + bundle: "./src/index.ts", }, output: { - path: path.resolve(__dirname, 'dist'), - filename: '[name].js', + path: path.resolve(__dirname, "dist"), + filename: "[name].js", }, module: { rules: [ { test: /.(ts|tsx)?$/, - loader: 'ts-loader', - include: [path.resolve(__dirname, 'src')], + loader: "ts-loader", + include: [path.resolve(__dirname, "src")], exclude: [/node_modules/], }, ], diff --git a/test/loader/loader.test.js b/test/loader/loader.test.js index e41af9401eb..0656845c50a 100644 --- a/test/loader/loader.test.js +++ b/test/loader/loader.test.js @@ -1,38 +1,43 @@ -'use strict'; - -const { existsSync } = require('fs'); -const { join, resolve } = require('path'); -const { run, runPromptWithAnswers, uniqueDirectoryForTest, normalizeStdout } = require('../utils/test-utils'); - -const firstPrompt = '? Loader name (my-loader)'; -const ENTER = '\x0D'; +"use strict"; + +const { existsSync } = require("fs"); +const { join, resolve } = require("path"); +const { + run, + runPromptWithAnswers, + uniqueDirectoryForTest, + normalizeStdout, +} = require("../utils/test-utils"); + +const firstPrompt = "? Loader name (my-loader)"; +const ENTER = "\x0D"; const dataForTests = (rootAssetsPath) => ({ - loaderName: 'test-loader', - loaderPath: join(rootAssetsPath, 'test-loader'), - defaultLoaderPath: join(rootAssetsPath, 'my-loader'), - genPath: join(rootAssetsPath, 'test-assets'), - customLoaderPath: join(rootAssetsPath, 'test-assets', 'loaderName'), + loaderName: "test-loader", + loaderPath: join(rootAssetsPath, "test-loader"), + defaultLoaderPath: join(rootAssetsPath, "my-loader"), + genPath: join(rootAssetsPath, "test-assets"), + customLoaderPath: join(rootAssetsPath, "test-assets", "loaderName"), }); -describe('loader command', () => { - it('should ask the loader name when invoked', async () => { +describe("loader command", () => { + it("should ask the loader name when invoked", async () => { const assetsPath = await uniqueDirectoryForTest(); - const { stdout, stderr } = await runPromptWithAnswers(assetsPath, ['loader']); + const { stdout, stderr } = await runPromptWithAnswers(assetsPath, ["loader"]); expect(stdout).toBeTruthy(); expect(stderr).toBeFalsy(); expect(normalizeStdout(stdout)).toContain(firstPrompt); }); - it('should scaffold loader with default name if no loader name provided', async () => { + it("should scaffold loader with default name if no loader name provided", async () => { const assetsPath = await uniqueDirectoryForTest(); const { defaultLoaderPath } = dataForTests(assetsPath); - let { stdout } = await runPromptWithAnswers(assetsPath, ['loader'], [`${ENTER}`]); + let { stdout } = await runPromptWithAnswers(assetsPath, ["loader"], [`${ENTER}`]); expect(normalizeStdout(stdout)).toContain(firstPrompt); // Skip test in case installation fails - if (!existsSync(resolve(defaultLoaderPath, './yarn.lock'))) { + if (!existsSync(resolve(defaultLoaderPath, "./yarn.lock"))) { return; } @@ -40,29 +45,40 @@ describe('loader command', () => { expect(existsSync(defaultLoaderPath)).toBeTruthy(); // All test files are scaffolded - const files = ['package.json', 'examples', 'src', 'test', 'src/index.js', 'examples/simple/webpack.config.js']; + const files = [ + "package.json", + "examples", + "src", + "test", + "src/index.js", + "examples/simple/webpack.config.js", + ]; files.forEach((file) => { expect(existsSync(defaultLoaderPath, file)).toBeTruthy(); }); // Check if the the generated loader works successfully - const path = resolve(__dirname, './my-loader/examples/simple/'); + const path = resolve(__dirname, "./my-loader/examples/simple/"); ({ stdout } = await run(path, [])); - expect(stdout).toContain('my-loader'); + expect(stdout).toContain("my-loader"); }); - it('should scaffold loader template with a given name', async () => { + it("should scaffold loader template with a given name", async () => { const assetsPath = await uniqueDirectoryForTest(); const { loaderName, loaderPath } = dataForTests(assetsPath); - let { stdout } = await runPromptWithAnswers(assetsPath, ['loader'], [`${loaderName}${ENTER}`]); + let { stdout } = await runPromptWithAnswers( + assetsPath, + ["loader"], + [`${loaderName}${ENTER}`], + ); expect(normalizeStdout(stdout)).toContain(firstPrompt); // Skip test in case installation fails - if (!existsSync(resolve(loaderPath, './yarn.lock'))) { + if (!existsSync(resolve(loaderPath, "./yarn.lock"))) { return; } @@ -70,29 +86,40 @@ describe('loader command', () => { expect(existsSync(loaderPath)).toBeTruthy(); // All test files are scaffolded - const files = ['package.json', 'examples', 'src', 'test', 'src/index.js', 'examples/simple/webpack.config.js']; + const files = [ + "package.json", + "examples", + "src", + "test", + "src/index.js", + "examples/simple/webpack.config.js", + ]; files.forEach((file) => { expect(existsSync(loaderPath, file)).toBeTruthy(); }); // Check if the the generated loader works successfully - const path = resolve(__dirname, './test-loader/examples/simple/'); + const path = resolve(__dirname, "./test-loader/examples/simple/"); ({ stdout } = await run(path, [])); - expect(stdout).toContain('test-loader'); + expect(stdout).toContain("test-loader"); }); - it('should scaffold loader template in the specified path', async () => { + it("should scaffold loader template in the specified path", async () => { const assetsPath = await uniqueDirectoryForTest(); const { loaderName, customLoaderPath } = dataForTests(assetsPath); - let { stdout } = await runPromptWithAnswers(assetsPath, ['loader', 'test-assets'], [`${loaderName}${ENTER}`]); + let { stdout } = await runPromptWithAnswers( + assetsPath, + ["loader", "test-assets"], + [`${loaderName}${ENTER}`], + ); expect(normalizeStdout(stdout)).toContain(firstPrompt); // Skip test in case installation fails - if (!existsSync(resolve(customLoaderPath, './yarn.lock'))) { + if (!existsSync(resolve(customLoaderPath, "./yarn.lock"))) { return; } @@ -100,30 +127,41 @@ describe('loader command', () => { expect(existsSync(customLoaderPath)).toBeTruthy(); // All test files are scaffolded - const files = ['package.json', 'examples', 'src', 'test', 'src/index.js', 'examples/simple/webpack.config.js']; + const files = [ + "package.json", + "examples", + "src", + "test", + "src/index.js", + "examples/simple/webpack.config.js", + ]; files.forEach((file) => { expect(existsSync(customLoaderPath, file)).toBeTruthy(); }); // Check if the the generated loader works successfully - const path = resolve(customLoaderPath, './examples/simple/'); + const path = resolve(customLoaderPath, "./examples/simple/"); ({ stdout } = await run(path, [])); - expect(stdout).toContain('test-loader'); + expect(stdout).toContain("test-loader"); }); - it('should scaffold loader template in the current directory', async () => { + it("should scaffold loader template in the current directory", async () => { const assetsPath = await uniqueDirectoryForTest(); const { loaderName, customLoaderPath } = dataForTests(assetsPath); - let { stdout } = await runPromptWithAnswers(assetsPath, ['loader', './'], [`${loaderName}${ENTER}`]); + let { stdout } = await runPromptWithAnswers( + assetsPath, + ["loader", "./"], + [`${loaderName}${ENTER}`], + ); expect(normalizeStdout(stdout)).toContain(firstPrompt); // Skip test in case installation fails - if (!existsSync(resolve(customLoaderPath, './yarn.lock'))) { + if (!existsSync(resolve(customLoaderPath, "./yarn.lock"))) { return; } @@ -131,24 +169,72 @@ describe('loader command', () => { expect(existsSync(customLoaderPath)).toBeTruthy(); // All test files are scaffolded - const files = ['package.json', 'examples', 'src', 'test', 'src/index.js', 'examples/simple/webpack.config.js']; + const files = [ + "package.json", + "examples", + "src", + "test", + "src/index.js", + "examples/simple/webpack.config.js", + ]; files.forEach((file) => { expect(existsSync(customLoaderPath, file)).toBeTruthy(); }); // Check if the the generated loader works successfully - const path = resolve(customLoaderPath, './examples/simple/'); + const path = resolve(customLoaderPath, "./examples/simple/"); ({ stdout } = await run(path, [])); - expect(stdout).toContain('test-loader'); + expect(stdout).toContain("test-loader"); }); - it('should prompt on supplying an invalid template', async () => { + it("should prompt on supplying an invalid template", async () => { const assetsPath = await uniqueDirectoryForTest(); - const { stderr } = await runPromptWithAnswers(assetsPath, ['loader', '--template=unknown']); + const { stderr } = await runPromptWithAnswers(assetsPath, ["loader", "--template=unknown"]); + + expect(stderr).toContain("unknown is not a valid template"); + }); + + it("recognizes '-t' as an alias for '--template'", async () => { + const assetsPath = await uniqueDirectoryForTest(); + const { defaultLoaderPath } = dataForTests(assetsPath); + let { stdout } = await runPromptWithAnswers( + assetsPath, + ["loader", "-t", "default"], + [`${ENTER}`], + ); + + expect(normalizeStdout(stdout)).toContain(firstPrompt); + + // Skip test in case installation fails + if (!existsSync(resolve(defaultLoaderPath, "./yarn.lock"))) { + return; + } + + // Check if the output directory exists with the appropriate loader name + expect(existsSync(defaultLoaderPath)).toBeTruthy(); + + // All test files are scaffolded + const files = [ + "package.json", + "examples", + "src", + "test", + "src/index.js", + "examples/simple/webpack.config.js", + ]; + + files.forEach((file) => { + expect(existsSync(defaultLoaderPath, file)).toBeTruthy(); + }); + + // Check if the the generated loader works successfully + const path = resolve(__dirname, "./my-loader/examples/simple/"); + + ({ stdout } = await run(path, [])); - expect(stderr).toContain('unknown is not a valid template'); + expect(stdout).toContain("my-loader"); }); }); diff --git a/test/loader/warning-test/loader-warning.test.js b/test/loader/warning-test/loader-warning.test.js index 317eadb8005..30da26499aa 100644 --- a/test/loader/warning-test/loader-warning.test.js +++ b/test/loader/warning-test/loader-warning.test.js @@ -1,13 +1,13 @@ -'use strict'; +"use strict"; -const { run } = require('../../utils/test-utils'); +const { run } = require("../../utils/test-utils"); -describe('loader warning test', () => { +describe("loader warning test", () => { it(`should not ignore loader's warning and exit with a non zero exit code`, async () => { const { stdout, exitCode } = await run(__dirname, [], false); - expect(stdout).toContain('[1 warning]'); - expect(stdout).toContain('This is a warning'); + expect(stdout).toContain("[1 warning]"); + expect(stdout).toContain("This is a warning"); expect(exitCode).toEqual(0); }); }); diff --git a/test/loader/warning-test/my-loader.js b/test/loader/warning-test/my-loader.js index 042520fc4a4..d9b32f45457 100644 --- a/test/loader/warning-test/my-loader.js +++ b/test/loader/warning-test/my-loader.js @@ -1,5 +1,5 @@ module.exports = function loader(source) { const { emitWarning } = this; - emitWarning('This is a warning'); + emitWarning("This is a warning"); return source; }; diff --git a/test/loader/warning-test/src/main.js b/test/loader/warning-test/src/main.js index fbcad03c6af..d89f4de2697 100644 --- a/test/loader/warning-test/src/main.js +++ b/test/loader/warning-test/src/main.js @@ -1,2 +1,2 @@ -require('../my-loader'); -console.log('loader warning test'); +require("../my-loader"); +console.log("loader warning test"); diff --git a/test/loader/warning-test/webpack.config.js b/test/loader/warning-test/webpack.config.js index 15f03beb9c8..f66fba9b0c2 100644 --- a/test/loader/warning-test/webpack.config.js +++ b/test/loader/warning-test/webpack.config.js @@ -1,33 +1,33 @@ -const path = require('path'); +const path = require("path"); module.exports = { - mode: 'development', + mode: "development", entry: { - bundle: './src/main.js', + bundle: "./src/main.js", }, output: { - path: path.resolve(__dirname, 'dist'), - filename: '[name].js', + path: path.resolve(__dirname, "dist"), + filename: "[name].js", }, module: { rules: [ { test: /.(js|jsx)?$/, - loader: 'my-loader', - include: [path.resolve(__dirname, 'src')], + loader: "my-loader", + include: [path.resolve(__dirname, "src")], exclude: [/node_modules/], }, ], }, resolveLoader: { alias: { - 'my-loader': require.resolve('./my-loader'), + "my-loader": require.resolve("./my-loader"), }, }, performance: { - hints: 'warning', + hints: "warning", }, }; diff --git a/test/plugin/plugin.test.js b/test/plugin/plugin.test.js index 2373fb5d91f..080e03b3342 100644 --- a/test/plugin/plugin.test.js +++ b/test/plugin/plugin.test.js @@ -1,30 +1,37 @@ -const { existsSync, mkdirSync } = require('fs'); -const { join, resolve } = require('path'); -const { run, runPromptWithAnswers, uniqueDirectoryForTest, normalizeStdout } = require('../utils/test-utils'); - -const ENTER = '\x0D'; - -const firstPrompt = '? Plugin name'; +const { existsSync, mkdirSync } = require("fs"); +const { join, resolve } = require("path"); +const { + run, + runPromptWithAnswers, + uniqueDirectoryForTest, + normalizeStdout, +} = require("../utils/test-utils"); + +const ENTER = "\x0D"; + +const firstPrompt = "? Plugin name"; const dataForTests = (rootAssetsPath) => ({ - pluginName: 'test-plugin', - pluginPath: join(rootAssetsPath, 'test-plugin'), - defaultPluginPath: join(rootAssetsPath, 'my-webpack-plugin'), - genPath: join(rootAssetsPath, 'test-assets'), - customPluginPath: join(rootAssetsPath, 'test-assets', 'test-plugin'), + pluginName: "test-plugin", + pluginPath: join(rootAssetsPath, "test-plugin"), + defaultPluginPath: join(rootAssetsPath, "my-webpack-plugin"), + genPath: join(rootAssetsPath, "test-assets"), + customPluginPath: join(rootAssetsPath, "test-assets", "test-plugin"), }); -describe('plugin command', () => { - it('should ask the plugin name when invoked', async () => { - const { stdout, stderr } = await runPromptWithAnswers(__dirname, ['plugin']); +describe("plugin command", () => { + it("should ask the plugin name when invoked", async () => { + const assetsPath = await uniqueDirectoryForTest(); + const { stdout, stderr } = await runPromptWithAnswers(assetsPath, ["plugin"]); + expect(stdout).toBeTruthy(); expect(stderr).toBeFalsy(); expect(normalizeStdout(stdout)).toContain(firstPrompt); }); - it('should scaffold plugin with default name if no plugin name provided', async () => { + it("should scaffold plugin with default name if no plugin name provided", async () => { const assetsPath = await uniqueDirectoryForTest(); const { defaultPluginPath } = dataForTests(assetsPath); - const { stdout } = await runPromptWithAnswers(assetsPath, ['plugin'], [`${ENTER}`]); + const { stdout } = await runPromptWithAnswers(assetsPath, ["plugin"], [`${ENTER}`]); expect(normalizeStdout(stdout)).toContain(firstPrompt); @@ -32,26 +39,40 @@ describe('plugin command', () => { expect(existsSync(defaultPluginPath)).toBeTruthy(); // Skip test in case installation fails - if (!existsSync(resolve(defaultPluginPath, './yarn.lock'))) { + if (!existsSync(resolve(defaultPluginPath, "./yarn.lock"))) { return; } // Test regressively files are scaffolded - const files = ['package.json', 'examples', 'src', 'test', 'src/index.js', 'examples/simple/webpack.config.js']; + const files = [ + "package.json", + "examples", + "src", + "test", + "src/index.js", + "examples/simple/webpack.config.js", + ]; files.forEach((file) => { expect(existsSync(join(defaultPluginPath, file))).toBeTruthy(); }); // Check if the the generated plugin works successfully - const { stdout: stdout2 } = await run(__dirname, ['--config', './my-webpack-plugin/examples/simple/webpack.config.js']); - expect(normalizeStdout(stdout2)).toContain('Hello World!'); + const { stdout: stdout2 } = await run(__dirname, [ + "--config", + "./my-webpack-plugin/examples/simple/webpack.config.js", + ]); + expect(normalizeStdout(stdout2)).toContain("Hello World!"); }); - it('should scaffold plugin template with a given name', async () => { + it("should scaffold plugin template with a given name", async () => { const assetsPath = await uniqueDirectoryForTest(); const { pluginName, pluginPath } = dataForTests(assetsPath); - const { stdout } = await runPromptWithAnswers(assetsPath, ['plugin'], [`${pluginName}${ENTER}`]); + const { stdout } = await runPromptWithAnswers( + assetsPath, + ["plugin"], + [`${pluginName}${ENTER}`], + ); expect(normalizeStdout(stdout)).toContain(firstPrompt); @@ -59,26 +80,40 @@ describe('plugin command', () => { expect(existsSync(pluginPath)).toBeTruthy(); // Skip test in case installation fails - if (!existsSync(resolve(pluginPath, './yarn.lock'))) { + if (!existsSync(resolve(pluginPath, "./yarn.lock"))) { return; } // Test regressively files are scaffolded - const files = ['package.json', 'examples', 'src', 'test', 'src/index.js', 'examples/simple/webpack.config.js']; + const files = [ + "package.json", + "examples", + "src", + "test", + "src/index.js", + "examples/simple/webpack.config.js", + ]; files.forEach((file) => { expect(existsSync(join(pluginPath, file))).toBeTruthy(); }); // Check if the the generated plugin works successfully - const { stdout: stdout2 } = await run(__dirname, ['--config', './test-plugin/examples/simple/webpack.config.js']); - expect(normalizeStdout(stdout2)).toContain('Hello World!'); + const { stdout: stdout2 } = await run(__dirname, [ + "--config", + "./test-plugin/examples/simple/webpack.config.js", + ]); + expect(normalizeStdout(stdout2)).toContain("Hello World!"); }); - it('should scaffold plugin template in the specified path', async () => { + it("should scaffold plugin template in the specified path", async () => { const assetsPath = await uniqueDirectoryForTest(); const { pluginName, customPluginPath } = dataForTests(assetsPath); - const { stdout } = await runPromptWithAnswers(assetsPath, ['plugin', 'test-assets'], [`${pluginName}${ENTER}`]); + const { stdout } = await runPromptWithAnswers( + assetsPath, + ["plugin", "test-assets"], + [`${pluginName}${ENTER}`], + ); expect(normalizeStdout(stdout)).toContain(firstPrompt); @@ -86,23 +121,33 @@ describe('plugin command', () => { expect(existsSync(customPluginPath)).toBeTruthy(); // Skip test in case installation fails - if (!existsSync(resolve(customPluginPath, './yarn.lock'))) { + if (!existsSync(resolve(customPluginPath, "./yarn.lock"))) { return; } // Test regressively files are scaffolded - const files = ['package.json', 'examples', 'src', 'test', 'src/index.js', 'examples/simple/webpack.config.js']; + const files = [ + "package.json", + "examples", + "src", + "test", + "src/index.js", + "examples/simple/webpack.config.js", + ]; files.forEach((file) => { expect(existsSync(join(customPluginPath, file))).toBeTruthy(); }); // Check if the the generated plugin works successfully - const { stdout: stdout2 } = await run(customPluginPath, ['--config', './examples/simple/webpack.config.js']); - expect(normalizeStdout(stdout2)).toContain('Hello World!'); + const { stdout: stdout2 } = await run(customPluginPath, [ + "--config", + "./examples/simple/webpack.config.js", + ]); + expect(normalizeStdout(stdout2)).toContain("Hello World!"); }); - it('should scaffold plugin template in the current directory', async () => { + it("should scaffold plugin template in the current directory", async () => { const assetsPath = await uniqueDirectoryForTest(); const { genPath, customPluginPath, pluginName } = dataForTests(assetsPath); @@ -110,7 +155,11 @@ describe('plugin command', () => { mkdirSync(genPath); } - let { stdout } = await runPromptWithAnswers(genPath, ['plugin', './'], [`${pluginName}${ENTER}`]); + const { stdout } = await runPromptWithAnswers( + genPath, + ["plugin", "./"], + [`${pluginName}${ENTER}`], + ); expect(normalizeStdout(stdout)).toContain(firstPrompt); @@ -118,26 +167,71 @@ describe('plugin command', () => { expect(existsSync(customPluginPath)).toBeTruthy(); // Skip test in case installation fails - if (!existsSync(resolve(customPluginPath, './yarn.lock'))) { + if (!existsSync(resolve(customPluginPath, "./yarn.lock"))) { return; } // Test regressively files are scaffolded - const files = ['package.json', 'examples', 'src', 'test', 'src/index.js', 'examples/simple/webpack.config.js']; + const files = [ + "package.json", + "examples", + "src", + "test", + "src/index.js", + "examples/simple/webpack.config.js", + ]; files.forEach((file) => { expect(existsSync(join(customPluginPath, file))).toBeTruthy(); }); // Check if the the generated plugin works successfully - const { stdout: stdout2 } = await run(customPluginPath, ['--config', './examples/simple/webpack.config.js']); - expect(normalizeStdout(stdout2)).toContain('Hello World!'); + const { stdout: stdout2 } = await run(customPluginPath, [ + "--config", + "./examples/simple/webpack.config.js", + ]); + expect(normalizeStdout(stdout2)).toContain("Hello World!"); }); - it('should prompt on supplying an invalid template', async () => { + it("should prompt on supplying an invalid template", async () => { const assetsPath = await uniqueDirectoryForTest(); - const { stderr } = await runPromptWithAnswers(assetsPath, ['plugin', '--template=unknown']); + const { stderr } = await runPromptWithAnswers(assetsPath, ["plugin", "--template=unknown"]); + + expect(stderr).toContain("unknown is not a valid template"); + }); - expect(stderr).toContain('unknown is not a valid template'); + it("recognizes '-t' as an alias for '--template'", async () => { + const assetsPath = await uniqueDirectoryForTest(); + const { defaultPluginPath } = dataForTests(assetsPath); + const { stdout } = await runPromptWithAnswers( + assetsPath, + ["plugin", "-t", "default"], + [`${ENTER}`], + ); + expect(normalizeStdout(stdout)).toContain(firstPrompt); + // Check if the output directory exists with the appropriate plugin name + expect(existsSync(defaultPluginPath)).toBeTruthy(); + // Skip test in case installation fails + if (!existsSync(resolve(defaultPluginPath, "./yarn.lock"))) { + return; + } + // Test regressively files are scaffolded + const files = [ + "package.json", + "examples", + "src", + "test", + "src/index.js", + "examples/simple/webpack.config.js", + ]; + files.forEach((file) => { + expect(existsSync(join(defaultPluginPath, file))).toBeTruthy(); + }); + // Check if the the generated plugin works successfully + const { stdout: stdout2 } = await run(__dirname, [ + "--config", + "./my-webpack-plugin/examples/simple/webpack.config.js", + ]); + expect(normalizeStdout(stdout2)).toContain("Hello World!"); }); }); diff --git a/test/serve/basic/__snapshots__/serve-basic.test.js.snap.devServer4.webpack4 b/test/serve/basic/__snapshots__/serve-basic.test.js.snap.devServer4.webpack4 index db2302b2200..117e8e5580e 100644 --- a/test/serve/basic/__snapshots__/serve-basic.test.js.snap.devServer4.webpack4 +++ b/test/serve/basic/__snapshots__/serve-basic.test.js.snap.devServer4.webpack4 @@ -74,62 +74,73 @@ exports[`basic serve usage should shoe help information for serve: stdout 1`] = Run the webpack dev server. Options: - -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. - --config-name Name of the configuration to use. - -m, --merge Merge two or more configurations using 'webpack-merge'. - --env Environment passed to the configuration when it is a function. - --node-env Sets process.env.NODE_ENV to the specified value. - --progress [value] Print compilation progress during build. - -j, --json [value] Prints result as JSON or store it in a file. - --entry The entry point(s) of your application e.g. ./src/main.js. - -o, --output-path Output location of the file generated by webpack e.g. ./dist/. - -t, --target Sets the build target e.g. node. - -d, --devtool Determine source maps to use. - --no-devtool Do not generate source maps. - --mode Defines the mode to pass to webpack. - --name Name of the configuration. Used when loading multiple configurations. - --stats [value] It instructs webpack on how to treat the stats e.g. verbose. - --no-stats Disable stats output. - --watch-options-stdin Stop watching when stdin stream has ended. - --no-watch-options-stdin Do not stop watching when stdin stream has ended. - --host The hostname/ip address the server will bind to. - --port The port server will listen to. - --static [value...] A directory to serve static content from. - --no-static Negative 'static' option. - --live-reload Enables live reloading on changing files. - --no-live-reload Disables live reloading on changing files. - --https Use HTTPS protocol. - --no-https Do not use HTTPS protocol. - --http2 Use HTTP/2, must be used with HTTPS. - --no-http2 Do not use HTTP/2. - --bonjour Broadcasts the server via ZeroConf networking on start. - --no-bonjour Do not broadcast the server via ZeroConf networking on start. - --client-progress Print compilation progress in percentage in the browser. - --no-client-progress Do not print compilation progress in percentage in the browser. - --client-overlay Show a full-screen overlay in the browser when there are compiler errors or warnings. - --no-client-overlay Do not show a full-screen overlay in the browser when there are compiler errors or warnings. - --setup-exit-signals Close and exit the process on SIGINT and SIGTERM. - --no-setup-exit-signals Do not close and exit the process on SIGNIT and SIGTERM. - --open [value...] Open the default browser. - --no-open Do not open the default browser. - --open-app Open specified browser. - --open-target [value...] Open specified route in browser. - --no-open-target Do not open specified route in browser. - --client-logging Log level in the browser (none, error, warn, info, log, verbose). - --history-api-fallback Fallback to /index.html for Single Page Applications. - --no-history-api-fallback Do not fallback to /index.html for Single Page Applications. - --compress Enable gzip compression. - --no-compress Disable gzip compression. - --public The public hostname/ip address of the server. - --firewall [value...] Enable firewall or set hosts that are allowed to access the dev server. - --no-firewall Disable firewall. - --watch-files Watch static files for file changes. + -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. + --config-name Name of the configuration to use. + -m, --merge Merge two or more configurations using 'webpack-merge'. + --env Environment passed to the configuration when it is a function. + --node-env Sets process.env.NODE_ENV to the specified value. + --progress [value] Print compilation progress during build. + -j, --json [value] Prints result as JSON or store it in a file. + --entry The entry point(s) of your application e.g. ./src/main.js. + -o, --output-path Output location of the file generated by webpack e.g. ./dist/. + -t, --target Sets the build target e.g. node. + -d, --devtool Determine source maps to use. + --no-devtool Do not generate source maps. + --mode Defines the mode to pass to webpack. + --name Name of the configuration. Used when loading multiple configurations. + --stats [value] It instructs webpack on how to treat the stats e.g. verbose. + --no-stats Disable stats output. + --watch-options-stdin Stop watching when stdin stream has ended. + --no-watch-options-stdin Do not stop watching when stdin stream has ended. + --host The hostname/ip address the server will bind to. + --port The port server will listen to. + --static [value...] A directory to serve static content from. + --no-static Negative 'static' option. + --static-directory Directory for static contents. + --static-public-path The bundled files will be available in the browser under this path. + --static-serve-index Tells dev-server to use serveIndex middleware. + --no-static-serve-index Do not tell dev-server to use serveIndex middleware. + --static-watch Watch for files in static content directory. + --no-static-watch Do not watch for files in static content directory. + --live-reload Enables live reloading on changing files. + --no-live-reload Disables live reloading on changing files. + --https Use HTTPS protocol. + --no-https Do not use HTTPS protocol. + --https-passphrase Passphrase for a pfx file. + --https-key Path to an SSL key. + --https-pfx Path to an SSL pfx file. + --https-cert Path to an SSL certificate. + --https-cacert Path to an SSL CA certificate. + --https-request-cert Request for an SSL certificate. + --no-https-request-cert Do not request for an SSL certificate. + --http2 Use HTTP/2, must be used with HTTPS. + --no-http2 Do not use HTTP/2. + --bonjour Broadcasts the server via ZeroConf networking on start. + --no-bonjour Do not broadcast the server via ZeroConf networking on start. + --client-progress Print compilation progress in percentage in the browser. + --no-client-progress Do not print compilation progress in percentage in the browser. + --client-overlay Show a full-screen overlay in the browser when there are compiler errors or warnings. + --no-client-overlay Do not show a full-screen overlay in the browser when there are compiler errors or warnings. + --open [value...] Open the default browser. + --no-open Do not open the default browser. + --open-app Open specified browser. + --open-target [value...] Open specified route in browser. + --no-open-target Do not open specified route in browser. + --client-logging Log level in the browser (none, error, warn, info, log, verbose). + --history-api-fallback Fallback to /index.html for Single Page Applications. + --no-history-api-fallback Do not fallback to /index.html for Single Page Applications. + --compress Enable gzip compression. + --no-compress Disable gzip compression. + --public The public hostname/ip address of the server. + --firewall [value...] Enable firewall or set hosts that are allowed to access the dev server. + --no-firewall Disable firewall. + --watch-files Watch static files for file changes. Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. diff --git a/test/serve/basic/__snapshots__/serve-basic.test.js.snap.devServer4.webpack5 b/test/serve/basic/__snapshots__/serve-basic.test.js.snap.devServer4.webpack5 index dad84972c3d..1dd6fc728ee 100644 --- a/test/serve/basic/__snapshots__/serve-basic.test.js.snap.devServer4.webpack5 +++ b/test/serve/basic/__snapshots__/serve-basic.test.js.snap.devServer4.webpack5 @@ -74,63 +74,74 @@ exports[`basic serve usage should shoe help information for serve: stdout 1`] = Run the webpack dev server. Options: - -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. - --config-name Name of the configuration to use. - -m, --merge Merge two or more configurations using 'webpack-merge'. - --env Environment passed to the configuration when it is a function. - --node-env Sets process.env.NODE_ENV to the specified value. - --progress [value] Print compilation progress during build. - -j, --json [value] Prints result as JSON or store it in a file. - -d, --devtool Determine source maps to use. - --no-devtool Do not generate source maps. - --entry The entry point(s) of your application e.g. ./src/main.js. - --mode Defines the mode to pass to webpack. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path Output location of the file generated by webpack e.g. ./dist/. - --stats [value] It instructs webpack on how to treat the stats e.g. verbose. - --no-stats Disable stats output. - -t, --target Sets the build target e.g. node. - --no-target Negative 'target' option. - --watch-options-stdin Stop watching when stdin stream has ended. - --no-watch-options-stdin Do not stop watching when stdin stream has ended. - --host The hostname/ip address the server will bind to. - --port The port server will listen to. - --static [value...] A directory to serve static content from. - --no-static Negative 'static' option. - --live-reload Enables live reloading on changing files. - --no-live-reload Disables live reloading on changing files. - --https Use HTTPS protocol. - --no-https Do not use HTTPS protocol. - --http2 Use HTTP/2, must be used with HTTPS. - --no-http2 Do not use HTTP/2. - --bonjour Broadcasts the server via ZeroConf networking on start. - --no-bonjour Do not broadcast the server via ZeroConf networking on start. - --client-progress Print compilation progress in percentage in the browser. - --no-client-progress Do not print compilation progress in percentage in the browser. - --client-overlay Show a full-screen overlay in the browser when there are compiler errors or warnings. - --no-client-overlay Do not show a full-screen overlay in the browser when there are compiler errors or warnings. - --setup-exit-signals Close and exit the process on SIGINT and SIGTERM. - --no-setup-exit-signals Do not close and exit the process on SIGNIT and SIGTERM. - --open [value...] Open the default browser. - --no-open Do not open the default browser. - --open-app Open specified browser. - --open-target [value...] Open specified route in browser. - --no-open-target Do not open specified route in browser. - --client-logging Log level in the browser (none, error, warn, info, log, verbose). - --history-api-fallback Fallback to /index.html for Single Page Applications. - --no-history-api-fallback Do not fallback to /index.html for Single Page Applications. - --compress Enable gzip compression. - --no-compress Disable gzip compression. - --public The public hostname/ip address of the server. - --firewall [value...] Enable firewall or set hosts that are allowed to access the dev server. - --no-firewall Disable firewall. - --watch-files Watch static files for file changes. + -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. + --config-name Name of the configuration to use. + -m, --merge Merge two or more configurations using 'webpack-merge'. + --env Environment passed to the configuration when it is a function. + --node-env Sets process.env.NODE_ENV to the specified value. + --progress [value] Print compilation progress during build. + -j, --json [value] Prints result as JSON or store it in a file. + -d, --devtool Determine source maps to use. + --no-devtool Do not generate source maps. + --entry The entry point(s) of your application e.g. ./src/main.js. + --mode Defines the mode to pass to webpack. + --name Name of the configuration. Used when loading multiple configurations. + -o, --output-path Output location of the file generated by webpack e.g. ./dist/. + --stats [value] It instructs webpack on how to treat the stats e.g. verbose. + --no-stats Disable stats output. + -t, --target Sets the build target e.g. node. + --no-target Negative 'target' option. + --watch-options-stdin Stop watching when stdin stream has ended. + --no-watch-options-stdin Do not stop watching when stdin stream has ended. + --host The hostname/ip address the server will bind to. + --port The port server will listen to. + --static [value...] A directory to serve static content from. + --no-static Negative 'static' option. + --static-directory Directory for static contents. + --static-public-path The bundled files will be available in the browser under this path. + --static-serve-index Tells dev-server to use serveIndex middleware. + --no-static-serve-index Do not tell dev-server to use serveIndex middleware. + --static-watch Watch for files in static content directory. + --no-static-watch Do not watch for files in static content directory. + --live-reload Enables live reloading on changing files. + --no-live-reload Disables live reloading on changing files. + --https Use HTTPS protocol. + --no-https Do not use HTTPS protocol. + --https-passphrase Passphrase for a pfx file. + --https-key Path to an SSL key. + --https-pfx Path to an SSL pfx file. + --https-cert Path to an SSL certificate. + --https-cacert Path to an SSL CA certificate. + --https-request-cert Request for an SSL certificate. + --no-https-request-cert Do not request for an SSL certificate. + --http2 Use HTTP/2, must be used with HTTPS. + --no-http2 Do not use HTTP/2. + --bonjour Broadcasts the server via ZeroConf networking on start. + --no-bonjour Do not broadcast the server via ZeroConf networking on start. + --client-progress Print compilation progress in percentage in the browser. + --no-client-progress Do not print compilation progress in percentage in the browser. + --client-overlay Show a full-screen overlay in the browser when there are compiler errors or warnings. + --no-client-overlay Do not show a full-screen overlay in the browser when there are compiler errors or warnings. + --open [value...] Open the default browser. + --no-open Do not open the default browser. + --open-app Open specified browser. + --open-target [value...] Open specified route in browser. + --no-open-target Do not open specified route in browser. + --client-logging Log level in the browser (none, error, warn, info, log, verbose). + --history-api-fallback Fallback to /index.html for Single Page Applications. + --no-history-api-fallback Do not fallback to /index.html for Single Page Applications. + --compress Enable gzip compression. + --no-compress Disable gzip compression. + --public The public hostname/ip address of the server. + --firewall [value...] Enable firewall or set hosts that are allowed to access the dev server. + --no-firewall Disable firewall. + --watch-files Watch static files for file changes. Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. To see list of all supported commands and options run 'webpack --help=verbose'. diff --git a/test/serve/basic/dev-server-output-public-path.config.js b/test/serve/basic/dev-server-output-public-path.config.js index d6d09b622ac..dc00230f01c 100644 --- a/test/serve/basic/dev-server-output-public-path.config.js +++ b/test/serve/basic/dev-server-output-public-path.config.js @@ -1,12 +1,12 @@ -const WebpackCLITestPlugin = require('../../utils/webpack-cli-test-plugin'); -const { devServerConfig } = require('./helper/base-dev-server.config'); +const WebpackCLITestPlugin = require("../../utils/webpack-cli-test-plugin"); +const { devServerConfig } = require("./helper/base-dev-server.config"); module.exports = { - mode: 'development', + mode: "development", devtool: false, output: { - publicPath: '/my-public-path/', + publicPath: "/my-public-path/", }, devServer: devServerConfig, - plugins: [new WebpackCLITestPlugin(['mode', 'output'], false, 'hooks.compilation.taps')], + plugins: [new WebpackCLITestPlugin(["mode", "output"], false, "hooks.compilation.taps")], }; diff --git a/test/serve/basic/function-with-argv.config.js b/test/serve/basic/function-with-argv.config.js index d5e597ff3ec..8102f9ccaf2 100644 --- a/test/serve/basic/function-with-argv.config.js +++ b/test/serve/basic/function-with-argv.config.js @@ -1,11 +1,19 @@ -const WebpackCLITestPlugin = require('../../utils/webpack-cli-test-plugin'); +const WebpackCLITestPlugin = require("../../utils/webpack-cli-test-plugin"); +const { isDevServer4 } = require("../../utils/test-utils"); module.exports = (env, argv) => { console.log(argv); return { - mode: 'development', + mode: "development", devtool: false, - plugins: [new WebpackCLITestPlugin(['mode'], false, 'hooks.compilation.taps')], + plugins: [new WebpackCLITestPlugin(["mode"], false, "hooks.compilation.taps")], + devServer: isDevServer4 + ? { + client: { + logging: "info", + }, + } + : {}, }; }; diff --git a/test/serve/basic/function-with-env.config.js b/test/serve/basic/function-with-env.config.js index 7aae1e7f0fe..43b163e1231 100644 --- a/test/serve/basic/function-with-env.config.js +++ b/test/serve/basic/function-with-env.config.js @@ -1,11 +1,19 @@ -const WebpackCLITestPlugin = require('../../utils/webpack-cli-test-plugin'); +const WebpackCLITestPlugin = require("../../utils/webpack-cli-test-plugin"); +const { isDevServer4 } = require("../../utils/test-utils"); module.exports = (env) => { console.log(env); return { - mode: 'development', + mode: "development", devtool: false, - plugins: [new WebpackCLITestPlugin(['mode'], false, 'hooks.compilation.taps')], + plugins: [new WebpackCLITestPlugin(["mode"], false, "hooks.compilation.taps")], + devServer: isDevServer4 + ? { + client: { + logging: "info", + }, + } + : {}, }; }; diff --git a/test/serve/basic/helper/base-dev-server.config.js b/test/serve/basic/helper/base-dev-server.config.js index 6dbb7901b8a..617f1522a02 100644 --- a/test/serve/basic/helper/base-dev-server.config.js +++ b/test/serve/basic/helper/base-dev-server.config.js @@ -1,16 +1,19 @@ -const { isDevServer4 } = require('../../../utils/test-utils'); +const { isDevServer4 } = require("../../../utils/test-utils"); let devServerConfig = {}; if (isDevServer4) { devServerConfig = { - dev: { - publicPath: '/dev-server-my-public-path/', + devMiddleware: { + publicPath: "/dev-server-my-public-path/", + }, + client: { + logging: "info", }, }; } else { devServerConfig = { - publicPath: '/dev-server-my-public-path/', + publicPath: "/dev-server-my-public-path/", }; } diff --git a/test/serve/basic/log.config.js b/test/serve/basic/log.config.js index 70619a29563..9384297c7eb 100644 --- a/test/serve/basic/log.config.js +++ b/test/serve/basic/log.config.js @@ -1,6 +1,15 @@ +const { isDevServer4 } = require("../../utils/test-utils"); + module.exports = { - mode: 'development', + mode: "development", infrastructureLogging: { - level: 'log', + level: "log", }, + devServer: isDevServer4 + ? { + client: { + logging: "info", + }, + } + : {}, }; diff --git a/test/serve/basic/multi-dev-server-output-public-path.config.js b/test/serve/basic/multi-dev-server-output-public-path.config.js index 2500c708719..e1098ce284c 100644 --- a/test/serve/basic/multi-dev-server-output-public-path.config.js +++ b/test/serve/basic/multi-dev-server-output-public-path.config.js @@ -1,26 +1,34 @@ -const WebpackCLITestPlugin = require('../../utils/webpack-cli-test-plugin'); -const { devServerConfig } = require('./helper/base-dev-server.config'); +const WebpackCLITestPlugin = require("../../utils/webpack-cli-test-plugin"); +const { devServerConfig } = require("./helper/base-dev-server.config"); +const { isDevServer4 } = require("../../utils/test-utils"); module.exports = [ { - name: 'one', - mode: 'development', + name: "one", + mode: "development", devtool: false, - entry: './src/other.js', + entry: "./src/other.js", output: { - filename: 'first-output/[name].js', + filename: "first-output/[name].js", }, + devServer: isDevServer4 + ? { + client: { + logging: "info", + }, + } + : {}, }, { - name: 'two', - mode: 'development', + name: "two", + mode: "development", devtool: false, - stats: 'detailed', + stats: "detailed", output: { - publicPath: '/my-public-path/', - filename: 'second-output/[name].js', + publicPath: "/my-public-path/", + filename: "second-output/[name].js", }, devServer: devServerConfig, - plugins: [new WebpackCLITestPlugin(['mode', 'output'], false, 'hooks.compilation.taps')], + plugins: [new WebpackCLITestPlugin(["mode", "output"], false, "hooks.compilation.taps")], }, ]; diff --git a/test/serve/basic/multi-dev-server.config.js b/test/serve/basic/multi-dev-server.config.js index 211aaef13e5..41afff3d1c7 100644 --- a/test/serve/basic/multi-dev-server.config.js +++ b/test/serve/basic/multi-dev-server.config.js @@ -1,30 +1,30 @@ // eslint-disable-next-line node/no-unpublished-require -const getPort = require('get-port'); +const getPort = require("get-port"); -const WebpackCLITestPlugin = require('../../utils/webpack-cli-test-plugin'); -const { devServerConfig } = require('./helper/base-dev-server.config'); +const WebpackCLITestPlugin = require("../../utils/webpack-cli-test-plugin"); +const { devServerConfig } = require("./helper/base-dev-server.config"); module.exports = async () => [ { - name: 'one', - mode: 'development', + name: "one", + mode: "development", devtool: false, output: { - filename: 'first-output/[name].js', + filename: "first-output/[name].js", }, devServer: { ...devServerConfig, port: await getPort(), }, - plugins: [new WebpackCLITestPlugin(['mode', 'output'], false, 'hooks.compilation.taps')], + plugins: [new WebpackCLITestPlugin(["mode", "output"], false, "hooks.compilation.taps")], }, { - name: 'two', - mode: 'development', + name: "two", + mode: "development", devtool: false, - entry: './src/other.js', + entry: "./src/other.js", output: { - filename: 'second-output/[name].js', + filename: "second-output/[name].js", }, devServer: { ...devServerConfig, diff --git a/test/serve/basic/multi-output-public-path.config.js b/test/serve/basic/multi-output-public-path.config.js index 64286a1c2ef..5058d96ceb7 100644 --- a/test/serve/basic/multi-output-public-path.config.js +++ b/test/serve/basic/multi-output-public-path.config.js @@ -1,23 +1,31 @@ -const WebpackCLITestPlugin = require('../../utils/webpack-cli-test-plugin'); +const WebpackCLITestPlugin = require("../../utils/webpack-cli-test-plugin"); +const { isDevServer4 } = require("../../utils/test-utils"); module.exports = [ { - name: 'one', - mode: 'development', + name: "one", + mode: "development", devtool: false, output: { - publicPath: '/my-public-path/', - filename: 'first-output/[name].js', + publicPath: "/my-public-path/", + filename: "first-output/[name].js", }, - plugins: [new WebpackCLITestPlugin(['mode', 'output'], false, 'hooks.compilation.taps')], + plugins: [new WebpackCLITestPlugin(["mode", "output"], false, "hooks.compilation.taps")], + devServer: isDevServer4 + ? { + client: { + logging: "info", + }, + } + : {}, }, { - name: 'two', - mode: 'development', + name: "two", + mode: "development", devtool: false, - entry: './src/other.js', + entry: "./src/other.js", output: { - filename: 'second-output/[name].js', + filename: "second-output/[name].js", }, }, ]; diff --git a/test/serve/basic/multi.config.js b/test/serve/basic/multi.config.js index e8134f9b209..190d78bdc34 100644 --- a/test/serve/basic/multi.config.js +++ b/test/serve/basic/multi.config.js @@ -1,24 +1,24 @@ -const WebpackCLITestPlugin = require('../../utils/webpack-cli-test-plugin'); -const { devServerConfig } = require('./helper/base-dev-server.config'); +const WebpackCLITestPlugin = require("../../utils/webpack-cli-test-plugin"); +const { devServerConfig } = require("./helper/base-dev-server.config"); module.exports = [ { - name: 'one', - mode: 'development', + name: "one", + mode: "development", devtool: false, output: { - filename: 'first-output/[name].js', + filename: "first-output/[name].js", }, devServer: devServerConfig, - plugins: [new WebpackCLITestPlugin(['mode', 'output'], false, 'hooks.compilation.taps')], + plugins: [new WebpackCLITestPlugin(["mode", "output"], false, "hooks.compilation.taps")], }, { - name: 'two', - mode: 'development', + name: "two", + mode: "development", devtool: false, - entry: './src/other.js', + entry: "./src/other.js", output: { - filename: 'second-output/[name].js', + filename: "second-output/[name].js", }, }, ]; diff --git a/test/serve/basic/multiple-dev-server.config.js b/test/serve/basic/multiple-dev-server.config.js index 8c72527829a..f43310fe3cc 100644 --- a/test/serve/basic/multiple-dev-server.config.js +++ b/test/serve/basic/multiple-dev-server.config.js @@ -1,26 +1,26 @@ -const WebpackCLITestPlugin = require('../../utils/webpack-cli-test-plugin'); -const { devServerConfig } = require('./helper/base-dev-server.config'); +const WebpackCLITestPlugin = require("../../utils/webpack-cli-test-plugin"); +const { devServerConfig } = require("./helper/base-dev-server.config"); module.exports = [ { - name: 'one', - mode: 'development', + name: "one", + mode: "development", devtool: false, output: { - filename: 'first-output/[name].js', + filename: "first-output/[name].js", }, devServer: devServerConfig, - plugins: [new WebpackCLITestPlugin(['mode', 'output'], false)], + plugins: [new WebpackCLITestPlugin(["mode", "output"], false)], }, { - name: 'two', - mode: 'development', + name: "two", + mode: "development", devtool: false, - entry: './src/other.js', + entry: "./src/other.js", output: { - filename: 'first-output/[name].js', + filename: "first-output/[name].js", }, devServer: devServerConfig, - plugins: [new WebpackCLITestPlugin(['mode', 'output'], false)], + plugins: [new WebpackCLITestPlugin(["mode", "output"], false)], }, ]; diff --git a/test/serve/basic/output-public-path.config.js b/test/serve/basic/output-public-path.config.js index 0b9f7f04547..0c09899f5ee 100644 --- a/test/serve/basic/output-public-path.config.js +++ b/test/serve/basic/output-public-path.config.js @@ -1,10 +1,18 @@ -const WebpackCLITestPlugin = require('../../utils/webpack-cli-test-plugin'); +const WebpackCLITestPlugin = require("../../utils/webpack-cli-test-plugin"); +const { isDevServer4 } = require("../../utils/test-utils"); module.exports = { - mode: 'development', + mode: "development", devtool: false, output: { - publicPath: '/my-public-path/', + publicPath: "/my-public-path/", }, - plugins: [new WebpackCLITestPlugin(['mode', 'output'], false, 'hooks.compilation.taps')], + plugins: [new WebpackCLITestPlugin(["mode", "output"], false, "hooks.compilation.taps")], + devServer: isDevServer4 + ? { + client: { + logging: "info", + }, + } + : {}, }; diff --git a/test/serve/basic/same-ports-dev-serever.config.js b/test/serve/basic/same-ports-dev-serever.config.js index d85e05a7341..d0c061494e7 100644 --- a/test/serve/basic/same-ports-dev-serever.config.js +++ b/test/serve/basic/same-ports-dev-serever.config.js @@ -1,22 +1,22 @@ module.exports = [ { - name: 'one', - mode: 'development', + name: "one", + mode: "development", devtool: false, output: { - filename: 'first-output/[name].js', + filename: "first-output/[name].js", }, devServer: { port: 8081, }, }, { - name: 'two', - mode: 'development', + name: "two", + mode: "development", devtool: false, - entry: './src/other.js', + entry: "./src/other.js", output: { - filename: 'second-output/[name].js', + filename: "second-output/[name].js", }, devServer: { port: 8081, diff --git a/test/serve/basic/serve-basic.test.js b/test/serve/basic/serve-basic.test.js index 8d296a2aced..d714dc0db8e 100644 --- a/test/serve/basic/serve-basic.test.js +++ b/test/serve/basic/serve-basic.test.js @@ -1,523 +1,610 @@ -'use strict'; +"use strict"; -const path = require('path'); +const path = require("path"); // eslint-disable-next-line node/no-unpublished-require -const getPort = require('get-port'); -const { runWatch, isWebpack5, normalizeStderr, normalizeStdout, isDevServer4 } = require('../../utils/test-utils'); +const getPort = require("get-port"); +const { + runWatch, + isWebpack5, + normalizeStderr, + normalizeStdout, + isDevServer4, +} = require("../../utils/test-utils"); const testPath = path.resolve(__dirname); -describe('basic serve usage', () => { +describe("basic serve usage", () => { let port; beforeEach(async () => { port = await getPort(); }); - it('should work', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['serve']); + it("should work", async () => { + const { stderr, stdout } = await runWatch(__dirname, ["serve"]); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); if (isDevServer4) { - expect(stdout).toContain('HotModuleReplacementPlugin'); + expect(stdout).toContain("HotModuleReplacementPlugin"); } else { - expect(stdout).not.toContain('HotModuleReplacementPlugin'); + expect(stdout).not.toContain("HotModuleReplacementPlugin"); } - expect(stdout).toContain('main.js'); + expect(stdout).toContain("main.js"); }); it('should work with the "--config" option', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['serve', '--config', 'serve.config.js', '--port', port]); + const { stderr, stdout } = await runWatch(__dirname, [ + "serve", + "--config", + "serve.config.js", + "--port", + port, + ]); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); if (isDevServer4) { - expect(stdout).toContain('HotModuleReplacementPlugin'); + expect(stdout).toContain("HotModuleReplacementPlugin"); } else { - expect(stdout).not.toContain('HotModuleReplacementPlugin'); + expect(stdout).not.toContain("HotModuleReplacementPlugin"); } - expect(stdout).toContain('main.js'); + expect(stdout).toContain("main.js"); }); it('should work with the "--config" and "--env" options', async () => { const { stderr, stdout } = await runWatch(__dirname, [ - 'serve', - '--config', - 'function-with-env.config.js', - '--env', - 'foo=bar', - '--port', + "serve", + "--config", + "function-with-env.config.js", + "--env", + "foo=bar", + "--port", port, ]); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); if (isDevServer4) { - expect(stdout).toContain('HotModuleReplacementPlugin'); + expect(stdout).toContain("HotModuleReplacementPlugin"); } else { - expect(stdout).not.toContain('HotModuleReplacementPlugin'); + expect(stdout).not.toContain("HotModuleReplacementPlugin"); } - expect(stdout).toContain('WEBPACK_SERVE: true'); + expect(stdout).toContain("WEBPACK_SERVE: true"); expect(stdout).toContain("foo: 'bar'"); - expect(stdout).toContain('development'); + expect(stdout).toContain("development"); }); it('should work with the "--config" and "--env" options and expose dev server options', async () => { const { stderr, stdout } = await runWatch(__dirname, [ - 'serve', - '--config', - 'function-with-argv.config.js', - '--env', - 'foo=bar', - '--hot', - '--port', + "serve", + "--config", + "function-with-argv.config.js", + "--env", + "foo=bar", + "--hot", + "--port", port, ]); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); if (isDevServer4) { - expect(stdout).toContain('HotModuleReplacementPlugin'); + expect(stdout).toContain("HotModuleReplacementPlugin"); } else { - expect(stdout).toContain('HotModuleReplacementPlugin'); + expect(stdout).toContain("HotModuleReplacementPlugin"); } - expect(stdout).toContain('hot: true'); - expect(stdout).toContain('WEBPACK_SERVE: true'); + expect(stdout).toContain("hot: true"); + expect(stdout).toContain("WEBPACK_SERVE: true"); expect(stdout).toContain("foo: 'bar'"); - expect(stdout).toContain('development'); + expect(stdout).toContain("development"); }); - it('should work in multi compiler mode', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['serve', '--config', 'multi.config.js', '--port', port]); + it("should work in multi compiler mode", async () => { + const { stderr, stdout } = await runWatch(__dirname, [ + "serve", + "--config", + "multi.config.js", + "--port", + port, + ]); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); if (isDevServer4) { - expect(stdout).toContain('HotModuleReplacementPlugin'); + expect(stdout).toContain("HotModuleReplacementPlugin"); } else { - expect(stdout).not.toContain('HotModuleReplacementPlugin'); + expect(stdout).not.toContain("HotModuleReplacementPlugin"); } - expect(stdout).toContain('one'); - expect(stdout).toContain('first-output/main.js'); - expect(stdout).toContain('two'); - expect(stdout).toContain('second-output/main.js'); + expect(stdout).toContain("one"); + expect(stdout).toContain("first-output/main.js"); + expect(stdout).toContain("two"); + expect(stdout).toContain("second-output/main.js"); }); // TODO need fix in future, edge case - it.skip('should work in multi compiler mode with multiple dev servers', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['serve', '--config', 'multi-dev-server.config.js']); + it.skip("should work in multi compiler mode with multiple dev servers", async () => { + const { stderr, stdout } = await runWatch(__dirname, [ + "serve", + "--config", + "multi-dev-server.config.js", + ]); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); if (isDevServer4) { - expect(stdout).toContain('HotModuleReplacementPlugin'); + expect(stdout).toContain("HotModuleReplacementPlugin"); } else { - expect(stdout).not.toContain('HotModuleReplacementPlugin'); + expect(stdout).not.toContain("HotModuleReplacementPlugin"); } - expect(stdout).toContain('one'); - expect(stdout).toContain('first-output/main.js'); - expect(stdout).toContain('two'); - expect(stdout).toContain('second-output/main.js'); + expect(stdout).toContain("one"); + expect(stdout).toContain("first-output/main.js"); + expect(stdout).toContain("two"); + expect(stdout).toContain("second-output/main.js"); }); it('should work with the "--mode" option', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['serve']); + const { stderr, stdout } = await runWatch(__dirname, ["serve"]); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); if (isDevServer4) { - expect(stdout).toContain('HotModuleReplacementPlugin'); + expect(stdout).toContain("HotModuleReplacementPlugin"); } else { - expect(stdout).not.toContain('HotModuleReplacementPlugin'); + expect(stdout).not.toContain("HotModuleReplacementPlugin"); } - expect(stdout).toContain('development'); - expect(stdout).toContain('main.js'); + expect(stdout).toContain("development"); + expect(stdout).toContain("main.js"); }); it('should work with the "--stats" option', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['serve', '--stats']); + const { stderr, stdout } = await runWatch(__dirname, ["serve", "--stats"]); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); if (isDevServer4) { - expect(stdout).toContain('HotModuleReplacementPlugin'); + expect(stdout).toContain("HotModuleReplacementPlugin"); } else { - expect(stdout).not.toContain('HotModuleReplacementPlugin'); + expect(stdout).not.toContain("HotModuleReplacementPlugin"); } - expect(stdout).toContain(isWebpack5 ? 'compiled successfully' : 'Version: webpack'); + expect(stdout).toContain(isWebpack5 ? "compiled successfully" : "Version: webpack"); }); it('should work with the "--stats verbose" option', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['serve', '--stats', 'verbose']); + const { stderr, stdout } = await runWatch(__dirname, ["serve", "--stats", "verbose"]); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); if (isDevServer4) { - expect(stdout).toContain('HotModuleReplacementPlugin'); + expect(stdout).toContain("HotModuleReplacementPlugin"); } else { - expect(stdout).not.toContain('HotModuleReplacementPlugin'); + expect(stdout).not.toContain("HotModuleReplacementPlugin"); } - expect(stdout).toContain(isWebpack5 ? 'from webpack.Compiler' : 'webpack.buildChunkGraph.visitModules'); - expect(stdout).toContain('main.js'); + expect(stdout).toContain( + isWebpack5 ? "from webpack.Compiler" : "webpack.buildChunkGraph.visitModules", + ); + expect(stdout).toContain("main.js"); }); it('should work with the "--mode" option #2', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['serve', '--mode', 'production']); + const { stderr, stdout } = await runWatch(__dirname, ["serve", "--mode", "production"]); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); if (isDevServer4) { - expect(stdout).toContain('HotModuleReplacementPlugin'); + expect(stdout).toContain("HotModuleReplacementPlugin"); } else { - expect(stdout).not.toContain('HotModuleReplacementPlugin'); + expect(stdout).not.toContain("HotModuleReplacementPlugin"); } - expect(stdout).toContain('production'); - expect(stdout).toContain('main.js'); + expect(stdout).toContain("production"); + expect(stdout).toContain("main.js"); }); it('should work with the "--mode" option #3', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['serve', '--mode', 'development']); + const { stderr, stdout } = await runWatch(__dirname, ["serve", "--mode", "development"]); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); if (isDevServer4) { - expect(stdout).toContain('HotModuleReplacementPlugin'); + expect(stdout).toContain("HotModuleReplacementPlugin"); } else { - expect(stdout).not.toContain('HotModuleReplacementPlugin'); + expect(stdout).not.toContain("HotModuleReplacementPlugin"); } - expect(stdout).toContain('development'); - expect(stdout).toContain('main.js'); + expect(stdout).toContain("development"); + expect(stdout).toContain("main.js"); }); it('should work with the "--progress" option', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['serve', '--progress']); + const { stderr, stdout } = await runWatch(__dirname, ["serve", "--progress"]); - expect(stderr).toContain('webpack.Progress'); + expect(stderr).toContain("webpack.Progress"); if (isDevServer4) { - expect(stdout).toContain('HotModuleReplacementPlugin'); + expect(stdout).toContain("HotModuleReplacementPlugin"); } else { - expect(stdout).not.toContain('HotModuleReplacementPlugin'); + expect(stdout).not.toContain("HotModuleReplacementPlugin"); } - expect(stdout).toContain('main.js'); + expect(stdout).toContain("main.js"); }); it('should work with the "--progress" option using the "profile" value', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['serve', '--progress', 'profile']); + const { stderr, stdout } = await runWatch(__dirname, ["serve", "--progress", "profile"]); - expect(stderr).toContain('webpack.Progress'); + expect(stderr).toContain("webpack.Progress"); if (isDevServer4) { - expect(stdout).toContain('HotModuleReplacementPlugin'); + expect(stdout).toContain("HotModuleReplacementPlugin"); } else { - expect(stdout).not.toContain('HotModuleReplacementPlugin'); + expect(stdout).not.toContain("HotModuleReplacementPlugin"); } - expect(stdout).toContain('main.js'); + expect(stdout).toContain("main.js"); }); it('should work with the "--client-log-level" option', async () => { - const { stdout, stderr } = await runWatch(testPath, ['serve', isDevServer4 ? '--client-logging' : '--client-log-level', 'info']); + const { stdout, stderr } = await runWatch(testPath, [ + "serve", + isDevServer4 ? "--client-logging" : "--client-log-level", + "info", + ]); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); if (isDevServer4) { - expect(stdout).toContain('HotModuleReplacementPlugin'); + expect(stdout).toContain("HotModuleReplacementPlugin"); } else { - expect(stdout).not.toContain('HotModuleReplacementPlugin'); + expect(stdout).not.toContain("HotModuleReplacementPlugin"); } - expect(stdout).toContain('main.js'); + expect(stdout).toContain("main.js"); }); it('should work with the "--port" option', async () => { - const { stdout, stderr } = await runWatch(testPath, ['serve', '--port', port]); + const { stdout, stderr } = await runWatch(testPath, ["serve", "--port", port]); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); if (isDevServer4) { - expect(stdout).toContain('HotModuleReplacementPlugin'); + expect(stdout).toContain("HotModuleReplacementPlugin"); } else { - expect(stdout).not.toContain('HotModuleReplacementPlugin'); + expect(stdout).not.toContain("HotModuleReplacementPlugin"); } - expect(stdout).toContain('main.js'); + expect(stdout).toContain("main.js"); }); it('should work with the "--hot" option', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['serve', '--hot']); + const { stderr, stdout } = await runWatch(__dirname, ["serve", "--hot"]); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); if (isDevServer4) { - expect(stdout).toContain('HotModuleReplacementPlugin'); + expect(stdout).toContain("HotModuleReplacementPlugin"); } else { - expect(stdout).toContain('HotModuleReplacementPlugin'); + expect(stdout).toContain("HotModuleReplacementPlugin"); } - expect(stdout).toContain('main.js'); + expect(stdout).toContain("main.js"); }); it('should work with the "--no-hot" option', async () => { - const { stdout, stderr } = await runWatch(testPath, ['serve', '--port', port, '--no-hot']); + const { stdout, stderr } = await runWatch(testPath, ["serve", "--port", port, "--no-hot"]); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(stdout).not.toContain('HotModuleReplacementPlugin'); - expect(stdout).toContain('main.js'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(stdout).not.toContain("HotModuleReplacementPlugin"); + expect(stdout).toContain("main.js"); }); it('should work with the "--hot" option using the "only" value', async () => { - const { stdout, stderr } = await runWatch(testPath, ['serve', '--port', port, isDevServer4 ? '--hot=only' : '--hot-only']); + const { stdout, stderr } = await runWatch(testPath, [ + "serve", + "--port", + port, + isDevServer4 ? "--hot=only" : "--hot-only", + ]); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(stdout).toContain('HotModuleReplacementPlugin'); - expect(stdout).toContain('main.js'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(stdout).toContain("HotModuleReplacementPlugin"); + expect(stdout).toContain("main.js"); }); it('should work with "--hot" and "--port" options', async () => { - const { stdout, stderr } = await runWatch(testPath, ['serve', '--port', port, '--hot']); + const { stdout, stderr } = await runWatch(testPath, ["serve", "--port", port, "--hot"]); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(stdout).toContain('HotModuleReplacementPlugin'); - expect(stdout).toContain('main.js'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(stdout).toContain("HotModuleReplacementPlugin"); + expect(stdout).toContain("main.js"); }); it('should work with the "--hot" and "--progress" options', async () => { - const { stdout, stderr } = await runWatch(testPath, ['serve', '--port', port, '--hot', '--progress']); + const { stdout, stderr } = await runWatch(testPath, [ + "serve", + "--port", + port, + "--hot", + "--progress", + ]); - expect(stderr).toContain('webpack.Progress'); - expect(stdout).toContain('HotModuleReplacementPlugin'); - expect(stdout).toContain('main.js'); + expect(stderr).toContain("webpack.Progress"); + expect(stdout).toContain("HotModuleReplacementPlugin"); + expect(stdout).toContain("main.js"); }); it('should work with the default "publicPath" option', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['serve']); + const { stderr, stdout } = await runWatch(__dirname, ["serve"]); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); if (isDevServer4) { - expect(stdout).toContain('HotModuleReplacementPlugin'); + expect(stdout).toContain("HotModuleReplacementPlugin"); } else { - expect(stdout).not.toContain('HotModuleReplacementPlugin'); + expect(stdout).not.toContain("HotModuleReplacementPlugin"); } - expect(stdout).toContain('main.js'); + expect(stdout).toContain("main.js"); }); // TODO bug on webpack-dev-server side, need respect `output.publicPath` too it('should work with the "--output-public-path" option', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['serve', '--output-public-path', '/my-public-path/']); + const { stderr, stdout } = await runWatch(__dirname, [ + "serve", + "--output-public-path", + "/my-public-path/", + ]); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); if (isWebpack5) { if (isDevServer4) { - expect(stdout).toContain('HotModuleReplacementPlugin'); + expect(stdout).toContain("HotModuleReplacementPlugin"); } else { - expect(stdout).toContain('/my-public-path/'); - expect(stdout).not.toContain('HotModuleReplacementPlugin'); + expect(stdout).toContain("/my-public-path/"); + expect(stdout).not.toContain("HotModuleReplacementPlugin"); } - expect(stdout).toContain('main.js'); + expect(stdout).toContain("main.js"); } else { - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); } }); it('should respect the "publicPath" option from configuration', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['serve', '--config', 'output-public-path.config.js']); + const { stderr, stdout } = await runWatch(__dirname, [ + "serve", + "--config", + "output-public-path.config.js", + ]); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); if (isDevServer4) { - expect(stdout).toContain('HotModuleReplacementPlugin'); + expect(stdout).toContain("HotModuleReplacementPlugin"); } else { - expect(stdout).not.toContain('HotModuleReplacementPlugin'); + expect(stdout).not.toContain("HotModuleReplacementPlugin"); } - expect(stdout).toContain('main.js'); - expect(stdout).toContain('/my-public-path/'); + expect(stdout).toContain("main.js"); + expect(stdout).toContain("/my-public-path/"); }); it('should respect the "publicPath" option from configuration using multi compiler mode', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['serve', '--config', 'multi-output-public-path.config.js', '--port', port]); + const { stderr, stdout } = await runWatch(__dirname, [ + "serve", + "--config", + "multi-output-public-path.config.js", + "--port", + port, + ]); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); if (isDevServer4) { - expect(stdout).toContain('HotModuleReplacementPlugin'); + expect(stdout).toContain("HotModuleReplacementPlugin"); } else { - expect(stdout).not.toContain('HotModuleReplacementPlugin'); + expect(stdout).not.toContain("HotModuleReplacementPlugin"); } - expect(stdout).toContain('one'); - expect(stdout).toContain('first-output/main.js'); - expect(stdout).toContain('two'); - expect(stdout).toContain('second-output/main.js'); - expect(stdout).toContain('/my-public-path/'); + expect(stdout).toContain("one"); + expect(stdout).toContain("first-output/main.js"); + expect(stdout).toContain("two"); + expect(stdout).toContain("second-output/main.js"); + expect(stdout).toContain("/my-public-path/"); }); it('should respect the "publicPath" option from configuration (from the "devServer" options)', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['serve', '--config', 'dev-server-output-public-path.config.js']); + const { stderr, stdout } = await runWatch(__dirname, [ + "serve", + "--config", + "dev-server-output-public-path.config.js", + ]); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); if (isDevServer4) { - expect(stdout).toContain('HotModuleReplacementPlugin'); + expect(stdout).toContain("HotModuleReplacementPlugin"); } else { - expect(stdout).not.toContain('HotModuleReplacementPlugin'); + expect(stdout).not.toContain("HotModuleReplacementPlugin"); } - expect(stdout).toContain('main.js'); + expect(stdout).toContain("main.js"); }); it('should work with the "--open" option', async () => { - const { stdout, stderr } = await runWatch(testPath, ['serve', '--open', '--port', port]); + const { stdout, stderr } = await runWatch(testPath, ["serve", "--open", "--port", port]); if (isDevServer4) { let normalizedStderr = normalizeStderr(stderr); if (/wait until bundle finished/.test(normalizedStderr)) { - normalizedStderr = normalizedStderr.split('\n'); + normalizedStderr = normalizedStderr.split("\n"); - const waitIndex = normalizedStderr.findIndex((item) => /wait until bundle finished/.test(item)); + const waitIndex = normalizedStderr.findIndex((item) => + /wait until bundle finished/.test(item), + ); if (waitIndex !== -1) { normalizedStderr.splice(waitIndex, 1); } - normalizedStderr = normalizedStderr.join('\n'); + normalizedStderr = normalizedStderr.join("\n"); } - expect(normalizedStderr).toMatchSnapshot('stderr'); - expect(stdout).toContain('HotModuleReplacementPlugin'); + expect(normalizedStderr).toMatchSnapshot("stderr"); + expect(stdout).toContain("HotModuleReplacementPlugin"); } else { - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(stdout).not.toContain('HotModuleReplacementPlugin'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(stdout).not.toContain("HotModuleReplacementPlugin"); } - expect(stdout).toContain('main.js'); + expect(stdout).toContain("main.js"); }); it('should respect the "publicPath" option from configuration using multi compiler mode (from the "devServer" options)', async () => { const { stderr, stdout } = await runWatch(__dirname, [ - 'serve', - '--config', - 'multi-dev-server-output-public-path.config.js', - '--port', + "serve", + "--config", + "multi-dev-server-output-public-path.config.js", + "--port", port, ]); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); if (isDevServer4) { - expect(stdout).toContain('HotModuleReplacementPlugin'); + expect(stdout).toContain("HotModuleReplacementPlugin"); } else { - expect(stdout).not.toContain('HotModuleReplacementPlugin'); + expect(stdout).not.toContain("HotModuleReplacementPlugin"); } - expect(stdout).toContain('one'); - expect(stdout).toContain('first-output/main.js'); - expect(stdout).toContain('two'); - expect(stdout).toContain('second-output/main.js'); + expect(stdout).toContain("one"); + expect(stdout).toContain("first-output/main.js"); + expect(stdout).toContain("two"); + expect(stdout).toContain("second-output/main.js"); }); - it('should work with entries syntax', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['serve', './src/entry.js', '--port', port]); + it("should work with entries syntax", async () => { + const { stderr, stdout } = await runWatch(__dirname, [ + "serve", + "./src/entry.js", + "--port", + port, + ]); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); if (isDevServer4) { - expect(stdout).toContain('HotModuleReplacementPlugin'); + expect(stdout).toContain("HotModuleReplacementPlugin"); } else { - expect(stdout).not.toContain('HotModuleReplacementPlugin'); + expect(stdout).not.toContain("HotModuleReplacementPlugin"); } - expect(stdout).toContain('development'); + expect(stdout).toContain("development"); }); - it('should work and log warning on the `watch option in a configuration', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['serve', '--config', './watch.config.js', '--port', port]); + it("should work and log warning on the `watch option in a configuration", async () => { + const { stderr, stdout } = await runWatch(__dirname, [ + "serve", + "--config", + "./watch.config.js", + "--port", + port, + ]); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); if (isDevServer4) { - expect(stdout).toContain('HotModuleReplacementPlugin'); + expect(stdout).toContain("HotModuleReplacementPlugin"); } else { - expect(stdout).not.toContain('HotModuleReplacementPlugin'); + expect(stdout).not.toContain("HotModuleReplacementPlugin"); } - expect(stdout).toContain('development'); + expect(stdout).toContain("development"); }); - it('should shoe help information for serve', async () => { - const { exitCode, stderr, stdout } = await runWatch(__dirname, ['serve', '--help']); + it("should shoe help information for serve", async () => { + const { exitCode, stderr, stdout } = await runWatch(__dirname, ["serve", "--help"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should log used supplied config with serve', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['serve', '--config', 'log.config.js', '--port', port], { - killString: /Compiler is watching files for updates\.\.\./, - }); + it("should log used supplied config with serve", async () => { + const { stderr, stdout } = await runWatch( + __dirname, + ["serve", "--config", "log.config.js", "--port", port], + { + killString: /Compiler is watching files for updates\.\.\./, + }, + ); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); expect(stdout).toBeTruthy(); }); it("should log error on using '--watch' flag with serve", async () => { - const { exitCode, stdout, stderr } = await runWatch(testPath, ['serve', '--watch']); + const { exitCode, stdout, stderr } = await runWatch(testPath, ["serve", "--watch"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it("should log error on using '-w' alias with serve", async () => { - const { exitCode, stdout, stderr } = await runWatch(testPath, ['serve', '-w']); + const { exitCode, stdout, stderr } = await runWatch(testPath, ["serve", "-w"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should log an error on unknown flag', async () => { - const { exitCode, stdout, stderr } = await runWatch(testPath, ['serve', '--port', port, '--unknown-flag']); + it("should log an error on unknown flag", async () => { + const { exitCode, stdout, stderr } = await runWatch(testPath, [ + "serve", + "--port", + port, + "--unknown-flag", + ]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should work with the "stats" option in config', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['serve', '--config', 'stats.config.js'], { - killString: /Compiled successfully|modules/i, - }); - - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(stdout).toContain(isWebpack5 ? 'compiled successfully' : 'modules'); + const { stderr, stdout } = await runWatch( + __dirname, + ["serve", "--config", "stats.config.js"], + { + killString: /Compiled successfully|modules/i, + }, + ); + + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(stdout).toContain(isWebpack5 ? "compiled successfully" : "modules"); expect(stdout.match(/HotModuleReplacementPlugin/g)).toBeNull(); }); - it('should throw error when same ports in multicompiler', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['serve', '--config', 'same-ports-dev-serever.config.js']); + it("should throw error when same ports in multicompiler", async () => { + const { stderr, stdout } = await runWatch(__dirname, [ + "serve", + "--config", + "same-ports-dev-serever.config.js", + ]); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); }); diff --git a/test/serve/basic/serve.config.js b/test/serve/basic/serve.config.js index cef4d803dc3..abc3475ef45 100644 --- a/test/serve/basic/serve.config.js +++ b/test/serve/basic/serve.config.js @@ -1,7 +1,15 @@ -const WebpackCLITestPlugin = require('../../utils/webpack-cli-test-plugin'); +const WebpackCLITestPlugin = require("../../utils/webpack-cli-test-plugin"); +const { isDevServer4 } = require("../../utils/test-utils"); module.exports = { - mode: 'development', + mode: "development", devtool: false, - plugins: [new WebpackCLITestPlugin(['mode'], false, 'hooks.compilation.taps')], + plugins: [new WebpackCLITestPlugin(["mode"], false, "hooks.compilation.taps")], + devServer: isDevServer4 + ? { + client: { + logging: "info", + }, + } + : {}, }; diff --git a/test/serve/basic/src/entry.js b/test/serve/basic/src/entry.js index a136806e8f1..79f3f155834 100644 --- a/test/serve/basic/src/entry.js +++ b/test/serve/basic/src/entry.js @@ -1 +1 @@ -console.log('Entry'); +console.log("Entry"); diff --git a/test/serve/basic/src/other.js b/test/serve/basic/src/other.js index 2457f618e17..a2831caa096 100644 --- a/test/serve/basic/src/other.js +++ b/test/serve/basic/src/other.js @@ -1 +1 @@ -console.log('HERE'); +console.log("HERE"); diff --git a/test/serve/basic/stats.config.js b/test/serve/basic/stats.config.js index 0159b1dbf83..f01f9035323 100644 --- a/test/serve/basic/stats.config.js +++ b/test/serve/basic/stats.config.js @@ -1,15 +1,18 @@ -const { isDevServer4 } = require('../../utils/test-utils'); +const { isDevServer4 } = require("../../utils/test-utils"); module.exports = { - mode: 'development', + mode: "development", devtool: false, devServer: isDevServer4 ? { - dev: { - stats: 'minimal', + devMiddleware: { + stats: "minimal", + }, + client: { + logging: "info", }, } : { - stats: 'minimal', + stats: "minimal", }, }; diff --git a/test/serve/basic/watch.config.js b/test/serve/basic/watch.config.js index 7f7eb3153b8..f0e1746a6b2 100644 --- a/test/serve/basic/watch.config.js +++ b/test/serve/basic/watch.config.js @@ -1,8 +1,16 @@ -const WebpackCLITestPlugin = require('../../utils/webpack-cli-test-plugin'); +const WebpackCLITestPlugin = require("../../utils/webpack-cli-test-plugin"); +const { isDevServer4 } = require("../../utils/test-utils"); module.exports = { - mode: 'development', + mode: "development", devtool: false, - plugins: [new WebpackCLITestPlugin(['mode'], false, 'hooks.compilation.taps')], + plugins: [new WebpackCLITestPlugin(["mode"], false, "hooks.compilation.taps")], watch: true, + devServer: isDevServer4 + ? { + client: { + logging: "info", + }, + } + : {}, }; diff --git a/test/serve/basic/webpack.config.js b/test/serve/basic/webpack.config.js index cef4d803dc3..abc3475ef45 100644 --- a/test/serve/basic/webpack.config.js +++ b/test/serve/basic/webpack.config.js @@ -1,7 +1,15 @@ -const WebpackCLITestPlugin = require('../../utils/webpack-cli-test-plugin'); +const WebpackCLITestPlugin = require("../../utils/webpack-cli-test-plugin"); +const { isDevServer4 } = require("../../utils/test-utils"); module.exports = { - mode: 'development', + mode: "development", devtool: false, - plugins: [new WebpackCLITestPlugin(['mode'], false, 'hooks.compilation.taps')], + plugins: [new WebpackCLITestPlugin(["mode"], false, "hooks.compilation.taps")], + devServer: isDevServer4 + ? { + client: { + logging: "info", + }, + } + : {}, }; diff --git a/test/serve/invalid-schema/__snapshots__/invalid-schema.test.js.snap.devServer4.webpack4 b/test/serve/invalid-schema/__snapshots__/invalid-schema.test.js.snap.devServer4.webpack4 index 1af2481082e..5d45ad3d218 100644 --- a/test/serve/invalid-schema/__snapshots__/invalid-schema.test.js.snap.devServer4.webpack4 +++ b/test/serve/invalid-schema/__snapshots__/invalid-schema.test.js.snap.devServer4.webpack4 @@ -20,8 +20,13 @@ exports[`invalid schema should log webpack error and exit process on invalid fla exports[`invalid schema should log webpack-dev-server error and exit process on invalid config: stderr 1`] = ` "[webpack-cli] Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema. - - configuration.bonjour should be a boolean. - -> Broadcasts the server via ZeroConf networking on start. https://webpack.js.org/configuration/dev-server/#devserverbonjour" + - configuration.bonjour should be one of these: + boolean | object { … } + -> Broadcasts the server via ZeroConf networking on start. https://webpack.js.org/configuration/dev-server/#devserverbonjour + Details: + * configuration.bonjour should be a boolean. + * configuration.bonjour should be an object: + object { … }" `; exports[`invalid schema should log webpack-dev-server error and exit process on invalid config: stdout 1`] = `""`; diff --git a/test/serve/invalid-schema/__snapshots__/invalid-schema.test.js.snap.devServer4.webpack5 b/test/serve/invalid-schema/__snapshots__/invalid-schema.test.js.snap.devServer4.webpack5 index 9c3aeaffc0e..764cb17a6d3 100644 --- a/test/serve/invalid-schema/__snapshots__/invalid-schema.test.js.snap.devServer4.webpack5 +++ b/test/serve/invalid-schema/__snapshots__/invalid-schema.test.js.snap.devServer4.webpack5 @@ -18,8 +18,13 @@ exports[`invalid schema should log webpack error and exit process on invalid fla exports[`invalid schema should log webpack-dev-server error and exit process on invalid config: stderr 1`] = ` "[webpack-cli] Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema. - - configuration.bonjour should be a boolean. - -> Broadcasts the server via ZeroConf networking on start. https://webpack.js.org/configuration/dev-server/#devserverbonjour" + - configuration.bonjour should be one of these: + boolean | object { … } + -> Broadcasts the server via ZeroConf networking on start. https://webpack.js.org/configuration/dev-server/#devserverbonjour + Details: + * configuration.bonjour should be a boolean. + * configuration.bonjour should be an object: + object { … }" `; exports[`invalid schema should log webpack-dev-server error and exit process on invalid config: stdout 1`] = `""`; diff --git a/test/serve/invalid-schema/invalid-schema.test.js b/test/serve/invalid-schema/invalid-schema.test.js index 95030317d64..81aede987c5 100644 --- a/test/serve/invalid-schema/invalid-schema.test.js +++ b/test/serve/invalid-schema/invalid-schema.test.js @@ -1,37 +1,45 @@ -'use strict'; -const { run, normalizeStderr, normalizeStdout } = require('../../utils/test-utils'); +"use strict"; +const { run, normalizeStderr, normalizeStdout } = require("../../utils/test-utils"); -describe('invalid schema', () => { - it('should log webpack error and exit process on invalid config', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['serve', '--config', './webpack.config.mock.js']); +describe("invalid schema", () => { + it("should log webpack error and exit process on invalid config", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "serve", + "--config", + "./webpack.config.mock.js", + ]); expect(exitCode).toEqual(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should log webpack error and exit process on invalid flag', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['serve', '--mode', 'Yukihira']); + it("should log webpack error and exit process on invalid flag", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["serve", "--mode", "Yukihira"]); expect(exitCode).toEqual(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); // TODO need fix on webpack-dev-server side - it.skip('should log webpack-dev-server error and exit process on invalid flag', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['serve', '--port', '-1']); + it.skip("should log webpack-dev-server error and exit process on invalid flag", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["serve", "--port", "-1"]); expect(exitCode).toEqual(2); - expect(normalizeStderr(stderr).replace('Port', 'options.port')).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr).replace("Port", "options.port")).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should log webpack-dev-server error and exit process on invalid config', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['serve', '--config', './webpack-dev-server.config.mock.js']); + it("should log webpack-dev-server error and exit process on invalid config", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "serve", + "--config", + "./webpack-dev-server.config.mock.js", + ]); expect(exitCode).toEqual(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); }); diff --git a/test/serve/invalid-schema/webpack-dev-server.config.mock.js b/test/serve/invalid-schema/webpack-dev-server.config.mock.js index 37e88e65591..59dfc1d6c0b 100644 --- a/test/serve/invalid-schema/webpack-dev-server.config.mock.js +++ b/test/serve/invalid-schema/webpack-dev-server.config.mock.js @@ -1,6 +1,6 @@ module.exports = { - mode: 'development', + mode: "development", devServer: { - bonjour: '', + bonjour: "", }, }; diff --git a/test/serve/invalid-schema/webpack.config.mock.js b/test/serve/invalid-schema/webpack.config.mock.js index f6d8ff0ce80..d436ef9ecc5 100644 --- a/test/serve/invalid-schema/webpack.config.mock.js +++ b/test/serve/invalid-schema/webpack.config.mock.js @@ -1,3 +1,3 @@ module.exports = { - mode: 'Nishinoya Yuu', + mode: "Nishinoya Yuu", }; diff --git a/test/serve/serve-variable/__snapshots__/serve-basic.test.js.snap.devServer3.webpack4 b/test/serve/serve-variable/__snapshots__/serve-variable.test.js.snap.devServer3.webpack4 similarity index 100% rename from test/serve/serve-variable/__snapshots__/serve-basic.test.js.snap.devServer3.webpack4 rename to test/serve/serve-variable/__snapshots__/serve-variable.test.js.snap.devServer3.webpack4 diff --git a/test/serve/serve-variable/__snapshots__/serve-basic.test.js.snap.devServer3.webpack5 b/test/serve/serve-variable/__snapshots__/serve-variable.test.js.snap.devServer3.webpack5 similarity index 100% rename from test/serve/serve-variable/__snapshots__/serve-basic.test.js.snap.devServer3.webpack5 rename to test/serve/serve-variable/__snapshots__/serve-variable.test.js.snap.devServer3.webpack5 diff --git a/test/serve/serve-variable/__snapshots__/serve-basic.test.js.snap.devServer4.webpack4 b/test/serve/serve-variable/__snapshots__/serve-variable.test.js.snap.devServer4.webpack4 similarity index 100% rename from test/serve/serve-variable/__snapshots__/serve-basic.test.js.snap.devServer4.webpack4 rename to test/serve/serve-variable/__snapshots__/serve-variable.test.js.snap.devServer4.webpack4 diff --git a/test/serve/serve-variable/__snapshots__/serve-basic.test.js.snap.devServer4.webpack5 b/test/serve/serve-variable/__snapshots__/serve-variable.test.js.snap.devServer4.webpack5 similarity index 100% rename from test/serve/serve-variable/__snapshots__/serve-basic.test.js.snap.devServer4.webpack5 rename to test/serve/serve-variable/__snapshots__/serve-variable.test.js.snap.devServer4.webpack5 diff --git a/test/serve/serve-variable/serve-basic.test.js b/test/serve/serve-variable/serve-basic.test.js deleted file mode 100644 index ba6c28d2326..00000000000 --- a/test/serve/serve-variable/serve-basic.test.js +++ /dev/null @@ -1,31 +0,0 @@ -'use strict'; - -const path = require('path'); -// eslint-disable-next-line node/no-unpublished-require -const getPort = require('get-port'); -const { runWatch, normalizeStderr, isDevServer4 } = require('../../utils/test-utils'); - -const testPath = path.resolve(__dirname); - -describe('serve variable', () => { - let port; - - beforeEach(async () => { - port = await getPort(); - }); - - it('compiles without flags and export variable', async () => { - const { stdout, stderr } = await runWatch(testPath, ['serve', '--port', port]); - - expect(normalizeStderr(stderr)).toMatchSnapshot(); - expect(stdout).toContain('main.js'); - - if (isDevServer4) { - expect(stdout).not.toContain('HotModuleReplacementPlugin'); - } else { - expect(stdout).not.toContain('HotModuleReplacementPlugin'); - } - - expect(stdout).toContain('PASS'); - }); -}); diff --git a/test/serve/serve-variable/serve-variable.test.js b/test/serve/serve-variable/serve-variable.test.js new file mode 100644 index 00000000000..3ae3600b041 --- /dev/null +++ b/test/serve/serve-variable/serve-variable.test.js @@ -0,0 +1,31 @@ +"use strict"; + +const path = require("path"); +// eslint-disable-next-line node/no-unpublished-require +const getPort = require("get-port"); +const { runWatch, normalizeStderr, isDevServer4 } = require("../../utils/test-utils"); + +const testPath = path.resolve(__dirname); + +describe("serve variable", () => { + let port; + + beforeEach(async () => { + port = await getPort(); + }); + + it("compiles without flags and export variable", async () => { + const { stdout, stderr } = await runWatch(testPath, ["serve", "--port", port]); + + expect(normalizeStderr(stderr)).toMatchSnapshot(); + expect(stdout).toContain("main.js"); + + if (isDevServer4) { + expect(stdout).not.toContain("HotModuleReplacementPlugin"); + } else { + expect(stdout).not.toContain("HotModuleReplacementPlugin"); + } + + expect(stdout).toContain("PASS"); + }); +}); diff --git a/test/serve/serve-variable/webpack.config.js b/test/serve/serve-variable/webpack.config.js index 435b8b21190..c660b2fb547 100644 --- a/test/serve/serve-variable/webpack.config.js +++ b/test/serve/serve-variable/webpack.config.js @@ -1,15 +1,15 @@ -const isInProcess = process.env.WEBPACK_SERVE; +const HAS_WEBPACK_SERVE = process.env.WEBPACK_SERVE || process.env.WEBPACK_DEV_SERVER; class CustomTestPlugin { constructor(isInEnvironment) { this.isInEnvironment = isInEnvironment; } apply(compiler) { - compiler.hooks.done.tap('testPlugin', () => { - if (!isInProcess && this.isInEnvironment) { - console.log('PASS'); + compiler.hooks.done.tap("testPlugin", () => { + if (this.isInEnvironment) { + console.log("PASS"); } else { - console.log('FAIL'); + console.log("FAIL"); } }); } @@ -17,8 +17,8 @@ class CustomTestPlugin { module.exports = (env) => { return { - mode: 'development', + mode: "development", devtool: false, - plugins: [new CustomTestPlugin(env.WEBPACK_SERVE)], + plugins: [new CustomTestPlugin(HAS_WEBPACK_SERVE && env.WEBPACK_SERVE)], }; }; diff --git a/test/serve/with-custom-port/serve-custom-config.test.js b/test/serve/with-custom-port/serve-custom-config.test.js index 6808e94b1b8..085759b6148 100644 --- a/test/serve/with-custom-port/serve-custom-config.test.js +++ b/test/serve/with-custom-port/serve-custom-config.test.js @@ -1,75 +1,75 @@ -'use strict'; +"use strict"; -const path = require('path'); +const path = require("path"); // eslint-disable-next-line node/no-unpublished-require -const getPort = require('get-port'); -const { runWatch, normalizeStderr, isDevServer4 } = require('../../utils/test-utils'); +const getPort = require("get-port"); +const { runWatch, normalizeStderr, isDevServer4 } = require("../../utils/test-utils"); const testPath = path.resolve(__dirname); -describe('serve with devServer in config', () => { +describe("serve with devServer in config", () => { let port; beforeEach(async () => { port = await getPort(); }); - it('Should pick up the host and port from config', async () => { - const { stdout, stderr } = await runWatch(testPath, ['serve']); + it("Should pick up the host and port from config", async () => { + const { stdout, stderr } = await runWatch(testPath, ["serve"]); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); if (isDevServer4) { - expect(stdout).toContain('HotModuleReplacementPlugin'); + expect(stdout).toContain("HotModuleReplacementPlugin"); } else { - expect(stdout).not.toContain('HotModuleReplacementPlugin'); - expect(stdout).toContain('http://0.0.0.0:1234'); + expect(stdout).not.toContain("HotModuleReplacementPlugin"); + expect(stdout).toContain("http://0.0.0.0:1234"); } - expect(stdout).toContain('main.js'); + expect(stdout).toContain("main.js"); }); - it('Port flag should override the config port', async () => { - const { stdout, stderr } = await runWatch(testPath, ['serve', '--port', port]); + it("Port flag should override the config port", async () => { + const { stdout, stderr } = await runWatch(testPath, ["serve", "--port", port]); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); if (isDevServer4) { - expect(stdout).toContain('HotModuleReplacementPlugin'); + expect(stdout).toContain("HotModuleReplacementPlugin"); } else { - expect(stdout).not.toContain('HotModuleReplacementPlugin'); + expect(stdout).not.toContain("HotModuleReplacementPlugin"); expect(stdout).toContain(`http://0.0.0.0:${port}`); } - expect(stdout).toContain('main.js'); + expect(stdout).toContain("main.js"); }); - it('Passing hot flag works alongside other server config', async () => { - const { stdout, stderr } = await runWatch(testPath, ['serve', '--port', port, '--hot']); + it("Passing hot flag works alongside other server config", async () => { + const { stdout, stderr } = await runWatch(testPath, ["serve", "--port", port, "--hot"]); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); if (isDevServer4) { - expect(stdout).toContain('HotModuleReplacementPlugin'); + expect(stdout).toContain("HotModuleReplacementPlugin"); } else { - expect(stdout).toContain('HotModuleReplacementPlugin'); + expect(stdout).toContain("HotModuleReplacementPlugin"); expect(stdout).toContain(`http://0.0.0.0:${port}`); } - expect(stdout).toContain('main.js'); + expect(stdout).toContain("main.js"); }); - it('works fine when no-hot flag is passed alongside other server config', async () => { - const { stdout, stderr } = await runWatch(testPath, ['serve', '--port', port, '--no-hot']); + it("works fine when no-hot flag is passed alongside other server config", async () => { + const { stdout, stderr } = await runWatch(testPath, ["serve", "--port", port, "--no-hot"]); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(stdout).not.toContain('HotModuleReplacementPlugin'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(stdout).not.toContain("HotModuleReplacementPlugin"); if (!isDevServer4) { // Runs at correct host and port expect(stdout).toContain(`http://0.0.0.0:${port}`); } - expect(stdout).toContain('main.js'); + expect(stdout).toContain("main.js"); }); }); diff --git a/test/serve/with-custom-port/webpack.config.js b/test/serve/with-custom-port/webpack.config.js index c0a8ac96ef6..54496f35346 100644 --- a/test/serve/with-custom-port/webpack.config.js +++ b/test/serve/with-custom-port/webpack.config.js @@ -1,12 +1,12 @@ -const WebpackCLITestPlugin = require('../../utils/webpack-cli-test-plugin'); +const WebpackCLITestPlugin = require("../../utils/webpack-cli-test-plugin"); module.exports = { - mode: 'development', + mode: "development", devtool: false, - stats: 'detailed', + stats: "detailed", devServer: { port: 1234, - host: '0.0.0.0', + host: "0.0.0.0", }, - plugins: [new WebpackCLITestPlugin(['mode'], false, 'hooks.compilation.taps')], + plugins: [new WebpackCLITestPlugin(["mode"], false, "hooks.compilation.taps")], }; diff --git a/test/utils/cli-plugin-test/main.js b/test/utils/cli-plugin-test/main.js index 3451e9b7ed7..accefceba62 100644 --- a/test/utils/cli-plugin-test/main.js +++ b/test/utils/cli-plugin-test/main.js @@ -1 +1 @@ -console.log('Hello World'); +console.log("Hello World"); diff --git a/test/utils/cli-plugin-test/plugin.test.js b/test/utils/cli-plugin-test/plugin.test.js index c7510abe361..280a6a9b152 100644 --- a/test/utils/cli-plugin-test/plugin.test.js +++ b/test/utils/cli-plugin-test/plugin.test.js @@ -1,19 +1,19 @@ -'use strict'; -const { cli } = require('webpack'); -const { run } = require('../test-utils'); +"use strict"; +const { cli } = require("webpack"); +const { run } = require("../test-utils"); -describe('webpack-cli-test-plugin Test', () => { - it('should log the webpack configuration', async () => { +describe("webpack-cli-test-plugin Test", () => { + it("should log the webpack configuration", async () => { const { exitCode, stderr, stdout } = await run(__dirname); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toContain(`target: 'node'`); - if (typeof cli !== 'undefined') { + if (typeof cli !== "undefined") { expect(stdout).toContain(`alias: { alias: [ 'alias1', 'alias2' ] }`); } - expect(stdout).toContain('WebpackCLITestPlugin'); + expect(stdout).toContain("WebpackCLITestPlugin"); }); }); diff --git a/test/utils/cli-plugin-test/webpack.config.js b/test/utils/cli-plugin-test/webpack.config.js index fa4684df319..6a777189d65 100644 --- a/test/utils/cli-plugin-test/webpack.config.js +++ b/test/utils/cli-plugin-test/webpack.config.js @@ -1,18 +1,18 @@ // webpack.config.js -const { cli } = require('webpack'); -const WebpackCLITestPlugin = require('../webpack-cli-test-plugin'); +const { cli } = require("webpack"); +const WebpackCLITestPlugin = require("../webpack-cli-test-plugin"); module.exports = { - entry: './main.js', - mode: 'development', - target: 'node', + entry: "./main.js", + mode: "development", + target: "node", resolve: { alias: - typeof cli !== 'undefined' + typeof cli !== "undefined" ? { - alias: ['alias1', 'alias2'], + alias: ["alias1", "alias2"], } : {}, }, - plugins: [new WebpackCLITestPlugin(['resolve'])], + plugins: [new WebpackCLITestPlugin(["resolve"])], }; diff --git a/test/utils/exec-in-directory.js b/test/utils/exec-in-directory.js index 7654c374026..c8a5f4d522f 100644 --- a/test/utils/exec-in-directory.js +++ b/test/utils/exec-in-directory.js @@ -1,4 +1,4 @@ -'use strict'; +"use strict"; const [, , dir, bin] = process.argv; process.argv.splice(1, 2); diff --git a/test/utils/test-utils.js b/test/utils/test-utils.js index 65a9fce20b7..ed707c23691 100644 --- a/test/utils/test-utils.js +++ b/test/utils/test-utils.js @@ -1,33 +1,33 @@ /* eslint-disable node/no-unpublished-require */ -'use strict'; - -const os = require('os'); -const stripAnsi = require('strip-ansi'); -const path = require('path'); -const fs = require('fs'); -const execa = require('execa'); -const internalIp = require('internal-ip'); -const { exec } = require('child_process'); +"use strict"; + +const os = require("os"); +const stripAnsi = require("strip-ansi"); +const path = require("path"); +const fs = require("fs"); +const execa = require("execa"); +const internalIp = require("internal-ip"); +const { exec } = require("child_process"); const { node: execaNode } = execa; -const { Writable } = require('readable-stream'); -const concat = require('concat-stream'); -const { cli, version } = require('webpack'); -const isWebpack5 = version.startsWith('5'); +const { Writable } = require("readable-stream"); +const concat = require("concat-stream"); +const { cli, version } = require("webpack"); +const isWebpack5 = version.startsWith("5"); let devServerVersion; try { - devServerVersion = require('webpack-dev-server/package.json').version; + devServerVersion = require("webpack-dev-server/package.json").version; } catch (error) { // Nothing } -const isDevServer4 = devServerVersion && devServerVersion.startsWith('4'); +const isDevServer4 = devServerVersion && devServerVersion.startsWith("4"); -const WEBPACK_PATH = path.resolve(__dirname, '../../packages/webpack-cli/bin/cli.js'); +const WEBPACK_PATH = path.resolve(__dirname, "../../packages/webpack-cli/bin/cli.js"); const ENABLE_LOG_COMPILATION = process.env.ENABLE_PIPE || false; -const isWindows = process.platform === 'win32'; +const isWindows = process.platform === "win32"; const hyphenToUpperCase = (name) => { if (!name) { @@ -41,7 +41,7 @@ const hyphenToUpperCase = (name) => { const processKill = (process) => { if (isWindows) { - exec('taskkill /pid ' + process.pid + ' /T /F'); + exec("taskkill /pid " + process.pid + " /T /F"); } else { process.kill(); } @@ -62,7 +62,7 @@ const createProcess = (cwd, args, options) => { return processExecutor(WEBPACK_PATH, args, { cwd: path.resolve(cwd), reject: false, - stdio: ENABLE_LOG_COMPILATION ? 'inherit' : 'pipe', + stdio: ENABLE_LOG_COMPILATION ? "inherit" : "pipe", maxBuffer: Infinity, env: { WEBPACK_CLI_HELP_WIDTH: 1024 }, ...options, @@ -109,7 +109,7 @@ const runWatch = (cwd, args = [], options = {}) => { process.stdout.pipe( new Writable({ write(chunk, encoding, callback) { - const output = stripAnsi(chunk.toString('utf8')); + const output = stripAnsi(chunk.toString("utf8")); if (outputKillStr.test(output)) { processKill(process); @@ -123,7 +123,7 @@ const runWatch = (cwd, args = [], options = {}) => { process.stderr.pipe( new Writable({ write(chunk, encoding, callback) { - const output = stripAnsi(chunk.toString('utf8')); + const output = stripAnsi(chunk.toString("utf8")); if (outputKillStr.test(output)) { processKill(process); @@ -153,7 +153,7 @@ const runWatch = (cwd, args = [], options = {}) => { const runPromptWithAnswers = (location, args, answers) => { const process = runAndGetProcess(location, args); - process.stdin.setDefaultEncoding('utf-8'); + process.stdin.setDefaultEncoding("utf-8"); const delay = 2000; let outputTimeout; @@ -176,7 +176,7 @@ const runPromptWithAnswers = (location, args, answers) => { process.stdout.pipe( new Writable({ write(chunk, encoding, callback) { - const output = chunk.toString('utf8'); + const output = chunk.toString("utf8"); if (output) { if (outputTimeout) { @@ -207,7 +207,7 @@ const runPromptWithAnswers = (location, args, answers) => { } if (stdoutDone && stderrDone) { - process.kill('SIGKILL'); + process.kill("SIGKILL"); resolve(obj); } }; @@ -235,20 +235,24 @@ const runPromptWithAnswers = (location, args, answers) => { const normalizeVersions = (output) => { return output.replace( /(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?/gi, - 'x.x.x', + "x.x.x", ); }; const normalizeCwd = (output) => { - return output.replace(/\\/g, '/').replace(new RegExp(process.cwd().replace(/\\/g, '/'), 'g'), ''); + return output + .replace(/\\/g, "/") + .replace(new RegExp(process.cwd().replace(/\\/g, "/"), "g"), ""); }; const normalizeError = (output) => { - return output.replace(/SyntaxError: .+/, 'SyntaxError: ').replace(/\s+at .+(}|\)|\d)/gs, '\n at stack'); + return output + .replace(/SyntaxError: .+/, "SyntaxError: ") + .replace(/\s+at .+(}|\)|\d)/gs, "\n at stack"); }; const normalizeStdout = (stdout) => { - if (typeof stdout !== 'string') { + if (typeof stdout !== "string") { return stdout; } @@ -265,7 +269,7 @@ const normalizeStdout = (stdout) => { }; const normalizeStderr = (stderr) => { - if (typeof stderr !== 'string') { + if (typeof stderr !== "string") { return stderr; } @@ -279,32 +283,40 @@ const normalizeStderr = (stderr) => { const networkIPv4 = internalIp.v4.sync(); if (networkIPv4) { - normalizedStderr = normalizedStderr.replace(new RegExp(networkIPv4, 'g'), ''); + normalizedStderr = normalizedStderr.replace( + new RegExp(networkIPv4, "g"), + "", + ); } const networkIPv6 = internalIp.v6.sync(); if (networkIPv6) { - normalizedStderr = normalizedStderr.replace(new RegExp(networkIPv6, 'g'), ''); + normalizedStderr = normalizedStderr.replace( + new RegExp(networkIPv6, "g"), + "", + ); } - normalizedStderr = normalizedStderr.replace(/:[0-9]+\//g, ':/'); + normalizedStderr = normalizedStderr.replace(/:[0-9]+\//g, ":/"); if (!/On Your Network \(IPv6\)/.test(stderr)) { // Github Actions doesnt' support IPv6 on ubuntu in some cases - normalizedStderr = normalizedStderr.split('\n'); + normalizedStderr = normalizedStderr.split("\n"); - const ipv4MessageIndex = normalizedStderr.findIndex((item) => /On Your Network \(IPv4\)/.test(item)); + const ipv4MessageIndex = normalizedStderr.findIndex((item) => + /On Your Network \(IPv4\)/.test(item), + ); if (ipv4MessageIndex !== -1) { normalizedStderr.splice( ipv4MessageIndex + 1, 0, - ' [webpack-dev-server] On Your Network (IPv6): http://[]:/', + " [webpack-dev-server] On Your Network (IPv6): http://[]:/", ); } - normalizedStderr = normalizedStderr.join('\n'); + normalizedStderr = normalizedStderr.join("\n"); } normalizedStderr = normalizeVersions(normalizedStderr); @@ -314,7 +326,7 @@ const normalizeStderr = (stderr) => { }; const getWebpackCliArguments = (startWith) => { - if (typeof startWith === 'undefined') { + if (typeof startWith === "undefined") { return cli.getArguments(); } diff --git a/test/utils/test-utils.test.js b/test/utils/test-utils.test.js index 5f16439d554..efe183b6a78 100644 --- a/test/utils/test-utils.test.js +++ b/test/utils/test-utils.test.js @@ -1,81 +1,94 @@ -'use strict'; +"use strict"; -const { run, runAndGetProcess, hyphenToUpperCase, uniqueDirectoryForTest } = require('./test-utils'); +const { + run, + runAndGetProcess, + hyphenToUpperCase, + uniqueDirectoryForTest, +} = require("./test-utils"); -const ENTER = '\x0D'; +const ENTER = "\x0D"; -describe('run function', () => { - it('should work correctly by default', async () => { +describe("run function", () => { + it("should work correctly by default", async () => { const { command, stdout, stderr } = await run(__dirname); expect(stderr).toBeFalsy(); // Executes the correct command - expect(command).toContain('cli.js'); - expect(command).toContain('bin'); + expect(command).toContain("cli.js"); + expect(command).toContain("bin"); expect(stdout).toBeTruthy(); }); - it('executes cli with passed commands and params', async () => { - const { stdout, stderr, command } = await run(__dirname, ['info', '--output', 'markdown']); + it("executes cli with passed commands and params", async () => { + const { stdout, stderr, command } = await run(__dirname, ["info", "--output", "markdown"]); // execution command contains info command - expect(command).toContain('info'); - expect(command).toContain('--output markdown'); + expect(command).toContain("info"); + expect(command).toContain("--output markdown"); // Contains info command output - expect(stdout).toContain('System:'); - expect(stdout).toContain('Node'); - expect(stdout).toContain('npm'); - expect(stdout).toContain('Yarn'); + expect(stdout).toContain("System:"); + expect(stdout).toContain("Node"); + expect(stdout).toContain("npm"); + expect(stdout).toContain("Yarn"); expect(stderr).toBeFalsy(); }); - it('uses default output when output param is false', async () => { + it("uses default output when output param is false", async () => { const { stdout, stderr, command } = await run(__dirname, []); // execution command contains info command - expect(command).not.toContain('--output-path'); + expect(command).not.toContain("--output-path"); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); }); }); -describe('runAndGetWatchProc function', () => { - it('should work correctly by default', async () => { +describe("runAndGetWatchProc function", () => { + it("should work correctly by default", async () => { const { command, stdout, stderr } = await runAndGetProcess(__dirname); // Executes the correct command - expect(command).toContain('cli.js'); + expect(command).toContain("cli.js"); // Should use apply a default output dir expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); }); - it('executes cli with passed commands and params', async () => { - const { stdout, stderr, command } = await runAndGetProcess(__dirname, ['info', '--output', 'markdown']); + it("executes cli with passed commands and params", async () => { + const { stdout, stderr, command } = await runAndGetProcess(__dirname, [ + "info", + "--output", + "markdown", + ]); // execution command contains info command - expect(command).toContain('info'); - expect(command).toContain('--output markdown'); + expect(command).toContain("info"); + expect(command).toContain("--output markdown"); // Contains info command output - expect(stdout).toContain('System:'); - expect(stdout).toContain('Node'); - expect(stdout).toContain('npm'); - expect(stdout).toContain('Yarn'); + expect(stdout).toContain("System:"); + expect(stdout).toContain("Node"); + expect(stdout).toContain("npm"); + expect(stdout).toContain("Yarn"); expect(stderr).toBeFalsy(); }); - it('writes to stdin', async () => { + it("writes to stdin", async () => { const assetsPath = await uniqueDirectoryForTest(); - const { stdout } = await runAndGetProcess(assetsPath, ['init', '--force', '--template=mango'], { input: ENTER }); + const { stdout } = await runAndGetProcess( + assetsPath, + ["init", "--force", "--template=mango"], + { input: ENTER }, + ); - expect(stdout).toContain('Project has been initialised with webpack!'); + expect(stdout).toContain("Project has been initialised with webpack!"); }); }); -describe('hyphenToUpperCase function', () => { - it('changes value from hypen to upperCase', () => { - const result = hyphenToUpperCase('test-value'); +describe("hyphenToUpperCase function", () => { + it("changes value from hypen to upperCase", () => { + const result = hyphenToUpperCase("test-value"); - expect(result).toEqual('testValue'); + expect(result).toEqual("testValue"); }); }); diff --git a/test/utils/webpack-cli-test-plugin.js b/test/utils/webpack-cli-test-plugin.js index 510b5889bea..963ac5ff1cc 100644 --- a/test/utils/webpack-cli-test-plugin.js +++ b/test/utils/webpack-cli-test-plugin.js @@ -6,9 +6,9 @@ class WebpackCLITestPlugin { } apply(compiler) { - compiler.hooks.done.tap('webpack-cli Test Plugin', () => { + compiler.hooks.done.tap("webpack-cli Test Plugin", () => { if (this.showHooks) { - const identifiers = this.showHooks.split('.'); + const identifiers = this.showHooks.split("."); let shown = compiler; diff --git a/test/version/version.test.js b/test/version/version.test.js index 224d79ef21a..5d1416c7e4b 100644 --- a/test/version/version.test.js +++ b/test/version/version.test.js @@ -1,333 +1,342 @@ -'use strict'; +"use strict"; -const { run, normalizeStderr, normalizeStdout } = require('../utils/test-utils'); +const { run, normalizeStderr, normalizeStdout } = require("../utils/test-utils"); -describe('single version flag', () => { - it('outputs versions with command syntax', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['version']); +describe("single version flag", () => { + it("outputs versions with command syntax", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["version"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('outputs versions with dashed syntax', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--version']); + it("outputs versions with dashed syntax", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--version"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('outputs versions with alias syntax', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-v']); + it("outputs versions with alias syntax", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["-v"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('outputs version with info', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['info', '--version']); + it("outputs version with info", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["info", "--version"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('outputs version with info using option alias', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['info', '-v']); + it("outputs version with info using option alias", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["info", "-v"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('outputs version with info using command syntax', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['version', 'info']); + it("outputs version with info using command syntax", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["version", "info"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('outputs version with info using command alias', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['v', 'info']); + it("outputs version with info using command alias", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["v", "info"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('outputs version with build', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['build', '--version']); + it("outputs version with build", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["build", "--version"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('outputs version with bundle', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['bundle', '--version']); + it("outputs version with bundle", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["bundle", "--version"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('outputs version with b', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['b', '--version']); + it("outputs version with b", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["b", "--version"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('outputs version with watch', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['watch', '--version']); + it("outputs version with watch", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["watch", "--version"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('outputs version with w', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['w', '--version']); + it("outputs version with w", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["w", "--version"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('outputs version with plugin', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['plugin', '--version']); + it("outputs version with plugin", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["plugin", "--version"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('outputs version with loader', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['loader', '--version']); + it("outputs version with loader", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["loader", "--version"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('outputs version with init', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['init', '--version']); + it("outputs version with init", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["init", "--version"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('outputs version with serve', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['serve', '--version']); + it("outputs version with serve", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["serve", "--version"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('outputs version with migrate', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['migrate', '--version']); + it("outputs version with migrate", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["migrate", "--version"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('outputs version with the alias c for init', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['c', '--version']); + it("outputs version with the alias c for init", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["c", "--version"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should log error when unknown command using command syntax', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['version', 'unknown']); + it("should log error when unknown command using command syntax", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["version", "unknown"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should log version for known command and log error for unknown command using command syntax with multi commands', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['version', 'info', 'unknown']); + it("should log version for known command and log error for unknown command using command syntax with multi commands", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["version", "info", "unknown"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should work for multiple commands', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['info', 'serve', '--version']); + it("should work for multiple commands", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["info", "serve", "--version"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should output versions for multiple commands using command syntax', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['version', 'info', 'serve']); + it("should output versions for multiple commands using command syntax", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["version", "info", "serve"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should output versions with help command using command syntax', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['version', 'help']); + it("should output versions with help command using command syntax", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["version", "help"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should log version for known command and log error for unknown command using the "--version" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['serve', 'abc', '--version']); + const { exitCode, stderr, stdout } = await run(__dirname, ["serve", "abc", "--version"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should log version for known command and log error for unknown command using the "-v" option', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['serve', 'abc', '-v']); + const { exitCode, stderr, stdout } = await run(__dirname, ["serve", "abc", "-v"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should not output version with help dashed', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['version', '--help']); + it("should not output version with help dashed", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["version", "--help"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('outputs versions with --color using option syntax', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--version', '--color'], { env: { FORCE_COLOR: true } }); + it("outputs versions with --color using option syntax", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--version", "--color"], { + env: { FORCE_COLOR: true }, + }); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('outputs versions with --no-color using option syntax', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--version', '--no-color'], { env: { FORCE_COLOR: true } }); + it("outputs versions with --no-color using option syntax", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--version", "--no-color"], { + env: { FORCE_COLOR: true }, + }); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('outputs versions with --color using command syntax', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['version', '--color']); + it("outputs versions with --color using command syntax", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["version", "--color"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('outputs versions with --no-color using command syntax', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['version', '--no-color']); + it("outputs versions with --no-color using command syntax", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["version", "--no-color"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should log error when unknown command used', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['version', 'abc']); + it("should log error when unknown command used", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["version", "abc"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('throws error if invalid option is passed with version command', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['version', '--abc']); + it("throws error if invalid option is passed with version command", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["version", "--abc"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should log error when unknown command used with --version flag', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--version', 'abc']); + it("should log error when unknown command used with --version flag", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--version", "abc"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('throws error if invalid option is passed with --version flag', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['--version', '--abc']); + it("throws error if invalid option is passed with --version flag", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["--version", "--abc"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should log error when unknown command used with -v alias', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-v', 'abc']); + it("should log error when unknown command used with -v alias", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["-v", "abc"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('throws error if invalid option is passed with -v alias', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-v', '--abc']); + it("throws error if invalid option is passed with -v alias", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["-v", "--abc"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should work using command syntax with the "version" value', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['version', 'version']); + const { exitCode, stderr, stdout } = await run(__dirname, ["version", "version"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); it('should work using command syntax and the "--version" argument', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['version', '--version']); + const { exitCode, stderr, stdout } = await run(__dirname, ["version", "--version"]); expect(exitCode).toBe(0); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should log an error using command syntax with unknown argument', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['version', '--unknown']); + it("should log an error using command syntax with unknown argument", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["version", "--unknown"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should log an error using command syntax with unknown argument #2', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['version', 'info', '--unknown']); + it("should log an error using command syntax with unknown argument #2", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, ["version", "info", "--unknown"]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); - it('should log an error using command syntax with multiple commands with unknown argument', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['version', 'info', 'serve', '--unknown']); + it("should log an error using command syntax with multiple commands with unknown argument", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "version", + "info", + "serve", + "--unknown", + ]); expect(exitCode).toBe(2); - expect(normalizeStderr(stderr)).toMatchSnapshot('stderr'); - expect(normalizeStdout(stdout)).toMatchSnapshot('stdout'); + expect(normalizeStderr(stderr)).toMatchSnapshot("stderr"); + expect(normalizeStdout(stdout)).toMatchSnapshot("stdout"); }); }); diff --git a/test/watch/analyze/analyze-flag.test.js b/test/watch/analyze/analyze-flag.test.js index 25ef9e24825..cee8687346d 100644 --- a/test/watch/analyze/analyze-flag.test.js +++ b/test/watch/analyze/analyze-flag.test.js @@ -1,14 +1,14 @@ -'use strict'; +"use strict"; -const { runWatch } = require('../../utils/test-utils'); +const { runWatch } = require("../../utils/test-utils"); describe('"analyze" option', () => { - it('should load webpack-bundle-analyzer plugin with --analyze flag', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['--analyze'], { + it("should load webpack-bundle-analyzer plugin with --analyze flag", async () => { + const { stderr, stdout } = await runWatch(__dirname, ["--analyze"], { killString: /Webpack Bundle Analyzer is started at/, }); expect(stderr).toBeFalsy(); - expect(stdout).toContain('Webpack Bundle Analyzer is started at'); + expect(stdout).toContain("Webpack Bundle Analyzer is started at"); }); }); diff --git a/test/watch/analyze/analyze.config.js b/test/watch/analyze/analyze.config.js index 71329e267b0..a1671a29911 100644 --- a/test/watch/analyze/analyze.config.js +++ b/test/watch/analyze/analyze.config.js @@ -1,7 +1,12 @@ // eslint-disable-next-line node/no-unpublished-require -const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer'); +const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer"); module.exports = { - mode: 'development', - plugins: [new BundleAnalyzerPlugin({ analyzerMode: 'static', openAnalyzer: false })], + mode: "development", + plugins: [ + new BundleAnalyzerPlugin({ + analyzerMode: "static", + openAnalyzer: false, + }), + ], }; diff --git a/test/watch/analyze/webpack.config.js b/test/watch/analyze/webpack.config.js index 1bd7a2cee42..bbb2b37c677 100644 --- a/test/watch/analyze/webpack.config.js +++ b/test/watch/analyze/webpack.config.js @@ -1,4 +1,4 @@ module.exports = { - mode: 'development', + mode: "development", plugins: [], }; diff --git a/test/watch/bail/bail-and-watch-webpack.config.js b/test/watch/bail/bail-and-watch-webpack.config.js index 85d95542909..e29774ed94d 100644 --- a/test/watch/bail/bail-and-watch-webpack.config.js +++ b/test/watch/bail/bail-and-watch-webpack.config.js @@ -1,7 +1,7 @@ module.exports = { - entry: './src/first.js', + entry: "./src/first.js", devtool: false, - mode: 'development', + mode: "development", bail: true, watch: true, }; diff --git a/test/watch/bail/bail-multi-webpack.config.js b/test/watch/bail/bail-multi-webpack.config.js index d36a8ba9fe3..c2890ba9fff 100644 --- a/test/watch/bail/bail-multi-webpack.config.js +++ b/test/watch/bail/bail-multi-webpack.config.js @@ -2,20 +2,20 @@ module.exports = [ { devtool: false, output: { - filename: './dist-first.js', + filename: "./dist-first.js", }, - name: 'first', - entry: './src/first.js', - mode: 'development', + name: "first", + entry: "./src/first.js", + mode: "development", bail: true, }, { devtool: false, output: { - filename: './dist-second.js', + filename: "./dist-second.js", }, - name: 'second', - entry: './src/second.js', - mode: 'development', + name: "second", + entry: "./src/second.js", + mode: "development", }, ]; diff --git a/test/watch/bail/bail-webpack.config.js b/test/watch/bail/bail-webpack.config.js index d3f445c8782..67c7bb44a8f 100644 --- a/test/watch/bail/bail-webpack.config.js +++ b/test/watch/bail/bail-webpack.config.js @@ -1,6 +1,6 @@ module.exports = { devtool: false, - entry: './src/first.js', - mode: 'development', + entry: "./src/first.js", + mode: "development", bail: true, }; diff --git a/test/watch/bail/bail.test.js b/test/watch/bail/bail.test.js index 2d6bd82c1fb..ba351e6c71d 100644 --- a/test/watch/bail/bail.test.js +++ b/test/watch/bail/bail.test.js @@ -1,47 +1,68 @@ -'use strict'; +"use strict"; -const { runWatch } = require('../../utils/test-utils'); +const { runWatch } = require("../../utils/test-utils"); describe('"bail" option', () => { it('should not log warning in not watch mode without the "watch" option', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['-c', 'watch-webpack.config.js']); + const { stderr, stdout } = await runWatch(__dirname, ["-c", "watch-webpack.config.js"]); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); }); it('should not log warning without the "bail" option', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['-c', 'no-bail-webpack.config.js', '--watch']); + const { stderr, stdout } = await runWatch(__dirname, [ + "-c", + "no-bail-webpack.config.js", + "--watch", + ]); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); }); it('should not log warning without the "bail" option', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['-c', 'no-bail-webpack.config.js', '--watch']); + const { stderr, stdout } = await runWatch(__dirname, [ + "-c", + "no-bail-webpack.config.js", + "--watch", + ]); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); }); - it('should log warning in watch mode', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['-c', 'bail-webpack.config.js', '--watch']); + it("should log warning in watch mode", async () => { + const { stderr, stdout } = await runWatch(__dirname, [ + "-c", + "bail-webpack.config.js", + "--watch", + ]); - expect(stderr).toContain(`You are using "bail" with "watch". "bail" will still exit webpack when the first error is found.`); + expect(stderr).toContain( + `You are using "bail" with "watch". "bail" will still exit webpack when the first error is found.`, + ); expect(stdout).toBeTruthy(); }); - it('should log warning in watch mode', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['-c', 'bail-and-watch-webpack.config.js']); + it("should log warning in watch mode", async () => { + const { stderr, stdout } = await runWatch(__dirname, [ + "-c", + "bail-and-watch-webpack.config.js", + ]); - expect(stderr).toContain(`You are using "bail" with "watch". "bail" will still exit webpack when the first error is found.`); + expect(stderr).toContain( + `You are using "bail" with "watch". "bail" will still exit webpack when the first error is found.`, + ); expect(stdout).toBeTruthy(); }); - it('should log warning in case of multiple compilers', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['-c', 'multi-webpack.config.js']); + it("should log warning in case of multiple compilers", async () => { + const { stderr, stdout } = await runWatch(__dirname, ["-c", "multi-webpack.config.js"]); - expect(stderr).toContain(`You are using "bail" with "watch". "bail" will still exit webpack when the first error is found.`); + expect(stderr).toContain( + `You are using "bail" with "watch". "bail" will still exit webpack when the first error is found.`, + ); expect(stdout).toBeTruthy(); }); }); diff --git a/test/watch/bail/multi-webpack.config.js b/test/watch/bail/multi-webpack.config.js index b36638f118f..9fe0cb532f1 100644 --- a/test/watch/bail/multi-webpack.config.js +++ b/test/watch/bail/multi-webpack.config.js @@ -2,21 +2,21 @@ module.exports = [ { devtool: false, output: { - filename: './dist-first.js', + filename: "./dist-first.js", }, - name: 'first', - entry: './src/first.js', - mode: 'development', + name: "first", + entry: "./src/first.js", + mode: "development", bail: true, watch: true, }, { devtool: false, output: { - filename: './dist-second.js', + filename: "./dist-second.js", }, - name: 'second', - entry: './src/second.js', - mode: 'development', + name: "second", + entry: "./src/second.js", + mode: "development", }, ]; diff --git a/test/watch/bail/no-bail-webpack.config.js b/test/watch/bail/no-bail-webpack.config.js index 8cf031757bd..b55c39fc397 100644 --- a/test/watch/bail/no-bail-webpack.config.js +++ b/test/watch/bail/no-bail-webpack.config.js @@ -1,5 +1,5 @@ module.exports = { devtool: false, - entry: './src/first.js', - mode: 'development', + entry: "./src/first.js", + mode: "development", }; diff --git a/test/watch/bail/src/first.js b/test/watch/bail/src/first.js index fb7e56835c4..6566b640f0b 100644 --- a/test/watch/bail/src/first.js +++ b/test/watch/bail/src/first.js @@ -1 +1 @@ -console.log('bail and watch warning test first'); +console.log("bail and watch warning test first"); diff --git a/test/watch/bail/src/second.js b/test/watch/bail/src/second.js index 5b277372189..aebac93b7f8 100644 --- a/test/watch/bail/src/second.js +++ b/test/watch/bail/src/second.js @@ -1 +1 @@ -console.log('bail and watch warning test second'); +console.log("bail and watch warning test second"); diff --git a/test/watch/bail/watch-webpack.config.js b/test/watch/bail/watch-webpack.config.js index fa93f3f225b..bf6be48c2c7 100644 --- a/test/watch/bail/watch-webpack.config.js +++ b/test/watch/bail/watch-webpack.config.js @@ -1,6 +1,6 @@ module.exports = { devtool: false, - entry: './src/first.js', - mode: 'development', + entry: "./src/first.js", + mode: "development", watch: true, }; diff --git a/test/watch/basic/basic.test.js b/test/watch/basic/basic.test.js index ed0fd817749..a414b432f40 100644 --- a/test/watch/basic/basic.test.js +++ b/test/watch/basic/basic.test.js @@ -1,30 +1,34 @@ -'use strict'; +"use strict"; -const { run, runAndGetProcess, isWebpack5, processKill } = require('../../utils/test-utils'); -const { writeFileSync } = require('fs'); -const { resolve } = require('path'); +const { run, runAndGetProcess, isWebpack5, processKill } = require("../../utils/test-utils"); +const { writeFileSync } = require("fs"); +const { resolve } = require("path"); -const wordsInStatsv4 = ['Hash', 'Built at:', 'main.js']; -const wordsInStatsv5 = ['asset', 'index.js', 'compiled successfully']; +const wordsInStatsv4 = ["Hash", "Built at:", "main.js"]; +const wordsInStatsv5 = ["asset", "index.js", "compiled successfully"]; -describe('basic', () => { - it('should work with negative value', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['-c', './watch.config.js', '--no-watch']); +describe("basic", () => { + it("should work with negative value", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "-c", + "./watch.config.js", + "--no-watch", + ]); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); }); - it('should recompile upon file change using the `--watch` option', (done) => { - const proc = runAndGetProcess(__dirname, ['--watch', '--mode', 'development']); + it("should recompile upon file change using the `--watch` option", (done) => { + const proc = runAndGetProcess(__dirname, ["--watch", "--mode", "development"]); let modified = false; - proc.stdout.on('data', (chunk) => { + proc.stdout.on("data", (chunk) => { const data = chunk.toString(); - if (data.includes('index.js')) { + if (data.includes("index.js")) { if (isWebpack5) { for (const word of wordsInStatsv5) { expect(data).toContain(word); @@ -37,7 +41,10 @@ describe('basic', () => { if (!modified) { process.nextTick(() => { - writeFileSync(resolve(__dirname, './src/index.js'), `console.log('watch flag test');\n`); + writeFileSync( + resolve(__dirname, "./src/index.js"), + `console.log('watch flag test');\n`, + ); }); modified = true; @@ -49,15 +56,15 @@ describe('basic', () => { }); }); - it('should recompile upon file change using the `watch` command', (done) => { - const proc = runAndGetProcess(__dirname, ['watch', '--mode', 'development']); + it("should recompile upon file change using the `watch` command", (done) => { + const proc = runAndGetProcess(__dirname, ["watch", "--mode", "development"]); let modified = false; - proc.stdout.on('data', (chunk) => { + proc.stdout.on("data", (chunk) => { const data = chunk.toString(); - if (data.includes('index.js')) { + if (data.includes("index.js")) { if (isWebpack5) { for (const word of wordsInStatsv5) { expect(data).toContain(word); @@ -70,7 +77,10 @@ describe('basic', () => { if (!modified) { process.nextTick(() => { - writeFileSync(resolve(__dirname, './src/index.js'), `console.log('watch flag test');\n`); + writeFileSync( + resolve(__dirname, "./src/index.js"), + `console.log('watch flag test');\n`, + ); }); modified = true; @@ -82,17 +92,22 @@ describe('basic', () => { }); }); - it('should recompile upon file change using the `watch` command and entries syntax', (done) => { - const proc = runAndGetProcess(__dirname, ['watch', './src/entry.js', '--mode', 'development']); + it("should recompile upon file change using the `watch` command and entries syntax", (done) => { + const proc = runAndGetProcess(__dirname, [ + "watch", + "./src/entry.js", + "--mode", + "development", + ]); let modified = false; - const wordsInStatsv5Entries = ['asset', 'entry.js', 'compiled successfully']; + const wordsInStatsv5Entries = ["asset", "entry.js", "compiled successfully"]; - proc.stdout.on('data', (chunk) => { + proc.stdout.on("data", (chunk) => { const data = chunk.toString(); - if (data.includes('entry.js')) { + if (data.includes("entry.js")) { if (isWebpack5) { for (const word of wordsInStatsv5Entries) { expect(data).toContain(word); @@ -105,7 +120,10 @@ describe('basic', () => { if (!modified) { process.nextTick(() => { - writeFileSync(resolve(__dirname, './src/entry.js'), `console.log('watch flag test');\n`); + writeFileSync( + resolve(__dirname, "./src/entry.js"), + `console.log('watch flag test');\n`, + ); }); modified = true; @@ -117,15 +135,21 @@ describe('basic', () => { }); }); - it('should log warning about the `watch` option in the configuration and recompile upon file change using the `watch` command', (done) => { - const proc = runAndGetProcess(__dirname, ['--watch', '--mode', 'development', '--config', './watch.config.js']); + it("should log warning about the `watch` option in the configuration and recompile upon file change using the `watch` command", (done) => { + const proc = runAndGetProcess(__dirname, [ + "--watch", + "--mode", + "development", + "--config", + "./watch.config.js", + ]); let modified = false; - proc.stdout.on('data', (chunk) => { + proc.stdout.on("data", (chunk) => { const data = chunk.toString(); - if (data.includes('index.js')) { + if (data.includes("index.js")) { if (isWebpack5) { for (const word of wordsInStatsv5) { expect(data).toContain(word); @@ -138,7 +162,10 @@ describe('basic', () => { if (!modified) { process.nextTick(() => { - writeFileSync(resolve(__dirname, './src/index.js'), `console.log('watch flag test');\n`); + writeFileSync( + resolve(__dirname, "./src/index.js"), + `console.log('watch flag test');\n`, + ); }); modified = true; @@ -149,7 +176,7 @@ describe('basic', () => { } }); - proc.stderr.on('data', (chunk) => { + proc.stderr.on("data", (chunk) => { const data = chunk.toString(); expect(data).toContain( @@ -158,21 +185,21 @@ describe('basic', () => { }); }); - it('should log supplied config with watch', (done) => { - const proc = runAndGetProcess(__dirname, ['watch', '--config', 'log.config.js']); - const configPath = resolve(__dirname, './log.config.js'); + it("should log supplied config with watch", (done) => { + const proc = runAndGetProcess(__dirname, ["watch", "--config", "log.config.js"]); + const configPath = resolve(__dirname, "./log.config.js"); - let stderr = ''; + let stderr = ""; - proc.stderr.on('data', (chunk) => { + proc.stderr.on("data", (chunk) => { const data = chunk.toString(); stderr += data; if (/Compiler finished/.test(data)) { - expect(stderr).toContain('Compiler starting...'); + expect(stderr).toContain("Compiler starting..."); expect(stderr).toContain(`Compiler is using config: '${configPath}'`); - expect(stderr).toContain('Compiler finished'); + expect(stderr).toContain("Compiler finished"); processKill(proc); done(); @@ -180,8 +207,13 @@ describe('basic', () => { }); }); - it('should recompile upon file change using the `command` option and the `--watch` option and log warning', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['watch', '--watch', '--mode', 'development']); + it("should recompile upon file change using the `command` option and the `--watch` option and log warning", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "watch", + "--watch", + "--mode", + "development", + ]); expect(exitCode).toBe(2); expect(stderr).toContain("Error: Unknown option '--watch'"); @@ -189,8 +221,13 @@ describe('basic', () => { expect(stdout).toBeFalsy(); }); - it('should recompile upon file change using the `command` option and the `--no-watch` option and log warning', async () => { - const { exitCode, stderr, stdout } = await run(__dirname, ['watch', '--no-watch', '--mode', 'development']); + it("should recompile upon file change using the `command` option and the `--no-watch` option and log warning", async () => { + const { exitCode, stderr, stdout } = await run(__dirname, [ + "watch", + "--no-watch", + "--mode", + "development", + ]); expect(exitCode).toBe(2); expect(stderr).toContain("Error: Unknown option '--no-watch'"); diff --git a/test/watch/basic/log.config.js b/test/watch/basic/log.config.js index 70619a29563..5906a9bce94 100644 --- a/test/watch/basic/log.config.js +++ b/test/watch/basic/log.config.js @@ -1,6 +1,6 @@ module.exports = { - mode: 'development', + mode: "development", infrastructureLogging: { - level: 'log', + level: "log", }, }; diff --git a/test/watch/basic/src/entry.js b/test/watch/basic/src/entry.js index 1d8734ee1c8..923312d065f 100644 --- a/test/watch/basic/src/entry.js +++ b/test/watch/basic/src/entry.js @@ -1 +1 @@ -console.log('watch flag test'); +console.log("watch flag test"); diff --git a/test/watch/stats/multi-webpack.config.js b/test/watch/stats/multi-webpack.config.js index 2d865091b99..ac39ad32ead 100644 --- a/test/watch/stats/multi-webpack.config.js +++ b/test/watch/stats/multi-webpack.config.js @@ -1,32 +1,38 @@ -const webpack = require('webpack'); +const webpack = require("webpack"); module.exports = [ { - name: 'first', - mode: 'development', + name: "first", + mode: "development", watch: true, - stats: 'none', + stats: "none", plugins: [ { apply(compiler) { - (compiler.webpack ? compiler.hooks.afterDone : compiler.hooks.done).tap('webpack-cli-test', () => { - console.log(`webpack ${webpack.version}`); - }); + (compiler.webpack ? compiler.hooks.afterDone : compiler.hooks.done).tap( + "webpack-cli-test", + () => { + console.log(`webpack ${webpack.version}`); + }, + ); }, }, ], }, { - name: 'two', - mode: 'development', + name: "two", + mode: "development", watch: true, - stats: 'none', + stats: "none", plugins: [ { apply(compiler) { - (compiler.webpack ? compiler.hooks.afterDone : compiler.hooks.done).tap('webpack-cli-test', () => { - console.log(`webpack ${webpack.version}`); - }); + (compiler.webpack ? compiler.hooks.afterDone : compiler.hooks.done).tap( + "webpack-cli-test", + () => { + console.log(`webpack ${webpack.version}`); + }, + ); }, }, ], diff --git a/test/watch/stats/stats-and-watch.test.js b/test/watch/stats/stats-and-watch.test.js index 6b34d69ef6f..b2c3beee283 100644 --- a/test/watch/stats/stats-and-watch.test.js +++ b/test/watch/stats/stats-and-watch.test.js @@ -1,24 +1,29 @@ -'use strict'; +"use strict"; -const { runWatch } = require('../../utils/test-utils'); +const { runWatch } = require("../../utils/test-utils"); -describe('stats and watch', () => { +describe("stats and watch", () => { it('should not log stats with the "none" value from the configuration', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['-c', './webpack.config.js']); + const { stderr, stdout } = await runWatch(__dirname, ["-c", "./webpack.config.js"]); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); }); it('should not log stats with the "none" value from the configuration and multi compiler mode', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['-c', './multi-webpack.config.js']); + const { stderr, stdout } = await runWatch(__dirname, ["-c", "./multi-webpack.config.js"]); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); }); it('should log stats with the "normal" value in arguments', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['-c', './webpack.config.js', '--stats', 'normal']); + const { stderr, stdout } = await runWatch(__dirname, [ + "-c", + "./webpack.config.js", + "--stats", + "normal", + ]); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); diff --git a/test/watch/stats/webpack.config.js b/test/watch/stats/webpack.config.js index d98762eafc4..c8bf98e63b8 100644 --- a/test/watch/stats/webpack.config.js +++ b/test/watch/stats/webpack.config.js @@ -1,15 +1,18 @@ -const webpack = require('webpack'); +const webpack = require("webpack"); module.exports = { watch: true, - stats: 'none', - mode: 'development', + stats: "none", + mode: "development", plugins: [ { apply(compiler) { - (compiler.webpack ? compiler.hooks.afterDone : compiler.hooks.done).tap('webpack-cli-test', () => { - console.log(`webpack ${webpack.version}`); - }); + (compiler.webpack ? compiler.hooks.afterDone : compiler.hooks.done).tap( + "webpack-cli-test", + () => { + console.log(`webpack ${webpack.version}`); + }, + ); }, }, ], diff --git a/test/watch/stdin/multi-serve.config.js b/test/watch/stdin/multi-serve.config.js index ff242580667..9f20565e307 100644 --- a/test/watch/stdin/multi-serve.config.js +++ b/test/watch/stdin/multi-serve.config.js @@ -1,6 +1,6 @@ module.exports = [ { - entry: './src/second.js', + entry: "./src/second.js", }, { watchOptions: { diff --git a/test/watch/stdin/multi-watch.config.js b/test/watch/stdin/multi-watch.config.js index d722eda347a..8c659dd6a5e 100644 --- a/test/watch/stdin/multi-watch.config.js +++ b/test/watch/stdin/multi-watch.config.js @@ -1,6 +1,6 @@ module.exports = [ { - entry: './src/second.js', + entry: "./src/second.js", }, { watch: true, diff --git a/test/watch/stdin/src/second.js b/test/watch/stdin/src/second.js index 1d8734ee1c8..923312d065f 100644 --- a/test/watch/stdin/src/second.js +++ b/test/watch/stdin/src/second.js @@ -1 +1 @@ -console.log('watch flag test'); +console.log("watch flag test"); diff --git a/test/watch/stdin/stdin.test.js b/test/watch/stdin/stdin.test.js index fe22ebf15d8..cf7aa960c4f 100644 --- a/test/watch/stdin/stdin.test.js +++ b/test/watch/stdin/stdin.test.js @@ -1,12 +1,12 @@ -const { runAndGetProcess, processKill } = require('../../utils/test-utils'); +const { runAndGetProcess, processKill } = require("../../utils/test-utils"); -describe('--watch-options-stdin', () => { +describe("--watch-options-stdin", () => { it('should stop the process when stdin ends using "--watch" and "--watch-options-stdin" options', (done) => { - const proc = runAndGetProcess(__dirname, ['--watch', '--watch-options-stdin']); + const proc = runAndGetProcess(__dirname, ["--watch", "--watch-options-stdin"]); let semaphore = false; - proc.on('exit', () => { + proc.on("exit", () => { expect(semaphore).toBe(true); processKill(proc); @@ -20,11 +20,11 @@ describe('--watch-options-stdin', () => { }); it('should stop the process when stdin ends using the "watch" command and the "--watch-options-stdin" option', (done) => { - const proc = runAndGetProcess(__dirname, ['watch', '--watch-options-stdin']); + const proc = runAndGetProcess(__dirname, ["watch", "--watch-options-stdin"]); let semaphore = false; - proc.on('exit', () => { + proc.on("exit", () => { expect(semaphore).toBe(true); processKill(proc); @@ -37,12 +37,12 @@ describe('--watch-options-stdin', () => { }); }); - it('should stop the process when stdin ends using the config file', (done) => { - const proc = runAndGetProcess(__dirname, ['--config', './watch.config.js']); + it("should stop the process when stdin ends using the config file", (done) => { + const proc = runAndGetProcess(__dirname, ["--config", "./watch.config.js"]); let semaphore = false; - proc.on('exit', () => { + proc.on("exit", () => { expect(semaphore).toBe(true); processKill(proc); @@ -55,12 +55,12 @@ describe('--watch-options-stdin', () => { }); }); - it('should stop the process when stdin ends using the config file in multi compiler mode', (done) => { - const proc = runAndGetProcess(__dirname, ['--config', './multi-watch.config.js']); + it("should stop the process when stdin ends using the config file in multi compiler mode", (done) => { + const proc = runAndGetProcess(__dirname, ["--config", "./multi-watch.config.js"]); let semaphore = false; - proc.on('exit', () => { + proc.on("exit", () => { expect(semaphore).toBe(true); processKill(proc); @@ -74,11 +74,11 @@ describe('--watch-options-stdin', () => { }); it('should stop the process when stdin ends using the "serve" command and the "--watch-options-stdin" option', (done) => { - const proc = runAndGetProcess(__dirname, ['serve', '--watch-options-stdin']); + const proc = runAndGetProcess(__dirname, ["serve", "--watch-options-stdin"]); let semaphore = false; - proc.on('exit', () => { + proc.on("exit", () => { expect(semaphore).toBe(true); processKill(proc); done(); @@ -90,11 +90,11 @@ describe('--watch-options-stdin', () => { }); it('should stop the process when stdin ends using the "serve" command and the "--stdin" option', (done) => { - const proc = runAndGetProcess(__dirname, ['serve', '--stdin']); + const proc = runAndGetProcess(__dirname, ["serve", "--stdin"]); let semaphore = false; - proc.on('exit', () => { + proc.on("exit", () => { expect(semaphore).toBe(true); processKill(proc); done(); @@ -106,11 +106,11 @@ describe('--watch-options-stdin', () => { }); it('should stop the process when stdin ends using the "serve" command and configuration', (done) => { - const proc = runAndGetProcess(__dirname, ['serve', '--config', './serve.config.js']); + const proc = runAndGetProcess(__dirname, ["serve", "--config", "./serve.config.js"]); let semaphore = false; - proc.on('exit', () => { + proc.on("exit", () => { expect(semaphore).toBe(true); processKill(proc); done(); @@ -122,11 +122,11 @@ describe('--watch-options-stdin', () => { }); it('should stop the process when stdin ends using the "serve" command and the config file in multi compiler mode', (done) => { - const proc = runAndGetProcess(__dirname, ['--config', './multi-watch.config.js']); + const proc = runAndGetProcess(__dirname, ["--config", "./multi-watch.config.js"]); let semaphore = false; - proc.on('exit', () => { + proc.on("exit", () => { expect(semaphore).toBe(true); processKill(proc); diff --git a/test/watch/watch-variable/watch-variable.test.js b/test/watch/watch-variable/watch-variable.test.js index 19f35f13411..dc79871fdcc 100644 --- a/test/watch/watch-variable/watch-variable.test.js +++ b/test/watch/watch-variable/watch-variable.test.js @@ -1,24 +1,24 @@ -'use strict'; +"use strict"; -const { runAndGetProcess, isWebpack5, processKill } = require('../../utils/test-utils'); -const { writeFileSync } = require('fs'); -const { resolve } = require('path'); +const { runAndGetProcess, isWebpack5, processKill } = require("../../utils/test-utils"); +const { writeFileSync } = require("fs"); +const { resolve } = require("path"); -const wordsInStatsv4 = ['Hash', 'Built at:', 'main.js']; -const wordsInStatsv5 = ['asset', 'index.js', 'compiled successfully']; +const wordsInStatsv4 = ["Hash", "Built at:", "main.js"]; +const wordsInStatsv5 = ["asset", "index.js", "compiled successfully"]; -describe('watch variable', () => { - it('should pass `WEBPACK_WATCH` env variable and recompile upon file change using the `watch` command', (done) => { - const proc = runAndGetProcess(__dirname, ['watch', '--mode', 'development']); +describe("watch variable", () => { + it("should pass `WEBPACK_WATCH` env variable and recompile upon file change using the `watch` command", (done) => { + const proc = runAndGetProcess(__dirname, ["watch", "--mode", "development"]); let modified = false; - proc.stdout.on('data', (chunk) => { + proc.stdout.on("data", (chunk) => { const data = chunk.toString(); - expect(data).not.toContain('FAIL'); + expect(data).not.toContain("FAIL"); - if (data.includes('index.js')) { + if (data.includes("index.js")) { if (isWebpack5) { for (const word of wordsInStatsv5) { expect(data).toContain(word); @@ -31,7 +31,10 @@ describe('watch variable', () => { if (!modified) { process.nextTick(() => { - writeFileSync(resolve(__dirname, './src/index.js'), `console.log('watch flag test');`); + writeFileSync( + resolve(__dirname, "./src/index.js"), + `console.log('watch flag test');`, + ); }); modified = true; @@ -43,17 +46,17 @@ describe('watch variable', () => { }); }); - it.only('should pass `WEBPACK_WATCH` env variable and recompile upon file change using the `--watch` option', (done) => { - const proc = runAndGetProcess(__dirname, ['--watch', '--mode', 'development']); + it.only("should pass `WEBPACK_WATCH` env variable and recompile upon file change using the `--watch` option", (done) => { + const proc = runAndGetProcess(__dirname, ["--watch", "--mode", "development"]); let modified = false; - proc.stdout.on('data', (chunk) => { + proc.stdout.on("data", (chunk) => { const data = chunk.toString(); - expect(data).not.toContain('FAIL'); + expect(data).not.toContain("FAIL"); - if (data.includes('index.js')) { + if (data.includes("index.js")) { if (isWebpack5) { for (const word of wordsInStatsv5) { expect(data).toContain(word); @@ -66,7 +69,10 @@ describe('watch variable', () => { if (!modified) { process.nextTick(() => { - writeFileSync(resolve(__dirname, './src/index.js'), `console.log('watch flag test');`); + writeFileSync( + resolve(__dirname, "./src/index.js"), + `console.log('watch flag test');`, + ); }); modified = true; diff --git a/test/watch/watch-variable/webpack.config.js b/test/watch/watch-variable/webpack.config.js index a177e2cf731..1cc1d2ce126 100644 --- a/test/watch/watch-variable/webpack.config.js +++ b/test/watch/watch-variable/webpack.config.js @@ -5,11 +5,11 @@ class CustomTestPlugin { this.isInEnvironment = isInEnvironment; } apply(compiler) { - compiler.hooks.done.tap('testPlugin', () => { + compiler.hooks.done.tap("testPlugin", () => { if (!isInProcess && this.isInEnvironment) { - console.log('PASS'); + console.log("PASS"); } else { - console.log('FAIL'); + console.log("FAIL"); } }); } @@ -17,7 +17,7 @@ class CustomTestPlugin { module.exports = (env) => { return { - mode: 'development', + mode: "development", devtool: false, plugins: [new CustomTestPlugin(env.WEBPACK_WATCH)], }; diff --git a/yarn.lock b/yarn.lock index 1c999725484..d3626735084 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17,24 +17,24 @@ "@babel/highlight" "^7.12.13" "@babel/compat-data@^7.13.15": - version "7.13.15" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.13.15.tgz#7e8eea42d0b64fda2b375b22d06c605222e848f4" - integrity sha512-ltnibHKR1VnrU4ymHyQ/CXtNXI6yZC0oJThyW78Hft8XndANwi+9H+UIklBDraIjFEJzw8wmcM427oDd9KS5wA== + version "7.14.0" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.14.0.tgz#a901128bce2ad02565df95e6ecbf195cf9465919" + integrity sha512-vu9V3uMM/1o5Hl5OekMUowo3FqXLJSw+s+66nt0fSWVWTtmosdzn45JHOB3cPtZoe6CTBDzvSw0RdOY85Q37+Q== "@babel/core@^7.1.0", "@babel/core@^7.1.6", "@babel/core@^7.7.5": - version "7.13.16" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.13.16.tgz#7756ab24396cc9675f1c3fcd5b79fcce192ea96a" - integrity sha512-sXHpixBiWWFti0AV2Zq7avpTasr6sIAu7Y396c608541qAU2ui4a193m0KSQmfPSKFZLnQ3cvlKDOm3XkuXm3Q== + version "7.14.2" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.14.2.tgz#54e45334ffc0172048e5c93ded36461d3ad4c417" + integrity sha512-OgC1mON+l4U4B4wiohJlQNUU3H73mpTyYY3j/c8U9dr9UagGGSm+WFpzjy/YLdoyjiG++c1kIDgxCo/mLwQJeQ== dependencies: "@babel/code-frame" "^7.12.13" - "@babel/generator" "^7.13.16" + "@babel/generator" "^7.14.2" "@babel/helper-compilation-targets" "^7.13.16" - "@babel/helper-module-transforms" "^7.13.14" - "@babel/helpers" "^7.13.16" - "@babel/parser" "^7.13.16" + "@babel/helper-module-transforms" "^7.14.2" + "@babel/helpers" "^7.14.0" + "@babel/parser" "^7.14.2" "@babel/template" "^7.12.13" - "@babel/traverse" "^7.13.15" - "@babel/types" "^7.13.16" + "@babel/traverse" "^7.14.2" + "@babel/types" "^7.14.2" convert-source-map "^1.7.0" debug "^4.1.0" gensync "^1.0.0-beta.2" @@ -42,15 +42,52 @@ semver "^6.3.0" source-map "^0.5.0" -"@babel/generator@^7.13.16", "@babel/generator@^7.13.9": - version "7.13.16" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.13.16.tgz#0befc287031a201d84cdfc173b46b320ae472d14" - integrity sha512-grBBR75UnKOcUWMp8WoDxNsWCFl//XCK6HWTrBQKTr5SV9f5g0pNOjdyzi/DTBv12S9GnYPInIXQBTky7OXEMg== +"@babel/core@^7.7.2": + version "7.14.3" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.14.3.tgz#5395e30405f0776067fbd9cf0884f15bfb770a38" + integrity sha512-jB5AmTKOCSJIZ72sd78ECEhuPiDMKlQdDI/4QRI6lzYATx5SSogS1oQA2AoPecRCknm30gHi2l+QVvNUu3wZAg== + dependencies: + "@babel/code-frame" "^7.12.13" + "@babel/generator" "^7.14.3" + "@babel/helper-compilation-targets" "^7.13.16" + "@babel/helper-module-transforms" "^7.14.2" + "@babel/helpers" "^7.14.0" + "@babel/parser" "^7.14.3" + "@babel/template" "^7.12.13" + "@babel/traverse" "^7.14.2" + "@babel/types" "^7.14.2" + convert-source-map "^1.7.0" + debug "^4.1.0" + gensync "^1.0.0-beta.2" + json5 "^2.1.2" + semver "^6.3.0" + source-map "^0.5.0" + +"@babel/generator@^7.14.2": + version "7.14.2" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.14.2.tgz#d5773e8b557d421fd6ce0d5efa5fd7fc22567c30" + integrity sha512-OnADYbKrffDVai5qcpkMxQ7caomHOoEwjkouqnN2QhydAjowFAZcsdecFIRUBdb+ZcruwYE4ythYmF1UBZU5xQ== dependencies: - "@babel/types" "^7.13.16" + "@babel/types" "^7.14.2" jsesc "^2.5.1" source-map "^0.5.0" +"@babel/generator@^7.14.3", "@babel/generator@^7.7.2": + version "7.14.3" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.14.3.tgz#0c2652d91f7bddab7cccc6ba8157e4f40dcedb91" + integrity sha512-bn0S6flG/j0xtQdz3hsjJ624h3W0r3llttBMfyHX3YrZ/KtLYr15bjA0FXkgW7FpvrDuTuElXeVjiKlYRpnOFA== + dependencies: + "@babel/types" "^7.14.2" + jsesc "^2.5.1" + source-map "^0.5.0" + +"@babel/helper-annotate-as-pure@^7.12.13": + version "7.12.13" + resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.12.13.tgz#0f58e86dfc4bb3b1fcd7db806570e177d439b6ab" + integrity sha512-7YXfX5wQ5aYM/BOlbSccHDbuXXFPxeoUmfWtz8le2yTkTZc+BxsiEnENFoi2SlmA8ewDkG2LgIMIVzzn2h8kfw== + dependencies: + "@babel/types" "^7.12.13" + "@babel/helper-compilation-targets@^7.13.16": version "7.13.16" resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.13.16.tgz#6e91dccf15e3f43e5556dffe32d860109887563c" @@ -62,24 +99,25 @@ semver "^6.3.0" "@babel/helper-create-class-features-plugin@^7.13.0": - version "7.13.11" - resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.13.11.tgz#30d30a005bca2c953f5653fc25091a492177f4f6" - integrity sha512-ays0I7XYq9xbjCSvT+EvysLgfc3tOkwCULHjrnscGT3A9qD4sk3wXnJ3of0MAWsWGjdinFvajHU2smYuqXKMrw== + version "7.14.2" + resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.14.2.tgz#4e455b0329af29c2d3ad254b5dd5aed34595385d" + integrity sha512-6YctwVsmlkchxfGUogvVrrhzyD3grFJyluj5JgDlQrwfMLJSt5tdAzFZfPf4H2Xoi5YLcQ6BxfJlaOBHuctyIw== dependencies: - "@babel/helper-function-name" "^7.12.13" - "@babel/helper-member-expression-to-functions" "^7.13.0" + "@babel/helper-annotate-as-pure" "^7.12.13" + "@babel/helper-function-name" "^7.14.2" + "@babel/helper-member-expression-to-functions" "^7.13.12" "@babel/helper-optimise-call-expression" "^7.12.13" - "@babel/helper-replace-supers" "^7.13.0" + "@babel/helper-replace-supers" "^7.13.12" "@babel/helper-split-export-declaration" "^7.12.13" -"@babel/helper-function-name@^7.12.13": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.12.13.tgz#93ad656db3c3c2232559fd7b2c3dbdcbe0eb377a" - integrity sha512-TZvmPn0UOqmvi5G4vvw0qZTpVptGkB1GL61R6lKvrSdIxGm5Pky7Q3fpKiIkQCAtRCBUwB0PaThlx9vebCDSwA== +"@babel/helper-function-name@^7.14.2": + version "7.14.2" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.14.2.tgz#397688b590760b6ef7725b5f0860c82427ebaac2" + integrity sha512-NYZlkZRydxw+YT56IlhIcS8PAhb+FEUiOzuhFTfqDyPmzAhRge6ua0dQYT/Uh0t/EDHq05/i+e5M2d4XvjgarQ== dependencies: "@babel/helper-get-function-arity" "^7.12.13" "@babel/template" "^7.12.13" - "@babel/types" "^7.12.13" + "@babel/types" "^7.14.2" "@babel/helper-get-function-arity@^7.12.13": version "7.12.13" @@ -88,7 +126,7 @@ dependencies: "@babel/types" "^7.12.13" -"@babel/helper-member-expression-to-functions@^7.13.0", "@babel/helper-member-expression-to-functions@^7.13.12": +"@babel/helper-member-expression-to-functions@^7.13.12": version "7.13.12" resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.13.12.tgz#dfe368f26d426a07299d8d6513821768216e6d72" integrity sha512-48ql1CLL59aKbU94Y88Xgb2VFy7a95ykGRbJJaaVv+LX5U8wFpLfiGXJJGUozsmA1oEh/o5Bp60Voq7ACyA/Sw== @@ -102,19 +140,19 @@ dependencies: "@babel/types" "^7.13.12" -"@babel/helper-module-transforms@^7.13.0", "@babel/helper-module-transforms@^7.13.14": - version "7.13.14" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.13.14.tgz#e600652ba48ccb1641775413cb32cfa4e8b495ef" - integrity sha512-QuU/OJ0iAOSIatyVZmfqB0lbkVP0kDRiKj34xy+QNsnVZi/PA6BoSoreeqnxxa9EHFAIL0R9XOaAR/G9WlIy5g== +"@babel/helper-module-transforms@^7.14.0", "@babel/helper-module-transforms@^7.14.2": + version "7.14.2" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.14.2.tgz#ac1cc30ee47b945e3e0c4db12fa0c5389509dfe5" + integrity sha512-OznJUda/soKXv0XhpvzGWDnml4Qnwp16GN+D/kZIdLsWoHj05kyu8Rm5kXmMef+rVJZ0+4pSGLkeixdqNUATDA== dependencies: "@babel/helper-module-imports" "^7.13.12" "@babel/helper-replace-supers" "^7.13.12" "@babel/helper-simple-access" "^7.13.12" "@babel/helper-split-export-declaration" "^7.12.13" - "@babel/helper-validator-identifier" "^7.12.11" + "@babel/helper-validator-identifier" "^7.14.0" "@babel/template" "^7.12.13" - "@babel/traverse" "^7.13.13" - "@babel/types" "^7.13.14" + "@babel/traverse" "^7.14.2" + "@babel/types" "^7.14.2" "@babel/helper-optimise-call-expression@^7.12.13": version "7.12.13" @@ -128,7 +166,7 @@ resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.13.0.tgz#806526ce125aed03373bc416a828321e3a6a33af" integrity sha512-ZPafIPSwzUlAoWT8DKs1W2VyF2gOWthGd5NGFMsBcMMol+ZhK+EQY/e6V96poa6PA/Bh+C9plWN0hXO1uB8AfQ== -"@babel/helper-replace-supers@^7.13.0", "@babel/helper-replace-supers@^7.13.12": +"@babel/helper-replace-supers@^7.13.12": version "7.13.12" resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.13.12.tgz#6442f4c1ad912502481a564a7386de0c77ff3804" integrity sha512-Gz1eiX+4yDO8mT+heB94aLVNCL+rbuT2xy4YfyNqu8F+OI6vMvJK891qGBTqL9Uc8wxEvRW92Id6G7sDen3fFw== @@ -138,7 +176,7 @@ "@babel/traverse" "^7.13.0" "@babel/types" "^7.13.12" -"@babel/helper-simple-access@^7.12.13", "@babel/helper-simple-access@^7.13.12": +"@babel/helper-simple-access@^7.13.12": version "7.13.12" resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.13.12.tgz#dd6c538afb61819d205a012c31792a39c7a5eaf6" integrity sha512-7FEjbrx5SL9cWvXioDbnlYTppcZGuCY6ow3/D5vMggb2Ywgu4dMrpTJX0JdQAIcRRUElOIxF3yEooa9gUb9ZbA== @@ -159,38 +197,43 @@ dependencies: "@babel/types" "^7.12.13" -"@babel/helper-validator-identifier@^7.12.11": - version "7.12.11" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz#c9a1f021917dcb5ccf0d4e453e399022981fc9ed" - integrity sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw== +"@babel/helper-validator-identifier@^7.14.0": + version "7.14.0" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.0.tgz#d26cad8a47c65286b15df1547319a5d0bcf27288" + integrity sha512-V3ts7zMSu5lfiwWDVWzRDGIN+lnCEUdaXgtVHJgLb1rGaA6jMrtB9EmE7L18foXJIE8Un/A/h6NJfGQp/e1J4A== "@babel/helper-validator-option@^7.12.17": version "7.12.17" resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.12.17.tgz#d1fbf012e1a79b7eebbfdc6d270baaf8d9eb9831" integrity sha512-TopkMDmLzq8ngChwRlyjR6raKD6gMSae4JdYDB8bByKreQgG0RBTuKe9LRxW3wFtUnjxOPRKBDwEH6Mg5KeDfw== -"@babel/helpers@^7.13.16": - version "7.13.16" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.13.16.tgz#08af075f786fd06a56e41bcac3e8cc87ddc4d0b3" - integrity sha512-x5otxUaLpdWHl02P4L94wBU+2BJXBkvO+6d6uzQ+xD9/h2hTSAwA5O8QV8GqKx/l8i+VYmKKQg9e2QGTa2Wu3Q== +"@babel/helpers@^7.14.0": + version "7.14.0" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.14.0.tgz#ea9b6be9478a13d6f961dbb5f36bf75e2f3b8f62" + integrity sha512-+ufuXprtQ1D1iZTO/K9+EBRn+qPWMJjZSw/S0KlFrxCw4tkrzv9grgpDHkY9MeQTjTY8i2sp7Jep8DfU6tN9Mg== dependencies: "@babel/template" "^7.12.13" - "@babel/traverse" "^7.13.15" - "@babel/types" "^7.13.16" + "@babel/traverse" "^7.14.0" + "@babel/types" "^7.14.0" "@babel/highlight@^7.10.4", "@babel/highlight@^7.12.13": - version "7.13.10" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.13.10.tgz#a8b2a66148f5b27d666b15d81774347a731d52d1" - integrity sha512-5aPpe5XQPzflQrFwL1/QoeHkP2MsA4JCntcXHRhEsdsfPVkvPi2w7Qix4iV7t5S/oC9OodGrggd8aco1g3SZFg== + version "7.14.0" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.14.0.tgz#3197e375711ef6bf834e67d0daec88e4f46113cf" + integrity sha512-YSCOwxvTYEIMSGaBQb5kDDsCopDdiUGsqpatp3fOlI4+2HQSkTmEVWnVuySdAC5EWCqSWWTv0ib63RjR7dTBdg== dependencies: - "@babel/helper-validator-identifier" "^7.12.11" + "@babel/helper-validator-identifier" "^7.14.0" chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.1.6", "@babel/parser@^7.12.13", "@babel/parser@^7.13.15", "@babel/parser@^7.13.16": - version "7.13.16" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.13.16.tgz#0f18179b0448e6939b1f3f5c4c355a3a9bcdfd37" - integrity sha512-6bAg36mCwuqLO0hbR+z7PHuqWiCeP7Dzg73OpQwsAB1Eb8HnGEz5xYBzCfbu+YjoaJsJs+qheDxVAuqbt3ILEw== +"@babel/parser@^7.1.0", "@babel/parser@^7.1.6", "@babel/parser@^7.12.13", "@babel/parser@^7.14.2": + version "7.14.2" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.14.2.tgz#0c1680aa44ad4605b16cbdcc5c341a61bde9c746" + integrity sha512-IoVDIHpsgE/fu7eXBeRWt8zLbDrSvD7H1gpomOkPpBoEN8KCruCqSDdqo8dddwQQrui30KSvQBaMUOJiuFu6QQ== + +"@babel/parser@^7.14.3", "@babel/parser@^7.7.2": + version "7.14.4" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.14.4.tgz#a5c560d6db6cd8e6ed342368dea8039232cbab18" + integrity sha512-ArliyUsWDUqEGfWcmzpGUzNfLxTdTp6WU4IuP6QFSp9gGfWS6boxFCkJSJ/L4+RG8z/FnIU3WxCk6hPL9SSWeA== "@babel/plugin-proposal-class-properties@^7.1.0": version "7.13.0" @@ -201,17 +244,17 @@ "@babel/helper-plugin-utils" "^7.13.0" "@babel/plugin-proposal-nullish-coalescing-operator@^7.1.0": - version "7.13.8" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.13.8.tgz#3730a31dafd3c10d8ccd10648ed80a2ac5472ef3" - integrity sha512-iePlDPBn//UhxExyS9KyeYU7RM9WScAG+D3Hhno0PLJebAEpDZMocbDe64eqynhNAnwz/vZoL/q/QB2T1OH39A== + version "7.14.2" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.14.2.tgz#425b11dc62fc26939a2ab42cbba680bdf5734546" + integrity sha512-ebR0zU9OvI2N4qiAC38KIAK75KItpIPTpAtd2r4OZmMFeKbKJpUFLYP2EuDut82+BmYi8sz42B+TfTptJ9iG5Q== dependencies: "@babel/helper-plugin-utils" "^7.13.0" "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" "@babel/plugin-proposal-optional-chaining@^7.1.0": - version "7.13.12" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.13.12.tgz#ba9feb601d422e0adea6760c2bd6bbb7bfec4866" - integrity sha512-fcEdKOkIB7Tf4IxrgEVeFC4zeJSTr78no9wTdBuZZbqF64kzllU0ybo2zrzm7gUQfxGhBgq4E39oRs8Zx/RMYQ== + version "7.14.2" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.14.2.tgz#df8171a8b9c43ebf4c1dabe6311b432d83e1b34e" + integrity sha512-qQByMRPwMZJainfig10BoaDldx/+VDtNcrA7qdNaEOAj6VXud+gfrkA8j4CRAU5HjnWREXqIpSpH30qZX1xivA== dependencies: "@babel/helper-plugin-utils" "^7.13.0" "@babel/helper-skip-transparent-expression-wrappers" "^7.12.1" @@ -308,7 +351,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.12.13" -"@babel/plugin-syntax-typescript@^7.12.13": +"@babel/plugin-syntax-typescript@^7.12.13", "@babel/plugin-syntax-typescript@^7.7.2": version "7.12.13" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.12.13.tgz#9dff111ca64154cef0f4dc52cf843d9f12ce4474" integrity sha512-cHP3u1JiUiG2LFDKbXnwVad81GvfyIOmCD6HIEId6ojrY0Drfy2q1jw7BwN7dE84+kTnBjLkXoL3IEy/3JPu2w== @@ -324,13 +367,13 @@ "@babel/plugin-syntax-flow" "^7.12.13" "@babel/plugin-transform-modules-commonjs@^7.1.0": - version "7.13.8" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.13.8.tgz#7b01ad7c2dcf2275b06fa1781e00d13d420b3e1b" - integrity sha512-9QiOx4MEGglfYZ4XOnU79OHr6vIWUakIj9b4mioN8eQIoEh+pf5p/zEB36JpDFWA12nNMiRf7bfoRvl9Rn79Bw== + version "7.14.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.14.0.tgz#52bc199cb581e0992edba0f0f80356467587f161" + integrity sha512-EX4QePlsTaRZQmw9BsoPeyh5OCtRGIhwfLquhxGp5e32w+dyL8htOcDwamlitmNFK6xBZYlygjdye9dbd9rUlQ== dependencies: - "@babel/helper-module-transforms" "^7.13.0" + "@babel/helper-module-transforms" "^7.14.0" "@babel/helper-plugin-utils" "^7.13.0" - "@babel/helper-simple-access" "^7.12.13" + "@babel/helper-simple-access" "^7.13.12" babel-plugin-dynamic-import-node "^2.3.3" "@babel/plugin-transform-typescript@^7.13.0": @@ -380,26 +423,26 @@ "@babel/parser" "^7.12.13" "@babel/types" "^7.12.13" -"@babel/traverse@^7.1.0", "@babel/traverse@^7.13.0", "@babel/traverse@^7.13.13", "@babel/traverse@^7.13.15": - version "7.13.15" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.13.15.tgz#c38bf7679334ddd4028e8e1f7b3aa5019f0dada7" - integrity sha512-/mpZMNvj6bce59Qzl09fHEs8Bt8NnpEDQYleHUPZQ3wXUMvXi+HJPLars68oAbmp839fGoOkv2pSL2z9ajCIaQ== +"@babel/traverse@^7.1.0", "@babel/traverse@^7.13.0", "@babel/traverse@^7.14.0", "@babel/traverse@^7.14.2", "@babel/traverse@^7.7.2": + version "7.14.2" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.14.2.tgz#9201a8d912723a831c2679c7ebbf2fe1416d765b" + integrity sha512-TsdRgvBFHMyHOOzcP9S6QU0QQtjxlRpEYOy3mcCO5RgmC305ki42aSAmfZEMSSYBla2oZ9BMqYlncBaKmD/7iA== dependencies: "@babel/code-frame" "^7.12.13" - "@babel/generator" "^7.13.9" - "@babel/helper-function-name" "^7.12.13" + "@babel/generator" "^7.14.2" + "@babel/helper-function-name" "^7.14.2" "@babel/helper-split-export-declaration" "^7.12.13" - "@babel/parser" "^7.13.15" - "@babel/types" "^7.13.14" + "@babel/parser" "^7.14.2" + "@babel/types" "^7.14.2" debug "^4.1.0" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.12.1", "@babel/types@^7.12.13", "@babel/types@^7.13.12", "@babel/types@^7.13.14", "@babel/types@^7.13.16", "@babel/types@^7.3.0", "@babel/types@^7.3.3": - version "7.13.16" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.13.16.tgz#916120b858aa5655cfba84bd0f6021ff5bdb4e65" - integrity sha512-7enM8Wxhrl1hB1+k6+xO6RmxpNkaveRWkdpyii8DkrLWRgr0l3x29/SEuhTIkP+ynHsU/Hpjn8Evd/axv/ll6Q== +"@babel/types@^7.0.0", "@babel/types@^7.12.1", "@babel/types@^7.12.13", "@babel/types@^7.13.12", "@babel/types@^7.14.0", "@babel/types@^7.14.2", "@babel/types@^7.3.0", "@babel/types@^7.3.3": + version "7.14.2" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.14.2.tgz#4208ae003107ef8a057ea8333e56eb64d2f6a2c3" + integrity sha512-SdjAG/3DikRHpUOjxZgnkbR11xUlyDMUFJdvnIgZEE16mqmY0BINMmc4//JMJglEmn6i7sq6p+mGrFWyZ98EEw== dependencies: - "@babel/helper-validator-identifier" "^7.12.11" + "@babel/helper-validator-identifier" "^7.14.0" to-fast-properties "^2.0.0" "@bcoe/v8-coverage@^0.2.3": @@ -407,161 +450,152 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@cnakazawa/watch@^1.0.3": - version "1.0.4" - resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.4.tgz#f864ae85004d0fcab6f50be9141c4da368d1656a" - integrity sha512-v9kIhKwjeZThiWrLmj0y17CWoyddASLj9O2yvbZkbvw/N3rWOYy9zkV66ursAoVr0mV15bL8g0c4QZUE6cdDoQ== +"@commitlint/cli@^12.1.4": + version "12.1.4" + resolved "https://registry.yarnpkg.com/@commitlint/cli/-/cli-12.1.4.tgz#af4d9dd3c0122c7b39a61fa1cd2abbad0422dbe0" + integrity sha512-ZR1WjXLvqEffYyBPT0XdnSxtt3Ty1TMoujEtseW5o3vPnkA1UNashAMjQVg/oELqfaiAMnDw8SERPMN0e/0kLg== dependencies: - exec-sh "^0.3.2" - minimist "^1.2.0" - -"@commitlint/cli@^12.1.1": - version "12.1.1" - resolved "https://registry.yarnpkg.com/@commitlint/cli/-/cli-12.1.1.tgz#740370e557a8a17f415052821cdd5276ecb0ab98" - integrity sha512-SB67/s6VJ50seoPx/Sr2gj1fMzKrx+udgarecGdr8h43ah+M2e22gjQJ7xHv5KwyPQ+6ug1YOMCL34ubT4zupQ== - dependencies: - "@commitlint/format" "^12.1.1" - "@commitlint/lint" "^12.1.1" - "@commitlint/load" "^12.1.1" - "@commitlint/read" "^12.1.1" - "@commitlint/types" "^12.1.1" - get-stdin "8.0.0" + "@commitlint/format" "^12.1.4" + "@commitlint/lint" "^12.1.4" + "@commitlint/load" "^12.1.4" + "@commitlint/read" "^12.1.4" + "@commitlint/types" "^12.1.4" lodash "^4.17.19" resolve-from "5.0.0" resolve-global "1.0.0" yargs "^16.2.0" -"@commitlint/config-conventional@^12.1.1": - version "12.1.1" - resolved "https://registry.yarnpkg.com/@commitlint/config-conventional/-/config-conventional-12.1.1.tgz#73dd3b1a7912138420d248f334f15c94c250bc9e" - integrity sha512-15CqbXMsQiEb0qbzjEHe2OkzaXPYSp7RxaS6KoSVk/4W0QiigquavQ+M0huBZze92h0lMS6Pxoq4AJ5CQ3D+iQ== +"@commitlint/config-conventional@^12.1.4": + version "12.1.4" + resolved "https://registry.yarnpkg.com/@commitlint/config-conventional/-/config-conventional-12.1.4.tgz#95bbab622f117a8a3e49f95917b08655040c66a8" + integrity sha512-ZIdzmdy4o4WyqywMEpprRCrehjCSQrHkaRTVZV411GyLigFQHlEBSJITAihLAWe88Qy/8SyoIe5uKvAsV5vRqQ== dependencies: conventional-changelog-conventionalcommits "^4.3.1" -"@commitlint/ensure@^12.1.1": - version "12.1.1" - resolved "https://registry.yarnpkg.com/@commitlint/ensure/-/ensure-12.1.1.tgz#bcefc85f7f8a41bb31f67d7a8966e322b47a6e43" - integrity sha512-XEUQvUjzBVQM7Uv8vYz+c7PDukFvx0AvQEyX/V+PaTkCK/xPvexu7FLbFwvypjSt9BPMf+T/rhB1hVmldkd6lw== +"@commitlint/ensure@^12.1.4": + version "12.1.4" + resolved "https://registry.yarnpkg.com/@commitlint/ensure/-/ensure-12.1.4.tgz#287ae2dcc5ccb086e749705b1bd9bdb99773056f" + integrity sha512-MxHIBuAG9M4xl33qUfIeMSasbv3ktK0W+iygldBxZOL4QSYC2Gn66pZAQMnV9o3V+sVFHoAK2XUKqBAYrgbEqw== dependencies: - "@commitlint/types" "^12.1.1" + "@commitlint/types" "^12.1.4" lodash "^4.17.19" -"@commitlint/execute-rule@^12.1.1": - version "12.1.1" - resolved "https://registry.yarnpkg.com/@commitlint/execute-rule/-/execute-rule-12.1.1.tgz#8aad1d46fb78b3199e4ae36debdc93570bf765ea" - integrity sha512-6mplMGvLCKF5LieL7BRhydpg32tm6LICnWQADrWU4S5g9PKi2utNvhiaiuNPoHUXr29RdbNaGNcyyPv8DSjJsQ== +"@commitlint/execute-rule@^12.1.4": + version "12.1.4" + resolved "https://registry.yarnpkg.com/@commitlint/execute-rule/-/execute-rule-12.1.4.tgz#9973b02e9779adbf1522ae9ac207a4815ec73de1" + integrity sha512-h2S1j8SXyNeABb27q2Ok2vD1WfxJiXvOttKuRA9Or7LN6OQoC/KtT3844CIhhWNteNMu/wE0gkTqGxDVAnJiHg== -"@commitlint/format@^12.1.1": - version "12.1.1" - resolved "https://registry.yarnpkg.com/@commitlint/format/-/format-12.1.1.tgz#a6b14f8605171374eecc2c463098d63c127ab7df" - integrity sha512-bTAoOryTFLqls17JTaRwk2WDVOP0NwuG4F/JPK8RaF6DMZNVQTfajkgTxFENNZRnESfau1BvivvEXfUAW2ZsvA== +"@commitlint/format@^12.1.4": + version "12.1.4" + resolved "https://registry.yarnpkg.com/@commitlint/format/-/format-12.1.4.tgz#db2d46418a6ae57c90e5f7f65dff46f0265d9f24" + integrity sha512-h28ucMaoRjVvvgS6Bdf85fa/+ZZ/iu1aeWGCpURnQV7/rrVjkhNSjZwGlCOUd5kDV1EnZ5XdI7L18SUpRjs26g== dependencies: - "@commitlint/types" "^12.1.1" + "@commitlint/types" "^12.1.4" chalk "^4.0.0" -"@commitlint/is-ignored@^12.1.1": - version "12.1.1" - resolved "https://registry.yarnpkg.com/@commitlint/is-ignored/-/is-ignored-12.1.1.tgz#6075a5cd2dcda7b6ec93322f5dbe2142cfbb3248" - integrity sha512-Sn4fsnWX+wLAJOD/UZeoVruB98te1TyPYRiDEq0MhRJAQIrP+7jE/O3/ass68AAMq00HvH3OK9kt4UBXggcGjA== +"@commitlint/is-ignored@^12.1.4": + version "12.1.4" + resolved "https://registry.yarnpkg.com/@commitlint/is-ignored/-/is-ignored-12.1.4.tgz#4c430bc3b361aa9be5cd4ddb252c1559870ea7bc" + integrity sha512-uTu2jQU2SKvtIRVLOzMQo3KxDtO+iJ1p0olmncwrqy4AfPLgwoyCP2CiULq5M7xpR3+dE3hBlZXbZTQbD7ycIw== dependencies: - "@commitlint/types" "^12.1.1" + "@commitlint/types" "^12.1.4" semver "7.3.5" -"@commitlint/lint@^12.1.1": - version "12.1.1" - resolved "https://registry.yarnpkg.com/@commitlint/lint/-/lint-12.1.1.tgz#cdd898af6eadba8f9e71d7f1255b5a479a757078" - integrity sha512-FFFPpku/E0svL1jaUVqosuZJDDWiNWYBlUw5ZEljh3MwWRcoaWtMIX5bseX+IvHpFZsCTAiBs1kCgNulCi0UvA== +"@commitlint/lint@^12.1.4": + version "12.1.4" + resolved "https://registry.yarnpkg.com/@commitlint/lint/-/lint-12.1.4.tgz#856b7fd2b2e6367b836cb84a12f1c1b3c0e40d22" + integrity sha512-1kZ8YDp4to47oIPFELUFGLiLumtPNKJigPFDuHt2+f3Q3IKdQ0uk53n3CPl4uoyso/Og/EZvb1mXjFR/Yce4cA== dependencies: - "@commitlint/is-ignored" "^12.1.1" - "@commitlint/parse" "^12.1.1" - "@commitlint/rules" "^12.1.1" - "@commitlint/types" "^12.1.1" + "@commitlint/is-ignored" "^12.1.4" + "@commitlint/parse" "^12.1.4" + "@commitlint/rules" "^12.1.4" + "@commitlint/types" "^12.1.4" -"@commitlint/load@^12.1.1": - version "12.1.1" - resolved "https://registry.yarnpkg.com/@commitlint/load/-/load-12.1.1.tgz#5a7fb8be11e520931d1237c5e8dc401b7cc9c6c1" - integrity sha512-qOQtgNdJRULUQWP9jkpTwhj7aEtnqUtqeUpbQ9rjS+GIUST65HZbteNUX4S0mAEGPWqy2aK5xGd73cUfFSvuuw== +"@commitlint/load@^12.1.4": + version "12.1.4" + resolved "https://registry.yarnpkg.com/@commitlint/load/-/load-12.1.4.tgz#e3c2dbc0e7d8d928f57a6878bd7219909fc0acab" + integrity sha512-Keszi0IOjRzKfxT+qES/n+KZyLrxy79RQz8wWgssCboYjKEp+wC+fLCgbiMCYjI5k31CIzIOq/16J7Ycr0C0EA== dependencies: - "@commitlint/execute-rule" "^12.1.1" - "@commitlint/resolve-extends" "^12.1.1" - "@commitlint/types" "^12.1.1" + "@commitlint/execute-rule" "^12.1.4" + "@commitlint/resolve-extends" "^12.1.4" + "@commitlint/types" "^12.1.4" chalk "^4.0.0" cosmiconfig "^7.0.0" lodash "^4.17.19" resolve-from "^5.0.0" -"@commitlint/message@^12.1.1": - version "12.1.1" - resolved "https://registry.yarnpkg.com/@commitlint/message/-/message-12.1.1.tgz#56eb1dbb561e85e9295380a46ff3b09bc93cac65" - integrity sha512-RakDSLAiOligXjhbLahV8HowF4K75pZIcs0+Ii9Q8Gz5H3DWf1Ngit7alFTWfcbf/+DTjSzVPov5HiwQZPIBUg== +"@commitlint/message@^12.1.4": + version "12.1.4" + resolved "https://registry.yarnpkg.com/@commitlint/message/-/message-12.1.4.tgz#3895edcc0709deca5945f3d55f5ea95a9f1f446d" + integrity sha512-6QhalEKsKQ/Y16/cTk5NH4iByz26fqws2ub+AinHPtM7Io0jy4e3rym9iE+TkEqiqWZlUigZnTwbPvRJeSUBaA== -"@commitlint/parse@^12.1.1": - version "12.1.1" - resolved "https://registry.yarnpkg.com/@commitlint/parse/-/parse-12.1.1.tgz#3e49d6dc113d59cf266af0db99e320e933108c56" - integrity sha512-nuljIvAbBDr93DgL0wCArftEIhjSghawAwhvrKNV9FFcqAJqfVqitwMxJrNDCQ5pgUMCSKULLOEv+dA0bLlTEQ== +"@commitlint/parse@^12.1.4": + version "12.1.4" + resolved "https://registry.yarnpkg.com/@commitlint/parse/-/parse-12.1.4.tgz#ba03d54d24ef84f6fd2ff31c5e9998b22d7d0aa1" + integrity sha512-yqKSAsK2V4X/HaLb/yYdrzs6oD/G48Ilt0EJ2Mp6RJeWYxG14w/Out6JrneWnr/cpzemyN5hExOg6+TB19H/Lw== dependencies: - "@commitlint/types" "^12.1.1" + "@commitlint/types" "^12.1.4" conventional-changelog-angular "^5.0.11" conventional-commits-parser "^3.0.0" -"@commitlint/read@^12.1.1": - version "12.1.1" - resolved "https://registry.yarnpkg.com/@commitlint/read/-/read-12.1.1.tgz#22a2d7fd1eab5e38b9b262311af28ac42f9a5097" - integrity sha512-1k0CQEoZIdixvmqZRKEcWdj2XiKS7SlizEOJ1SE99Qui5d5FlBey8eaooTGgmpR6zObpIHJehtEPzM3VzUT3qA== +"@commitlint/read@^12.1.4": + version "12.1.4" + resolved "https://registry.yarnpkg.com/@commitlint/read/-/read-12.1.4.tgz#552fda42ef185d5b578beb6f626a5f8b282de3a6" + integrity sha512-TnPQSJgD8Aod5Xeo9W4SaYKRZmIahukjcCWJ2s5zb3ZYSmj6C85YD9cR5vlRyrZjj78ItLUV/X4FMWWVIS38Jg== dependencies: - "@commitlint/top-level" "^12.1.1" - "@commitlint/types" "^12.1.1" + "@commitlint/top-level" "^12.1.4" + "@commitlint/types" "^12.1.4" fs-extra "^9.0.0" git-raw-commits "^2.0.0" -"@commitlint/resolve-extends@^12.1.1": - version "12.1.1" - resolved "https://registry.yarnpkg.com/@commitlint/resolve-extends/-/resolve-extends-12.1.1.tgz#80a78b0940775d17888dd2985b52f93d93e0a885" - integrity sha512-/DXRt0S0U3o9lq5cc8OL1Lkx0IjW0HcDWjUkUXshAajBIKBYSJB8x/loNCi1krNEJ8SwLXUEFt5OLxNO6wE9yQ== +"@commitlint/resolve-extends@^12.1.4": + version "12.1.4" + resolved "https://registry.yarnpkg.com/@commitlint/resolve-extends/-/resolve-extends-12.1.4.tgz#e758ed7dcdf942618b9f603a7c28a640f6a0802a" + integrity sha512-R9CoUtsXLd6KSCfsZly04grsH6JVnWFmVtWgWs1KdDpdV+G3TSs37tColMFqglpkx3dsWu8dsPD56+D9YnJfqg== dependencies: import-fresh "^3.0.0" lodash "^4.17.19" resolve-from "^5.0.0" resolve-global "^1.0.0" -"@commitlint/rules@^12.1.1": - version "12.1.1" - resolved "https://registry.yarnpkg.com/@commitlint/rules/-/rules-12.1.1.tgz#d59182a837d2addf301a3a4ef83316ae7e70248f" - integrity sha512-oCcLF/ykcJfhM2DeeaDyrgdaiuKsqIPNocugdPj2WEyhSYqmx1/u18CV96LAtW+WyyiOLCCeiZwiQutx3T5nXg== +"@commitlint/rules@^12.1.4": + version "12.1.4" + resolved "https://registry.yarnpkg.com/@commitlint/rules/-/rules-12.1.4.tgz#0e141b08caa3d7bdc48aa784baa8baff3efd64db" + integrity sha512-W8m6ZSjg7RuIsIfzQiFHa48X5mcPXeKT9yjBxVmjHvYfS2FDBf1VxCQ7vO0JTVIdV4ohjZ0eKg/wxxUuZHJAZg== dependencies: - "@commitlint/ensure" "^12.1.1" - "@commitlint/message" "^12.1.1" - "@commitlint/to-lines" "^12.1.1" - "@commitlint/types" "^12.1.1" + "@commitlint/ensure" "^12.1.4" + "@commitlint/message" "^12.1.4" + "@commitlint/to-lines" "^12.1.4" + "@commitlint/types" "^12.1.4" -"@commitlint/to-lines@^12.1.1": - version "12.1.1" - resolved "https://registry.yarnpkg.com/@commitlint/to-lines/-/to-lines-12.1.1.tgz#40fbed1767d637249ce49b311a51909d8361ecf8" - integrity sha512-W23AH2XF5rI27MOAPSSr0TUDoRe7ZbFoRtYhFnPu2MBmcuDA9Tmfd9N5sM2tBXtdE26uq3SazwKqGt1OoGAilQ== +"@commitlint/to-lines@^12.1.4": + version "12.1.4" + resolved "https://registry.yarnpkg.com/@commitlint/to-lines/-/to-lines-12.1.4.tgz#caa582dbf121f377a0588bb64e25c4854843cd25" + integrity sha512-TParumvbi8bdx3EdLXz2MaX+e15ZgoCqNUgqHsRLwyqLUTRbqCVkzrfadG1UcMQk8/d5aMbb327ZKG3Q4BRorw== -"@commitlint/top-level@^12.1.1": - version "12.1.1" - resolved "https://registry.yarnpkg.com/@commitlint/top-level/-/top-level-12.1.1.tgz#228df8fc36b6d7ea7ad149badfb6ef53dbc7001d" - integrity sha512-g7uRbr81QEIg+pbii0OkE17Zh/2C/f6dSmiMDVRn1S0+hNHR1bENCh18hVUKcV/qKTUsKkFlhhWXM9mQBfxQJw== +"@commitlint/top-level@^12.1.4": + version "12.1.4" + resolved "https://registry.yarnpkg.com/@commitlint/top-level/-/top-level-12.1.4.tgz#96d5c715bfc1bdf86dfcf11b67fc2cf7658c7a6e" + integrity sha512-d4lTJrOT/dXlpY+NIt4CUl77ciEzYeNVc0VFgUQ6VA+b1rqYD2/VWFjBlWVOrklxtSDeKyuEhs36RGrppEFAvg== dependencies: find-up "^5.0.0" -"@commitlint/types@^12.1.1": - version "12.1.1" - resolved "https://registry.yarnpkg.com/@commitlint/types/-/types-12.1.1.tgz#8e651f6af0171cd4f8d464c6c37a7cf63ee071bd" - integrity sha512-+qGH+s2Lo6qwacV2X3/ZypZwaAI84ift+1HBjXdXtI/q0F5NtmXucV3lcQOTviMTNiJhq4qWON2fjci2NItASw== +"@commitlint/types@^12.1.4": + version "12.1.4" + resolved "https://registry.yarnpkg.com/@commitlint/types/-/types-12.1.4.tgz#9618a5dc8991fb58e6de6ed89d7bf712fa74ba7e" + integrity sha512-KRIjdnWNUx6ywz+SJvjmNCbQKcKP6KArhjZhY2l+CWKxak0d77SOjggkMwFTiSgLODOwmuLTbarR2ZfWPiPMlw== dependencies: chalk "^4.0.0" "@discoveryjs/json-ext@^0.5.0": - version "0.5.2" - resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.5.2.tgz#8f03a22a04de437254e8ce8cc84ba39689288752" - integrity sha512-HyYEUDeIj5rRQU2Hk5HTB2uHsbRQpF70nvMhVzi+VJR0X+xNEhjPui4/kBf3VeH/wqD28PT4sVOm8qqLjBrSZg== + version "0.5.3" + resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.5.3.tgz#90420f9f9c6d3987f176a19a7d8e764271a2f55d" + integrity sha512-Fxt+AfXgjMoin2maPIYzFZnQjAXjAL0PHscM5pRTtatFqB+vZxAM9tLp2Optnuw3QOQC40jTNeGYFOMvyf7v9g== -"@eslint/eslintrc@^0.4.0": - version "0.4.0" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.0.tgz#99cc0a0584d72f1df38b900fb062ba995f395547" - integrity sha512-2ZPCc+uNbjV5ERJr+aKSPRwZgKd2z11x0EgLvb1PURmUrn9QNRXFqje0Ldq454PfAVyaJYyrDvvIKSFP4NnBog== +"@eslint/eslintrc@^0.4.1": + version "0.4.1" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.1.tgz#442763b88cecbe3ee0ec7ca6d6dd6168550cbf14" + integrity sha512-5v7TDE9plVhvxQeWLXDTvFvJBdH6pEsdnl2g/dAptmuFEPedQ4Erq5rsDsX+mvAM610IhNaO2W5V1dOOnDKxkQ== dependencies: ajv "^6.12.4" debug "^4.1.1" @@ -589,93 +623,106 @@ resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== -"@jest/console@^26.6.2": - version "26.6.2" - resolved "https://registry.yarnpkg.com/@jest/console/-/console-26.6.2.tgz#4e04bc464014358b03ab4937805ee36a0aeb98f2" - integrity sha512-IY1R2i2aLsLr7Id3S6p2BA82GNWryt4oSvEXLAKc+L2zdi89dSkE8xC1C+0kpATG4JhBJREnQOH7/zmccM2B0g== +"@jest/console@^27.0.1": + version "27.0.1" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-27.0.1.tgz#c6acfec201f9b6823596eb6c4fcd77c89a8b27e9" + integrity sha512-50E6nN2F5cAXn1lDljn0gE9F0WFXHYz/u0EeR7sOt4nbRPNli34ckbl6CUDaDABJbHt62DYnyQAIB3KgdzwKDw== dependencies: - "@jest/types" "^26.6.2" + "@jest/types" "^27.0.1" "@types/node" "*" chalk "^4.0.0" - jest-message-util "^26.6.2" - jest-util "^26.6.2" + jest-message-util "^27.0.1" + jest-util "^27.0.1" slash "^3.0.0" -"@jest/core@^26.6.3": - version "26.6.3" - resolved "https://registry.yarnpkg.com/@jest/core/-/core-26.6.3.tgz#7639fcb3833d748a4656ada54bde193051e45fad" - integrity sha512-xvV1kKbhfUqFVuZ8Cyo+JPpipAHHAV3kcDBftiduK8EICXmTFddryy3P7NfZt8Pv37rA9nEJBKCCkglCPt/Xjw== +"@jest/console@^27.0.2": + version "27.0.2" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-27.0.2.tgz#b8eeff8f21ac51d224c851e1729d2630c18631e6" + integrity sha512-/zYigssuHLImGeMAACkjI4VLAiiJznHgAl3xnFT19iWyct2LhrH3KXOjHRmxBGTkiPLZKKAJAgaPpiU9EZ9K+w== dependencies: - "@jest/console" "^26.6.2" - "@jest/reporters" "^26.6.2" - "@jest/test-result" "^26.6.2" - "@jest/transform" "^26.6.2" - "@jest/types" "^26.6.2" + "@jest/types" "^27.0.2" + "@types/node" "*" + chalk "^4.0.0" + jest-message-util "^27.0.2" + jest-util "^27.0.2" + slash "^3.0.0" + +"@jest/core@^27.0.4": + version "27.0.4" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-27.0.4.tgz#679bf9ac07900da2ddbb9667bb1afa8029038f53" + integrity sha512-+dsmV8VUs1h/Szb+rEWk8xBM1fp1I///uFy9nk3wXGvRsF2lBp8EVPmtWc+QFRb3MY2b7u2HbkGF1fzoDzQTLA== + dependencies: + "@jest/console" "^27.0.2" + "@jest/reporters" "^27.0.4" + "@jest/test-result" "^27.0.2" + "@jest/transform" "^27.0.2" + "@jest/types" "^27.0.2" "@types/node" "*" ansi-escapes "^4.2.1" chalk "^4.0.0" + emittery "^0.8.1" exit "^0.1.2" graceful-fs "^4.2.4" - jest-changed-files "^26.6.2" - jest-config "^26.6.3" - jest-haste-map "^26.6.2" - jest-message-util "^26.6.2" - jest-regex-util "^26.0.0" - jest-resolve "^26.6.2" - jest-resolve-dependencies "^26.6.3" - jest-runner "^26.6.3" - jest-runtime "^26.6.3" - jest-snapshot "^26.6.2" - jest-util "^26.6.2" - jest-validate "^26.6.2" - jest-watcher "^26.6.2" - micromatch "^4.0.2" + jest-changed-files "^27.0.2" + jest-config "^27.0.4" + jest-haste-map "^27.0.2" + jest-message-util "^27.0.2" + jest-regex-util "^27.0.1" + jest-resolve "^27.0.4" + jest-resolve-dependencies "^27.0.4" + jest-runner "^27.0.4" + jest-runtime "^27.0.4" + jest-snapshot "^27.0.4" + jest-util "^27.0.2" + jest-validate "^27.0.2" + jest-watcher "^27.0.2" + micromatch "^4.0.4" p-each-series "^2.1.0" rimraf "^3.0.0" slash "^3.0.0" strip-ansi "^6.0.0" -"@jest/environment@^26.6.2": - version "26.6.2" - resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-26.6.2.tgz#ba364cc72e221e79cc8f0a99555bf5d7577cf92c" - integrity sha512-nFy+fHl28zUrRsCeMB61VDThV1pVTtlEokBRgqPrcT1JNq4yRNIyTHfyht6PqtUvY9IsuLGTrbG8kPXjSZIZwA== +"@jest/environment@^27.0.3": + version "27.0.3" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-27.0.3.tgz#68769b1dfdd213e3456169d64fbe9bd63a5fda92" + integrity sha512-pN9m7fbKsop5vc3FOfH8NF7CKKdRbEZzcxfIo1n2TT6ucKWLFq0P6gCJH0GpnQp036++yY9utHOxpeT1WnkWTA== dependencies: - "@jest/fake-timers" "^26.6.2" - "@jest/types" "^26.6.2" + "@jest/fake-timers" "^27.0.3" + "@jest/types" "^27.0.2" "@types/node" "*" - jest-mock "^26.6.2" + jest-mock "^27.0.3" -"@jest/fake-timers@^26.6.2": - version "26.6.2" - resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-26.6.2.tgz#459c329bcf70cee4af4d7e3f3e67848123535aad" - integrity sha512-14Uleatt7jdzefLPYM3KLcnUl1ZNikaKq34enpb5XG9i81JpppDb5muZvonvKyrl7ftEHkKS5L5/eB/kxJ+bvA== +"@jest/fake-timers@^27.0.3": + version "27.0.3" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-27.0.3.tgz#9899ba6304cc636734c74478df502e18136461dd" + integrity sha512-fQ+UCKRIYKvTCEOyKPnaPnomLATIhMnHC/xPZ7yT1Uldp7yMgMxoYIFidDbpSTgB79+/U+FgfoD30c6wg3IUjA== dependencies: - "@jest/types" "^26.6.2" - "@sinonjs/fake-timers" "^6.0.1" + "@jest/types" "^27.0.2" + "@sinonjs/fake-timers" "^7.0.2" "@types/node" "*" - jest-message-util "^26.6.2" - jest-mock "^26.6.2" - jest-util "^26.6.2" + jest-message-util "^27.0.2" + jest-mock "^27.0.3" + jest-util "^27.0.2" -"@jest/globals@^26.6.2": - version "26.6.2" - resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-26.6.2.tgz#5b613b78a1aa2655ae908eba638cc96a20df720a" - integrity sha512-85Ltnm7HlB/KesBUuALwQ68YTU72w9H2xW9FjZ1eL1U3lhtefjjl5c2MiUbpXt/i6LaPRvoOFJ22yCBSfQ0JIA== +"@jest/globals@^27.0.3": + version "27.0.3" + resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-27.0.3.tgz#1cf8933b7791bba0b99305cbf39fd4d2e3fe4060" + integrity sha512-OzsIuf7uf+QalqAGbjClyezzEcLQkdZ+7PejUrZgDs+okdAK8GwRCGcYCirHvhMBBQh60Jr3NlIGbn/KBPQLEQ== dependencies: - "@jest/environment" "^26.6.2" - "@jest/types" "^26.6.2" - expect "^26.6.2" + "@jest/environment" "^27.0.3" + "@jest/types" "^27.0.2" + expect "^27.0.2" -"@jest/reporters@^26.6.2": - version "26.6.2" - resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-26.6.2.tgz#1f518b99637a5f18307bd3ecf9275f6882a667f6" - integrity sha512-h2bW53APG4HvkOnVMo8q3QXa6pcaNt1HkwVsOPMBV6LD/q9oSpxNSYZQYkAnjdMjrJ86UuYeLo+aEZClV6opnw== +"@jest/reporters@^27.0.4": + version "27.0.4" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-27.0.4.tgz#95609b1be97afb80d55d8aa3d7c3179c15810e65" + integrity sha512-Xa90Nm3JnV0xCe4M6A10M9WuN9krb+WFKxV1A98Y4ePCw40n++r7uxFUNU7DT1i9Behj7fjrAIju9oU0t1QtCg== dependencies: "@bcoe/v8-coverage" "^0.2.3" - "@jest/console" "^26.6.2" - "@jest/test-result" "^26.6.2" - "@jest/transform" "^26.6.2" - "@jest/types" "^26.6.2" + "@jest/console" "^27.0.2" + "@jest/test-result" "^27.0.2" + "@jest/transform" "^27.0.2" + "@jest/types" "^27.0.2" chalk "^4.0.0" collect-v8-coverage "^1.0.0" exit "^0.1.2" @@ -686,64 +733,71 @@ istanbul-lib-report "^3.0.0" istanbul-lib-source-maps "^4.0.0" istanbul-reports "^3.0.2" - jest-haste-map "^26.6.2" - jest-resolve "^26.6.2" - jest-util "^26.6.2" - jest-worker "^26.6.2" + jest-haste-map "^27.0.2" + jest-resolve "^27.0.4" + jest-util "^27.0.2" + jest-worker "^27.0.2" slash "^3.0.0" source-map "^0.6.0" string-length "^4.0.1" terminal-link "^2.0.0" v8-to-istanbul "^7.0.0" - optionalDependencies: - node-notifier "^8.0.0" -"@jest/source-map@^26.6.2": - version "26.6.2" - resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-26.6.2.tgz#29af5e1e2e324cafccc936f218309f54ab69d535" - integrity sha512-YwYcCwAnNmOVsZ8mr3GfnzdXDAl4LaenZP5z+G0c8bzC9/dugL8zRmxZzdoTl4IaS3CryS1uWnROLPFmb6lVvA== +"@jest/source-map@^27.0.1": + version "27.0.1" + resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-27.0.1.tgz#2afbf73ddbaddcb920a8e62d0238a0a9e0a8d3e4" + integrity sha512-yMgkF0f+6WJtDMdDYNavmqvbHtiSpwRN2U/W+6uztgfqgkq/PXdKPqjBTUF1RD/feth4rH5N3NW0T5+wIuln1A== dependencies: callsites "^3.0.0" graceful-fs "^4.2.4" source-map "^0.6.0" -"@jest/test-result@^26.6.2": - version "26.6.2" - resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-26.6.2.tgz#55da58b62df134576cc95476efa5f7949e3f5f18" - integrity sha512-5O7H5c/7YlojphYNrK02LlDIV2GNPYisKwHm2QTKjNZeEzezCbwYs9swJySv2UfPMyZ0VdsmMv7jIlD/IKYQpQ== +"@jest/test-result@^27.0.1": + version "27.0.1" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-27.0.1.tgz#8fb97214268ea21cf8cfb83edc0f17e558b3466d" + integrity sha512-5aa+ibX2dsGSDLKaQMZb453MqjJU/CRVumebXfaJmuzuGE4qf87yQ2QZ6PEpEtBwVUEgrJCzi3jLCRaUbksSuw== dependencies: - "@jest/console" "^26.6.2" - "@jest/types" "^26.6.2" + "@jest/console" "^27.0.1" + "@jest/types" "^27.0.1" "@types/istanbul-lib-coverage" "^2.0.0" collect-v8-coverage "^1.0.0" -"@jest/test-sequencer@^26.6.3": - version "26.6.3" - resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-26.6.3.tgz#98e8a45100863886d074205e8ffdc5a7eb582b17" - integrity sha512-YHlVIjP5nfEyjlrSr8t/YdNfU/1XEt7c5b4OxcXCjyRhjzLYu/rO69/WHPuYcbCWkz8kAeZVZp2N2+IOLLEPGw== +"@jest/test-result@^27.0.2": + version "27.0.2" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-27.0.2.tgz#0451049e32ceb609b636004ccc27c8fa22263f10" + integrity sha512-gcdWwL3yP5VaIadzwQtbZyZMgpmes8ryBAJp70tuxghiA8qL4imJyZex+i+USQH2H4jeLVVszhwntgdQ97fccA== dependencies: - "@jest/test-result" "^26.6.2" + "@jest/console" "^27.0.2" + "@jest/types" "^27.0.2" + "@types/istanbul-lib-coverage" "^2.0.0" + collect-v8-coverage "^1.0.0" + +"@jest/test-sequencer@^27.0.4": + version "27.0.4" + resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-27.0.4.tgz#976493b277594d81e589896f0ed21f198308928a" + integrity sha512-6UFEVwdmxYdyNffBxVVZxmXEdBE4riSddXYSnFNH0ELFQFk/bvagizim8WfgJTqF4EKd+j1yFxvhb8BMHfOjSQ== + dependencies: + "@jest/test-result" "^27.0.2" graceful-fs "^4.2.4" - jest-haste-map "^26.6.2" - jest-runner "^26.6.3" - jest-runtime "^26.6.3" + jest-haste-map "^27.0.2" + jest-runtime "^27.0.4" -"@jest/transform@^26.6.2": - version "26.6.2" - resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-26.6.2.tgz#5ac57c5fa1ad17b2aae83e73e45813894dcf2e4b" - integrity sha512-E9JjhUgNzvuQ+vVAL21vlyfy12gP0GhazGgJC4h6qUt1jSdUXGWJ1wfu/X7Sd8etSgxV4ovT1pb9v5D6QW4XgA== +"@jest/transform@^27.0.2": + version "27.0.2" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-27.0.2.tgz#b073b7c589e3f4b842102468875def2bb722d6b5" + integrity sha512-H8sqKlgtDfVog/s9I4GG2XMbi4Ar7RBxjsKQDUhn2XHAi3NG+GoQwWMER+YfantzExbjNqQvqBHzo/G2pfTiPw== dependencies: "@babel/core" "^7.1.0" - "@jest/types" "^26.6.2" + "@jest/types" "^27.0.2" babel-plugin-istanbul "^6.0.0" chalk "^4.0.0" convert-source-map "^1.4.0" fast-json-stable-stringify "^2.0.0" graceful-fs "^4.2.4" - jest-haste-map "^26.6.2" - jest-regex-util "^26.0.0" - jest-util "^26.6.2" - micromatch "^4.0.2" + jest-haste-map "^27.0.2" + jest-regex-util "^27.0.1" + jest-util "^27.0.2" + micromatch "^4.0.4" pirates "^4.0.1" slash "^3.0.0" source-map "^0.6.1" @@ -760,6 +814,28 @@ "@types/yargs" "^15.0.0" chalk "^4.0.0" +"@jest/types@^27.0.1": + version "27.0.1" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-27.0.1.tgz#631738c942e70045ebbf42a3f9b433036d3845e4" + integrity sha512-8A25RRV4twZutsx2D+7WphnDsp7If9Yu6ko0Gxwrwv8BiWESFzka34+Aa2kC8w9xewt7SDuCUSZ6IiAFVj3PRg== + dependencies: + "@types/istanbul-lib-coverage" "^2.0.0" + "@types/istanbul-reports" "^3.0.0" + "@types/node" "*" + "@types/yargs" "^16.0.0" + chalk "^4.0.0" + +"@jest/types@^27.0.2": + version "27.0.2" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-27.0.2.tgz#e153d6c46bda0f2589f0702b071f9898c7bbd37e" + integrity sha512-XpjCtJ/99HB4PmyJ2vgmN7vT+JLP7RW1FBT9RgnMFS4Dt7cvIyBee8O3/j98aUZ34ZpenPZFqmaaObWSeL65dg== + dependencies: + "@types/istanbul-lib-coverage" "^2.0.0" + "@types/istanbul-reports" "^3.0.0" + "@types/node" "*" + "@types/yargs" "^16.0.0" + chalk "^4.0.0" + "@lerna/add@4.0.0": version "4.0.0" resolved "https://registry.yarnpkg.com/@lerna/add/-/add-4.0.0.tgz#c36f57d132502a57b9e7058d1548b7a565ef183f" @@ -1471,9 +1547,9 @@ integrity sha512-oN3y7FAROHhrAt7Rr7PnTSwrHrZVRTS2ZbyxeQwSSYD0ifwM3YNgQqbaRmjcWoPyq77MjchusjJDspbzMmip1Q== "@npmcli/git@^2.0.1": - version "2.0.8" - resolved "https://registry.yarnpkg.com/@npmcli/git/-/git-2.0.8.tgz#c38b54cdeec556ab641cf6161cc7825711a88d65" - integrity sha512-LPnzyBZ+1p7+JzHVwwKycMF8M3lr1ze3wxGRnxn/QxJtk++Y3prSJQrdBDGCxJyRpFsup6J3lrRBVYBhJVrM8Q== + version "2.0.9" + resolved "https://registry.yarnpkg.com/@npmcli/git/-/git-2.0.9.tgz#915bbfe66300e67b4da5ef765a4475ffb2ca5b6b" + integrity sha512-hTMbMryvOqGLwnmMBKs5usbPsJtyEsMsgXwJbmNrsEuQQh1LAIMDU77IoOrwkCg+NgQWl+ySlarJASwM3SutCA== dependencies: "@npmcli/promise-spawn" "^1.3.2" lru-cache "^6.0.0" @@ -1513,9 +1589,9 @@ infer-owner "^1.0.4" "@npmcli/run-script@^1.8.2": - version "1.8.4" - resolved "https://registry.yarnpkg.com/@npmcli/run-script/-/run-script-1.8.4.tgz#03ced92503a6fe948cbc0975ce39210bc5e824d6" - integrity sha512-Yd9HXTtF1JGDXZw0+SOn+mWLYS0e7bHBHVC/2C8yqs4wUrs/k8rwBSinD7rfk+3WG/MFGRZKxjyoD34Pch2E/A== + version "1.8.5" + resolved "https://registry.yarnpkg.com/@npmcli/run-script/-/run-script-1.8.5.tgz#f250a0c5e1a08a792d775a315d0ff42fc3a51e1d" + integrity sha512-NQspusBCpTjNwNRFMtz2C5MxoxyzlbuJ4YEhxAKrIonTiirKDtatsZictx9RgamQIx6+QuHMNmPl0wQdoESs9A== dependencies: "@npmcli/node-gyp" "^1.0.2" "@npmcli/promise-spawn" "^1.3.2" @@ -1561,10 +1637,10 @@ "@octokit/types" "^6.0.3" universal-user-agent "^6.0.0" -"@octokit/openapi-types@^6.0.0": - version "6.0.0" - resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-6.0.0.tgz#7da8d7d5a72d3282c1a3ff9f951c8133a707480d" - integrity sha512-CnDdK7ivHkBtJYzWzZm7gEkanA7gKH6a09Eguz7flHw//GacPJLmkHA3f3N++MJmlxD1Fl+mB7B32EEpSCwztQ== +"@octokit/openapi-types@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-7.0.0.tgz#0f6992db9854af15eca77d71ab0ec7fad2f20411" + integrity sha512-gV/8DJhAL/04zjTI95a7FhQwS6jlEE0W/7xeYAzuArD0KVAVWDLP2f3vi98hs3HLTczxXdRK/mF0tRoQPpolEw== "@octokit/plugin-enterprise-rest@^6.0.1": version "6.0.1" @@ -1583,12 +1659,12 @@ resolved "https://registry.yarnpkg.com/@octokit/plugin-request-log/-/plugin-request-log-1.0.3.tgz#70a62be213e1edc04bb8897ee48c311482f9700d" integrity sha512-4RFU4li238jMJAzLgAwkBAw+4Loile5haQMQr+uhFq27BmyJXcXSKvoQKqh0agsZEiUlW6iSv3FAgvmGkur7OQ== -"@octokit/plugin-rest-endpoint-methods@5.0.0": - version "5.0.0" - resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.0.0.tgz#cf2cdeb24ea829c31688216a5b165010b61f9a98" - integrity sha512-Jc7CLNUueIshXT+HWt6T+M0sySPjF32mSFQAK7UfAg8qGeRI6OM1GSBxDLwbXjkqy2NVdnqCedJcP1nC785JYg== +"@octokit/plugin-rest-endpoint-methods@5.0.1": + version "5.0.1" + resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.0.1.tgz#631b8d4edc6798b03489911252a25f2a4e58c594" + integrity sha512-vvWbPtPqLyIzJ7A4IPdTl+8IeuKAwMJ4LjvmqWOOdfSuqWQYZXq2CEd0hsnkidff2YfKlguzujHs/reBdAx8Sg== dependencies: - "@octokit/types" "^6.13.0" + "@octokit/types" "^6.13.1" deprecation "^2.3.1" "@octokit/request-error@^2.0.0", "@octokit/request-error@^2.0.5": @@ -1613,21 +1689,21 @@ universal-user-agent "^6.0.0" "@octokit/rest@^18.1.0": - version "18.5.2" - resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-18.5.2.tgz#0369e554b7076e3749005147be94c661c7a5a74b" - integrity sha512-Kz03XYfKS0yYdi61BkL9/aJ0pP2A/WK5vF/syhu9/kY30J8He3P68hv9GRpn8bULFx2K0A9MEErn4v3QEdbZcw== + version "18.5.3" + resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-18.5.3.tgz#6a2e6006a87ebbc34079c419258dd29ec9ff659d" + integrity sha512-KPAsUCr1DOdLVbZJgGNuE/QVLWEaVBpFQwDAz/2Cnya6uW2wJ/P5RVGk0itx7yyN1aGa8uXm2pri4umEqG1JBA== dependencies: "@octokit/core" "^3.2.3" "@octokit/plugin-paginate-rest" "^2.6.2" "@octokit/plugin-request-log" "^1.0.2" - "@octokit/plugin-rest-endpoint-methods" "5.0.0" + "@octokit/plugin-rest-endpoint-methods" "5.0.1" -"@octokit/types@^6.0.3", "@octokit/types@^6.11.0", "@octokit/types@^6.13.0", "@octokit/types@^6.7.1": - version "6.13.0" - resolved "https://registry.yarnpkg.com/@octokit/types/-/types-6.13.0.tgz#779e5b7566c8dde68f2f6273861dd2f0409480d0" - integrity sha512-W2J9qlVIU11jMwKHUp5/rbVUeErqelCsO5vW5PKNb7wAXQVUz87Rc+imjlEvpvbH8yUb+KHmv8NEjVZdsdpyxA== +"@octokit/types@^6.0.3", "@octokit/types@^6.11.0", "@octokit/types@^6.13.1", "@octokit/types@^6.7.1": + version "6.14.2" + resolved "https://registry.yarnpkg.com/@octokit/types/-/types-6.14.2.tgz#64c9457f38fb8522bdbba3c8cc814590a2d61bf5" + integrity sha512-wiQtW9ZSy4OvgQ09iQOdyXYNN60GqjCL/UdMsepDr1Gr0QzpW6irIKbH3REuAHXAhxkEk9/F2a3Gcs1P6kW5jA== dependencies: - "@octokit/openapi-types" "^6.0.0" + "@octokit/openapi-types" "^7.0.0" "@polka/url@^1.0.0-next.9": version "1.0.0-next.12" @@ -1642,9 +1718,9 @@ any-observable "^0.3.0" "@sindresorhus/is@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-4.0.0.tgz#2ff674e9611b45b528896d820d3d7a812de2f0e4" - integrity sha512-FyD2meJpDPjyNQejSjvnhpgI/azsQkA4lGbuu5BQZfjvJ9cbRZXzeWL2HceCekW4lixO9JPesIIQkSoLjeJHNQ== + version "4.0.1" + resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-4.0.1.tgz#d26729db850fa327b7cacc5522252194404226f5" + integrity sha512-Qm9hBEBu18wt1PO2flE7LPb30BHMQt1eQgbV76YntdNk73XZGpn3izvGTYxbGgzXKgbCjiia0uxTd3aTNQrY/g== "@sinonjs/commons@^1.7.0": version "1.8.3" @@ -1653,10 +1729,10 @@ dependencies: type-detect "4.0.8" -"@sinonjs/fake-timers@^6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-6.0.1.tgz#293674fccb3262ac782c7aadfdeca86b10c75c40" - integrity sha512-MZPUxrmFubI36XS1DI3qmI0YdN1gks62JtFZvxR67ljjSNCeK6U08Zx4msEWOXuofgqUt6zPHSi1H9fbjR/NRA== +"@sinonjs/fake-timers@^7.0.2": + version "7.1.2" + resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-7.1.2.tgz#2524eae70c4910edccf99b2f4e6efc5894aff7b5" + integrity sha512-iQADsW4LBMISqZ6Ci1dupJL9pprqwcVFTcOsEmQOEhW+KLCVn/Y4Jrvg2k19fIHCp+iFprriYPTdRcQR8NbUPg== dependencies: "@sinonjs/commons" "^1.7.0" @@ -1672,7 +1748,7 @@ resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82" integrity sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw== -"@types/babel__core@^7.0.0", "@types/babel__core@^7.1.7": +"@types/babel__core@^7.0.0", "@types/babel__core@^7.1.14": version "7.1.14" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.14.tgz#faaeefc4185ec71c389f4501ee5ec84b170cc402" integrity sha512-zGZJzzBUVDo/eV6KgbE0f0ZI7dInEYvo12Rb70uNQDshC3SkRMb67ja0GgRHZgAX3Za6rhaWlvbDO8rrGyAb1g== @@ -1811,7 +1887,7 @@ jest-diff "^26.0.0" pretty-format "^26.0.0" -"@types/json-schema@*", "@types/json-schema@^7.0.3", "@types/json-schema@^7.0.6": +"@types/json-schema@*", "@types/json-schema@^7.0.6", "@types/json-schema@^7.0.7": version "7.0.7" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.7.tgz#98a993516c859eb0d5c4c8f098317a9ea68db9ad" integrity sha512-cxWFQVseBm6O9Gbw1IWb8r6OS4OhSt3hPZLkFApLjM8TEXROBuQGLAH2i2gZpcXdLBIrpXuTDhH7Vbm1iXmNGA== @@ -1853,10 +1929,10 @@ resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.1.tgz#283f669ff76d7b8260df8ab7a4262cc83d988256" integrity sha512-fZQQafSREFyuZcdWFAExYjBiCL7AUCdgsk80iO0q4yihYYdcIiH28CcuPTGFgLOCC8RlW49GSQxdHwZP+I7CNg== -"@types/node@*", "@types/node@^14.14.40": - version "14.14.44" - resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.44.tgz#df7503e6002847b834371c004b372529f3f85215" - integrity sha512-+gaugz6Oce6ZInfI/tK4Pq5wIIkJMEJUu92RB3Eu93mtj4wjjjz9EB5mLp5s1pSsLXdC/CPut/xF20ZzAQJbTA== +"@types/node@*", "@types/node@^15.0.3": + version "15.12.0" + resolved "https://registry.yarnpkg.com/@types/node/-/node-15.12.0.tgz#6a459d261450a300e6865faeddb5af01c3389bb3" + integrity sha512-+aHJvoCsVhO2ZCuT4o5JtcPrCPyDE3+1nvbDprYes+pPkEsbjH7AGUCNtjMOXS0fqH14t+B7yLzaqSz92FPWyw== "@types/normalize-package-data@^2.4.0": version "2.4.0" @@ -1868,7 +1944,7 @@ resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0" integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA== -"@types/prettier@^2.0.0": +"@types/prettier@^2.1.5": version "2.2.3" resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.2.3.tgz#ef65165aea2924c9359205bf748865b8881753c0" integrity sha512-PijRCG/K3s3w1We6ynUKdxEc5AcuuH3NBmMDP8uvKVp6X43UY7NQlTzczakXP3DJR0F4dfNQIGjU2cUeRYs2AA== @@ -1917,10 +1993,17 @@ dependencies: "@types/yargs-parser" "*" +"@types/yargs@^16.0.0": + version "16.0.3" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-16.0.3.tgz#4b6d35bb8e680510a7dc2308518a80ee1ef27e01" + integrity sha512-YlFfTGS+zqCgXuXNV26rOIeETOkXnGQXP/pjjL9P0gO/EP9jTmc7pUBhx+jVEIxpq41RX33GQ7N3DzOSfZoglQ== + dependencies: + "@types/yargs-parser" "*" + "@types/yeoman-environment@*": - version "2.10.2" - resolved "https://registry.yarnpkg.com/@types/yeoman-environment/-/yeoman-environment-2.10.2.tgz#008b4f7a350ff8fb2be7ad7dda2580ead048ee76" - integrity sha512-Vz0qYnsUkTdH15nYo1OKax6wODQvPk6OKnbr3ATWRFizMTn6FhtoInuOIxVELK9swdqhAOF1goSdWhid0HmJkg== + version "2.10.3" + resolved "https://registry.yarnpkg.com/@types/yeoman-environment/-/yeoman-environment-2.10.3.tgz#e8e13b1238a32007b58290d79311aa5a9bf7e26c" + integrity sha512-1QQaJcXXFz5U/r83M6XShIr6GN3ps1mf/w4cDBrAmIP9ip+CPU+JklriPT6IMi2wb0oGzifx3iwjqXpHF63BlA== dependencies: "@types/diff" "*" "@types/inquirer" "*" @@ -1928,7 +2011,7 @@ "@types/text-table" "*" "@types/yeoman-generator" "*" chalk "^4.1.0" - rxjs ">=6.4.0" + rxjs "^6.4.0" "@types/yeoman-generator@*", "@types/yeoman-generator@^4.11.3": version "4.11.4" @@ -1943,73 +2026,73 @@ rxjs "^6.4.0" "@typescript-eslint/eslint-plugin@^4.14.1": - version "4.22.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.22.1.tgz#6bcdbaa4548553ab861b4e5f34936ead1349a543" - integrity sha512-kVTAghWDDhsvQ602tHBc6WmQkdaYbkcTwZu+7l24jtJiYvm9l+/y/b2BZANEezxPDiX5MK2ZecE+9BFi/YJryw== + version "4.26.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.26.0.tgz#12bbd6ebd5e7fabd32e48e1e60efa1f3554a3242" + integrity sha512-yA7IWp+5Qqf+TLbd8b35ySFOFzUfL7i+4If50EqvjT6w35X8Lv0eBHb6rATeWmucks37w+zV+tWnOXI9JlG6Eg== dependencies: - "@typescript-eslint/experimental-utils" "4.22.1" - "@typescript-eslint/scope-manager" "4.22.1" - debug "^4.1.1" + "@typescript-eslint/experimental-utils" "4.26.0" + "@typescript-eslint/scope-manager" "4.26.0" + debug "^4.3.1" functional-red-black-tree "^1.0.1" - lodash "^4.17.15" - regexpp "^3.0.0" - semver "^7.3.2" - tsutils "^3.17.1" - -"@typescript-eslint/experimental-utils@4.22.1": - version "4.22.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.22.1.tgz#3938a5c89b27dc9a39b5de63a62ab1623ab27497" - integrity sha512-svYlHecSMCQGDO2qN1v477ax/IDQwWhc7PRBiwAdAMJE7GXk5stF4Z9R/8wbRkuX/5e9dHqbIWxjeOjckK3wLQ== - dependencies: - "@types/json-schema" "^7.0.3" - "@typescript-eslint/scope-manager" "4.22.1" - "@typescript-eslint/types" "4.22.1" - "@typescript-eslint/typescript-estree" "4.22.1" - eslint-scope "^5.0.0" - eslint-utils "^2.0.0" - -"@typescript-eslint/parser@^4.14.1": - version "4.22.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.22.1.tgz#a95bda0fd01d994a15fc3e99dc984294f25c19cc" - integrity sha512-l+sUJFInWhuMxA6rtirzjooh8cM/AATAe3amvIkqKFeMzkn85V+eLzb1RyuXkHak4dLfYzOmF6DXPyflJvjQnw== - dependencies: - "@typescript-eslint/scope-manager" "4.22.1" - "@typescript-eslint/types" "4.22.1" - "@typescript-eslint/typescript-estree" "4.22.1" - debug "^4.1.1" + lodash "^4.17.21" + regexpp "^3.1.0" + semver "^7.3.5" + tsutils "^3.21.0" -"@typescript-eslint/scope-manager@4.22.1": - version "4.22.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.22.1.tgz#5bb357f94f9cd8b94e6be43dd637eb73b8f355b4" - integrity sha512-d5bAiPBiessSmNi8Amq/RuLslvcumxLmyhf1/Xa9IuaoFJ0YtshlJKxhlbY7l2JdEk3wS0EnmnfeJWSvADOe0g== +"@typescript-eslint/experimental-utils@4.26.0": + version "4.26.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.26.0.tgz#ba7848b3f088659cdf71bce22454795fc55be99a" + integrity sha512-TH2FO2rdDm7AWfAVRB5RSlbUhWxGVuxPNzGT7W65zVfl8H/WeXTk1e69IrcEVsBslrQSTDKQSaJD89hwKrhdkw== dependencies: - "@typescript-eslint/types" "4.22.1" - "@typescript-eslint/visitor-keys" "4.22.1" - -"@typescript-eslint/types@4.22.1": - version "4.22.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.22.1.tgz#bf99c6cec0b4a23d53a61894816927f2adad856a" - integrity sha512-2HTkbkdAeI3OOcWbqA8hWf/7z9c6gkmnWNGz0dKSLYLWywUlkOAQ2XcjhlKLj5xBFDf8FgAOF5aQbnLRvgNbCw== + "@types/json-schema" "^7.0.7" + "@typescript-eslint/scope-manager" "4.26.0" + "@typescript-eslint/types" "4.26.0" + "@typescript-eslint/typescript-estree" "4.26.0" + eslint-scope "^5.1.1" + eslint-utils "^3.0.0" -"@typescript-eslint/typescript-estree@4.22.1": - version "4.22.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.22.1.tgz#dca379eead8cdfd4edc04805e83af6d148c164f9" - integrity sha512-p3We0pAPacT+onSGM+sPR+M9CblVqdA9F1JEdIqRVlxK5Qth4ochXQgIyb9daBomyQKAXbygxp1aXQRV0GC79A== - dependencies: - "@typescript-eslint/types" "4.22.1" - "@typescript-eslint/visitor-keys" "4.22.1" - debug "^4.1.1" - globby "^11.0.1" +"@typescript-eslint/parser@^4.14.1": + version "4.26.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.26.0.tgz#31b6b732c9454f757b020dab9b6754112aa5eeaf" + integrity sha512-b4jekVJG9FfmjUfmM4VoOItQhPlnt6MPOBUL0AQbiTmm+SSpSdhHYlwayOm4IW9KLI/4/cRKtQCmDl1oE2OlPg== + dependencies: + "@typescript-eslint/scope-manager" "4.26.0" + "@typescript-eslint/types" "4.26.0" + "@typescript-eslint/typescript-estree" "4.26.0" + debug "^4.3.1" + +"@typescript-eslint/scope-manager@4.26.0": + version "4.26.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.26.0.tgz#60d1a71df162404e954b9d1c6343ff3bee496194" + integrity sha512-G6xB6mMo4xVxwMt5lEsNTz3x4qGDt0NSGmTBNBPJxNsrTXJSm21c6raeYroS2OwQsOyIXqKZv266L/Gln1BWqg== + dependencies: + "@typescript-eslint/types" "4.26.0" + "@typescript-eslint/visitor-keys" "4.26.0" + +"@typescript-eslint/types@4.26.0": + version "4.26.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.26.0.tgz#7c6732c0414f0a69595f4f846ebe12616243d546" + integrity sha512-rADNgXl1kS/EKnDr3G+m7fB9yeJNnR9kF7xMiXL6mSIWpr3Wg5MhxyfEXy/IlYthsqwBqHOr22boFbf/u6O88A== + +"@typescript-eslint/typescript-estree@4.26.0": + version "4.26.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.26.0.tgz#aea17a40e62dc31c63d5b1bbe9a75783f2ce7109" + integrity sha512-GHUgahPcm9GfBuy3TzdsizCcPjKOAauG9xkz9TR8kOdssz2Iz9jRCSQm6+aVFa23d5NcSpo1GdHGSQKe0tlcbg== + dependencies: + "@typescript-eslint/types" "4.26.0" + "@typescript-eslint/visitor-keys" "4.26.0" + debug "^4.3.1" + globby "^11.0.3" is-glob "^4.0.1" - semver "^7.3.2" - tsutils "^3.17.1" + semver "^7.3.5" + tsutils "^3.21.0" -"@typescript-eslint/visitor-keys@4.22.1": - version "4.22.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.22.1.tgz#6045ae25a11662c671f90b3a403d682dfca0b7a6" - integrity sha512-WPkOrIRm+WCLZxXQHCi+WG8T2MMTUFR70rWjdWYddLT7cEfb2P4a3O/J2U1FBVsSFTocXLCoXWY6MZGejeStvQ== +"@typescript-eslint/visitor-keys@4.26.0": + version "4.26.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.26.0.tgz#26d2583169222815be4dcd1da4fe5459bc3bcc23" + integrity sha512-cw4j8lH38V1ycGBbF+aFiLUls9Z0Bw8QschP3mkth50BbWzgFS33ISIgBzUMuQ2IdahoEv/rXstr8Zhlz4B1Zg== dependencies: - "@typescript-eslint/types" "4.22.1" + "@typescript-eslint/types" "4.26.0" eslint-visitor-keys "^2.0.0" "@webassemblyjs/ast@1.11.0": @@ -2217,19 +2300,24 @@ acorn-walk@^7.1.1: integrity sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA== acorn-walk@^8.0.0: - version "8.0.2" - resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.0.2.tgz#d4632bfc63fd93d0f15fd05ea0e984ffd3f5a8c3" - integrity sha512-+bpA9MJsHdZ4bgfDcpk0ozQyhhVct7rzOmO0s1IIr0AGGgKBljss8n2zp11rRP2wid5VGeh04CgeKzgat5/25A== + version "8.1.0" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.1.0.tgz#d3c6a9faf00987a5e2b9bdb506c2aa76cd707f83" + integrity sha512-mjmzmv12YIG/G8JQdQuz2MUDShEJ6teYpT5bmWA4q7iwoGen8xtt3twF3OvzIUl+Q06aWIjvnwQUKvQ6TtMRjg== acorn@^7.1.1, acorn@^7.4.0: version "7.4.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== -acorn@^8.0.4, acorn@^8.1.0, acorn@^8.2.1: - version "8.2.1" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.2.1.tgz#0d36af126fb6755095879c1dc6fd7edf7d60a5fb" - integrity sha512-z716cpm5TX4uzOzILx8PavOE6C6DKshHDw1aQN52M/yNSqE9s5O8SMfyhCCfCJ3HmTL0NkVOi+8a/55T7YB3bg== +acorn@^8.0.4, acorn@^8.2.1: + version "8.2.4" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.2.4.tgz#caba24b08185c3b56e3168e97d15ed17f4d31fd0" + integrity sha512-Ibt84YwBDDA890eDiDCEqcbwvHlBvzzDkU2cGBBDDI1QWT12jTiXIOn2CIw5KK4i6N5Z2HUxwYjzriDyqaqqZg== + +acorn@^8.2.4: + version "8.3.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.3.0.tgz#1193f9b96c4e8232f00b11a9edff81b2c8b98b88" + integrity sha512-tqPKHZ5CaBJw0Xmy0ZZvLs1qTV+BNFSyvn77ASXkpBNfIRk8ev26fKrD9iLGwGA9zedPao52GSHzq8lyZG0NUw== add-stream@^1.0.0: version "1.0.0" @@ -2281,9 +2369,9 @@ ajv@^6.1.0, ajv@^6.10.0, ajv@^6.12.3, ajv@^6.12.4, ajv@^6.12.5: uri-js "^4.2.2" ajv@^8.0.1: - version "8.1.0" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.1.0.tgz#45d5d3d36c7cdd808930cc3e603cf6200dbeb736" - integrity sha512-B/Sk2Ix7A36fs/ZkuGLIR86EdjbgR6fsAcbx9lOP/QBSXujDNbVmIS/U4Itz5k8fPFDeVZl/zQ/gJW4Jrq6XjQ== + version "8.3.0" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.3.0.tgz#25ee7348e32cdc4a1dbb38256bf6bdc451dd577c" + integrity sha512-RYE7B5An83d7eWnDR8kbdaIFqmKCNsP16ay1hDbJEU+sa0e3H9SebskCt0Uufem6cfAVu7Col6ubcn/W+Sm8/Q== dependencies: fast-deep-equal "^3.1.1" json-schema-traverse "^1.0.0" @@ -2356,6 +2444,11 @@ ansi-styles@^4.0.0, ansi-styles@^4.1.0: dependencies: color-convert "^2.0.1" +ansi-styles@^5.0.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" + integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== + any-observable@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/any-observable/-/any-observable-0.3.0.tgz#af933475e5806a67d0d7df090dd5e8bef65d119b" @@ -2584,16 +2677,16 @@ babel-core@^7.0.0-bridge.0: resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-7.0.0-bridge.0.tgz#95a492ddd90f9b4e9a4a1da14eb335b87b634ece" integrity sha512-poPX9mZH/5CSanm50Q+1toVci6pv5KSRv/5TWCwtzQS5XEwn40BcCrgIeMFWP9CKKIniKXNxoIOnOq4VVlGXhg== -babel-jest@^26.6.3: - version "26.6.3" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-26.6.3.tgz#d87d25cb0037577a0c89f82e5755c5d293c01056" - integrity sha512-pl4Q+GAVOHwvjrck6jKjvmGhnO3jHX/xuB9d27f+EJZ/6k+6nMuPjorrYp7s++bKKdANwzElBWnLWaObvTnaZA== +babel-jest@^27.0.2: + version "27.0.2" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-27.0.2.tgz#7dc18adb01322acce62c2af76ea2c7cd186ade37" + integrity sha512-9OThPl3/IQbo4Yul2vMz4FYwILPQak8XelX4YGowygfHaOl5R5gfjm4iVx4d8aUugkW683t8aq0A74E7b5DU1Q== dependencies: - "@jest/transform" "^26.6.2" - "@jest/types" "^26.6.2" - "@types/babel__core" "^7.1.7" + "@jest/transform" "^27.0.2" + "@jest/types" "^27.0.2" + "@types/babel__core" "^7.1.14" babel-plugin-istanbul "^6.0.0" - babel-preset-jest "^26.6.2" + babel-preset-jest "^27.0.1" chalk "^4.0.0" graceful-fs "^4.2.4" slash "^3.0.0" @@ -2616,10 +2709,10 @@ babel-plugin-istanbul@^6.0.0: istanbul-lib-instrument "^4.0.0" test-exclude "^6.0.0" -babel-plugin-jest-hoist@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-26.6.2.tgz#8185bd030348d254c6d7dd974355e6a28b21e62d" - integrity sha512-PO9t0697lNTmcEHH69mdtYiOIkkOlj9fySqfO3K1eCcdISevLAE0xY59VLLUj0SoiPiTX/JU2CYFpILydUa5Lw== +babel-plugin-jest-hoist@^27.0.1: + version "27.0.1" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-27.0.1.tgz#a6d10e484c93abff0f4e95f437dad26e5736ea11" + integrity sha512-sqBF0owAcCDBVEDtxqfYr2F36eSHdx7lAVGyYuOBRnKdD6gzcy0I0XrAYCZgOA3CRrLhmR+Uae9nogPzmAtOfQ== dependencies: "@babel/template" "^7.3.3" "@babel/types" "^7.3.3" @@ -2644,12 +2737,12 @@ babel-preset-current-node-syntax@^1.0.0: "@babel/plugin-syntax-optional-chaining" "^7.8.3" "@babel/plugin-syntax-top-level-await" "^7.8.3" -babel-preset-jest@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-26.6.2.tgz#747872b1171df032252426586881d62d31798fee" - integrity sha512-YvdtlVm9t3k777c5NPQIv6cxFFFapys25HiUmuSgHwIZhfifweR5c5Sf5nwE3MAbfu327CYSvps8Yx6ANLyleQ== +babel-preset-jest@^27.0.1: + version "27.0.1" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-27.0.1.tgz#7a50c75d16647c23a2cf5158d5bb9eb206b10e20" + integrity sha512-nIBIqCEpuiyhvjQs2mVNwTxQQa2xk70p9Dd/0obQGBf8FBzbnI8QhQKzLsWMN2i6q+5B0OcWDtrboBX5gmOLyA== dependencies: - babel-plugin-jest-hoist "^26.6.2" + babel-plugin-jest-hoist "^27.0.1" babel-preset-current-node-syntax "^1.0.0" balanced-match@^1.0.0: @@ -2769,13 +2862,13 @@ browser-process-hrtime@^1.0.0: integrity sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow== browserslist@^4.14.5: - version "4.16.4" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.16.4.tgz#7ebf913487f40caf4637b892b268069951c35d58" - integrity sha512-d7rCxYV8I9kj41RH8UKYnvDYCRENUlHRgyXy/Rhr/1BaeLGfiCptEdFE8MIrvGfWbBFNjVYx76SQWvNX1j+/cQ== + version "4.16.6" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.16.6.tgz#d7901277a5a88e554ed305b183ec9b0c08f66fa2" + integrity sha512-Wspk/PqO+4W9qp5iUTJsa1B/QrYn1keNCcEP5OvP7WBwT4KaDly0uONYmC6Xa3Z5IqnUgS0KcgLYu1l74x0ZXQ== dependencies: - caniuse-lite "^1.0.30001208" + caniuse-lite "^1.0.30001219" colorette "^1.2.2" - electron-to-chromium "^1.3.712" + electron-to-chromium "^1.3.723" escalade "^3.1.1" node-releases "^1.1.71" @@ -2939,22 +3032,15 @@ camelcase@^5.0.0, camelcase@^5.3.1: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== -camelcase@^6.0.0: +camelcase@^6.2.0: version "6.2.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.2.0.tgz#924af881c9d525ac9d87f40d964e5cea982a1809" integrity sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg== -caniuse-lite@^1.0.30001208: - version "1.0.30001214" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001214.tgz#70f153c78223515c6d37a9fde6cd69250da9d872" - integrity sha512-O2/SCpuaU3eASWVaesQirZv1MSjUNOvmugaD8zNSJqw6Vv5SGwoOpA9LJs3pNPfM745nxqPvfZY3MQKY4AKHYg== - -capture-exit@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/capture-exit/-/capture-exit-2.0.0.tgz#fb953bfaebeb781f62898239dabb426d08a509a4" - integrity sha512-PiT/hQmTonHhl/HFGN+Lx3JJUznrVYJ3+AQsnthneZbvW7x+f08Tk7yLJTLEOUvBTbduLeeBkxEaYXUOUrRq6g== - dependencies: - rsvp "^4.8.4" +caniuse-lite@^1.0.30001219: + version "1.0.30001228" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001228.tgz#bfdc5942cd3326fa51ee0b42fbef4da9d492a7fa" + integrity sha512-QQmLOGJ3DEgokHbMSA8cj2a+geXqmnpyOFT0lhQV6P3/YOJvGDEwoedcwxEQ30gJIwIIunHIicunJ2rzK5gB2A== capture-stack-trace@^1.0.0: version "1.0.1" @@ -2986,10 +3072,10 @@ chalk@^2.0.0, chalk@^2.0.1, chalk@^2.4.1, chalk@^2.4.2: escape-string-regexp "^1.0.5" supports-color "^5.3.0" -chalk@^4.0.0, chalk@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a" - integrity sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A== +chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.1.tgz#c80b3fab28bf6371e6863325eee67e618b77e6ad" + integrity sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg== dependencies: ansi-styles "^4.1.0" supports-color "^7.1.0" @@ -3043,10 +3129,15 @@ ci-info@^2.0.0: resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ== -cjs-module-lexer@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-0.6.0.tgz#4186fcca0eae175970aee870b9fe2d6cf8d5655f" - integrity sha512-uc2Vix1frTfnuzxxu1Hp4ktSvM3QaI4oXl4ZUqL1wjTu/BGki9TrCWoqLTg/drR1KwAEarXuRFCG2Svr1GxPFw== +ci-info@^3.1.1: + version "3.2.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.2.0.tgz#2876cb948a498797b5236f0095bc057d0dca38b6" + integrity sha512-dVqRX7fLUm8J6FgHJ418XuIgDLZDkYcDFTeL6TA2gt5WlIZUQrrH6EZrNClwT/H0FateUsZkGIOPRrLbP+PR9A== + +cjs-module-lexer@^1.0.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.2.1.tgz#2fd46d9906a126965aa541345c499aaa18e8cd73" + integrity sha512-jVamGdJPDeuQilKhvVn1h3knuMOZzr8QDnpk+M9aMlCaMkTDd6fBWPhiDqFvFZ07pL0liqabAiuy8SY4jGHeaw== class-utils@^0.3.5: version "0.3.6" @@ -3264,7 +3355,7 @@ columnify@^1.5.4: strip-ansi "^3.0.0" wcwidth "^1.0.0" -combined-stream@^1.0.6, combined-stream@~1.0.6: +combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@~1.0.6: version "1.0.8" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== @@ -3378,9 +3469,9 @@ conventional-changelog-angular@^5.0.11, conventional-changelog-angular@^5.0.12: q "^1.5.1" conventional-changelog-conventionalcommits@^4.3.1: - version "4.5.0" - resolved "https://registry.yarnpkg.com/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-4.5.0.tgz#a02e0b06d11d342fdc0f00c91d78265ed0bc0a62" - integrity sha512-buge9xDvjjOxJlyxUnar/+6i/aVEVGA7EEh4OafBCXPlLUQPGbRUBhBUveWRxzvR8TEjhKEP4BdepnpG2FSZXw== + version "4.6.0" + resolved "https://registry.yarnpkg.com/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-4.6.0.tgz#7fc17211dbca160acf24687bd2fdd5fd767750eb" + integrity sha512-sj9tj3z5cnHaSJCYObA9nISf7eq/YjscLPoq6nmew4SiOjxqL2KRpK20fjnjVbpNDjJ2HR3MoVcWKXwbVvzS0A== dependencies: compare-func "^2.0.0" lodash "^4.17.15" @@ -3612,7 +3703,7 @@ debug@2.6.9, debug@^2.2.0, debug@^2.3.3: dependencies: ms "2.0.0" -debug@4, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.2.0: +debug@4, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.2.0, debug@^4.3.1: version "4.3.1" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee" integrity sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ== @@ -3854,6 +3945,11 @@ diff-sequences@^26.6.2: resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-26.6.2.tgz#48ba99157de1923412eed41db6b6d4aa9ca7c0b1" integrity sha512-Mv/TDa3nZ9sbc5soK+OoA74BsS3mL37yixCvUAQkiuA4Wz6YtwP/K47n2rv2ovzHZvoiQeA5FTQOschKkEwB0Q== +diff-sequences@^27.0.1: + version "27.0.1" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-27.0.1.tgz#9c9801d52ed5f576ff0a20e3022a13ee6e297e7c" + integrity sha512-XPLijkfJUh/PIBnfkcSHgvD6tlYixmcMAn3osTk6jt+H0v/mgURto1XUiD9DKuGX5NDoVS6dSlA23gd9FUaCFg== + diff@^3.5.0: version "3.5.0" resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12" @@ -3892,9 +3988,9 @@ dns-equal@^1.0.0: integrity sha1-s55/HabrCnW6nBcySzR1PEfgZU0= dns-packet@^1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/dns-packet/-/dns-packet-1.3.1.tgz#12aa426981075be500b910eedcd0b47dd7deda5a" - integrity sha512-0UxfQkMhYAUaZI+xrNZOz/as5KgDU0M/fQ9b6SpkyLbk3GEswDi6PADJVaYJradtRVsRIlF1zLyOodbcTCDzUg== + version "1.3.4" + resolved "https://registry.yarnpkg.com/dns-packet/-/dns-packet-1.3.4.tgz#e3455065824a2507ba886c55a89963bb107dec6f" + integrity sha512-BQ6F4vycLXBvdrJZ6S3gZewt6rcrks9KBgM9vrhW+knGRqc8uEdT7fuCwloc7nny5xNoMJ17HGH0R/6fpo8ECA== dependencies: ip "^1.1.0" safe-buffer "^5.0.1" @@ -3991,20 +4087,20 @@ ejs@^3.1.5: dependencies: jake "^10.6.1" -electron-to-chromium@^1.3.712: - version "1.3.717" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.717.tgz#78d4c857070755fb58ab64bcc173db1d51cbc25f" - integrity sha512-OfzVPIqD1MkJ7fX+yTl2nKyOE4FReeVfMCzzxQS+Kp43hZYwHwThlGP+EGIZRXJsxCM7dqo8Y65NOX/HP12iXQ== +electron-to-chromium@^1.3.723: + version "1.3.727" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.727.tgz#857e310ca00f0b75da4e1db6ff0e073cc4a91ddf" + integrity sha512-Mfz4FIB4FSvEwBpDfdipRIrwd6uo8gUDoRDF4QEYb4h4tSuI3ov594OrjU6on042UlFHouIJpClDODGkPcBSbg== elegant-spinner@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/elegant-spinner/-/elegant-spinner-1.0.1.tgz#db043521c95d7e303fd8f345bedc3349cfb0729e" integrity sha1-2wQ1IcldfjA/2PNFvtwzSc+wcp4= -emittery@^0.7.1: - version "0.7.2" - resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.7.2.tgz#25595908e13af0f5674ab419396e2fb394cdfa82" - integrity sha512-A8OG5SR/ij3SsJdWDJdkkSYUjQdCUx6APQXem0SaEePBSRg4eymGYwBkKo1Y6DU+af/Jn2dBQqDBvjnr9Vi8nQ== +emittery@^0.8.1: + version "0.8.1" + resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.8.1.tgz#bb23cc86d03b30aa75a7f734819dee2e1ba70860" + integrity sha512-uDfvUjVrfGJJhymx/kz6prltenw1u7WrCg1oa94zYY8xxVpLLUu045LAT0dhDZdXG58/EpPL/5kA180fQ/qudg== emoji-regex@^7.0.1: version "7.0.3" @@ -4036,9 +4132,9 @@ end-of-stream@^1.1.0: once "^1.4.0" enhanced-resolve@^5.8.0: - version "5.8.0" - resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.8.0.tgz#d9deae58f9d3773b6a111a5a46831da5be5c9ac0" - integrity sha512-Sl3KRpJA8OpprrtaIswVki3cWPiPKxXuFxJXBp+zNb6s6VwNWwFRUdtmzd2ReUut8n+sCPx7QCtQ7w5wfJhSgQ== + version "5.8.2" + resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.8.2.tgz#15ddc779345cbb73e97c611cd00c01c1e7bf4d8b" + integrity sha512-F27oB3WuHDzvR2DOGNTaYy0D5o0cnrv8TeI482VM4kYgQd/FT9lUQwuNsJ0oOHtBUq7eiW5ytqzp7nBFknL+GA== dependencies: graceful-fs "^4.2.4" tapable "^2.2.0" @@ -4152,6 +4248,11 @@ escape-string-regexp@^2.0.0: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== +escape-string-regexp@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" + integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== + escodegen@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-2.0.0.tgz#5e32b12833e8aa8fa35e1bf0befa89380484c7dd" @@ -4196,7 +4297,7 @@ eslint-plugin-prettier@^3.1.4: dependencies: prettier-linter-helpers "^1.0.0" -eslint-scope@^5.0.0, eslint-scope@^5.1.1: +eslint-scope@5.1.1, eslint-scope@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== @@ -4211,35 +4312,44 @@ eslint-utils@^2.0.0, eslint-utils@^2.1.0: dependencies: eslint-visitor-keys "^1.1.0" +eslint-utils@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-3.0.0.tgz#8aebaface7345bb33559db0a1f13a1d2d48c3672" + integrity sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA== + dependencies: + eslint-visitor-keys "^2.0.0" + eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e" integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ== eslint-visitor-keys@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8" - integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ== + version "2.1.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303" + integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== eslint@^7.12.1: - version "7.25.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.25.0.tgz#1309e4404d94e676e3e831b3a3ad2b050031eb67" - integrity sha512-TVpSovpvCNpLURIScDRB6g5CYu/ZFq9GfX2hLNIV4dSBKxIWojeDODvYl3t0k0VtMxYeR8OXPCFE5+oHMlGfhw== + version "7.27.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.27.0.tgz#665a1506d8f95655c9274d84bd78f7166b07e9c7" + integrity sha512-JZuR6La2ZF0UD384lcbnd0Cgg6QJjiCwhMD6eU4h/VGPcVGwawNNzKU41tgokGXnfjOOyI6QIffthhJTPzzuRA== dependencies: "@babel/code-frame" "7.12.11" - "@eslint/eslintrc" "^0.4.0" + "@eslint/eslintrc" "^0.4.1" ajv "^6.10.0" chalk "^4.0.0" cross-spawn "^7.0.2" debug "^4.0.1" doctrine "^3.0.0" enquirer "^2.3.5" + escape-string-regexp "^4.0.0" eslint-scope "^5.1.1" eslint-utils "^2.1.0" eslint-visitor-keys "^2.0.0" espree "^7.3.1" esquery "^1.4.0" esutils "^2.0.2" + fast-deep-equal "^3.1.3" file-entry-cache "^6.0.1" functional-red-black-tree "^1.0.1" glob-parent "^5.0.0" @@ -4251,7 +4361,7 @@ eslint@^7.12.1: js-yaml "^3.13.1" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.4.1" - lodash "^4.17.21" + lodash.merge "^4.6.2" minimatch "^3.0.4" natural-compare "^1.4.0" optionator "^0.9.1" @@ -4260,7 +4370,7 @@ eslint@^7.12.1: semver "^7.2.1" strip-ansi "^6.0.0" strip-json-comments "^3.1.0" - table "^6.0.4" + table "^6.0.9" text-table "^0.2.0" v8-compile-cache "^2.0.3" @@ -4329,11 +4439,6 @@ eventsource@^1.0.7: dependencies: original "^1.0.0" -exec-sh@^0.3.2: - version "0.3.6" - resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.3.6.tgz#ff264f9e325519a60cb5e273692943483cca63bc" - integrity sha512-nQn+hI3yp+oD0huYhKwvYI32+JFeq+XkNcD1GAo3Y/MjxsfVGmrrzrnzjWiNY6f+pUCP440fThsFh5gZrRAU/w== - execa@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/execa/-/execa-1.0.0.tgz#c6236a5bb4df6d6f15e88e7f017798216749ddd8" @@ -4363,9 +4468,9 @@ execa@^4.0.0, execa@^4.1.0: strip-final-newline "^2.0.0" execa@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-5.0.0.tgz#4029b0007998a841fbd1032e5f4de86a3c1e3376" - integrity sha512-ov6w/2LCiuyO4RLYGdpFGjkcs0wMTgGE8PrkTHikeUy5iJekXyPIKUjifk5CsE0pt7sMCrMZ3YNqoCj6idQOnQ== + version "5.0.1" + resolved "https://registry.yarnpkg.com/execa/-/execa-5.0.1.tgz#aee63b871c9b2cb56bc9addcd3c70a785c6bf0d1" + integrity sha512-4hFTjFbFzQa3aCLobpbPJR/U+VoL1wdV5ozOWjeet0AWDeYr9UFGM1eUFWHX+VtOWFq4p0xXUXfW1YxUaP4fpw== dependencies: cross-spawn "^7.0.3" get-stream "^6.0.0" @@ -4402,17 +4507,17 @@ expand-tilde@^2.0.0, expand-tilde@^2.0.2: dependencies: homedir-polyfill "^1.0.1" -expect@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/expect/-/expect-26.6.2.tgz#c6b996bf26bf3fe18b67b2d0f51fc981ba934417" - integrity sha512-9/hlOBkQl2l/PLHJx6JjoDF6xPKcJEsUlWKb23rKE7KzeDqUZKXKNMW27KIue5JMdBV9HgmoJPcc8HtO85t9IA== +expect@^27.0.2: + version "27.0.2" + resolved "https://registry.yarnpkg.com/expect/-/expect-27.0.2.tgz#e66ca3a4c9592f1c019fa1d46459a9d2084f3422" + integrity sha512-YJFNJe2+P2DqH+ZrXy+ydRQYO87oxRUonZImpDodR1G7qo3NYd3pL+NQ9Keqpez3cehczYwZDBC3A7xk3n7M/w== dependencies: - "@jest/types" "^26.6.2" - ansi-styles "^4.0.0" - jest-get-type "^26.3.0" - jest-matcher-utils "^26.6.2" - jest-message-util "^26.6.2" - jest-regex-util "^26.0.0" + "@jest/types" "^27.0.2" + ansi-styles "^5.0.0" + jest-get-type "^27.0.1" + jest-matcher-utils "^27.0.2" + jest-message-util "^27.0.2" + jest-regex-util "^27.0.1" express@^4.17.1: version "4.17.1" @@ -4503,7 +4608,7 @@ extsprintf@^1.2.0: resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= -fast-deep-equal@^3.1.1: +fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== @@ -4743,14 +4848,14 @@ flatted@^3.1.0: integrity sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA== flow-parser@0.*: - version "0.149.0" - resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.149.0.tgz#6e5749ad832ba211968429accdb6a3858706e4f8" - integrity sha512-ruUVkZuM9oFQjhSsLO/OJYRYpGnuXJpTnIZmgzna6DyLFb3CLpeO27oJbWyeXaa830hmKf0JRzpcdFsFS8lmpg== + version "0.151.0" + resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.151.0.tgz#e1656a8bbc5979d3e624224dcc72e3fc8da58cdc" + integrity sha512-jDcpO8IFfVs29jlYsh/cDDZ4yQcl8ed0RZP+oQ2Hoo7OrI3xffTYnYa1lg84SB51iIbXLDhS3uwQdXgqKZWb5g== follow-redirects@^1.0.0, follow-redirects@^1.10.0: - version "1.13.3" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.13.3.tgz#e5598ad50174c1bc4e872301e82ac2cd97f90267" - integrity sha512-DUgl6+HDzB0iEptNQEXLx/KhTmDb8tZUHSeLqpnjpknR70H0nC2t9N73BK6fN4hOvJ84pKlIQVQ4k5FFlBedKA== + version "1.14.1" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.1.tgz#d9114ded0a1cfdd334e164e6662ad02bfd91ff43" + integrity sha512-HWqDgT7ZEkqRzBvc2s64vSZ/hfOceEol3ac/7tKwzuvEyWx3/4UegXh5oBOIotkGsObyk3xznnSRVADBgWSQVg== for-in@^1.0.2: version "1.0.2" @@ -4770,6 +4875,15 @@ forever-agent@~0.6.1: resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= +form-data@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f" + integrity sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.8" + mime-types "^2.1.12" + form-data@~2.3.2: version "2.3.3" resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" @@ -4838,7 +4952,7 @@ fsevents@^1.2.7: bindings "^1.5.0" nan "^2.12.1" -fsevents@^2.1.2: +fsevents@^2.3.2: version "2.3.2" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== @@ -4912,11 +5026,6 @@ get-port@^5.1.1: resolved "https://registry.yarnpkg.com/get-port/-/get-port-5.1.1.tgz#0469ed07563479de6efb986baf053dcd7d4e3193" integrity sha512-g/Q1aTSDOxFpchXC4i8ZWvxA1lnPqx/JHqcpIw0/LX9T8x/GBbi6YnlN5nhaKIFkT8oFsscUKgDJYxfwfS6QsQ== -get-stdin@8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-8.0.0.tgz#cbad6a73feb75f6eeb22ba9e01f89aa28aa97a53" - integrity sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg== - get-stdin@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe" @@ -5048,9 +5157,9 @@ glob-to-regexp@^0.4.1: integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== glob@^7.0.0, glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: - version "7.1.6" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" - integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== + version "7.1.7" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.7.tgz#3b193e9233f01d42d0b3f78294bbeeb418f94a90" + integrity sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ== dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" @@ -5135,7 +5244,7 @@ globby@^10.0.1: merge2 "^1.2.3" slash "^3.0.0" -globby@^11.0.1, globby@^11.0.2: +globby@^11.0.2, globby@^11.0.3: version "11.0.3" resolved "https://registry.yarnpkg.com/globby/-/globby-11.0.3.tgz#9b1f0cb523e171dd1ad8c7b2a9fb4b644b9593cb" integrity sha512-ffdmosjA807y7+lA1NM0jELARVmYul/715xiILEjo3hBLPTcirgQNnXECn5g3mtR8TOLCVbkfua1Hpen25/Xcg== @@ -5231,11 +5340,6 @@ grouped-queue@^1.1.0: dependencies: lodash "^4.17.15" -growly@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" - integrity sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE= - gzip-size@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/gzip-size/-/gzip-size-6.0.0.tgz#065367fd50c239c0671cbcbad5be3e2eeb10e462" @@ -5539,9 +5643,9 @@ iconv-lite@^0.6.2: safer-buffer ">= 2.1.2 < 3.0.0" ignore-walk@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.3.tgz#017e2447184bfeade7c238e4aefdd1e8f95b1e37" - integrity sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw== + version "3.0.4" + resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.4.tgz#c9a09f69b7c7b479a5d74ac1a3c0d4236d2a6335" + integrity sha512-PY6Ii8o1jMRA1z4F2hRkH/xN59ox43DavKvD3oDpfurRlOJyAHpifIwpbdv1n4jt4ov0jSpw3kQ4GhJnpBL6WQ== dependencies: minimatch "^3.0.4" @@ -5766,9 +5870,9 @@ is-arrayish@^0.2.1: integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= is-bigint@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-bigint/-/is-bigint-1.0.1.tgz#6923051dfcbc764278540b9ce0e6b3213aa5ebc2" - integrity sha512-J0ELF4yHFxHy0cmSxZuheDOz2luOdVvqjwmEcj8H/L1JHeuEDSDbeRP+Dk9kFVk5RTFzbucJ2Kb9F7ixY2QaCg== + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-bigint/-/is-bigint-1.0.2.tgz#ffb381442503235ad245ea89e45b3dbff040ee5a" + integrity sha512-0JV5+SOCQkIdzjBK9buARcV804Ddu7A0Qet6sHi3FimE9ne6m4BGQZfRn+NZiXbBk4F4XmHfDZIipLj9pX8dSA== is-binary-path@^1.0.0: version "1.0.1" @@ -5778,11 +5882,11 @@ is-binary-path@^1.0.0: binary-extensions "^1.0.0" is-boolean-object@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.1.0.tgz#e2aaad3a3a8fca34c28f6eee135b156ed2587ff0" - integrity sha512-a7Uprx8UtD+HWdyYwnD1+ExtTgqQtD2k/1yJgtXP6wnMm8byhkoTZRl+95LLThpzNZJ5aEvi46cdH+ayMFRwmA== + version "1.1.1" + resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.1.1.tgz#3c0878f035cb821228d350d2e1e36719716a3de8" + integrity sha512-bXdQWkECBUIAcCkeH1unwJLIpZYaa5VvuygSyS/c2lf719mTKZDU5UdDRlpd01UjADgmW8RfqaP+mRaVPdr/Ng== dependencies: - call-bind "^1.0.0" + call-bind "^1.0.2" is-buffer@^1.1.5: version "1.1.6" @@ -5801,10 +5905,17 @@ is-ci@^2.0.0: dependencies: ci-info "^2.0.0" +is-ci@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-3.0.0.tgz#c7e7be3c9d8eef7d0fa144390bd1e4b88dc4c994" + integrity sha512-kDXyttuLeslKAHYL/K28F2YkM3x5jvFPEw3yXbRptXydjD9rpLEz+C5K5iutY9ZiUu6AP41JdvRQwF4Iqs4ZCQ== + dependencies: + ci-info "^3.1.1" + is-core-module@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.2.0.tgz#97037ef3d52224d85163f5597b2b63d9afed981a" - integrity sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ== + version "2.4.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.4.0.tgz#8e9fc8e15027b011418026e98f0e6f4d86305cc1" + integrity sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A== dependencies: has "^1.0.3" @@ -5823,9 +5934,9 @@ is-data-descriptor@^1.0.0: kind-of "^6.0.0" is-date-object@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.2.tgz#bda736f2cd8fd06d32844e7743bfa7494c3bfd7e" - integrity sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g== + version "1.0.4" + resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.4.tgz#550cfcc03afada05eea3dd30981c7b09551f73e5" + integrity sha512-/b4ZVsG7Z5XVtIxs/h9W8nvfLgSAyKYdtGWQLbqy6jA1icmgjf8WCoTKgeS4wy5tYaPePouzFMANbnj94c2Z+A== is-descriptor@^0.1.0: version "0.1.6" @@ -5845,11 +5956,6 @@ is-descriptor@^1.0.0, is-descriptor@^1.0.2: is-data-descriptor "^1.0.0" kind-of "^6.0.2" -is-docker@^2.0.0: - version "2.2.1" - resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.2.1.tgz#33eeabe23cfe86f14bde4408a02c0cfb853acdaa" - integrity sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ== - 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" @@ -5926,9 +6032,9 @@ is-negative-zero@^2.0.1: integrity sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w== is-number-object@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/is-number-object/-/is-number-object-1.0.4.tgz#36ac95e741cf18b283fc1ddf5e83da798e3ec197" - integrity sha512-zohwelOAur+5uXtk8O3GPQ1eAcu4ZX3UwxQhUlfFFMNpUd83gXgjbhJh6HmB6LUNV/ieOLQuDwJO3dWJosUeMw== + version "1.0.5" + resolved "https://registry.yarnpkg.com/is-number-object/-/is-number-object-1.0.5.tgz#6edfaeed7950cff19afedce9fbfca9ee6dd289eb" + integrity sha512-RU0lI/n95pMoUKu9v1BZP5MBcZuNSVJkMkAG2dJqC4z2GlkGUNeH68SuHuBKBD/XFe+LHZ+f9BKkLET60Niedw== is-number@^3.0.0: version "3.0.0" @@ -6005,7 +6111,7 @@ is-plain-object@^5.0.0: resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-5.0.0.tgz#4427f50ab3429e9025ea7d52e9043a9ef4159344" integrity sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q== -is-potential-custom-element-name@^1.0.0: +is-potential-custom-element-name@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz#171ed6f19e3ac554394edf78caa05784a45bebb5" integrity sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ== @@ -6021,12 +6127,12 @@ is-redirect@^1.0.0: integrity sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ= is-regex@^1.0.4, is-regex@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.2.tgz#81c8ebde4db142f2cf1c53fc86d6a45788266251" - integrity sha512-axvdhb5pdhEVThqJzYXwMlVuZwC+FF2DpcOhTS+y/8jVq4trxyPgfcwIxIKiyeuLlSQYKkmUaPQJ8ZE4yNKXDg== + version "1.1.3" + resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.3.tgz#d029f9aff6448b93ebbe3f33dac71511fdcbef9f" + integrity sha512-qSVXFz28HM7y+IWX6vLCsexdlvzT1PJNFSBuaQLQ5o0IEw8UDYW6/2+eCMVyIsbM8CNLX2a/QWmSpyxYEHY7CQ== dependencies: call-bind "^1.0.2" - has-symbols "^1.0.1" + has-symbols "^1.0.2" is-regexp@^1.0.0: version "1.0.0" @@ -6063,16 +6169,16 @@ is-stream@^2.0.0: integrity sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw== is-string@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.5.tgz#40493ed198ef3ff477b8c7f92f644ec82a5cd3a6" - integrity sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ== + version "1.0.6" + resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.6.tgz#3fe5d5992fb0d93404f32584d4b0179a71b54a5f" + integrity sha512-2gdzbKUuqtQ3lYNrUTQYoClPhm7oQu4UdpSZMp1/DGgkHBT8E2Z1l0yMdb6D4zNAxwDiMv8MdulKROJGNl0Q0w== is-symbol@^1.0.2, is-symbol@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.3.tgz#38e1014b9e6329be0de9d24a414fd7441ec61937" - integrity sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ== + version "1.0.4" + resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.4.tgz#a6dac93b635b063ca6872236de88910a57af139c" + integrity sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg== dependencies: - has-symbols "^1.0.1" + has-symbols "^1.0.2" is-text-path@^1.0.1: version "1.0.1" @@ -6106,22 +6212,15 @@ is-wsl@^1.1.0: resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d" integrity sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0= -is-wsl@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-2.2.0.tgz#74a4c76e77ca9fd3f932f290c17ea326cd157271" - integrity sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww== - dependencies: - is-docker "^2.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" integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= isbinaryfile@^4.0.0: - version "4.0.6" - resolved "https://registry.yarnpkg.com/isbinaryfile/-/isbinaryfile-4.0.6.tgz#edcb62b224e2b4710830b67498c8e4e5a4d2610b" - integrity sha512-ORrEy+SNVqUhrCaal4hA4fBzhggQQ+BaLntyPOdoEiwlKZW9BZiJXjg3RMiruE4tPEI3pyVPpySHQF/dKWperg== + version "4.0.8" + resolved "https://registry.yarnpkg.com/isbinaryfile/-/isbinaryfile-4.0.8.tgz#5d34b94865bd4946633ecc78a026fc76c5b11fcf" + integrity sha512-53h6XFniq77YdW+spoRrebh0mnmTxRPTlcuIArO57lmMdq4uBKFKaeTjnb92oYWrSn/LVL+LT+Hap2tFQj8V+w== isexe@^2.0.0: version "2.0.0" @@ -6225,59 +6324,86 @@ jake@^10.6.1: filelist "^1.0.1" minimatch "^3.0.4" -jest-changed-files@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-26.6.2.tgz#f6198479e1cc66f22f9ae1e22acaa0b429c042d0" - integrity sha512-fDS7szLcY9sCtIip8Fjry9oGf3I2ht/QT21bAHm5Dmf0mD4X3ReNUf17y+bO6fR8WgbIZTlbyG1ak/53cbRzKQ== +jest-changed-files@^27.0.2: + version "27.0.2" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-27.0.2.tgz#997253042b4a032950fc5f56abf3c5d1f8560801" + integrity sha512-eMeb1Pn7w7x3wue5/vF73LPCJ7DKQuC9wQUR5ebP9hDPpk5hzcT/3Hmz3Q5BOFpR3tgbmaWhJcMTVgC8Z1NuMw== dependencies: - "@jest/types" "^26.6.2" - execa "^4.0.0" - throat "^5.0.0" + "@jest/types" "^27.0.2" + execa "^5.0.0" + throat "^6.0.1" -jest-cli@^26.6.3: - version "26.6.3" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-26.6.3.tgz#43117cfef24bc4cd691a174a8796a532e135e92a" - integrity sha512-GF9noBSa9t08pSyl3CY4frMrqp+aQXFGFkf5hEPbh/pIUFYWMK6ZLTfbmadxJVcJrdRoChlWQsA2VkJcDFK8hg== +jest-circus@^27.0.4: + version "27.0.4" + resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-27.0.4.tgz#3b261514ee3b3da33def736a6352c98ff56bb6e6" + integrity sha512-QD+eblDiRphta630WRKewuASLs/oY1Zki2G4bccntRvrTHQ63ljwFR5TLduuK4Zg0ZPzW0+8o6AP7KRd1yKOjw== dependencies: - "@jest/core" "^26.6.3" - "@jest/test-result" "^26.6.2" - "@jest/types" "^26.6.2" + "@jest/environment" "^27.0.3" + "@jest/test-result" "^27.0.2" + "@jest/types" "^27.0.2" + "@types/node" "*" + chalk "^4.0.0" + co "^4.6.0" + dedent "^0.7.0" + expect "^27.0.2" + is-generator-fn "^2.0.0" + jest-each "^27.0.2" + jest-matcher-utils "^27.0.2" + jest-message-util "^27.0.2" + jest-runtime "^27.0.4" + jest-snapshot "^27.0.4" + jest-util "^27.0.2" + pretty-format "^27.0.2" + slash "^3.0.0" + stack-utils "^2.0.3" + throat "^6.0.1" + +jest-cli@^27.0.4: + version "27.0.4" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-27.0.4.tgz#491b12c754c0d7c6873b13a66f26b3a80a852910" + integrity sha512-E0T+/i2lxsWAzV7LKYd0SB7HUAvePqaeIh5vX43/G5jXLhv1VzjYzJAGEkTfvxV774ll9cyE2ljcL73PVMEOXQ== + dependencies: + "@jest/core" "^27.0.4" + "@jest/test-result" "^27.0.2" + "@jest/types" "^27.0.2" chalk "^4.0.0" exit "^0.1.2" graceful-fs "^4.2.4" import-local "^3.0.2" - is-ci "^2.0.0" - jest-config "^26.6.3" - jest-util "^26.6.2" - jest-validate "^26.6.2" + jest-config "^27.0.4" + jest-util "^27.0.2" + jest-validate "^27.0.2" prompts "^2.0.1" - yargs "^15.4.1" + yargs "^16.0.3" -jest-config@^26.6.3: - version "26.6.3" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-26.6.3.tgz#64f41444eef9eb03dc51d5c53b75c8c71f645349" - integrity sha512-t5qdIj/bCj2j7NFVHb2nFB4aUdfucDn3JRKgrZnplb8nieAirAzRSHP8uDEd+qV6ygzg9Pz4YG7UTJf94LPSyg== +jest-config@^27.0.4: + version "27.0.4" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-27.0.4.tgz#c4f41378acf40ca77860fb4e213b12109d87b8cf" + integrity sha512-VkQFAHWnPQefdvHU9A+G3H/Z3NrrTKqWpvxgQz3nkUdkDTWeKJE6e//BL+R7z79dXOMVksYgM/z6ndtN0hfChg== dependencies: "@babel/core" "^7.1.0" - "@jest/test-sequencer" "^26.6.3" - "@jest/types" "^26.6.2" - babel-jest "^26.6.3" + "@jest/test-sequencer" "^27.0.4" + "@jest/types" "^27.0.2" + babel-jest "^27.0.2" chalk "^4.0.0" deepmerge "^4.2.2" glob "^7.1.1" graceful-fs "^4.2.4" - jest-environment-jsdom "^26.6.2" - jest-environment-node "^26.6.2" - jest-get-type "^26.3.0" - jest-jasmine2 "^26.6.3" - jest-regex-util "^26.0.0" - jest-resolve "^26.6.2" - jest-util "^26.6.2" - jest-validate "^26.6.2" - micromatch "^4.0.2" - pretty-format "^26.6.2" - -jest-diff@^26.0.0, jest-diff@^26.6.2: + is-ci "^3.0.0" + jest-circus "^27.0.4" + jest-environment-jsdom "^27.0.3" + jest-environment-node "^27.0.3" + jest-get-type "^27.0.1" + jest-jasmine2 "^27.0.4" + jest-regex-util "^27.0.1" + jest-resolve "^27.0.4" + jest-runner "^27.0.4" + jest-util "^27.0.2" + jest-validate "^27.0.2" + micromatch "^4.0.4" + pretty-format "^27.0.2" + +jest-diff@^26.0.0: version "26.6.2" resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-26.6.2.tgz#1aa7468b52c3a68d7d5c5fdcdfcd5e49bd164394" integrity sha512-6m+9Z3Gv9wN0WFVasqjCL/06+EFCMTqDEUl/b87HYK2rAPTyfz4ZIuSlPhY51PIQRWx5TaxeF1qmXKe9gfN3sA== @@ -6287,138 +6413,167 @@ jest-diff@^26.0.0, jest-diff@^26.6.2: jest-get-type "^26.3.0" pretty-format "^26.6.2" -jest-docblock@^26.0.0: - version "26.0.0" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-26.0.0.tgz#3e2fa20899fc928cb13bd0ff68bd3711a36889b5" - integrity sha512-RDZ4Iz3QbtRWycd8bUEPxQsTlYazfYn/h5R65Fc6gOfwozFhoImx+affzky/FFBuqISPTqjXomoIGJVKBWoo0w== - dependencies: - detect-newline "^3.0.0" - -jest-each@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-26.6.2.tgz#02526438a77a67401c8a6382dfe5999952c167cb" - integrity sha512-Mer/f0KaATbjl8MCJ+0GEpNdqmnVmDYqCTJYTvoo7rqmRiDllmp2AYN+06F93nXcY3ur9ShIjS+CO/uD+BbH4A== +jest-diff@^27.0.2: + version "27.0.2" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-27.0.2.tgz#f315b87cee5dc134cf42c2708ab27375cc3f5a7e" + integrity sha512-BFIdRb0LqfV1hBt8crQmw6gGQHVDhM87SpMIZ45FPYKReZYG5er1+5pIn2zKqvrJp6WNox0ylR8571Iwk2Dmgw== dependencies: - "@jest/types" "^26.6.2" chalk "^4.0.0" - jest-get-type "^26.3.0" - jest-util "^26.6.2" - pretty-format "^26.6.2" + diff-sequences "^27.0.1" + jest-get-type "^27.0.1" + pretty-format "^27.0.2" -jest-environment-jsdom@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-26.6.2.tgz#78d09fe9cf019a357009b9b7e1f101d23bd1da3e" - integrity sha512-jgPqCruTlt3Kwqg5/WVFyHIOJHsiAvhcp2qiR2QQstuG9yWox5+iHpU3ZrcBxW14T4fe5Z68jAfLRh7joCSP2Q== +jest-docblock@^27.0.1: + version "27.0.1" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-27.0.1.tgz#bd9752819b49fa4fab1a50b73eb58c653b962e8b" + integrity sha512-TA4+21s3oebURc7VgFV4r7ltdIJ5rtBH1E3Tbovcg7AV+oLfD5DcJ2V2vJ5zFA9sL5CFd/d2D6IpsAeSheEdrA== dependencies: - "@jest/environment" "^26.6.2" - "@jest/fake-timers" "^26.6.2" - "@jest/types" "^26.6.2" - "@types/node" "*" - jest-mock "^26.6.2" - jest-util "^26.6.2" - jsdom "^16.4.0" + detect-newline "^3.0.0" -jest-environment-node@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-26.6.2.tgz#824e4c7fb4944646356f11ac75b229b0035f2b0c" - integrity sha512-zhtMio3Exty18dy8ee8eJ9kjnRyZC1N4C1Nt/VShN1apyXc8rWGtJ9lI7vqiWcyyXS4BVSEn9lxAM2D+07/Tag== +jest-each@^27.0.2: + version "27.0.2" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-27.0.2.tgz#865ddb4367476ced752167926b656fa0dcecd8c7" + integrity sha512-OLMBZBZ6JkoXgUenDtseFRWA43wVl2BwmZYIWQws7eS7pqsIvePqj/jJmEnfq91ALk3LNphgwNK/PRFBYi7ITQ== dependencies: - "@jest/environment" "^26.6.2" - "@jest/fake-timers" "^26.6.2" - "@jest/types" "^26.6.2" + "@jest/types" "^27.0.2" + chalk "^4.0.0" + jest-get-type "^27.0.1" + jest-util "^27.0.2" + pretty-format "^27.0.2" + +jest-environment-jsdom@^27.0.3: + version "27.0.3" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-27.0.3.tgz#ed73e913ddc03864eb9f934b5cbabf1b63504e2e" + integrity sha512-5KLmgv1bhiimpSA8oGTnZYk6g4fsNyZiA/6gI2tAZUgrufd7heRUSVh4gRokzZVEj8zlwAQYT0Zs6tuJSW/ECA== + dependencies: + "@jest/environment" "^27.0.3" + "@jest/fake-timers" "^27.0.3" + "@jest/types" "^27.0.2" "@types/node" "*" - jest-mock "^26.6.2" - jest-util "^26.6.2" + jest-mock "^27.0.3" + jest-util "^27.0.2" + jsdom "^16.6.0" + +jest-environment-node@^27.0.3: + version "27.0.3" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-27.0.3.tgz#b4acb3679d2552a4215732cab8b0ca7ec4398ee0" + integrity sha512-co2/IVnIFL3cItpFULCvXFg9us4gvWXgs7mutAMPCbFhcqh56QAOdKhNzC2+RycsC/k4mbMj1VF+9F/NzA0ROg== + dependencies: + "@jest/environment" "^27.0.3" + "@jest/fake-timers" "^27.0.3" + "@jest/types" "^27.0.2" + "@types/node" "*" + jest-mock "^27.0.3" + jest-util "^27.0.2" jest-get-type@^26.3.0: version "26.3.0" resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-26.3.0.tgz#e97dc3c3f53c2b406ca7afaed4493b1d099199e0" integrity sha512-TpfaviN1R2pQWkIihlfEanwOXK0zcxrKEE4MlU6Tn7keoXdN6/3gK/xl0yEh8DOunn5pOVGKf8hB4R9gVh04ig== -jest-haste-map@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-26.6.2.tgz#dd7e60fe7dc0e9f911a23d79c5ff7fb5c2cafeaa" - integrity sha512-easWIJXIw71B2RdR8kgqpjQrbMRWQBgiBwXYEhtGUTaX+doCjBheluShdDMeR8IMfJiTqH4+zfhtg29apJf/8w== +jest-get-type@^27.0.1: + version "27.0.1" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-27.0.1.tgz#34951e2b08c8801eb28559d7eb732b04bbcf7815" + integrity sha512-9Tggo9zZbu0sHKebiAijyt1NM77Z0uO4tuWOxUCujAiSeXv30Vb5D4xVF4UR4YWNapcftj+PbByU54lKD7/xMg== + +jest-haste-map@^27.0.2: + version "27.0.2" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-27.0.2.tgz#3f1819400c671237e48b4d4b76a80a0dbed7577f" + integrity sha512-37gYfrYjjhEfk37C4bCMWAC0oPBxDpG0qpl8lYg8BT//wf353YT/fzgA7+Dq0EtM7rPFS3JEcMsxdtDwNMi2cA== dependencies: - "@jest/types" "^26.6.2" + "@jest/types" "^27.0.2" "@types/graceful-fs" "^4.1.2" "@types/node" "*" anymatch "^3.0.3" fb-watchman "^2.0.0" graceful-fs "^4.2.4" - jest-regex-util "^26.0.0" - jest-serializer "^26.6.2" - jest-util "^26.6.2" - jest-worker "^26.6.2" - micromatch "^4.0.2" - sane "^4.0.3" + jest-regex-util "^27.0.1" + jest-serializer "^27.0.1" + jest-util "^27.0.2" + jest-worker "^27.0.2" + micromatch "^4.0.4" walker "^1.0.7" optionalDependencies: - fsevents "^2.1.2" + fsevents "^2.3.2" -jest-jasmine2@^26.6.3: - version "26.6.3" - resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-26.6.3.tgz#adc3cf915deacb5212c93b9f3547cd12958f2edd" - integrity sha512-kPKUrQtc8aYwBV7CqBg5pu+tmYXlvFlSFYn18ev4gPFtrRzB15N2gW/Roew3187q2w2eHuu0MU9TJz6w0/nPEg== +jest-jasmine2@^27.0.4: + version "27.0.4" + resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-27.0.4.tgz#c669519ccf4904a485338555e1e66cad36bb0670" + integrity sha512-yj3WrjjquZwkJw+eA4c9yucHw4/+EHndHWSqgHbHGQfT94ihaaQsa009j1a0puU8CNxPDk0c1oAPeOpdJUElwA== dependencies: "@babel/traverse" "^7.1.0" - "@jest/environment" "^26.6.2" - "@jest/source-map" "^26.6.2" - "@jest/test-result" "^26.6.2" - "@jest/types" "^26.6.2" + "@jest/environment" "^27.0.3" + "@jest/source-map" "^27.0.1" + "@jest/test-result" "^27.0.2" + "@jest/types" "^27.0.2" "@types/node" "*" chalk "^4.0.0" co "^4.6.0" - expect "^26.6.2" + expect "^27.0.2" is-generator-fn "^2.0.0" - jest-each "^26.6.2" - jest-matcher-utils "^26.6.2" - jest-message-util "^26.6.2" - jest-runtime "^26.6.3" - jest-snapshot "^26.6.2" - jest-util "^26.6.2" - pretty-format "^26.6.2" - throat "^5.0.0" - -jest-leak-detector@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-26.6.2.tgz#7717cf118b92238f2eba65054c8a0c9c653a91af" - integrity sha512-i4xlXpsVSMeKvg2cEKdfhh0H39qlJlP5Ex1yQxwF9ubahboQYMgTtz5oML35AVA3B4Eu+YsmwaiKVev9KCvLxg== + jest-each "^27.0.2" + jest-matcher-utils "^27.0.2" + jest-message-util "^27.0.2" + jest-runtime "^27.0.4" + jest-snapshot "^27.0.4" + jest-util "^27.0.2" + pretty-format "^27.0.2" + throat "^6.0.1" + +jest-leak-detector@^27.0.2: + version "27.0.2" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-27.0.2.tgz#ce19aa9dbcf7a72a9d58907a970427506f624e69" + integrity sha512-TZA3DmCOfe8YZFIMD1GxFqXUkQnIoOGQyy4hFCA2mlHtnAaf+FeOMxi0fZmfB41ZL+QbFG6BVaZF5IeFIVy53Q== + dependencies: + jest-get-type "^27.0.1" + pretty-format "^27.0.2" + +jest-matcher-utils@^27.0.2: + version "27.0.2" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-27.0.2.tgz#f14c060605a95a466cdc759acc546c6f4cbfc4f0" + integrity sha512-Qczi5xnTNjkhcIB0Yy75Txt+Ez51xdhOxsukN7awzq2auZQGPHcQrJ623PZj0ECDEMOk2soxWx05EXdXGd1CbA== dependencies: - jest-get-type "^26.3.0" - pretty-format "^26.6.2" + chalk "^4.0.0" + jest-diff "^27.0.2" + jest-get-type "^27.0.1" + pretty-format "^27.0.2" -jest-matcher-utils@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-26.6.2.tgz#8e6fd6e863c8b2d31ac6472eeb237bc595e53e7a" - integrity sha512-llnc8vQgYcNqDrqRDXWwMr9i7rS5XFiCwvh6DTP7Jqa2mqpcCBBlpCbn+trkG0KNhPu/h8rzyBkriOtBstvWhw== +jest-message-util@^27.0.1: + version "27.0.1" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-27.0.1.tgz#382b7c55d8e0b1aba9eeb41d3cfdd34e451210ed" + integrity sha512-w8BfON2GwWORkos8BsxcwwQrLkV2s1ENxSRXK43+6yuquDE2hVxES/jrFqOArpP1ETVqqMmktU6iGkG8ncVzeA== dependencies: + "@babel/code-frame" "^7.12.13" + "@jest/types" "^27.0.1" + "@types/stack-utils" "^2.0.0" chalk "^4.0.0" - jest-diff "^26.6.2" - jest-get-type "^26.3.0" - pretty-format "^26.6.2" + graceful-fs "^4.2.4" + micromatch "^4.0.4" + pretty-format "^27.0.1" + slash "^3.0.0" + stack-utils "^2.0.3" -jest-message-util@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-26.6.2.tgz#58173744ad6fc0506b5d21150b9be56ef001ca07" - integrity sha512-rGiLePzQ3AzwUshu2+Rn+UMFk0pHN58sOG+IaJbk5Jxuqo3NYO1U2/MIR4S1sKgsoYSXSzdtSa0TgrmtUwEbmA== +jest-message-util@^27.0.2: + version "27.0.2" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-27.0.2.tgz#181c9b67dff504d8f4ad15cba10d8b80f272048c" + integrity sha512-rTqWUX42ec2LdMkoUPOzrEd1Tcm+R1KfLOmFK+OVNo4MnLsEaxO5zPDb2BbdSmthdM/IfXxOZU60P/WbWF8BTw== dependencies: - "@babel/code-frame" "^7.0.0" - "@jest/types" "^26.6.2" + "@babel/code-frame" "^7.12.13" + "@jest/types" "^27.0.2" "@types/stack-utils" "^2.0.0" chalk "^4.0.0" graceful-fs "^4.2.4" - micromatch "^4.0.2" - pretty-format "^26.6.2" + micromatch "^4.0.4" + pretty-format "^27.0.2" slash "^3.0.0" - stack-utils "^2.0.2" + stack-utils "^2.0.3" -jest-mock@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-26.6.2.tgz#d6cb712b041ed47fe0d9b6fc3474bc6543feb302" - integrity sha512-YyFjePHHp1LzpzYcmgqkJ0nm0gg/lJx2aZFzFy1S6eUqNjXsOqTK10zNRff2dNfssgokjkG65OlWNcIlgd3zew== +jest-mock@^27.0.3: + version "27.0.3" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-27.0.3.tgz#5591844f9192b3335c0dca38e8e45ed297d4d23d" + integrity sha512-O5FZn5XDzEp+Xg28mUz4ovVcdwBBPfAhW9+zJLO0Efn2qNbYcDaJvSlRiQ6BCZUCVOJjALicuJQI9mRFjv1o9Q== dependencies: - "@jest/types" "^26.6.2" + "@jest/types" "^27.0.2" "@types/node" "*" jest-pnp-resolver@^1.2.2: @@ -6426,171 +6581,194 @@ jest-pnp-resolver@^1.2.2: resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.2.tgz#b704ac0ae028a89108a4d040b3f919dfddc8e33c" integrity sha512-olV41bKSMm8BdnuMsewT4jqlZ8+3TCARAXjZGT9jcoSnrfUnRCqnMoF9XEeoWjbzObpqF9dRhHQj0Xb9QdF6/w== -jest-regex-util@^26.0.0: - version "26.0.0" - resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-26.0.0.tgz#d25e7184b36e39fd466c3bc41be0971e821fee28" - integrity sha512-Gv3ZIs/nA48/Zvjrl34bf+oD76JHiGDUxNOVgUjh3j890sblXryjY4rss71fPtD/njchl6PSE2hIhvyWa1eT0A== +jest-regex-util@^27.0.0, jest-regex-util@^27.0.1: + version "27.0.1" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-27.0.1.tgz#69d4b1bf5b690faa3490113c47486ed85dd45b68" + integrity sha512-6nY6QVcpTgEKQy1L41P4pr3aOddneK17kn3HJw6SdwGiKfgCGTvH02hVXL0GU8GEKtPH83eD2DIDgxHXOxVohQ== -jest-resolve-dependencies@^26.6.3: - version "26.6.3" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-26.6.3.tgz#6680859ee5d22ee5dcd961fe4871f59f4c784fb6" - integrity sha512-pVwUjJkxbhe4RY8QEWzN3vns2kqyuldKpxlxJlzEYfKSvY6/bMvxoFrYYzUO1Gx28yKWN37qyV7rIoIp2h8fTg== +jest-resolve-dependencies@^27.0.4: + version "27.0.4" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-27.0.4.tgz#a07a242d70d668afd3fcf7f4270755eebb1fe579" + integrity sha512-F33UPfw1YGWCV2uxJl7wD6TvcQn5IC0LtguwY3r4L7R6H4twpLkp5Q2ZfzRx9A2I3G8feiy0O0sqcn/Qoym71A== dependencies: - "@jest/types" "^26.6.2" - jest-regex-util "^26.0.0" - jest-snapshot "^26.6.2" + "@jest/types" "^27.0.2" + jest-regex-util "^27.0.1" + jest-snapshot "^27.0.4" -jest-resolve@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-26.6.2.tgz#a3ab1517217f469b504f1b56603c5bb541fbb507" - integrity sha512-sOxsZOq25mT1wRsfHcbtkInS+Ek7Q8jCHUB0ZUTP0tc/c41QHriU/NunqMfCUWsL4H3MHpvQD4QR9kSYhS7UvQ== +jest-resolve@^27.0.4: + version "27.0.4" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-27.0.4.tgz#8a27bc3f2f00c8ea28f3bc99bbf6f468300a703d" + integrity sha512-BcfyK2i3cG79PDb/6gB6zFeFQlcqLsQjGBqznFCpA0L/3l1L/oOsltdUjs5eISAWA9HS9qtj8v2PSZr/yWxONQ== dependencies: - "@jest/types" "^26.6.2" + "@jest/types" "^27.0.2" chalk "^4.0.0" + escalade "^3.1.1" graceful-fs "^4.2.4" jest-pnp-resolver "^1.2.2" - jest-util "^26.6.2" - read-pkg-up "^7.0.1" - resolve "^1.18.1" + jest-util "^27.0.2" + jest-validate "^27.0.2" + resolve "^1.20.0" slash "^3.0.0" -jest-runner@^26.6.3: - version "26.6.3" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-26.6.3.tgz#2d1fed3d46e10f233fd1dbd3bfaa3fe8924be159" - integrity sha512-atgKpRHnaA2OvByG/HpGA4g6CSPS/1LK0jK3gATJAoptC1ojltpmVlYC3TYgdmGp+GLuhzpH30Gvs36szSL2JQ== +jest-runner@^27.0.4: + version "27.0.4" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-27.0.4.tgz#2787170a9509b792ae129794f6944d27d5d12a4f" + integrity sha512-NfmvSYLCsCJk2AG8Ar2NAh4PhsJJpO+/r+g4bKR5L/5jFzx/indUpnVBdrfDvuqhGLLAvrKJ9FM/Nt8o1dsqxg== dependencies: - "@jest/console" "^26.6.2" - "@jest/environment" "^26.6.2" - "@jest/test-result" "^26.6.2" - "@jest/types" "^26.6.2" + "@jest/console" "^27.0.2" + "@jest/environment" "^27.0.3" + "@jest/test-result" "^27.0.2" + "@jest/transform" "^27.0.2" + "@jest/types" "^27.0.2" "@types/node" "*" chalk "^4.0.0" - emittery "^0.7.1" + emittery "^0.8.1" exit "^0.1.2" graceful-fs "^4.2.4" - jest-config "^26.6.3" - jest-docblock "^26.0.0" - jest-haste-map "^26.6.2" - jest-leak-detector "^26.6.2" - jest-message-util "^26.6.2" - jest-resolve "^26.6.2" - jest-runtime "^26.6.3" - jest-util "^26.6.2" - jest-worker "^26.6.2" + jest-docblock "^27.0.1" + jest-environment-jsdom "^27.0.3" + jest-environment-node "^27.0.3" + jest-haste-map "^27.0.2" + jest-leak-detector "^27.0.2" + jest-message-util "^27.0.2" + jest-resolve "^27.0.4" + jest-runtime "^27.0.4" + jest-util "^27.0.2" + jest-worker "^27.0.2" source-map-support "^0.5.6" - throat "^5.0.0" - -jest-runtime@^26.6.3: - version "26.6.3" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-26.6.3.tgz#4f64efbcfac398331b74b4b3c82d27d401b8fa2b" - integrity sha512-lrzyR3N8sacTAMeonbqpnSka1dHNux2uk0qqDXVkMv2c/A3wYnvQ4EXuI013Y6+gSKSCxdaczvf4HF0mVXHRdw== - dependencies: - "@jest/console" "^26.6.2" - "@jest/environment" "^26.6.2" - "@jest/fake-timers" "^26.6.2" - "@jest/globals" "^26.6.2" - "@jest/source-map" "^26.6.2" - "@jest/test-result" "^26.6.2" - "@jest/transform" "^26.6.2" - "@jest/types" "^26.6.2" - "@types/yargs" "^15.0.0" + throat "^6.0.1" + +jest-runtime@^27.0.4: + version "27.0.4" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-27.0.4.tgz#2e4a6aa77cac32ac612dfe12768387a8aa15c2f0" + integrity sha512-voJB4xbAjS/qYPboV+e+gmg3jfvHJJY4CagFWBOM9dQKtlaiTjcpD2tWwla84Z7PtXSQPeIpXY0qksA9Dum29A== + dependencies: + "@jest/console" "^27.0.2" + "@jest/environment" "^27.0.3" + "@jest/fake-timers" "^27.0.3" + "@jest/globals" "^27.0.3" + "@jest/source-map" "^27.0.1" + "@jest/test-result" "^27.0.2" + "@jest/transform" "^27.0.2" + "@jest/types" "^27.0.2" + "@types/yargs" "^16.0.0" chalk "^4.0.0" - cjs-module-lexer "^0.6.0" + cjs-module-lexer "^1.0.0" collect-v8-coverage "^1.0.0" exit "^0.1.2" glob "^7.1.3" graceful-fs "^4.2.4" - jest-config "^26.6.3" - jest-haste-map "^26.6.2" - jest-message-util "^26.6.2" - jest-mock "^26.6.2" - jest-regex-util "^26.0.0" - jest-resolve "^26.6.2" - jest-snapshot "^26.6.2" - jest-util "^26.6.2" - jest-validate "^26.6.2" + jest-haste-map "^27.0.2" + jest-message-util "^27.0.2" + jest-mock "^27.0.3" + jest-regex-util "^27.0.1" + jest-resolve "^27.0.4" + jest-snapshot "^27.0.4" + jest-util "^27.0.2" + jest-validate "^27.0.2" slash "^3.0.0" strip-bom "^4.0.0" - yargs "^15.4.1" + yargs "^16.0.3" -jest-serializer@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-26.6.2.tgz#d139aafd46957d3a448f3a6cdabe2919ba0742d1" - integrity sha512-S5wqyz0DXnNJPd/xfIzZ5Xnp1HrJWBczg8mMfMpN78OJ5eDxXyf+Ygld9wX1DnUWbIbhM1YDY95NjR4CBXkb2g== +jest-serializer@^27.0.1: + version "27.0.1" + resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-27.0.1.tgz#2464d04dcc33fb71dc80b7c82e3c5e8a08cb1020" + integrity sha512-svy//5IH6bfQvAbkAEg1s7xhhgHTtXu0li0I2fdKHDsLP2P2MOiscPQIENQep8oU2g2B3jqLyxKKzotZOz4CwQ== dependencies: "@types/node" "*" graceful-fs "^4.2.4" -jest-snapshot@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-26.6.2.tgz#f3b0af1acb223316850bd14e1beea9837fb39c84" - integrity sha512-OLhxz05EzUtsAmOMzuupt1lHYXCNib0ECyuZ/PZOx9TrZcC8vL0x+DUG3TL+GLX3yHG45e6YGjIm0XwDc3q3og== +jest-snapshot@^27.0.4: + version "27.0.4" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-27.0.4.tgz#2b96e22ca90382b3e93bd0aae2ce4c78bf51fb5b" + integrity sha512-hnjrvpKGdSMvKfbHyaG5Kul7pDJGZvjVy0CKpzhu28MmAssDXS6GpynhXzgst1wBQoKD8c9b2VS2a5yhDLQRCA== dependencies: + "@babel/core" "^7.7.2" + "@babel/generator" "^7.7.2" + "@babel/parser" "^7.7.2" + "@babel/plugin-syntax-typescript" "^7.7.2" + "@babel/traverse" "^7.7.2" "@babel/types" "^7.0.0" - "@jest/types" "^26.6.2" + "@jest/transform" "^27.0.2" + "@jest/types" "^27.0.2" "@types/babel__traverse" "^7.0.4" - "@types/prettier" "^2.0.0" + "@types/prettier" "^2.1.5" + babel-preset-current-node-syntax "^1.0.0" chalk "^4.0.0" - expect "^26.6.2" + expect "^27.0.2" graceful-fs "^4.2.4" - jest-diff "^26.6.2" - jest-get-type "^26.3.0" - jest-haste-map "^26.6.2" - jest-matcher-utils "^26.6.2" - jest-message-util "^26.6.2" - jest-resolve "^26.6.2" + jest-diff "^27.0.2" + jest-get-type "^27.0.1" + jest-haste-map "^27.0.2" + jest-matcher-utils "^27.0.2" + jest-message-util "^27.0.2" + jest-resolve "^27.0.4" + jest-util "^27.0.2" natural-compare "^1.4.0" - pretty-format "^26.6.2" + pretty-format "^27.0.2" semver "^7.3.2" -jest-util@^26.1.0, jest-util@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-26.6.2.tgz#907535dbe4d5a6cb4c47ac9b926f6af29576cbc1" - integrity sha512-MDW0fKfsn0OI7MS7Euz6h8HNDXVQ0gaM9uW6RjfDmd1DAFcaxX9OqIakHIqhbnmF08Cf2DLDG+ulq8YQQ0Lp0Q== +jest-util@^27.0.0, jest-util@^27.0.1, jest-util@^27.0.2: + version "27.0.2" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-27.0.2.tgz#fc2c7ace3c75ae561cf1e5fdb643bf685a5be7c7" + integrity sha512-1d9uH3a00OFGGWSibpNYr+jojZ6AckOMCXV2Z4K3YXDnzpkAaXQyIpY14FOJPiUmil7CD+A6Qs+lnnh6ctRbIA== dependencies: - "@jest/types" "^26.6.2" + "@jest/types" "^27.0.2" "@types/node" "*" chalk "^4.0.0" graceful-fs "^4.2.4" - is-ci "^2.0.0" - micromatch "^4.0.2" + is-ci "^3.0.0" + picomatch "^2.2.3" -jest-validate@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-26.6.2.tgz#23d380971587150467342911c3d7b4ac57ab20ec" - integrity sha512-NEYZ9Aeyj0i5rQqbq+tpIOom0YS1u2MVu6+euBsvpgIme+FOfRmoC4R5p0JiAUpaFvFy24xgrpMknarR/93XjQ== +jest-validate@^27.0.2: + version "27.0.2" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-27.0.2.tgz#7fe2c100089449cd5cbb47a5b0b6cb7cda5beee5" + integrity sha512-UgBF6/oVu1ofd1XbaSotXKihi8nZhg0Prm8twQ9uCuAfo59vlxCXMPI/RKmrZEVgi3Nd9dS0I8A0wzWU48pOvg== dependencies: - "@jest/types" "^26.6.2" - camelcase "^6.0.0" + "@jest/types" "^27.0.2" + camelcase "^6.2.0" chalk "^4.0.0" - jest-get-type "^26.3.0" + jest-get-type "^27.0.1" leven "^3.1.0" - pretty-format "^26.6.2" + pretty-format "^27.0.2" jest-watch-typeahead@^0.6.1: - version "0.6.3" - resolved "https://registry.yarnpkg.com/jest-watch-typeahead/-/jest-watch-typeahead-0.6.3.tgz#26efa37da39a46d8ff417b9e4badc8176a698016" - integrity sha512-rM+2m2U/7o4VeXxA3rcEWbbKq8K/aGjAwCgmqsthPV1AqLb5NNACzS+tDCD11bdQ8MrN+H3uN61Y9qFiJgtZPw== + version "0.6.4" + resolved "https://registry.yarnpkg.com/jest-watch-typeahead/-/jest-watch-typeahead-0.6.4.tgz#ea70bf1bec34bd4f55b5b72d471b02d997899c3e" + integrity sha512-tGxriteVJqonyrDj/xZHa0E2glKMiglMLQqISLCjxLUfeueRBh9VoRF2FKQyYO2xOqrWDTg7781zUejx411ZXA== dependencies: ansi-escapes "^4.3.1" chalk "^4.0.0" - jest-regex-util "^26.0.0" - jest-watcher "^26.3.0" + jest-regex-util "^27.0.0" + jest-watcher "^27.0.0" slash "^3.0.0" string-length "^4.0.1" strip-ansi "^6.0.0" -jest-watcher@^26.3.0, jest-watcher@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-26.6.2.tgz#a5b683b8f9d68dbcb1d7dae32172d2cca0592975" - integrity sha512-WKJob0P/Em2csiVthsI68p6aGKTIcsfjH9Gsx1f0A3Italz43e3ho0geSAVsmj09RWOELP1AZ/DXyJgOgDKxXQ== +jest-watcher@^27.0.0: + version "27.0.1" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-27.0.1.tgz#61b9403d7b498161f6aa6124602363525ac3efc2" + integrity sha512-Chp9c02BN0IgEbtGreyAhGqIsOrn9a0XnzbuXOxdW1+cW0Tjh12hMzHDIdLFHpYP/TqaMTmPHaJ5KWvpCCrNFw== dependencies: - "@jest/test-result" "^26.6.2" - "@jest/types" "^26.6.2" + "@jest/test-result" "^27.0.1" + "@jest/types" "^27.0.1" "@types/node" "*" ansi-escapes "^4.2.1" chalk "^4.0.0" - jest-util "^26.6.2" + jest-util "^27.0.1" + string-length "^4.0.1" + +jest-watcher@^27.0.2: + version "27.0.2" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-27.0.2.tgz#dab5f9443e2d7f52597186480731a8c6335c5deb" + integrity sha512-8nuf0PGuTxWj/Ytfw5fyvNn/R80iXY8QhIT0ofyImUvdnoaBdT6kob0GmhXR+wO+ALYVnh8bQxN4Tjfez0JgkA== + dependencies: + "@jest/test-result" "^27.0.2" + "@jest/types" "^27.0.2" + "@types/node" "*" + ansi-escapes "^4.2.1" + chalk "^4.0.0" + jest-util "^27.0.2" string-length "^4.0.1" jest-worker@^26.6.2: @@ -6602,14 +6780,23 @@ jest-worker@^26.6.2: merge-stream "^2.0.0" supports-color "^7.0.0" -jest@^26.6.1: - version "26.6.3" - resolved "https://registry.yarnpkg.com/jest/-/jest-26.6.3.tgz#40e8fdbe48f00dfa1f0ce8121ca74b88ac9148ef" - integrity sha512-lGS5PXGAzR4RF7V5+XObhqz2KZIDUA1yD0DG6pBVmy10eh0ZIXQImRuzocsI/N2XZ1GrLFwTS27In2i2jlpq1Q== +jest-worker@^27.0.2: + version "27.0.2" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-27.0.2.tgz#4ebeb56cef48b3e7514552f80d0d80c0129f0b05" + integrity sha512-EoBdilOTTyOgmHXtw/cPc+ZrCA0KJMrkXzkrPGNwLmnvvlN1nj7MPrxpT7m+otSv2e1TLaVffzDnE/LB14zJMg== + dependencies: + "@types/node" "*" + merge-stream "^2.0.0" + supports-color "^8.0.0" + +jest@^27.0.3: + version "27.0.4" + resolved "https://registry.yarnpkg.com/jest/-/jest-27.0.4.tgz#91d4d564b36bcf93b98dac1ab19f07089e670f53" + integrity sha512-Px1iKFooXgGSkk1H8dJxxBIrM3tsc5SIuI4kfKYK2J+4rvCvPGr/cXktxh0e9zIPQ5g09kOMNfHQEmusBUf/ZA== dependencies: - "@jest/core" "^26.6.3" + "@jest/core" "^27.0.4" import-local "^3.0.2" - jest-cli "^26.6.3" + jest-cli "^27.0.4" js-tokens@^4.0.0: version "4.0.0" @@ -6654,13 +6841,13 @@ jscodeshift@^0.11.0: temp "^0.8.1" write-file-atomic "^2.3.0" -jsdom@^16.4.0: - version "16.5.3" - resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-16.5.3.tgz#13a755b3950eb938b4482c407238ddf16f0d2136" - integrity sha512-Qj1H+PEvUsOtdPJ056ewXM4UJPCi4hhLA8wpiz9F2YvsRBhuFsXxtrIFAgGBDynQA9isAMGE91PfUYbdMPXuTA== +jsdom@^16.6.0: + version "16.6.0" + resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-16.6.0.tgz#f79b3786682065492a3da6a60a4695da983805ac" + integrity sha512-Ty1vmF4NHJkolaEmdjtxTfSfkdb8Ywarwf63f+F8/mDD1uLSSWDxDuMiZxiPhwunLrn9LOSVItWj4bLYsLN3Dg== dependencies: abab "^2.0.5" - acorn "^8.1.0" + acorn "^8.2.4" acorn-globals "^6.0.0" cssom "^0.4.4" cssstyle "^2.3.0" @@ -6668,12 +6855,13 @@ jsdom@^16.4.0: decimal.js "^10.2.1" domexception "^2.0.1" escodegen "^2.0.0" + form-data "^3.0.0" html-encoding-sniffer "^2.0.1" - is-potential-custom-element-name "^1.0.0" + http-proxy-agent "^4.0.1" + https-proxy-agent "^5.0.0" + is-potential-custom-element-name "^1.0.1" nwsapi "^2.2.0" parse5 "6.0.1" - request "^2.88.2" - request-promise-native "^1.0.9" saxes "^5.0.1" symbol-tree "^3.2.4" tough-cookie "^4.0.0" @@ -6683,7 +6871,7 @@ jsdom@^16.4.0: whatwg-encoding "^1.0.5" whatwg-mimetype "^2.3.0" whatwg-url "^8.5.0" - ws "^7.4.4" + ws "^7.4.5" xml-name-validator "^3.0.0" jsesc@^2.5.1: @@ -6861,25 +7049,25 @@ levn@~0.3.0: type-check "~0.3.2" libnpmaccess@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/libnpmaccess/-/libnpmaccess-4.0.1.tgz#17e842e03bef759854adf6eb6c2ede32e782639f" - integrity sha512-ZiAgvfUbvmkHoMTzdwmNWCrQRsDkOC+aM5BDfO0C9aOSwF3R1LdFDBD+Rer1KWtsoQYO35nXgmMR7OUHpDRxyA== + version "4.0.2" + resolved "https://registry.yarnpkg.com/libnpmaccess/-/libnpmaccess-4.0.2.tgz#781832fb7ccb867b26343a75a85ad9c43e50406e" + integrity sha512-avXtJibZuGap0/qADDYqb9zdpgzVu/yG5+tl2sTRa7MCkDNv2ZlGwCYI0r6/+tmqXPj0iB9fKexHz426vB326w== dependencies: aproba "^2.0.0" minipass "^3.1.1" - npm-package-arg "^8.0.0" - npm-registry-fetch "^9.0.0" + npm-package-arg "^8.1.2" + npm-registry-fetch "^10.0.0" libnpmpublish@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/libnpmpublish/-/libnpmpublish-4.0.0.tgz#ad6413914e0dfd78df868ce14ba3d3a4cc8b385b" - integrity sha512-2RwYXRfZAB1x/9udKpZmqEzSqNd7ouBRU52jyG14/xG8EF+O9A62d7/XVR3iABEQHf1iYhkm0Oq9iXjrL3tsXA== + version "4.0.1" + resolved "https://registry.yarnpkg.com/libnpmpublish/-/libnpmpublish-4.0.1.tgz#08ca2cbb5d7f6be1ce4f3f9c49b3822682bcf166" + integrity sha512-hZCrZ8v4G9YH3DxpIyBdob25ijD5v5LNzRbwsej4pPDopjdcLLj1Widl+BUeFa7D0ble1JYL4F3owjLJqiA8yA== dependencies: - normalize-package-data "^3.0.0" - npm-package-arg "^8.1.0" - npm-registry-fetch "^9.0.0" + normalize-package-data "^3.0.2" + npm-package-arg "^8.1.2" + npm-registry-fetch "^10.0.0" semver "^7.1.3" - ssri "^8.0.0" + ssri "^8.0.1" lines-and-columns@^1.1.6: version "1.1.6" @@ -6937,11 +7125,11 @@ listr-verbose-renderer@^0.5.0: figures "^2.0.0" listr2@^3.2.2: - version "3.7.1" - resolved "https://registry.yarnpkg.com/listr2/-/listr2-3.7.1.tgz#ff0c410b10eb1c5c76735e4814128ec8f7d2b983" - integrity sha512-cNd368GTrk8351/ov/IV+BSwyf9sJRgI0UIvfORonCZA1u9UHAtAlqSEv9dgafoQIA1CgB3nu4No79pJtK2LHw== + version "3.8.2" + resolved "https://registry.yarnpkg.com/listr2/-/listr2-3.8.2.tgz#99b138ad1cfb08f1b0aacd422972e49b2d814b99" + integrity sha512-E28Fw7Zd3HQlCJKzb9a8C8M0HtFWQeucE+S8YrSrqZObuCLPRHMRrR8gNmYt65cU9orXYHwvN5agXC36lYt7VQ== dependencies: - chalk "^4.1.0" + chalk "^4.1.1" cli-truncate "^2.1.0" figures "^3.2.0" indent-string "^4.0.0" @@ -7042,11 +7230,6 @@ lodash.clonedeep@^4.5.0: resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" integrity sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8= -lodash.flatten@^4.4.0: - version "4.4.0" - resolved "https://registry.yarnpkg.com/lodash.flatten/-/lodash.flatten-4.4.0.tgz#f31c22225a9632d2bbf8e4addbef240aa765a61f" - integrity sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8= - lodash.flattendeep@^4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz#fb030917f86a3134e5bc9bec0d69e0013ddfedb2" @@ -7057,6 +7240,11 @@ lodash.ismatch@^4.4.0: resolved "https://registry.yarnpkg.com/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz#756cb5150ca3ba6f11085a78849645f188f85f37" integrity sha1-dWy1FQyjum8RCFp4hJZF8Yj4Xzc= +lodash.merge@^4.6.2: + version "4.6.2" + resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" + integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== + lodash.template@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.template/-/lodash.template-4.5.0.tgz#f976195cf3f347d0d5f52483569fe8031ccce8ab" @@ -7368,7 +7556,7 @@ micromatch@^3.1.10, micromatch@^3.1.4: snapdragon "^0.8.1" to-regex "^3.0.2" -micromatch@^4.0.2: +micromatch@^4.0.2, micromatch@^4.0.4: version "4.0.4" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.4.tgz#896d519dfe9db25fce94ceb7a500919bf881ebf9" integrity sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg== @@ -7444,7 +7632,7 @@ minimist-options@4.1.0, minimist-options@^4.0.2: is-plain-obj "^1.1.0" kind-of "^6.0.3" -minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0, minimist@^1.2.5: +minimist@^1.1.3, minimist@^1.2.0, minimist@^1.2.5: version "1.2.5" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== @@ -7732,18 +7920,6 @@ node-modules-regexp@^1.0.0: resolved "https://registry.yarnpkg.com/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz#8d9dbe28964a4ac5712e9131642107c71e90ec40" integrity sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA= -node-notifier@^8.0.0: - version "8.0.2" - resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-8.0.2.tgz#f3167a38ef0d2c8a866a83e318c1ba0efeb702c5" - integrity sha512-oJP/9NAdd9+x2Q+rfphB2RJCHjod70RcRLjosiPMMu5gjIfwVnOUGq2nbTjTUbmy0DJ/tFIVT30+Qe3nzl4TJg== - dependencies: - growly "^1.3.0" - is-wsl "^2.2.0" - semver "^7.3.2" - shellwords "^0.1.1" - uuid "^8.3.0" - which "^2.0.2" - node-preload@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/node-preload/-/node-preload-0.2.1.tgz#c03043bb327f417a18fee7ab7ee57b408a144301" @@ -7781,7 +7957,7 @@ normalize-package-data@^2.0.0, normalize-package-data@^2.3.0, normalize-package- semver "2 || 3 || 4 || 5" validate-npm-package-license "^3.0.1" -normalize-package-data@^3.0.0: +normalize-package-data@^3.0.0, normalize-package-data@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-3.0.2.tgz#cae5c410ae2434f9a6c1baa65d5bc3b9366c8699" integrity sha512-6CdZocmfGaKnIHPVFhJJZ3GuR8SsLKvDANFp47Jmy51aKIr8akjAWTSxtpI+MBgBFdSMRyo4hMpDlT6dTffgZg== @@ -7826,9 +8002,9 @@ npm-api@^1.0.0: paged-request "^2.0.1" npm-bundled@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.1.1.tgz#1edd570865a94cdb1bc8220775e29466c9fb234b" - integrity sha512-gqkfgGePhTpAEgUsGEgcq1rqPXA+tv/aVBlgEzfXwA1yiUJF7xtEt3CtVwOjNYQOVknDk0F20w58Fnm3EtG0fA== + version "1.1.2" + resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.1.2.tgz#944c78789bd739035b70baa2ca5cc32b8d860bc1" + integrity sha512-x5DHup0SuyQcmL3s7Rx/YQ8sbw/Hzg0rj48eN0dV7hf5cmQq5PXIeioroH3raV1QC1yh3uTYuMThvEQF3iKgGQ== dependencies: npm-normalize-package-bin "^1.0.1" @@ -7868,9 +8044,9 @@ npm-package-arg@^8.0.0, npm-package-arg@^8.0.1, npm-package-arg@^8.1.0, npm-pack validate-npm-package-name "^3.0.0" npm-packlist@^2.1.4: - version "2.1.5" - resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-2.1.5.tgz#43ef5bbb9f59b7c0ef91e0905f1dd707b4cfb33c" - integrity sha512-KCfK3Vi2F+PH1klYauoQzg81GQ8/GGjQRKYY6tRnpQUPKTs/1gBZSRWtTEd7jGdSn1LZL7gpAmJT+BcS55k2XQ== + version "2.2.2" + resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-2.2.2.tgz#076b97293fa620f632833186a7a8f65aaa6148c8" + integrity sha512-Jt01acDvJRhJGthnUJVF/w6gumWOZxO7IkpY/lsX9//zqQgnF7OJaxgQXcerd4uQOLu7W5bkb4mChL9mdfm+Zg== dependencies: glob "^7.1.6" ignore-walk "^3.0.3" @@ -7887,6 +8063,19 @@ npm-pick-manifest@^6.0.0, npm-pick-manifest@^6.1.1: npm-package-arg "^8.1.2" semver "^7.3.4" +npm-registry-fetch@^10.0.0: + version "10.1.1" + resolved "https://registry.yarnpkg.com/npm-registry-fetch/-/npm-registry-fetch-10.1.1.tgz#97bc7a0fca5e8f76cc5162185b8de8caa8bea639" + integrity sha512-F6a3l+ffCQ7hvvN16YG5bpm1rPZntCg66PLHDQ1apWJPOCUVHoKnL2w5fqEaTVhp42dmossTyXeR7hTGirfXrg== + dependencies: + lru-cache "^6.0.0" + make-fetch-happen "^8.0.9" + minipass "^3.1.3" + minipass-fetch "^1.3.0" + minipass-json-stream "^1.0.1" + minizlib "^2.0.0" + npm-package-arg "^8.0.0" + npm-registry-fetch@^9.0.0: version "9.0.0" resolved "https://registry.yarnpkg.com/npm-registry-fetch/-/npm-registry-fetch-9.0.0.tgz#86f3feb4ce00313bc0b8f1f8f69daae6face1661" @@ -7988,9 +8177,9 @@ object-copy@^0.1.0: kind-of "^3.0.3" object-inspect@^1.9.0: - version "1.10.2" - resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.10.2.tgz#b6385a3e2b7cae0b5eafcf90cddf85d128767f30" - integrity sha512-gz58rdPpadwztRrPjZE9DZLOABUpTGdcANUgOwBFO1C+HZZhePoP83M65WGDmbpwFYJSWqavbl4SgDn4k8RYTA== + version "1.10.3" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.10.3.tgz#c2aa7d2d09f50c99375704f7a0adf24c5782d369" + integrity sha512-e5mCJlSH7poANfC8z8S9s9S2IN5/4Zb3aZ33f5s8YqoazCFzNLloLU8r5VCG+G7WoqLvAAZoVMcy3tp/3X0Plw== object-is@^1.0.1: version "1.1.5" @@ -8138,9 +8327,9 @@ osenv@^0.1.4: os-tmpdir "^1.0.0" p-cancelable@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-2.1.0.tgz#4d51c3b91f483d02a0d300765321fca393d758dd" - integrity sha512-HAZyB3ZodPo+BDpb4/Iu7Jv4P6cSazBz9ZM0ChhEXp70scx834aWCEjQRwgt41UzzejUAPdbqqONfRWTPYrPAQ== + version "2.1.1" + resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-2.1.1.tgz#aab7fbd416582fa32a3db49859c122487c5ed2cf" + integrity sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg== p-each-series@^2.1.0: version "2.2.0" @@ -8297,9 +8486,9 @@ package-hash@^4.0.0: release-zalgo "^1.0.0" pacote@^11.2.6: - version "11.3.1" - resolved "https://registry.yarnpkg.com/pacote/-/pacote-11.3.1.tgz#6ce95dd230db475cbd8789fd1f986bec51b4bf7c" - integrity sha512-TymtwoAG12cczsJIrwI/euOQKtjrQHlD0k0oyt9QSmZGpqa+KdlxKdWR/YUjYizkixaVyztxt/Wsfo8bL3A6Fg== + version "11.3.3" + resolved "https://registry.yarnpkg.com/pacote/-/pacote-11.3.3.tgz#d7d6091464f77c09691699df2ded13ab906b3e68" + integrity sha512-GQxBX+UcVZrrJRYMK2HoG+gPeSUX/rQhnbPkkGrCYa4n2F/bgClFPaMm0nsdnYrxnmUy85uMHoFXZ0jTD0drew== dependencies: "@npmcli/git" "^2.0.1" "@npmcli/installed-package-contents" "^1.0.6" @@ -8314,7 +8503,7 @@ pacote@^11.2.6: npm-package-arg "^8.0.1" npm-packlist "^2.1.4" npm-pick-manifest "^6.0.0" - npm-registry-fetch "^9.0.0" + npm-registry-fetch "^10.0.0" promise-retry "^2.0.1" read-package-json-fast "^2.0.1" rimraf "^3.0.2" @@ -8584,10 +8773,10 @@ prettier-linter-helpers@^1.0.0: dependencies: fast-diff "^1.1.2" -prettier@^2.1.2: - version "2.2.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5" - integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q== +prettier@^2.3.0: + version "2.3.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.1.tgz#76903c3f8c4449bc9ac597acefa24dc5ad4cbea6" + integrity sha512-p+vNbgpLjif/+D+DwAZAbndtRrR0md0MwfmOVN9N+2RgyACMT+7tfaRnT+WDPkqnuVwleyuBIG2XBxKDme3hPA== pretty-bytes@^5.2.0: version "5.6.0" @@ -8604,6 +8793,26 @@ pretty-format@^26.0.0, pretty-format@^26.6.2: ansi-styles "^4.0.0" react-is "^17.0.1" +pretty-format@^27.0.1: + version "27.0.1" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-27.0.1.tgz#c4094621dfbd3e8ab751964d1cf01edc6f88474d" + integrity sha512-qE+0J6c/gd+R6XTcQgPJMc5hMJNsxzSF5p8iZSbMZ7GQzYGlSLNkh2P80Wa2dbF4gEVUsJEgcrBY+1L2/j265w== + dependencies: + "@jest/types" "^27.0.1" + ansi-regex "^5.0.0" + ansi-styles "^5.0.0" + react-is "^17.0.1" + +pretty-format@^27.0.2: + version "27.0.2" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-27.0.2.tgz#9283ff8c4f581b186b2d4da461617143dca478a4" + integrity sha512-mXKbbBPnYTG7Yra9qFBtqj+IXcsvxsvOBco3QHxtxTl+hHKq6QdzMZ+q0CtL4ORHZgwGImRr2XZUX2EWzORxig== + dependencies: + "@jest/types" "^27.0.2" + ansi-regex "^5.0.0" + ansi-styles "^5.0.0" + react-is "^17.0.1" + process-nextick-args@^2.0.0, process-nextick-args@~2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" @@ -9033,22 +9242,6 @@ replace-ext@^1.0.0: resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-1.0.1.tgz#2d6d996d04a15855d967443631dd5f77825b016a" integrity sha512-yD5BHCe7quCgBph4rMQ+0KkIRKwWCrHDOX1p1Gp6HwjPM5kVoCdKGNhN7ydqqsX6lJEnQDKZ/tFMiEdQ1dvPEw== -request-promise-core@1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/request-promise-core/-/request-promise-core-1.1.4.tgz#3eedd4223208d419867b78ce815167d10593a22f" - integrity sha512-TTbAfBBRdWD7aNNOoVOBH4pN/KigV6LyapYNNlAPA8JwbovRti1E88m3sYAwsLi5ryhPKsE9APwnjFTgdUjTpw== - dependencies: - lodash "^4.17.19" - -request-promise-native@^1.0.9: - version "1.0.9" - resolved "https://registry.yarnpkg.com/request-promise-native/-/request-promise-native-1.0.9.tgz#e407120526a5efdc9a39b28a5679bf47b9d9dc28" - integrity sha512-wcW+sIUiWnKgNY0dqCpOZkUbF/I+YPi+f09JZIDa39Ec+q82CpSYniDp+ISgTTbKmnpJWASeJBPZmoxH84wt3g== - dependencies: - request-promise-core "1.1.4" - stealthy-require "^1.1.1" - tough-cookie "^2.3.3" - request@^2.88.0, request@^2.88.2: version "2.88.2" resolved "https://registry.yarnpkg.com/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3" @@ -9149,7 +9342,7 @@ resolve-url@^0.2.1: resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= -resolve@^1.1.6, resolve@^1.10.0, resolve@^1.10.1, resolve@^1.18.1, resolve@^1.20.0, resolve@^1.9.0: +resolve@^1.1.6, resolve@^1.10.0, resolve@^1.10.1, resolve@^1.20.0, resolve@^1.9.0: version "1.20.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.20.0.tgz#629a013fb3f70755d6f0b7935cc1c2c5378b1975" integrity sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A== @@ -9216,11 +9409,6 @@ rimraf@~2.6.2: dependencies: glob "^7.1.3" -rsvp@^4.8.4: - version "4.8.5" - resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-4.8.5.tgz#c8f155311d167f68f21e168df71ec5b083113734" - integrity sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA== - run-async@^2.0.0, run-async@^2.2.0, run-async@^2.4.0: version "2.4.1" resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.4.1.tgz#8440eccf99ea3e70bd409d49aab88e10c189a455" @@ -9233,7 +9421,7 @@ run-parallel@^1.1.9: dependencies: queue-microtask "^1.2.2" -rxjs@>=6.4.0, rxjs@^6.3.3, rxjs@^6.4.0, rxjs@^6.6.0, rxjs@^6.6.7: +rxjs@^6.3.3, rxjs@^6.4.0, rxjs@^6.6.0, rxjs@^6.6.7: version "6.6.7" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.7.tgz#90ac018acabf491bf65044235d5863c4dab804c9" integrity sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ== @@ -9262,21 +9450,6 @@ safe-regex@^1.1.0: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -sane@^4.0.3: - version "4.1.0" - resolved "https://registry.yarnpkg.com/sane/-/sane-4.1.0.tgz#ed881fd922733a6c461bc189dc2b6c006f3ffded" - integrity sha512-hhbzAgTIX8O7SHfp2c8/kREfEn4qO/9q8C9beyY6+tvZ87EpoZ3i1RIEvp27YBswnNbY9mWd6paKVmKbAgLfZA== - dependencies: - "@cnakazawa/watch" "^1.0.3" - anymatch "^2.0.0" - capture-exit "^2.0.0" - exec-sh "^0.3.2" - execa "^1.0.0" - fb-watchman "^2.0.0" - micromatch "^3.1.4" - minimist "^1.1.1" - walker "~1.0.5" - saxes@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/saxes/-/saxes-5.0.1.tgz#eebab953fa3b7608dbe94e5dadb15c888fa6696d" @@ -9313,9 +9486,9 @@ select-hose@^2.0.0: integrity sha1-Yl2GWPhlr0Psliv8N2o3NZpJlMo= selfsigned@^1.10.8: - version "1.10.8" - resolved "https://registry.yarnpkg.com/selfsigned/-/selfsigned-1.10.8.tgz#0d17208b7d12c33f8eac85c41835f27fc3d81a30" - integrity sha512-2P4PtieJeEwVgTU9QEcwIRDQ/mXJLX8/+I3ur+Pg16nS8oNbrGxEso9NyYWy8NAmXiNl4dlAp5MwoNeCWzON4w== + version "1.10.11" + resolved "https://registry.yarnpkg.com/selfsigned/-/selfsigned-1.10.11.tgz#24929cd906fe0f44b6d01fb23999a739537acbe9" + integrity sha512-aVmbPOfViZqOZPgRBT0+3u4yZFHpmnIghLMlAcb5/xhp5ZtB/RVnKhz5vl2M32CLXAqR4kha9zfhNg0Lf/sxKA== dependencies: node-forge "^0.10.0" @@ -9462,11 +9635,6 @@ shelljs@^0.8.3, shelljs@^0.8.4: interpret "^1.0.0" rechoir "^0.6.2" -shellwords@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" - integrity sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww== - side-channel@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf" @@ -9783,7 +9951,7 @@ ssri@^8.0.0, ssri@^8.0.1: dependencies: minipass "^3.1.1" -stack-utils@^2.0.2: +stack-utils@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.3.tgz#cd5f030126ff116b78ccb3c027fe302713b61277" integrity sha512-gL//fkxfWUsIlFL2Tl42Cl6+HFALEaB1FU76I/Fy+oZjRreP7OPMXFlGbxM7NQsI0ZpUfw76sHnv0WNYuTb7Iw== @@ -9803,11 +9971,6 @@ static-extend@^0.1.1: resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" integrity sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow= -stealthy-require@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/stealthy-require/-/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b" - integrity sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks= - strict-uri-encode@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz#b9c7330c7042862f6b142dc274bbcc5866ce3546" @@ -10029,6 +10192,13 @@ supports-color@^7.0.0, supports-color@^7.1.0: dependencies: has-flag "^4.0.0" +supports-color@^8.0.0: + version "8.1.1" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" + integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== + dependencies: + has-flag "^4.0.0" + supports-hyperlinks@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/supports-hyperlinks/-/supports-hyperlinks-2.2.0.tgz#4f77b42488765891774b70c79babd87f9bd594bb" @@ -10047,20 +10217,17 @@ symbol-tree@^3.2.4: resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== -table@^6.0.4: - version "6.3.1" - resolved "https://registry.yarnpkg.com/table/-/table-6.3.1.tgz#ff50199ca5de00bc695596d581f7550759889b35" - integrity sha512-kNpMVSN4fj9KY4G6tNDVIT59uaG8ZELGQ+cmFSqivmWkCXJLd00VfRmtyHa8X7AeM75PQ/6/TtEtWjTDs1jXJw== +table@^6.0.9: + version "6.7.1" + resolved "https://registry.yarnpkg.com/table/-/table-6.7.1.tgz#ee05592b7143831a8c94f3cee6aae4c1ccef33e2" + integrity sha512-ZGum47Yi6KOOFDE8m223td53ath2enHcYLgOCjGr5ngu8bdIARQk6mN/wRMv4yMRcHnCSnHbCEha4sobQx5yWg== dependencies: ajv "^8.0.1" - is-boolean-object "^1.1.0" - is-number-object "^1.0.4" - is-string "^1.0.5" lodash.clonedeep "^4.5.0" - lodash.flatten "^4.4.0" lodash.truncate "^4.4.2" slice-ansi "^4.0.0" string-width "^4.2.0" + strip-ansi "^6.0.0" tapable@^2.1.1, tapable@^2.2.0: version "2.2.0" @@ -10132,21 +10299,21 @@ terminal-link@^2.0.0: supports-hyperlinks "^2.0.0" terser-webpack-plugin@^5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.1.1.tgz#7effadee06f7ecfa093dbbd3e9ab23f5f3ed8673" - integrity sha512-5XNNXZiR8YO6X6KhSGXfY0QrGrCRlSwAEjIIrlRQR4W8nP69TaJUlh3bkuac6zzgspiGPfKEHcY295MMVExl5Q== + version "5.1.2" + resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.1.2.tgz#51d295eb7cc56785a67a372575fdc46e42d5c20c" + integrity sha512-6QhDaAiVHIQr5Ab3XUWZyDmrIPCHMiqJVljMF91YKyqwKkL5QHnYMkrMBy96v9Z7ev1hGhSEw1HQZc2p/s5Z8Q== dependencies: jest-worker "^26.6.2" p-limit "^3.1.0" schema-utils "^3.0.0" serialize-javascript "^5.0.1" source-map "^0.6.1" - terser "^5.5.1" + terser "^5.7.0" -terser@^5.5.1: - version "5.6.1" - resolved "https://registry.yarnpkg.com/terser/-/terser-5.6.1.tgz#a48eeac5300c0a09b36854bf90d9c26fb201973c" - integrity sha512-yv9YLFQQ+3ZqgWCUk+pvNJwgUTdlIxUk1WTN+RnaFJe2L7ipG2csPT0ra2XRm7Cs8cxN7QXmK1rFzEwYEQkzXw== +terser@^5.7.0: + version "5.7.0" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.7.0.tgz#a761eeec206bc87b605ab13029876ead938ae693" + integrity sha512-HP5/9hp2UaZt5fYkuhNBR8YyRcT8juw8+uFbAme53iN9hblvKnLUTKkmwJG6ocWpIKf8UK4DoeWG4ty0J6S6/g== dependencies: commander "^2.20.0" source-map "~0.7.2" @@ -10176,10 +10343,10 @@ textextensions@^2.5.0: resolved "https://registry.yarnpkg.com/textextensions/-/textextensions-2.6.0.tgz#d7e4ab13fe54e32e08873be40d51b74229b00fc4" integrity sha512-49WtAWS+tcsy93dRt6P0P3AMD2m5PvXRhuEA0kaXos5ZLlujtYmpmFsB+QvWUSxE1ZsstmYXfQ7L40+EcQgpAQ== -throat@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/throat/-/throat-5.0.0.tgz#c5199235803aad18754a667d659b5e72ce16764b" - integrity sha512-fcwX4mndzpLQKBS1DVYhGAcYaYt7vsHNIvQV+WXMvnow5cgjPphq5CaayLaGsjRdSCKZFNGt7/GYAuXaNOiYCA== +throat@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/throat/-/throat-6.0.1.tgz#d514fedad95740c12c2d7fc70ea863eb51ade375" + integrity sha512-8hmiGIJMDlwjg7dlJ4yKGLK8EsYqKgPWbG3b4wjJddKNwc7N7Dpn08Df4szr/sZdMVeOstrdYSsqzX6BYbcB+w== through2@^2.0.0: version "2.0.5" @@ -10278,14 +10445,6 @@ totalist@^1.0.0: resolved "https://registry.yarnpkg.com/totalist/-/totalist-1.1.0.tgz#a4d65a3e546517701e3e5c37a47a70ac97fe56df" integrity sha512-gduQwd1rOdDMGxFG1gEvhV88Oirdo2p+KjoYFU7k2g+i7n6AFFbDQ5kMPUsW0pNbfQsB/cwXvT1i4Bue0s9g5g== -tough-cookie@^2.3.3, tough-cookie@~2.5.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" - integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== - dependencies: - psl "^1.1.28" - punycode "^2.1.1" - tough-cookie@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.0.0.tgz#d822234eeca882f991f0f908824ad2622ddbece4" @@ -10295,6 +10454,14 @@ tough-cookie@^4.0.0: punycode "^2.1.1" universalify "^0.1.2" +tough-cookie@~2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" + integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== + dependencies: + psl "^1.1.28" + punycode "^2.1.1" + tr46@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/tr46/-/tr46-2.0.2.tgz#03273586def1595ae08fedb38d7733cee91d2479" @@ -10317,15 +10484,15 @@ trim-off-newlines@^1.0.0: resolved "https://registry.yarnpkg.com/trim-off-newlines/-/trim-off-newlines-1.0.1.tgz#9f9ba9d9efa8764c387698bcbfeb2c848f11adb3" integrity sha1-n5up2e+odkw4dpi8v+sshI8RrbM= -ts-jest@^26.5.5: - version "26.5.6" - resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-26.5.6.tgz#c32e0746425274e1dfe333f43cd3c800e014ec35" - integrity sha512-rua+rCP8DxpA8b4DQD/6X2HQS8Zy/xzViVYfEs2OQu68tkCuKLV0Md8pmX55+W24uRIyAsf/BajRfxOs+R2MKA== +ts-jest@^27.0.2: + version "27.0.3" + resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-27.0.3.tgz#808492f022296cde19390bb6ad627c8126bf93f8" + integrity sha512-U5rdMjnYam9Ucw+h0QvtNDbc5+88nxt7tbIvqaZUhFrfG4+SkWhMXjejCLVGcpILTPuV+H3W/GZDZrnZFpPeXw== dependencies: bs-logger "0.x" buffer-from "1.x" fast-json-stable-stringify "2.x" - jest-util "^26.1.0" + jest-util "^27.0.0" json5 "2.x" lodash "4.x" make-error "1.x" @@ -10355,7 +10522,7 @@ tslib@^2.0.1: resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.2.0.tgz#fb2c475977e35e241311ede2693cee1ec6698f5c" integrity sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w== -tsutils@^3.17.1: +tsutils@^3.21.0: version "3.21.0" resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623" integrity sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA== @@ -10449,14 +10616,14 @@ typedarray@^0.0.6: integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= typescript@^4.1.3: - version "4.2.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.4.tgz#8610b59747de028fda898a8aef0e103f156d0961" - integrity sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg== + version "4.3.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.2.tgz#399ab18aac45802d6f2498de5054fcbbe716a805" + integrity sha512-zZ4hShnmnoVnAHpVHWpTcxdv7dWP60S2FsydQLV8V5PbS3FifjWFFRiHSWpDJahly88PRyV5teTSLoq4eG7mKw== uglify-js@^3.1.4: - version "3.13.4" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.13.4.tgz#592588bb9f47ae03b24916e2471218d914955574" - integrity sha512-kv7fCkIXyQIilD5/yQy8O+uagsYIOt5cZvs890W40/e/rvjMSzJw81o9Bg0tkURxzZBROtDQhW2LFjOGoK3RZw== + version "3.13.6" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.13.6.tgz#6815ac7fdd155d03c83e2362bb717e5b39b74013" + integrity sha512-rRprLwl8RVaS+Qvx3Wh5hPfPBn9++G6xkGlUupya0s5aDmNjI7z3lnRLB3u7sN4OmbB0pWgzhM9BEJyiWAwtAA== uid-number@0.0.6: version "0.0.6" @@ -10619,20 +10786,15 @@ uuid@^3.3.2, uuid@^3.3.3, uuid@^3.4.0: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== -uuid@^8.3.0: - version "8.3.2" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" - integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== - v8-compile-cache@^2.0.3, v8-compile-cache@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee" integrity sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA== v8-to-istanbul@^7.0.0: - version "7.1.1" - resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-7.1.1.tgz#04bfd1026ba4577de5472df4f5e89af49de5edda" - integrity sha512-p0BB09E5FRjx0ELN6RgusIPsSPhtgexSRcKETybEs6IGOTXJSZqfwxp7r//55nnu0f1AxltY5VvdVqy2vZf9AA== + version "7.1.2" + resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-7.1.2.tgz#30898d1a7fa0c84d225a2c1434fb958f290883c1" + integrity sha512-TxNb7YEUwkLXCQYeudi6lgQ/SZrzNO4kMdlqVxaZPUIUjCv6iSSypUQX70kNBSERpQ8fk48+d61FXk+tgqcWow== dependencies: "@types/istanbul-lib-coverage" "^2.0.1" convert-source-map "^1.6.0" @@ -10704,17 +10866,17 @@ w3c-xmlserializer@^2.0.0: dependencies: xml-name-validator "^3.0.0" -walker@^1.0.7, walker@~1.0.5: +walker@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.7.tgz#2f7f9b8fd10d677262b18a884e28d19618e028fb" integrity sha1-L3+bj9ENZ3JisYqITijRlhjgKPs= dependencies: makeerror "1.0.x" -watchpack@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.1.1.tgz#e99630550fca07df9f90a06056987baa40a689c7" - integrity sha512-Oo7LXCmc1eE1AjyuSBmtC3+Wy4HcV8PxWh2kP6fOl8yTlNS7r0K9l1ao2lrrUza7V39Y3D/BbJgY8VeSlc5JKw== +watchpack@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.2.0.tgz#47d78f5415fe550ecd740f99fe2882323a58b1ce" + integrity sha512-up4YAn/XHgZHIxFBVCdlMiWDj6WaLKpwVeGQk2I5thdYxF/KmF0aaz6TfJZ/hfl1h/XlcDr7k1KH7ThDagpFaA== dependencies: glob-to-regexp "^0.4.1" graceful-fs "^4.1.2" @@ -10744,9 +10906,9 @@ webidl-conversions@^6.1.0: integrity sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w== webpack-bundle-analyzer@^4.3.0: - version "4.4.1" - resolved "https://registry.yarnpkg.com/webpack-bundle-analyzer/-/webpack-bundle-analyzer-4.4.1.tgz#c71fb2eaffc10a4754d7303b224adb2342069da1" - integrity sha512-j5m7WgytCkiVBoOGavzNokBOqxe6Mma13X1asfVYtKWM3wxBiRRu1u1iG0Iol5+qp9WgyhkMmBAcvjEfJ2bdDw== + version "4.4.2" + resolved "https://registry.yarnpkg.com/webpack-bundle-analyzer/-/webpack-bundle-analyzer-4.4.2.tgz#39898cf6200178240910d629705f0f3493f7d666" + integrity sha512-PIagMYhlEzFfhMYOzs5gFT55DkUdkyrJi/SxJp8EF3YMWhS+T9vvs2EoTetpk5qb6VsCq02eXTlRDOydRhDFAQ== dependencies: acorn "^8.0.4" acorn-walk "^8.0.0" @@ -10824,18 +10986,18 @@ webpack-merge@^5.7.3: clone-deep "^4.0.1" wildcard "^2.0.0" -webpack-sources@^2.1.1: - version "2.2.0" - resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-2.2.0.tgz#058926f39e3d443193b6c31547229806ffd02bac" - integrity sha512-bQsA24JLwcnWGArOKUxYKhX3Mz/nK1Xf6hxullKERyktjNMC4x8koOeaDNTA2fEJ09BdWLbM/iTW0ithREUP0w== +webpack-sources@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-2.3.0.tgz#9ed2de69b25143a4c18847586ad9eccb19278cfa" + integrity sha512-WyOdtwSvOML1kbgtXbTDnEW0jkJ7hZr/bDByIwszhWd/4XX1A3XMkrbFMsuH4+/MfLlZCUzlAdg4r7jaGKEIgQ== dependencies: source-list-map "^2.0.1" source-map "^0.6.1" -webpack@^5.35.1: - version "5.36.2" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.36.2.tgz#6ef1fb2453ad52faa61e78d486d353d07cca8a0f" - integrity sha512-XJumVnnGoH2dV+Pk1VwgY4YT6AiMKpVoudUFCNOXMIVrEKPUgEwdIfWPjIuGLESAiS8EdIHX5+TiJz/5JccmRg== +webpack@^5.38.1: + version "5.38.1" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.38.1.tgz#5224c7f24c18e729268d3e3bc97240d6e880258e" + integrity sha512-OqRmYD1OJbHZph6RUMD93GcCZy4Z4wC0ele4FXyYF0J6AxO1vOSuIlU1hkS/lDlR9CDYBz64MZRmdbdnFFoT2g== dependencies: "@types/eslint-scope" "^3.7.0" "@types/estree" "^0.0.47" @@ -10847,7 +11009,7 @@ webpack@^5.35.1: chrome-trace-event "^1.0.2" enhanced-resolve "^5.8.0" es-module-lexer "^0.4.0" - eslint-scope "^5.1.1" + eslint-scope "5.1.1" events "^3.2.0" glob-to-regexp "^0.4.1" graceful-fs "^4.2.4" @@ -10858,8 +11020,8 @@ webpack@^5.35.1: schema-utils "^3.0.0" tapable "^2.1.1" terser-webpack-plugin "^5.1.1" - watchpack "^2.0.0" - webpack-sources "^2.1.1" + watchpack "^2.2.0" + webpack-sources "^2.3.0" websocket-driver@>=0.5.1, websocket-driver@^0.7.4: version "0.7.4" @@ -11056,11 +11218,16 @@ ws@^6.2.1: dependencies: async-limiter "~1.0.0" -ws@^7.3.1, ws@^7.4.4: +ws@^7.3.1: version "7.4.5" resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.5.tgz#a484dd851e9beb6fdb420027e3885e8ce48986c1" integrity sha512-xzyu3hFvomRfXKH8vOFMU3OguG6oOvhXMo3xsGy3xWExqaM2dxBbVxuD99O7m3ZUFMvvscsZDqxfgMaRr/Nr1g== +ws@^7.4.5: + version "7.4.6" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c" + integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== + 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" @@ -11143,7 +11310,7 @@ yargs@^13.3.2: y18n "^4.0.0" yargs-parser "^13.1.2" -yargs@^15.0.2, yargs@^15.4.1: +yargs@^15.0.2: version "15.4.1" resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.4.1.tgz#0d87a16de01aee9d8bec2bfbf74f67851730f4f8" integrity sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A== @@ -11160,7 +11327,7 @@ yargs@^15.0.2, yargs@^15.4.1: y18n "^4.0.0" yargs-parser "^18.1.2" -yargs@^16.2.0: +yargs@^16.0.3, yargs@^16.2.0: version "16.2.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==