├── .eslintrc.js ├── .github └── workflows │ └── ci.yml ├── .gitignore ├── CHANGELOG.md ├── LICENSE.md ├── README.md ├── __mocks__ └── node-notifier.ts ├── example ├── .gitignore ├── entry.js ├── package.json └── webpack.config.js ├── index.d.ts ├── index.js ├── jest.config.js ├── logo.png ├── package.json ├── screenshot.png ├── test-d └── index-tests.ts ├── test ├── .eslintrc.js ├── VerbosityLevelAllVariants.test.ts ├── WebpackNotifierPlugin.test.ts ├── __snapshots__ │ ├── VerbosityLevelAllVariants.test.ts.snap │ └── WebpackNotifierPlugin.test.ts.snap └── helpers │ ├── ChildCompilationPlugin.ts │ ├── CustomWarningPlugin.ts │ ├── fixtures.ts │ └── utils.ts ├── tsconfig.json └── yarn.lock /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | parserOptions: { 3 | ecmaVersion: 2015, 4 | sourceType: 'module' 5 | }, 6 | root: true, 7 | env: { 8 | node: true 9 | }, 10 | extends: [ 11 | 'eslint:recommended', 12 | 'eslint-config-airbnb-base/legacy' 13 | ], 14 | rules: { 15 | 'vars-on-top': 0, 16 | 'consistent-return': 0 17 | } 18 | }; 19 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | pull_request: 6 | schedule: 7 | - cron: '0 3 * * *' # daily, at 3am 8 | 9 | jobs: 10 | lint: 11 | name: Lint 12 | runs-on: ubuntu-18.04 13 | 14 | steps: 15 | - uses: actions/checkout@v2 16 | - uses: actions/setup-node@v1 17 | with: 18 | node-version: 14.x 19 | - run: yarn 20 | - run: yarn lint 21 | - run: yarn tsd 22 | 23 | test: 24 | name: Test - ${{ matrix.os }}/node@${{ matrix.node-version }} 25 | 26 | strategy: 27 | fail-fast: false 28 | matrix: 29 | os: [ ubuntu-18.04 ] 30 | node-version: [ 14.x ] 31 | include: 32 | # different platforms 33 | - { os: ubuntu-18.04, node-version: 14.x } 34 | - { os: windows-latest, node-version: 14.x } 35 | - { os: macos-latest, node-version: 14.x } 36 | # different Node.js 37 | - { os: ubuntu-18.04, node-version: 10.x } 38 | - { os: ubuntu-18.04, node-version: 12.x } 39 | - { os: ubuntu-18.04, node-version: 14.x } 40 | - { os: ubuntu-18.04, node-version: 16.x } 41 | 42 | runs-on: ${{ matrix.os }} 43 | env: 44 | coverage-filename: ./coverage-final.${{ matrix.os }}_${{ matrix.node-version }}.json 45 | 46 | steps: 47 | - uses: actions/checkout@v2 48 | - uses: actions/setup-node@v1 49 | with: 50 | node-version: ${{ matrix.node-version }} 51 | - run: yarn --ignore-engines 52 | - run: yarn test:coverage 53 | - name: Unify different platfrom paths in coverage file 54 | if: ${{ always() }} 55 | shell: bash 56 | run: | 57 | node -e " 58 | const cwdForReplace = process.cwd().replace(/\\\\/g, '\\\\\\\\'); 59 | const file = fs.readFileSync('./coverage/coverage-final.json', {encoding: 'utf8'}); 60 | const replaceBase = file.split(cwdForReplace).join('.cwd').replace(/\\\\\\\\/g, '/'); 61 | fs.writeFileSync(process.env['coverage-filename'], replaceBase); 62 | " 63 | - name: Save current coverage to artifacts 64 | if: ${{ always() }} 65 | uses: actions/upload-artifact@v2 66 | with: 67 | name: coverages 68 | path: ${{ env.coverage-filename }} 69 | retention-days: 1 70 | 71 | coverage: 72 | name: Coverage 73 | needs: test 74 | if: ${{ always() }} 75 | runs-on: ubuntu-18.04 76 | steps: 77 | - uses: actions/checkout@v2 78 | - uses: actions/setup-node@v1 79 | - name: Download all coverage files from previous job 80 | uses: actions/download-artifact@v2 81 | with: 82 | name: coverages 83 | path: ./coverages 84 | - run: ls -laR ./coverages 85 | - name: Normalize paths to absolute form 86 | run: replace '.cwd' '${{ github.workspace }}' -- * 87 | working-directory: ./coverages 88 | - run: npx nyc merge ./coverages ./coverage/coverage-final.json 89 | - run: >- 90 | npx nyc report 91 | --check-coverage true 92 | --statements 100 93 | --branches 98.2 94 | --functions 100 95 | --lines 100 96 | -t ./coverage 97 | --report-dir ./coverage 98 | --reporter=html --reporter=lcov 99 | - uses: actions/upload-artifact@v2 100 | if: ${{ always() }} 101 | with: 102 | name: coverages 103 | path: ./**/coverage/ 104 | - uses: coverallsapp/github-action@v1.1.2 105 | if: ${{ always() }} 106 | with: 107 | github-token: ${{ secrets.GITHUB_TOKEN }} 108 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | /coverage 3 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 2 | Changelog 3 | =============================================================================== 4 | 5 | v1.13.0 6 | ------------------------------------------------------------------------------- 7 | 8 | - Update node-notifier to v9 9 | 10 | 11 | v1.12.0 12 | ------------------------------------------------------------------------------- 13 | 14 | - fix(dependencies): moved the erroneous dependency to devDependencies 15 | - Add support set of images for different build status 16 | - fix default title, when `title` option skipped 17 | - Update node-notifier to v8 18 | 19 | Minimum supported Node version is 6+ 20 | 21 | 22 | v1.11.1 23 | ------------------------------------------------------------------------------- 24 | 25 | - support child compilation errors in webpack@<3.11.0 26 | 27 | 28 | v1.11.0 29 | ------------------------------------------------------------------------------- 30 | 31 | - Support for `title` function for dynamic titles ([#53](https://github.com/Turbo87/webpack-notifier/pull/53)) 32 | 33 | 34 | v1.10.1 35 | ------------------------------------------------------------------------------- 36 | 37 | - fix(emoji): show success icon 38 | - docs(emoji): documentation about emoji option 39 | 40 | 41 | v1.10.0 42 | ------------------------------------------------------------------------------- 43 | 44 | - Add `onlyOnError` option ([#51](https://github.com/Turbo87/webpack-notifier/pull/51)) 45 | 46 | 47 | v1.9.1 48 | ------------------------------------------------------------------------------- 49 | 50 | - reduced package size by 2 times 51 | 52 | 53 | v1.9.0 54 | ------------------------------------------------------------------------------- 55 | 56 | - Update node-notifier to v6 ([#56](https://github.com/Turbo87/webpack-notifier/pull/56)) 57 | 58 | 59 | v1.8.0 60 | ------------------------------------------------------------------------------- 61 | 62 | - Add `--emoji` option ([#55](https://github.com/Turbo87/webpack-notifier/pull/55)) 63 | 64 | 65 | v1.7.0 66 | ------------------------------------------------------------------------------- 67 | 68 | - Handle errors/warnings in child compilations ([#49](https://github.com/Turbo87/webpack-notifier/pull/49)) 69 | 70 | 71 | v1.6.0 72 | ------------------------------------------------------------------------------- 73 | 74 | - Add support for webpack 4 plugin system ([#39](https://github.com/Turbo87/webpack-notifier/pull/39)) 75 | 76 | 77 | v1.5.1 78 | ------------------------------------------------------------------------------- 79 | 80 | - Update `node-notifier` dependency ([#23](https://github.com/Turbo87/webpack-notifier/pull/23) and [#36](https://github.com/Turbo87/webpack-notifier/pull/36)) 81 | 82 | 83 | v1.5.0 84 | ------------------------------------------------------------------------------- 85 | 86 | - Add `skipFirstNotification` option ([#21](https://github.com/Turbo87/webpack-notifier/pull/21)) 87 | 88 | 89 | v1.4.1 90 | ------------------------------------------------------------------------------- 91 | 92 | - Add missing `logo.png` to published NPM package ([#18](https://github.com/Turbo87/webpack-notifier/pull/18)) 93 | 94 | 95 | v1.4.0 96 | ------------------------------------------------------------------------------- 97 | 98 | - Pass all options to `node-notifier` ([@opensrcken](https://github.com/opensrcken)) 99 | - Strip ANSI escape codes from the messages ([@opensrcken](https://github.com/opensrcken)) 100 | - Remove unnecessary files from NPM package 101 | 102 | 103 | v1.3.2 104 | ------------------------------------------------------------------------------- 105 | 106 | - Use contentImage as icon on linux ([#17](https://github.com/Turbo87/webpack-notifier/pull/17)) 107 | 108 | 109 | v1.3.1 110 | ------------------------------------------------------------------------------- 111 | 112 | - Republished v1.3.0 due to NPM deployment failure 113 | 114 | 115 | v1.3.0 116 | ------------------------------------------------------------------------------- 117 | 118 | - Prefix error + warning messages ([#13](https://github.com/Turbo87/webpack-notifier/pull/13)) 119 | 120 | 121 | v1.2.1 122 | ------------------------------------------------------------------------------- 123 | 124 | - fixed `Cannot read property 'rawRequest' of undefined` error ([#5](https://github.com/Turbo87/webpack-notifier/issues/5)) 125 | 126 | 127 | v1.2.0 128 | ------------------------------------------------------------------------------- 129 | 130 | - `alwaysNotify` option ([#4](https://github.com/Turbo87/webpack-notifier/pull/4)) 131 | 132 | 133 | v1.1.1 134 | ------------------------------------------------------------------------------- 135 | 136 | - fixed `error is undefined` exception 137 | 138 | 139 | v1.1.0 140 | ------------------------------------------------------------------------------- 141 | 142 | - `title` and `contentImage` options ([#1](https://github.com/Turbo87/webpack-notifier/pull/1)) 143 | - `excludeWarnings` option ([#2](https://github.com/Turbo87/webpack-notifier/pull/2)) 144 | - fixed warnings display 145 | 146 | 147 | v1.0.1 148 | ------------------------------------------------------------------------------- 149 | 150 | - documentation improvements 151 | 152 | 153 | v1.0.0 154 | ------------------------------------------------------------------------------- 155 | 156 | - initial release after fork 157 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014, Vsevolod Solovyov 2 | Copyright (c) 2015, Tobias Bieniek 3 | 4 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 5 | 6 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # webpack-notifier 2 | 3 | [![npm Version](https://img.shields.io/npm/v/webpack-notifier.svg)](https://www.npmjs.com/package/webpack-notifier) 4 | [![GitHub Workflow Status](https://github.com/Turbo87/webpack-notifier/workflows/CI/badge.svg)](https://github.com/Turbo87/webpack-notifier/actions?query=workflow:CI) 5 | [![Coverage Status](https://coveralls.io/repos/github/Turbo87/webpack-notifier/badge.svg)](https://coveralls.io/github/Turbo87/webpack-notifier?branch=master) 6 | [![Code Style](https://badgen.net/badge/code%20style/Airbnb/007ec6?icon=airbnb)](https://github.com/airbnb/javascript) 7 | [![npm](https://img.shields.io/npm/dm/webpack-notifier)](https://www.npmjs.com/package/webpack-notifier) 8 | ![npm bundle size](https://img.shields.io/bundlephobia/minzip/webpack-notifier) 9 | 10 | This is a [webpack](http://webpack.github.io/) plugin that uses the 11 | [node-notifier](https://github.com/mikaelbr/node-notifier) package to 12 | display build status system notifications to the user. 13 | 14 | ![webpack-notifier screenshot](screenshot.png) 15 | 16 | > This is a fork of the 17 | [webpack-error-notification](https://github.com/vsolovyov/webpack-error-notification) 18 | plugin. It adds support for Windows and there is no need to manually install 19 | the `terminal-notifier` package on OS X anymore. 20 | 21 | The plugin will notify you about the first run (success/fail), 22 | all failed runs and the first successful run after recovering from 23 | a build failure. In other words: it will stay silent if everything 24 | is fine with your build. 25 | 26 | 27 | ## Installation 28 | 29 | Use `npm` to install this package: 30 | 31 | npm install --save-dev webpack-notifier 32 | 33 | Check the `node-notifier` 34 | [Requirements](https://github.com/mikaelbr/node-notifier#requirements) 35 | whether you need to install any additional tools for your OS. 36 | 37 | 38 | ## Usage 39 | 40 | In the `webpack.config.js` file: 41 | 42 | ```js 43 | var WebpackNotifierPlugin = require('webpack-notifier'); 44 | 45 | var config = module.exports = { 46 | // ... 47 | 48 | plugins: [ 49 | new WebpackNotifierPlugin(), 50 | ] 51 | } 52 | ``` 53 | 54 | 55 | ## Configuration 56 | 57 | ### All `node-notifier` options 58 | 59 | You can use any [node-notifier](https://www.npmjs.com/package/node-notifier) options (depending on your OS) 60 | Except for options generated by the plugin itself: 61 | * `title` - it can be not only a string, but also a function 62 | * `message` - generated based on the value of other options 63 | * `contentImage` - it can be an object with images for different statuses 64 | * `icon` - matches with `contentImage` 65 | 66 | ### Title 67 | 68 | Title shown in the notification. 69 | 70 | ```js 71 | new WebpackNotifierPlugin({title: 'Webpack'}); 72 | ``` 73 | 74 | ```js 75 | new WebpackNotifierPlugin({title: function (params) { 76 | return `Build status is ${params.status} with message ${params.message}`; 77 | }}); 78 | ``` 79 | 80 | ### Emojis in message text 81 | 82 | Show status emoji icon before the message. 83 | 84 | ```js 85 | new WebpackNotifierPlugin({emoji: true}); 86 | ``` 87 | 88 | ### Content Image 89 | 90 | Image shown in the notification. Can be a path string or object with paths. 91 | 92 | #### String path: 93 | ```js 94 | var path = require('path'); 95 | 96 | new WebpackNotifierPlugin({contentImage: path.join(__dirname, 'logo.png')}); 97 | ``` 98 | 99 | #### Object string path: 100 | ```js 101 | var path = require('path'); 102 | 103 | const statusesPaths = { 104 | success: path.join(__dirname, 'success.png'), 105 | warning: path.join(__dirname, 'warning.png'), 106 | error: path.join(__dirname, 'error.png') 107 | } 108 | 109 | new WebpackNotifierPlugin({contentImage: statusesPaths}); 110 | ``` 111 | 112 | ### Exclude Warnings 113 | 114 | If set to `true`, warnings will not cause a notification. 115 | 116 | ```js 117 | new WebpackNotifierPlugin({excludeWarnings: true}); 118 | ``` 119 | 120 | ### Always Notify 121 | 122 | Trigger a notification every time. Call it "noisy-mode". 123 | 124 | ```js 125 | new WebpackNotifierPlugin({alwaysNotify: true}); 126 | ``` 127 | 128 | ### Notify on error 129 | 130 | Trigger a notification only on error. 131 | 132 | ```js 133 | new WebpackNotifierPlugin({onlyOnError: true}); 134 | ``` 135 | 136 | ### Skip Notification on the First Build 137 | 138 | Do not notify on the first build. This allows you to receive notifications on subsequent incremental builds without being notified on the initial build. 139 | 140 | ```js 141 | new WebpackNotifierPlugin({skipFirstNotification: true}); 142 | ``` 143 | -------------------------------------------------------------------------------- /__mocks__/node-notifier.ts: -------------------------------------------------------------------------------- 1 | export const notify: jest.Mock = jest.fn(() => void 0); 2 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | bundle.js 2 | -------------------------------------------------------------------------------- /example/entry.js: -------------------------------------------------------------------------------- 1 | document.write("It works."); 2 | -------------------------------------------------------------------------------- /example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "webpack-notifier-example", 3 | "author": "Tobias Bieniek ", 4 | "license": "ISC", 5 | "scripts": { 6 | "watch": "webpack -w" 7 | }, 8 | "devDependencies": { 9 | "webpack": "^1.5.3" 10 | }, 11 | "private": true 12 | } 13 | -------------------------------------------------------------------------------- /example/webpack.config.js: -------------------------------------------------------------------------------- 1 | var WebpackNotifierPlugin = require('..'); 2 | 3 | module.exports = { 4 | entry: "./entry.js", 5 | output: { 6 | path: __dirname, 7 | filename: "bundle.js" 8 | }, 9 | plugins: [ 10 | new WebpackNotifierPlugin(), 11 | ] 12 | }; 13 | -------------------------------------------------------------------------------- /index.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions imported from DefinitielyTyped for webpack-notifier 1.13 2 | // Project: https://github.com/Turbo87/webpack-notifier#readme 3 | // Definitions by: Benjamin Lim 4 | // Piotr Błażejewicz 5 | // Alexandre Germain 6 | // Gvozdev Viktor 7 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 8 | // TypeScript Version: 3.9 9 | 10 | import { Compiler } from 'webpack'; 11 | 12 | export = WebpackNotifierPlugin; 13 | 14 | declare class WebpackNotifierPlugin { 15 | constructor(options?: WebpackNotifierPlugin.Options); 16 | apply(compiler: Compiler): void; 17 | } 18 | 19 | declare namespace WebpackNotifierPlugin { 20 | interface Options { 21 | alwaysNotify?: boolean; 22 | contentImage?: {[key in 'success' | 'warning' | 'error']: string} | string; 23 | excludeWarnings?: boolean; 24 | onlyOnError?: boolean; 25 | skipFirstNotification?: boolean; 26 | title?: string | TitleGetter; 27 | /** 28 | * Use emoji in notifications 29 | */ 30 | emoji?: boolean; 31 | } 32 | 33 | /** @deprecated use Options */ 34 | type Config = Options; 35 | 36 | type TitleGetter = (data: {msg: string,message: string,status: string}) => string; 37 | } 38 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | var stripANSI = require('strip-ansi'); 2 | var path = require('path'); 3 | var os = require('os'); 4 | var notifier = require('node-notifier'); 5 | 6 | var DEFAULT_LOGO = path.join(__dirname, 'logo.png'); 7 | 8 | function WebpackNotifierPlugin(options) { 9 | this.options = options || {}; 10 | this.lastBuildSucceeded = false; 11 | this.isFirstBuild = true; 12 | } 13 | module.exports = WebpackNotifierPlugin; 14 | 15 | function findFirstDFS(compilation, key) { 16 | var match = compilation[key][0]; 17 | if (match) { 18 | return match; 19 | } 20 | 21 | var children = compilation.children; 22 | for (var i = 0; i < children.length; i += 1) { 23 | match = findFirstDFS(children[i], key); 24 | if (match) { 25 | return match; 26 | } 27 | } 28 | } 29 | 30 | WebpackNotifierPlugin.prototype.compileEndOptions = function compileEndOptions(stats) { 31 | if (this.isFirstBuild) { 32 | this.isFirstBuild = false; 33 | 34 | if (this.options.skipFirstNotification) { 35 | return {}; 36 | } 37 | } 38 | 39 | var imageFromOptions = ('contentImage' in this.options) 40 | ? this.options.contentImage 41 | : DEFAULT_LOGO; 42 | 43 | var successImage = ''; 44 | var warningsImage = ''; 45 | var errorsImage = ''; 46 | if (typeof imageFromOptions === 'object') { 47 | successImage = imageFromOptions.success; 48 | warningsImage = imageFromOptions.warning; 49 | errorsImage = imageFromOptions.error; 50 | } else { 51 | successImage = imageFromOptions; 52 | warningsImage = imageFromOptions; 53 | errorsImage = imageFromOptions; 54 | } 55 | 56 | var hasEmoji = this.options.emoji; 57 | var error; 58 | var contentImage; 59 | var status; 60 | if (this.hasErrors(stats)) { 61 | error = findFirstDFS(stats.compilation, 'errors'); 62 | contentImage = errorsImage; 63 | status = 'error'; 64 | } else if (this.options.onlyOnError) { 65 | return {}; 66 | } else if (this.hasWarnings(stats) && !this.options.excludeWarnings) { 67 | error = findFirstDFS(stats.compilation, 'warnings'); 68 | contentImage = warningsImage; 69 | status = 'warning'; 70 | } else if (!this.lastBuildSucceeded || this.options.alwaysNotify) { 71 | this.lastBuildSucceeded = true; 72 | return { 73 | message: (hasEmoji ? '✅ ' : '') + 'Build successful', 74 | contentImage: successImage, 75 | status: 'success' 76 | }; 77 | } else { 78 | return {}; 79 | } 80 | 81 | this.lastBuildSucceeded = false; 82 | 83 | var message = ''; 84 | if (error.module && error.module.rawRequest) { 85 | message = error.module.rawRequest + '\n'; 86 | } 87 | 88 | if (error.error) { 89 | message = (hasEmoji ? '❌ ' : '') + 'Error: ' + message + error.error.toString(); 90 | } else if (error.warning) { 91 | message = (hasEmoji ? '⚠️ ' : '') + 'Warning: ' + message + error.warning.toString(); 92 | } else if (error.message) { 93 | message = (hasEmoji ? '⚠️ ' : '') + 'Warning: ' + message + error.message.toString(); 94 | } 95 | 96 | return { 97 | message: stripANSI(message), 98 | contentImage: contentImage, 99 | status: status 100 | }; 101 | }; 102 | 103 | WebpackNotifierPlugin.prototype.hasErrors = function hasErrors(stats) { 104 | return stats.hasErrors() 105 | || stats.compilation.children.some(child => child.getStats().hasErrors()); 106 | }; 107 | 108 | WebpackNotifierPlugin.prototype.hasWarnings = function hasWarnings(stats) { 109 | return stats.hasWarnings() 110 | || stats.compilation.children.some(child => child.getStats().hasWarnings()); 111 | }; 112 | 113 | WebpackNotifierPlugin.prototype.compilationDone = function compilationDone(stats) { 114 | var { message, contentImage, status } = this.compileEndOptions(stats); 115 | if (message) { 116 | var title = this.options.title ? this.options.title : 'Webpack'; 117 | if (typeof title === 'function') { 118 | title = title({ 119 | msg: message, // compatibility with v1.11.0 120 | message: message, 121 | status: status 122 | }); 123 | } 124 | 125 | var icon = (os.platform() === 'win32' || os.platform() === 'linux') 126 | ? contentImage 127 | : undefined; 128 | 129 | notifier.notify(Object.assign( 130 | {}, 131 | this.options, 132 | { 133 | title, 134 | message, 135 | contentImage, 136 | icon 137 | } 138 | )); 139 | } 140 | }; 141 | 142 | WebpackNotifierPlugin.prototype.apply = function apply(compiler) { 143 | if (compiler.hooks) { 144 | var plugin = { name: 'Notifier' }; 145 | 146 | compiler.hooks.done.tap(plugin, this.compilationDone.bind(this)); 147 | } else { 148 | compiler.plugin('done', this.compilationDone.bind(this)); 149 | } 150 | }; 151 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | // For a detailed explanation regarding each configuration property, visit: 2 | // https://jestjs.io/docs/en/configuration.html 3 | 4 | module.exports = { 5 | // All imported modules in your tests should be mocked automatically 6 | // automock: false, 7 | 8 | // Stop running tests after `n` failures 9 | // bail: 0, 10 | 11 | // Respect "browser" field in package.json when resolving modules 12 | // browser: false, 13 | 14 | // The directory where Jest should store its cached dependency information 15 | // cacheDirectory: "C:\\Users\\alter\\AppData\\Local\\Temp\\jest", 16 | 17 | // Automatically clear mock calls and instances between every test 18 | clearMocks: true, 19 | 20 | // Indicates whether the coverage information should be collected while executing the test 21 | // collectCoverage: false, 22 | 23 | // An array of glob patterns indicating a set of files for which coverage information should be collected 24 | // collectCoverageFrom: null, 25 | 26 | // The directory where Jest should output its coverage files 27 | coverageDirectory: "coverage", 28 | 29 | // An array of regexp pattern strings used to skip coverage collection 30 | // coveragePathIgnorePatterns: [ 31 | // "\\\\node_modules\\\\" 32 | // ], 33 | 34 | // A list of reporter names that Jest uses when writing coverage reports 35 | // coverageReporters: [ 36 | // "json", 37 | // "text", 38 | // "lcov", 39 | // "clover" 40 | // ], 41 | 42 | // An object that configures minimum threshold enforcement for coverage results 43 | // coverageThreshold: null, 44 | 45 | // A path to a custom dependency extractor 46 | // dependencyExtractor: null, 47 | 48 | // Make calling deprecated APIs throw helpful error messages 49 | // errorOnDeprecated: false, 50 | 51 | // Force coverage collection from ignored files using an array of glob patterns 52 | // forceCoverageMatch: [], 53 | 54 | // A path to a module which exports an async function that is triggered once before all test suites 55 | // globalSetup: null, 56 | 57 | // A path to a module which exports an async function that is triggered once after all test suites 58 | // globalTeardown: null, 59 | 60 | // A set of global variables that need to be available in all test environments 61 | // globals: {}, 62 | 63 | // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers. 64 | // maxWorkers: "50%", 65 | 66 | // An array of directory names to be searched recursively up from the requiring module's location 67 | // moduleDirectories: [ 68 | // "node_modules" 69 | // ], 70 | 71 | // An array of file extensions your modules use 72 | // moduleFileExtensions: [ 73 | // "js", 74 | // "json", 75 | // "jsx", 76 | // "ts", 77 | // "tsx", 78 | // "node" 79 | // ], 80 | 81 | // A map from regular expressions to module names that allow to stub out resources with a single module 82 | // moduleNameMapper: {}, 83 | 84 | // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader 85 | // modulePathIgnorePatterns: [], 86 | 87 | // Activates notifications for test results 88 | // notify: false, 89 | 90 | // An enum that specifies notification mode. Requires { notify: true } 91 | // notifyMode: "failure-change", 92 | 93 | // A preset that is used as a base for Jest's configuration 94 | // preset: null, 95 | 96 | // Run tests from one or more projects 97 | // projects: null, 98 | 99 | // Use this configuration option to add custom reporters to Jest 100 | // reporters: undefined, 101 | 102 | // Automatically reset mock state between every test 103 | // resetMocks: false, 104 | 105 | // Reset the module registry before running each individual test 106 | // resetModules: false, 107 | 108 | // A path to a custom resolver 109 | // resolver: null, 110 | 111 | // Automatically restore mock state between every test 112 | // restoreMocks: false, 113 | 114 | // The root directory that Jest should scan for tests and modules within 115 | // rootDir: null, 116 | 117 | // A list of paths to directories that Jest should use to search for files in 118 | // roots: [ 119 | // "" 120 | // ], 121 | 122 | // Allows you to use a custom runner instead of Jest's default test runner 123 | // runner: "jest-runner", 124 | 125 | // The paths to modules that run some code to configure or set up the testing environment before each test 126 | // setupFiles: [], 127 | 128 | // A list of paths to modules that run some code to configure or set up the testing framework before each test 129 | // setupFilesAfterEnv: [], 130 | 131 | // A list of paths to snapshot serializer modules Jest should use for snapshot testing 132 | // snapshotSerializers: [], 133 | 134 | // The test environment that will be used for testing 135 | testEnvironment: "node", 136 | 137 | // Options that will be passed to the testEnvironment 138 | // testEnvironmentOptions: {}, 139 | 140 | // Adds a location field to test results 141 | // testLocationInResults: false, 142 | 143 | // The glob patterns Jest uses to detect test files 144 | // testMatch: [ 145 | // "**/__tests__/**/*.[jt]s?(x)", 146 | // "**/?(*.)+(spec|test).[tj]s?(x)" 147 | // ], 148 | 149 | // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped 150 | // testPathIgnorePatterns: [ 151 | // "\\\\node_modules\\\\" 152 | // ], 153 | 154 | // The regexp pattern or array of patterns that Jest uses to detect test files 155 | // testRegex: [], 156 | 157 | // This option allows the use of a custom results processor 158 | // testResultsProcessor: null, 159 | 160 | // This option allows use of a custom test runner 161 | // testRunner: "jasmine2", 162 | 163 | // This option sets the URL for the jsdom environment. It is reflected in properties such as location.href 164 | // testURL: "http://localhost", 165 | 166 | // Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout" 167 | // timers: "real", 168 | 169 | // A map from regular expressions to paths to transformers 170 | transform: { 171 | '^.+\\.ts?$': 'ts-jest', 172 | }, 173 | 174 | // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation 175 | // transformIgnorePatterns: [ 176 | // "\\\\node_modules\\\\" 177 | // ], 178 | 179 | // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them 180 | // unmockedModulePathPatterns: undefined, 181 | 182 | // Indicates whether each individual test should be reported during the run 183 | // verbose: null, 184 | 185 | // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode 186 | // watchPathIgnorePatterns: [], 187 | 188 | // Whether to use watchman for file crawling 189 | // watchman: true, 190 | }; 191 | -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Turbo87/webpack-notifier/c8022dd49dd41e21d0154389adc7694611a96b8c/logo.png -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "webpack-notifier", 3 | "version": "1.15.0", 4 | "description": "webpack + node-notifier = build status system notifications", 5 | "main": "index.js", 6 | "types": "./index.d.ts", 7 | "files": [ 8 | "index.js", 9 | "index.d.ts", 10 | "logo.png" 11 | ], 12 | "scripts": { 13 | "prepublishOnly": "npm run lint", 14 | "lint": "eslint index.js", 15 | "test": "jest", 16 | "test:coverage": "jest --coverage", 17 | "tsd": "tsd" 18 | }, 19 | "husky": { 20 | "hooks": { 21 | "pre-commit": "npm run lint" 22 | } 23 | }, 24 | "keywords": [ 25 | "webpack", 26 | "notify", 27 | "notification", 28 | "node-notifier", 29 | "notifier", 30 | "build" 31 | ], 32 | "repository": { 33 | "type": "git", 34 | "url": "https://github.com/Turbo87/webpack-notifier.git" 35 | }, 36 | "author": "Tobias Bieniek ", 37 | "license": "ISC", 38 | "dependencies": { 39 | "node-notifier": "^9.0.0", 40 | "strip-ansi": "^6.0.0" 41 | }, 42 | "devDependencies": { 43 | "@types/jest": "^26.0.15", 44 | "@types/node-notifier": "^8.0.1", 45 | "@types/semver": "^7.3.8", 46 | "@types/webpack": ">4.41.31", 47 | "eslint": "^7.14.0", 48 | "eslint-config-airbnb-base": "^14.2.1", 49 | "husky": "^4.3.0", 50 | "jest": "^24.9.0", 51 | "memfs": "^3.2.0", 52 | "semver": "^7.3.2", 53 | "ts-jest": "^24.3.0", 54 | "tsd": "^0.17.0", 55 | "typescript": "^3.9.7", 56 | "webpack-1": "npm:webpack@1", 57 | "webpack-2": "npm:webpack@2", 58 | "webpack-3": "npm:webpack@3", 59 | "webpack-4": "npm:webpack@4", 60 | "webpack-5": "npm:webpack@5", 61 | "webpack-latest": "npm:webpack@latest" 62 | }, 63 | "peerDependencies": { 64 | "@types/webpack": ">4.41.31" 65 | }, 66 | "peerDependenciesMeta": { 67 | "@types/webpack": { 68 | "optional": true 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Turbo87/webpack-notifier/c8022dd49dd41e21d0154389adc7694611a96b8c/screenshot.png -------------------------------------------------------------------------------- /test-d/index-tests.ts: -------------------------------------------------------------------------------- 1 | import WebpackNotifierPlugin = require('../'); 2 | 3 | const optionsArray: WebpackNotifierPlugin.Options[] = [ 4 | { 5 | title: 'Webpack', 6 | contentImage: 'logo.png', 7 | excludeWarnings: true, 8 | alwaysNotify: true, 9 | skipFirstNotification: true, 10 | emoji: true, 11 | }, 12 | { 13 | title: (data: {msg: string,message: string,status: string}) => 'Webpack', 14 | }, 15 | ]; 16 | 17 | const plugins: WebpackNotifierPlugin[] = optionsArray.map(options => new WebpackNotifierPlugin(options)); 18 | -------------------------------------------------------------------------------- /test/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | parserOptions: { 3 | sourceType: 'module', 4 | ecmaVersion: 2017 5 | }, 6 | env: { 7 | es2017: true, 8 | jest: true 9 | }, 10 | rules: { 11 | 'no-use-before-define': 0 12 | } 13 | }; 14 | -------------------------------------------------------------------------------- /test/VerbosityLevelAllVariants.test.ts: -------------------------------------------------------------------------------- 1 | import WebpackNotifierPlugin from '../'; 2 | import {contentImageSerializer, reduceArraySerializer, testChangesFlow as _testChangesFlow, PartialTestArguments} from './helpers/utils'; 3 | 4 | expect.addSnapshotSerializer(reduceArraySerializer); 5 | expect.addSnapshotSerializer(contentImageSerializer); 6 | 7 | describe.each([ 8 | ['1', require('webpack-1/package.json').version, require('webpack-1')], 9 | ['2', require('webpack-2/package.json').version, require('webpack-2')], 10 | ['3', require('webpack-3/package.json').version, require('webpack-3')], 11 | ['4', require('webpack-4/package.json').version, require('webpack-4')], 12 | ['5', require('webpack-5/package.json').version, require('webpack-5')], 13 | ['latest', require('webpack-latest/package.json').version, require('webpack-latest')], 14 | ])('webpack@%s', (name, webpackVersion, webpack) => { 15 | const testChangesFlow = (...args: PartialTestArguments) => _testChangesFlow(webpackVersion, webpack, ...args); 16 | describe('VerbosityLevelAllVariants', () => { 17 | describe.each([...generateOptions()])('%j', (opts) => { 18 | test.each([...generateSteps(opts)])('%j', testChangesFlow); 19 | }); 20 | 21 | function* generateOptions(): Generator { 22 | for (const excludeWarnings of [false, true]) { 23 | for (const alwaysNotify of [false, true]) { 24 | for (const onlyOnError of [false, true]) { 25 | for (const skipFirstNotification of [false, true]) { 26 | yield {excludeWarnings, alwaysNotify, onlyOnError, skipFirstNotification}; 27 | } 28 | } 29 | } 30 | } 31 | } 32 | function* generateSteps(opts: WebpackNotifierPlugin.Options): Generator<[string[], WebpackNotifierPlugin.Options]> { 33 | for (const firsStep of ['successful', 'warning', 'error']) { 34 | yield [[firsStep], opts]; 35 | for (const secondStep of ['successful', 'warning', 'error']) { 36 | yield [[firsStep, secondStep], opts]; 37 | for (const thirdStep of ['successful', 'warning', 'error']) { 38 | yield [[firsStep, secondStep, thirdStep], opts]; 39 | } 40 | } 41 | } 42 | } 43 | }); 44 | }); -------------------------------------------------------------------------------- /test/WebpackNotifierPlugin.test.ts: -------------------------------------------------------------------------------- 1 | import {join} from 'path'; 2 | import {contentImageSerializer, reduceArraySerializer, testChangesFlow as _testChangesFlow, PartialTestArguments} from './helpers/utils'; 3 | import CustomWarningPlugin from './helpers/CustomWarningPlugin'; 4 | import ChildCompilationPlugin from './helpers/ChildCompilationPlugin'; 5 | 6 | expect.addSnapshotSerializer(reduceArraySerializer); 7 | expect.addSnapshotSerializer(contentImageSerializer); 8 | 9 | describe.each([ 10 | ['1', require('webpack-1/package.json').version, require('webpack-1')], 11 | ['2', require('webpack-2/package.json').version, require('webpack-2')], 12 | ['3', require('webpack-3/package.json').version, require('webpack-3')], 13 | ['4', require('webpack-4/package.json').version, require('webpack-4')], 14 | ['5', require('webpack-5/package.json').version, require('webpack-5')], 15 | ['latest', require('webpack-latest/package.json').version, require('webpack-latest')], 16 | ])('webpack@%s', (name, webpackVersion, webpack) => { 17 | const testChangesFlow = (...args: PartialTestArguments) => _testChangesFlow(webpackVersion, webpack, ...args); 18 | describe('WebpackNotifierPlugin', () => { 19 | describe('one compilation', () => { 20 | test.each([ 21 | [['successful'], undefined], 22 | [['error'], undefined], 23 | [['warning'], undefined], 24 | ])('%j %j', testChangesFlow); 25 | }); 26 | describe('title', () => { 27 | test.each([ 28 | [['successful'], {title: 'Webpack'}], 29 | [['successful'], {title}], 30 | [['error'], {title}], 31 | [['warning'], {title}], 32 | ])('%j %j', testChangesFlow); 33 | function title({msg}: {msg: string}) { 34 | if (msg.startsWith('Error')) return 'build error ❌'; 35 | if (msg.startsWith('Warning')) return 'build warning ⚠️'; 36 | return 'build complete ✅'; 37 | } 38 | describe('new title function API', () => { 39 | test.each([ 40 | [['successful'], {title: 'Webpack'}], 41 | [['successful'], {title}], 42 | [['error'], {title}], 43 | [['warning'], {title}], 44 | ])('%j %j', testChangesFlow); 45 | function title(params: {status: string, message: string}) { 46 | return `Build status is ${params.status} with message ${params.message}`; 47 | } 48 | }); 49 | }); 50 | describe('emoji message', () => { 51 | test.each([ 52 | [['successful'], {emoji: true}], 53 | [['error'], {emoji: true}], 54 | [['warning'], {emoji: true}], 55 | [['successful'], {emoji: true}, {plugins: [new CustomWarningPlugin()]}], 56 | ])('%j %j %j', testChangesFlow); 57 | }); 58 | describe('contentImage', () => { 59 | const contentImage = { 60 | success: join(__dirname, '../successImage.png'), 61 | warning: join(__dirname, '../warningsImage.png'), 62 | error: join(__dirname, '../errorsImage.png') 63 | }; 64 | test.each([ 65 | [['successful'], { 66 | contentImage: join(__dirname, '../another-logo.png') 67 | }], 68 | ])('%j {contentImage: "../another-logo.png"}', testChangesFlow); 69 | test.each([ 70 | [['successful'], {contentImage}], 71 | [['error'], {contentImage}], 72 | [['warning'], {contentImage}], 73 | ])('%j {contentImage: {success: "../successImage.png"}, error: "../errorImage.png"}, warning: "../warningImage.png"}}', testChangesFlow); 74 | }); 75 | describe('verbosity level configuration', () => { 76 | describe('Default', () => { 77 | test.each([ 78 | [['successful', 'successful', 'successful'], undefined], 79 | [['error', 'error', 'successful'], undefined], 80 | ])('%j %j', testChangesFlow); 81 | }); 82 | describe('Exclude Warnings', () => { 83 | test.each([ 84 | [['warning'], {excludeWarnings: true}], 85 | ])('%j %j', testChangesFlow); 86 | }); 87 | describe('Always Notify', () => { 88 | test.each([ 89 | [['successful', 'successful'], {alwaysNotify: true}], 90 | ])('%j %j', testChangesFlow); 91 | }); 92 | describe('Notify on error', () => { 93 | test.each([ 94 | [['successful', 'warning', 'error'], {onlyOnError: true}], 95 | ])('%j %j', testChangesFlow); 96 | }); 97 | describe('Skip Notification on the First Build', () => { 98 | test.each([ 99 | [['successful', 'successful'], {skipFirstNotification: true}], 100 | ])('%j %j', testChangesFlow); 101 | }); 102 | }); 103 | 104 | describe('custom warning', () => {// TODO maybe deprecated 105 | test.each([ 106 | [['successful'], undefined, {plugins: [new CustomWarningPlugin()]}], 107 | ])('%j %j', testChangesFlow); 108 | }); 109 | describe('child compilation errors', () => { 110 | test.each([ 111 | [['successful'], undefined, {plugins: [new ChildCompilationPlugin('Warning')]}], 112 | [['successful'], undefined, {plugins: [new ChildCompilationPlugin('Error')]}], 113 | [['successful'], undefined, {plugins: [new ChildCompilationPlugin(), new ChildCompilationPlugin('Warning')]}], 114 | ])('%j %j %j', testChangesFlow, 10e3); 115 | }); 116 | }); 117 | }); -------------------------------------------------------------------------------- /test/__snapshots__/WebpackNotifierPlugin.test.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`webpack@1 WebpackNotifierPlugin child compilation errors ["successful"] undefined {"plugins":[{"level":"Error","levelCollectionKey":"errors"}]}: after "successful" build 1`] = ` 4 | Object { 5 | "contentImage": "__dirname/logo.png", 6 | "message": "Warning: Child Compilation Error", 7 | "title": "Webpack", 8 | } 9 | `; 10 | 11 | exports[`webpack@1 WebpackNotifierPlugin child compilation errors ["successful"] undefined {"plugins":[{"level":"Warning","levelCollectionKey":"warnings"}]}: after "successful" build 1`] = ` 12 | Object { 13 | "contentImage": "__dirname/logo.png", 14 | "message": "Warning: Child Compilation Warning", 15 | "title": "Webpack", 16 | } 17 | `; 18 | 19 | exports[`webpack@1 WebpackNotifierPlugin child compilation errors ["successful"] undefined {"plugins":[{"level":false},{"level":"Warning","levelCollectionKey":"warnings"}]}: after "successful" build 1`] = ` 20 | Object { 21 | "contentImage": "__dirname/logo.png", 22 | "message": "Warning: Child Compilation Warning", 23 | "title": "Webpack", 24 | } 25 | `; 26 | 27 | exports[`webpack@1 WebpackNotifierPlugin contentImage ["error"] {contentImage: {success: "../successImage.png"}, error: "../errorImage.png"}, warning: "../warningImage.png"}}: after "error" build 1`] = ` 28 | Object { 29 | "contentImage": "__dirname/errorsImage.png", 30 | "message": "Error: /entry.js 31 | SyntaxError: Unexpected token (1:8)", 32 | "title": "Webpack", 33 | } 34 | `; 35 | 36 | exports[`webpack@1 WebpackNotifierPlugin contentImage ["successful"] {contentImage: "../another-logo.png"}: after "successful" build 1`] = ` 37 | Object { 38 | "contentImage": "__dirname/another-logo.png", 39 | "message": "Build successful", 40 | "title": "Webpack", 41 | } 42 | `; 43 | 44 | exports[`webpack@1 WebpackNotifierPlugin contentImage ["successful"] {contentImage: {success: "../successImage.png"}, error: "../errorImage.png"}, warning: "../warningImage.png"}}: after "successful" build 1`] = ` 45 | Object { 46 | "contentImage": "__dirname/successImage.png", 47 | "message": "Build successful", 48 | "title": "Webpack", 49 | } 50 | `; 51 | 52 | exports[`webpack@1 WebpackNotifierPlugin contentImage ["warning"] {contentImage: {success: "../successImage.png"}, error: "../errorImage.png"}, warning: "../warningImage.png"}}: after "warning" build 1`] = ` 53 | Object { 54 | "contentImage": "__dirname/warningsImage.png", 55 | "message": "Warning: /entry.js 56 | require.extensions is not supported by webpack. Use a loader instead.", 57 | "title": "Webpack", 58 | } 59 | `; 60 | 61 | exports[`webpack@1 WebpackNotifierPlugin custom warning ["successful"] undefined: after "successful" build 1`] = ` 62 | Object { 63 | "contentImage": "__dirname/logo.png", 64 | "message": "Warning: Custom Warning message", 65 | "title": "Webpack", 66 | } 67 | `; 68 | 69 | exports[`webpack@1 WebpackNotifierPlugin emoji message ["error"] {"emoji":true} %j: after "error" build 1`] = ` 70 | Object { 71 | "contentImage": "__dirname/logo.png", 72 | "emoji": true, 73 | "message": "❌ Error: /entry.js 74 | SyntaxError: Unexpected token (1:8)", 75 | "title": "Webpack", 76 | } 77 | `; 78 | 79 | exports[`webpack@1 WebpackNotifierPlugin emoji message ["successful"] {"emoji":true} %j: after "successful" build 1`] = ` 80 | Object { 81 | "contentImage": "__dirname/logo.png", 82 | "emoji": true, 83 | "message": "✅ Build successful", 84 | "title": "Webpack", 85 | } 86 | `; 87 | 88 | exports[`webpack@1 WebpackNotifierPlugin emoji message ["successful"] {"emoji":true} {"plugins":[{}]}: after "successful" build 1`] = ` 89 | Object { 90 | "contentImage": "__dirname/logo.png", 91 | "emoji": true, 92 | "message": "⚠️ Warning: Custom Warning message", 93 | "title": "Webpack", 94 | } 95 | `; 96 | 97 | exports[`webpack@1 WebpackNotifierPlugin emoji message ["warning"] {"emoji":true} %j: after "warning" build 1`] = ` 98 | Object { 99 | "contentImage": "__dirname/logo.png", 100 | "emoji": true, 101 | "message": "⚠️ Warning: /entry.js 102 | require.extensions is not supported by webpack. Use a loader instead.", 103 | "title": "Webpack", 104 | } 105 | `; 106 | 107 | exports[`webpack@1 WebpackNotifierPlugin one compilation ["error"] undefined: after "error" build 1`] = ` 108 | Object { 109 | "contentImage": "__dirname/logo.png", 110 | "message": "Error: /entry.js 111 | SyntaxError: Unexpected token (1:8)", 112 | "title": "Webpack", 113 | } 114 | `; 115 | 116 | exports[`webpack@1 WebpackNotifierPlugin one compilation ["successful"] undefined: after "successful" build 1`] = ` 117 | Object { 118 | "contentImage": "__dirname/logo.png", 119 | "message": "Build successful", 120 | "title": "Webpack", 121 | } 122 | `; 123 | 124 | exports[`webpack@1 WebpackNotifierPlugin one compilation ["warning"] undefined: after "warning" build 1`] = ` 125 | Object { 126 | "contentImage": "__dirname/logo.png", 127 | "message": "Warning: /entry.js 128 | require.extensions is not supported by webpack. Use a loader instead.", 129 | "title": "Webpack", 130 | } 131 | `; 132 | 133 | exports[`webpack@1 WebpackNotifierPlugin title ["error"] {}: after "error" build 1`] = ` 134 | Object { 135 | "contentImage": "__dirname/logo.png", 136 | "message": "Error: /entry.js 137 | SyntaxError: Unexpected token (1:8)", 138 | "title": "build error ❌", 139 | } 140 | `; 141 | 142 | exports[`webpack@1 WebpackNotifierPlugin title ["successful"] {"title":"Webpack"}: after "successful" build 1`] = ` 143 | Object { 144 | "contentImage": "__dirname/logo.png", 145 | "message": "Build successful", 146 | "title": "Webpack", 147 | } 148 | `; 149 | 150 | exports[`webpack@1 WebpackNotifierPlugin title ["successful"] {}: after "successful" build 1`] = ` 151 | Object { 152 | "contentImage": "__dirname/logo.png", 153 | "message": "Build successful", 154 | "title": "build complete ✅", 155 | } 156 | `; 157 | 158 | exports[`webpack@1 WebpackNotifierPlugin title ["warning"] {}: after "warning" build 1`] = ` 159 | Object { 160 | "contentImage": "__dirname/logo.png", 161 | "message": "Warning: /entry.js 162 | require.extensions is not supported by webpack. Use a loader instead.", 163 | "title": "build warning ⚠️", 164 | } 165 | `; 166 | 167 | exports[`webpack@1 WebpackNotifierPlugin title new title function API ["error"] {}: after "error" build 1`] = ` 168 | Object { 169 | "contentImage": "__dirname/logo.png", 170 | "message": "Error: /entry.js 171 | SyntaxError: Unexpected token (1:8)", 172 | "title": "Build status is error with message Error: /entry.js 173 | SyntaxError: Unexpected token (1:8)", 174 | } 175 | `; 176 | 177 | exports[`webpack@1 WebpackNotifierPlugin title new title function API ["successful"] {"title":"Webpack"}: after "successful" build 1`] = ` 178 | Object { 179 | "contentImage": "__dirname/logo.png", 180 | "message": "Build successful", 181 | "title": "Webpack", 182 | } 183 | `; 184 | 185 | exports[`webpack@1 WebpackNotifierPlugin title new title function API ["successful"] {}: after "successful" build 1`] = ` 186 | Object { 187 | "contentImage": "__dirname/logo.png", 188 | "message": "Build successful", 189 | "title": "Build status is success with message Build successful", 190 | } 191 | `; 192 | 193 | exports[`webpack@1 WebpackNotifierPlugin title new title function API ["warning"] {}: after "warning" build 1`] = ` 194 | Object { 195 | "contentImage": "__dirname/logo.png", 196 | "message": "Warning: /entry.js 197 | require.extensions is not supported by webpack. Use a loader instead.", 198 | "title": "Build status is warning with message Warning: /entry.js 199 | require.extensions is not supported by webpack. Use a loader instead.", 200 | } 201 | `; 202 | 203 | exports[`webpack@1 WebpackNotifierPlugin verbosity level configuration Always Notify ["successful","successful"] {"alwaysNotify":true}: after "successful" build 1`] = ` 204 | Object { 205 | "alwaysNotify": true, 206 | "contentImage": "__dirname/logo.png", 207 | "message": "Build successful", 208 | "title": "Webpack", 209 | } 210 | `; 211 | 212 | exports[`webpack@1 WebpackNotifierPlugin verbosity level configuration Always Notify ["successful","successful"] {"alwaysNotify":true}: after "successful" build 2`] = ` 213 | Object { 214 | "alwaysNotify": true, 215 | "contentImage": "__dirname/logo.png", 216 | "message": "Build successful", 217 | "title": "Webpack", 218 | } 219 | `; 220 | 221 | exports[`webpack@1 WebpackNotifierPlugin verbosity level configuration Default ["error","error","successful"] undefined: after "error" build 1`] = ` 222 | Object { 223 | "contentImage": "__dirname/logo.png", 224 | "message": "Error: /entry.js 225 | SyntaxError: Unexpected token (1:8)", 226 | "title": "Webpack", 227 | } 228 | `; 229 | 230 | exports[`webpack@1 WebpackNotifierPlugin verbosity level configuration Default ["error","error","successful"] undefined: after "error" build 2`] = ` 231 | Object { 232 | "contentImage": "__dirname/logo.png", 233 | "message": "Error: /entry.js 234 | SyntaxError: Unexpected token (1:8)", 235 | "title": "Webpack", 236 | } 237 | `; 238 | 239 | exports[`webpack@1 WebpackNotifierPlugin verbosity level configuration Default ["error","error","successful"] undefined: after "successful" build 1`] = ` 240 | Object { 241 | "contentImage": "__dirname/logo.png", 242 | "message": "Build successful", 243 | "title": "Webpack", 244 | } 245 | `; 246 | 247 | exports[`webpack@1 WebpackNotifierPlugin verbosity level configuration Default ["successful","successful","successful"] undefined: after "successful" build 1`] = ` 248 | Object { 249 | "contentImage": "__dirname/logo.png", 250 | "message": "Build successful", 251 | "title": "Webpack", 252 | } 253 | `; 254 | 255 | exports[`webpack@1 WebpackNotifierPlugin verbosity level configuration Default ["successful","successful","successful"] undefined: after "successful" build 2`] = `Array []`; 256 | 257 | exports[`webpack@1 WebpackNotifierPlugin verbosity level configuration Default ["successful","successful","successful"] undefined: after "successful" build 3`] = `Array []`; 258 | 259 | exports[`webpack@1 WebpackNotifierPlugin verbosity level configuration Exclude Warnings ["warning"] {"excludeWarnings":true}: after "warning" build 1`] = ` 260 | Object { 261 | "contentImage": "__dirname/logo.png", 262 | "excludeWarnings": true, 263 | "message": "Build successful", 264 | "title": "Webpack", 265 | } 266 | `; 267 | 268 | exports[`webpack@1 WebpackNotifierPlugin verbosity level configuration Notify on error ["successful","warning","error"] {"onlyOnError":true}: after "error" build 1`] = ` 269 | Object { 270 | "contentImage": "__dirname/logo.png", 271 | "message": "Error: /entry.js 272 | SyntaxError: Unexpected token (1:8)", 273 | "onlyOnError": true, 274 | "title": "Webpack", 275 | } 276 | `; 277 | 278 | exports[`webpack@1 WebpackNotifierPlugin verbosity level configuration Notify on error ["successful","warning","error"] {"onlyOnError":true}: after "successful" build 1`] = `Array []`; 279 | 280 | exports[`webpack@1 WebpackNotifierPlugin verbosity level configuration Notify on error ["successful","warning","error"] {"onlyOnError":true}: after "warning" build 1`] = `Array []`; 281 | 282 | exports[`webpack@1 WebpackNotifierPlugin verbosity level configuration Skip Notification on the First Build ["successful","successful"] {"skipFirstNotification":true}: after "successful" build 1`] = `Array []`; 283 | 284 | exports[`webpack@1 WebpackNotifierPlugin verbosity level configuration Skip Notification on the First Build ["successful","successful"] {"skipFirstNotification":true}: after "successful" build 2`] = ` 285 | Object { 286 | "contentImage": "__dirname/logo.png", 287 | "message": "Build successful", 288 | "skipFirstNotification": true, 289 | "title": "Webpack", 290 | } 291 | `; 292 | 293 | exports[`webpack@2 WebpackNotifierPlugin child compilation errors ["successful"] undefined {"plugins":[{"level":"Error","levelCollectionKey":"errors"}]}: after "successful" build 1`] = ` 294 | Object { 295 | "contentImage": "__dirname/logo.png", 296 | "message": "Warning: Child Compilation Error", 297 | "title": "Webpack", 298 | } 299 | `; 300 | 301 | exports[`webpack@2 WebpackNotifierPlugin child compilation errors ["successful"] undefined {"plugins":[{"level":"Warning","levelCollectionKey":"warnings"}]}: after "successful" build 1`] = ` 302 | Object { 303 | "contentImage": "__dirname/logo.png", 304 | "message": "Warning: Child Compilation Warning", 305 | "title": "Webpack", 306 | } 307 | `; 308 | 309 | exports[`webpack@2 WebpackNotifierPlugin child compilation errors ["successful"] undefined {"plugins":[{"level":false},{"level":"Warning","levelCollectionKey":"warnings"}]}: after "successful" build 1`] = ` 310 | Object { 311 | "contentImage": "__dirname/logo.png", 312 | "message": "Warning: Child Compilation Warning", 313 | "title": "Webpack", 314 | } 315 | `; 316 | 317 | exports[`webpack@2 WebpackNotifierPlugin contentImage ["error"] {contentImage: {success: "../successImage.png"}, error: "../errorImage.png"}, warning: "../warningImage.png"}}: after "error" build 1`] = ` 318 | Object { 319 | "contentImage": "__dirname/errorsImage.png", 320 | "message": "Error: /entry.js 321 | SyntaxError: Unexpected token (1:8)", 322 | "title": "Webpack", 323 | } 324 | `; 325 | 326 | exports[`webpack@2 WebpackNotifierPlugin contentImage ["successful"] {contentImage: "../another-logo.png"}: after "successful" build 1`] = ` 327 | Object { 328 | "contentImage": "__dirname/another-logo.png", 329 | "message": "Build successful", 330 | "title": "Webpack", 331 | } 332 | `; 333 | 334 | exports[`webpack@2 WebpackNotifierPlugin contentImage ["successful"] {contentImage: {success: "../successImage.png"}, error: "../errorImage.png"}, warning: "../warningImage.png"}}: after "successful" build 1`] = ` 335 | Object { 336 | "contentImage": "__dirname/successImage.png", 337 | "message": "Build successful", 338 | "title": "Webpack", 339 | } 340 | `; 341 | 342 | exports[`webpack@2 WebpackNotifierPlugin contentImage ["warning"] {contentImage: {success: "../successImage.png"}, error: "../errorImage.png"}, warning: "../warningImage.png"}}: after "warning" build 1`] = ` 343 | Object { 344 | "contentImage": "__dirname/warningsImage.png", 345 | "message": "Warning: /entry.js 346 | require.extensions is not supported by webpack. Use a loader instead.", 347 | "title": "Webpack", 348 | } 349 | `; 350 | 351 | exports[`webpack@2 WebpackNotifierPlugin custom warning ["successful"] undefined: after "successful" build 1`] = ` 352 | Object { 353 | "contentImage": "__dirname/logo.png", 354 | "message": "Warning: Custom Warning message", 355 | "title": "Webpack", 356 | } 357 | `; 358 | 359 | exports[`webpack@2 WebpackNotifierPlugin emoji message ["error"] {"emoji":true} %j: after "error" build 1`] = ` 360 | Object { 361 | "contentImage": "__dirname/logo.png", 362 | "emoji": true, 363 | "message": "❌ Error: /entry.js 364 | SyntaxError: Unexpected token (1:8)", 365 | "title": "Webpack", 366 | } 367 | `; 368 | 369 | exports[`webpack@2 WebpackNotifierPlugin emoji message ["successful"] {"emoji":true} %j: after "successful" build 1`] = ` 370 | Object { 371 | "contentImage": "__dirname/logo.png", 372 | "emoji": true, 373 | "message": "✅ Build successful", 374 | "title": "Webpack", 375 | } 376 | `; 377 | 378 | exports[`webpack@2 WebpackNotifierPlugin emoji message ["successful"] {"emoji":true} {"plugins":[{}]}: after "successful" build 1`] = ` 379 | Object { 380 | "contentImage": "__dirname/logo.png", 381 | "emoji": true, 382 | "message": "⚠️ Warning: Custom Warning message", 383 | "title": "Webpack", 384 | } 385 | `; 386 | 387 | exports[`webpack@2 WebpackNotifierPlugin emoji message ["warning"] {"emoji":true} %j: after "warning" build 1`] = ` 388 | Object { 389 | "contentImage": "__dirname/logo.png", 390 | "emoji": true, 391 | "message": "⚠️ Warning: /entry.js 392 | require.extensions is not supported by webpack. Use a loader instead.", 393 | "title": "Webpack", 394 | } 395 | `; 396 | 397 | exports[`webpack@2 WebpackNotifierPlugin one compilation ["error"] undefined: after "error" build 1`] = ` 398 | Object { 399 | "contentImage": "__dirname/logo.png", 400 | "message": "Error: /entry.js 401 | SyntaxError: Unexpected token (1:8)", 402 | "title": "Webpack", 403 | } 404 | `; 405 | 406 | exports[`webpack@2 WebpackNotifierPlugin one compilation ["successful"] undefined: after "successful" build 1`] = ` 407 | Object { 408 | "contentImage": "__dirname/logo.png", 409 | "message": "Build successful", 410 | "title": "Webpack", 411 | } 412 | `; 413 | 414 | exports[`webpack@2 WebpackNotifierPlugin one compilation ["warning"] undefined: after "warning" build 1`] = ` 415 | Object { 416 | "contentImage": "__dirname/logo.png", 417 | "message": "Warning: /entry.js 418 | require.extensions is not supported by webpack. Use a loader instead.", 419 | "title": "Webpack", 420 | } 421 | `; 422 | 423 | exports[`webpack@2 WebpackNotifierPlugin title ["error"] {}: after "error" build 1`] = ` 424 | Object { 425 | "contentImage": "__dirname/logo.png", 426 | "message": "Error: /entry.js 427 | SyntaxError: Unexpected token (1:8)", 428 | "title": "build error ❌", 429 | } 430 | `; 431 | 432 | exports[`webpack@2 WebpackNotifierPlugin title ["successful"] {"title":"Webpack"}: after "successful" build 1`] = ` 433 | Object { 434 | "contentImage": "__dirname/logo.png", 435 | "message": "Build successful", 436 | "title": "Webpack", 437 | } 438 | `; 439 | 440 | exports[`webpack@2 WebpackNotifierPlugin title ["successful"] {}: after "successful" build 1`] = ` 441 | Object { 442 | "contentImage": "__dirname/logo.png", 443 | "message": "Build successful", 444 | "title": "build complete ✅", 445 | } 446 | `; 447 | 448 | exports[`webpack@2 WebpackNotifierPlugin title ["warning"] {}: after "warning" build 1`] = ` 449 | Object { 450 | "contentImage": "__dirname/logo.png", 451 | "message": "Warning: /entry.js 452 | require.extensions is not supported by webpack. Use a loader instead.", 453 | "title": "build warning ⚠️", 454 | } 455 | `; 456 | 457 | exports[`webpack@2 WebpackNotifierPlugin title new title function API ["error"] {}: after "error" build 1`] = ` 458 | Object { 459 | "contentImage": "__dirname/logo.png", 460 | "message": "Error: /entry.js 461 | SyntaxError: Unexpected token (1:8)", 462 | "title": "Build status is error with message Error: /entry.js 463 | SyntaxError: Unexpected token (1:8)", 464 | } 465 | `; 466 | 467 | exports[`webpack@2 WebpackNotifierPlugin title new title function API ["successful"] {"title":"Webpack"}: after "successful" build 1`] = ` 468 | Object { 469 | "contentImage": "__dirname/logo.png", 470 | "message": "Build successful", 471 | "title": "Webpack", 472 | } 473 | `; 474 | 475 | exports[`webpack@2 WebpackNotifierPlugin title new title function API ["successful"] {}: after "successful" build 1`] = ` 476 | Object { 477 | "contentImage": "__dirname/logo.png", 478 | "message": "Build successful", 479 | "title": "Build status is success with message Build successful", 480 | } 481 | `; 482 | 483 | exports[`webpack@2 WebpackNotifierPlugin title new title function API ["warning"] {}: after "warning" build 1`] = ` 484 | Object { 485 | "contentImage": "__dirname/logo.png", 486 | "message": "Warning: /entry.js 487 | require.extensions is not supported by webpack. Use a loader instead.", 488 | "title": "Build status is warning with message Warning: /entry.js 489 | require.extensions is not supported by webpack. Use a loader instead.", 490 | } 491 | `; 492 | 493 | exports[`webpack@2 WebpackNotifierPlugin verbosity level configuration Always Notify ["successful","successful"] {"alwaysNotify":true}: after "successful" build 1`] = ` 494 | Object { 495 | "alwaysNotify": true, 496 | "contentImage": "__dirname/logo.png", 497 | "message": "Build successful", 498 | "title": "Webpack", 499 | } 500 | `; 501 | 502 | exports[`webpack@2 WebpackNotifierPlugin verbosity level configuration Always Notify ["successful","successful"] {"alwaysNotify":true}: after "successful" build 2`] = ` 503 | Object { 504 | "alwaysNotify": true, 505 | "contentImage": "__dirname/logo.png", 506 | "message": "Build successful", 507 | "title": "Webpack", 508 | } 509 | `; 510 | 511 | exports[`webpack@2 WebpackNotifierPlugin verbosity level configuration Default ["error","error","successful"] undefined: after "error" build 1`] = ` 512 | Object { 513 | "contentImage": "__dirname/logo.png", 514 | "message": "Error: /entry.js 515 | SyntaxError: Unexpected token (1:8)", 516 | "title": "Webpack", 517 | } 518 | `; 519 | 520 | exports[`webpack@2 WebpackNotifierPlugin verbosity level configuration Default ["error","error","successful"] undefined: after "error" build 2`] = ` 521 | Object { 522 | "contentImage": "__dirname/logo.png", 523 | "message": "Error: /entry.js 524 | SyntaxError: Unexpected token (1:8)", 525 | "title": "Webpack", 526 | } 527 | `; 528 | 529 | exports[`webpack@2 WebpackNotifierPlugin verbosity level configuration Default ["error","error","successful"] undefined: after "successful" build 1`] = ` 530 | Object { 531 | "contentImage": "__dirname/logo.png", 532 | "message": "Build successful", 533 | "title": "Webpack", 534 | } 535 | `; 536 | 537 | exports[`webpack@2 WebpackNotifierPlugin verbosity level configuration Default ["successful","successful","successful"] undefined: after "successful" build 1`] = ` 538 | Object { 539 | "contentImage": "__dirname/logo.png", 540 | "message": "Build successful", 541 | "title": "Webpack", 542 | } 543 | `; 544 | 545 | exports[`webpack@2 WebpackNotifierPlugin verbosity level configuration Default ["successful","successful","successful"] undefined: after "successful" build 2`] = `Array []`; 546 | 547 | exports[`webpack@2 WebpackNotifierPlugin verbosity level configuration Default ["successful","successful","successful"] undefined: after "successful" build 3`] = `Array []`; 548 | 549 | exports[`webpack@2 WebpackNotifierPlugin verbosity level configuration Exclude Warnings ["warning"] {"excludeWarnings":true}: after "warning" build 1`] = ` 550 | Object { 551 | "contentImage": "__dirname/logo.png", 552 | "excludeWarnings": true, 553 | "message": "Build successful", 554 | "title": "Webpack", 555 | } 556 | `; 557 | 558 | exports[`webpack@2 WebpackNotifierPlugin verbosity level configuration Notify on error ["successful","warning","error"] {"onlyOnError":true}: after "error" build 1`] = ` 559 | Object { 560 | "contentImage": "__dirname/logo.png", 561 | "message": "Error: /entry.js 562 | SyntaxError: Unexpected token (1:8)", 563 | "onlyOnError": true, 564 | "title": "Webpack", 565 | } 566 | `; 567 | 568 | exports[`webpack@2 WebpackNotifierPlugin verbosity level configuration Notify on error ["successful","warning","error"] {"onlyOnError":true}: after "successful" build 1`] = `Array []`; 569 | 570 | exports[`webpack@2 WebpackNotifierPlugin verbosity level configuration Notify on error ["successful","warning","error"] {"onlyOnError":true}: after "warning" build 1`] = `Array []`; 571 | 572 | exports[`webpack@2 WebpackNotifierPlugin verbosity level configuration Skip Notification on the First Build ["successful","successful"] {"skipFirstNotification":true}: after "successful" build 1`] = `Array []`; 573 | 574 | exports[`webpack@2 WebpackNotifierPlugin verbosity level configuration Skip Notification on the First Build ["successful","successful"] {"skipFirstNotification":true}: after "successful" build 2`] = ` 575 | Object { 576 | "contentImage": "__dirname/logo.png", 577 | "message": "Build successful", 578 | "skipFirstNotification": true, 579 | "title": "Webpack", 580 | } 581 | `; 582 | 583 | exports[`webpack@3 WebpackNotifierPlugin child compilation errors ["successful"] undefined {"plugins":[{"level":"Error","levelCollectionKey":"errors"}]}: after "successful" build 1`] = ` 584 | Object { 585 | "contentImage": "__dirname/logo.png", 586 | "message": "Warning: Child Compilation Error", 587 | "title": "Webpack", 588 | } 589 | `; 590 | 591 | exports[`webpack@3 WebpackNotifierPlugin child compilation errors ["successful"] undefined {"plugins":[{"level":"Warning","levelCollectionKey":"warnings"}]}: after "successful" build 1`] = ` 592 | Object { 593 | "contentImage": "__dirname/logo.png", 594 | "message": "Warning: Child Compilation Warning", 595 | "title": "Webpack", 596 | } 597 | `; 598 | 599 | exports[`webpack@3 WebpackNotifierPlugin child compilation errors ["successful"] undefined {"plugins":[{"level":false},{"level":"Warning","levelCollectionKey":"warnings"}]}: after "successful" build 1`] = ` 600 | Object { 601 | "contentImage": "__dirname/logo.png", 602 | "message": "Warning: Child Compilation Warning", 603 | "title": "Webpack", 604 | } 605 | `; 606 | 607 | exports[`webpack@3 WebpackNotifierPlugin contentImage ["error"] {contentImage: {success: "../successImage.png"}, error: "../errorImage.png"}, warning: "../warningImage.png"}}: after "error" build 1`] = ` 608 | Object { 609 | "contentImage": "__dirname/errorsImage.png", 610 | "message": "Error: /entry.js 611 | SyntaxError: Unexpected token (1:8)", 612 | "title": "Webpack", 613 | } 614 | `; 615 | 616 | exports[`webpack@3 WebpackNotifierPlugin contentImage ["successful"] {contentImage: "../another-logo.png"}: after "successful" build 1`] = ` 617 | Object { 618 | "contentImage": "__dirname/another-logo.png", 619 | "message": "Build successful", 620 | "title": "Webpack", 621 | } 622 | `; 623 | 624 | exports[`webpack@3 WebpackNotifierPlugin contentImage ["successful"] {contentImage: {success: "../successImage.png"}, error: "../errorImage.png"}, warning: "../warningImage.png"}}: after "successful" build 1`] = ` 625 | Object { 626 | "contentImage": "__dirname/successImage.png", 627 | "message": "Build successful", 628 | "title": "Webpack", 629 | } 630 | `; 631 | 632 | exports[`webpack@3 WebpackNotifierPlugin contentImage ["warning"] {contentImage: {success: "../successImage.png"}, error: "../errorImage.png"}, warning: "../warningImage.png"}}: after "warning" build 1`] = ` 633 | Object { 634 | "contentImage": "__dirname/warningsImage.png", 635 | "message": "Warning: /entry.js 636 | require.extensions is not supported by webpack. Use a loader instead.", 637 | "title": "Webpack", 638 | } 639 | `; 640 | 641 | exports[`webpack@3 WebpackNotifierPlugin custom warning ["successful"] undefined: after "successful" build 1`] = ` 642 | Object { 643 | "contentImage": "__dirname/logo.png", 644 | "message": "Warning: Custom Warning message", 645 | "title": "Webpack", 646 | } 647 | `; 648 | 649 | exports[`webpack@3 WebpackNotifierPlugin emoji message ["error"] {"emoji":true} %j: after "error" build 1`] = ` 650 | Object { 651 | "contentImage": "__dirname/logo.png", 652 | "emoji": true, 653 | "message": "❌ Error: /entry.js 654 | SyntaxError: Unexpected token (1:8)", 655 | "title": "Webpack", 656 | } 657 | `; 658 | 659 | exports[`webpack@3 WebpackNotifierPlugin emoji message ["successful"] {"emoji":true} %j: after "successful" build 1`] = ` 660 | Object { 661 | "contentImage": "__dirname/logo.png", 662 | "emoji": true, 663 | "message": "✅ Build successful", 664 | "title": "Webpack", 665 | } 666 | `; 667 | 668 | exports[`webpack@3 WebpackNotifierPlugin emoji message ["successful"] {"emoji":true} {"plugins":[{}]}: after "successful" build 1`] = ` 669 | Object { 670 | "contentImage": "__dirname/logo.png", 671 | "emoji": true, 672 | "message": "⚠️ Warning: Custom Warning message", 673 | "title": "Webpack", 674 | } 675 | `; 676 | 677 | exports[`webpack@3 WebpackNotifierPlugin emoji message ["warning"] {"emoji":true} %j: after "warning" build 1`] = ` 678 | Object { 679 | "contentImage": "__dirname/logo.png", 680 | "emoji": true, 681 | "message": "⚠️ Warning: /entry.js 682 | require.extensions is not supported by webpack. Use a loader instead.", 683 | "title": "Webpack", 684 | } 685 | `; 686 | 687 | exports[`webpack@3 WebpackNotifierPlugin one compilation ["error"] undefined: after "error" build 1`] = ` 688 | Object { 689 | "contentImage": "__dirname/logo.png", 690 | "message": "Error: /entry.js 691 | SyntaxError: Unexpected token (1:8)", 692 | "title": "Webpack", 693 | } 694 | `; 695 | 696 | exports[`webpack@3 WebpackNotifierPlugin one compilation ["successful"] undefined: after "successful" build 1`] = ` 697 | Object { 698 | "contentImage": "__dirname/logo.png", 699 | "message": "Build successful", 700 | "title": "Webpack", 701 | } 702 | `; 703 | 704 | exports[`webpack@3 WebpackNotifierPlugin one compilation ["warning"] undefined: after "warning" build 1`] = ` 705 | Object { 706 | "contentImage": "__dirname/logo.png", 707 | "message": "Warning: /entry.js 708 | require.extensions is not supported by webpack. Use a loader instead.", 709 | "title": "Webpack", 710 | } 711 | `; 712 | 713 | exports[`webpack@3 WebpackNotifierPlugin title ["error"] {}: after "error" build 1`] = ` 714 | Object { 715 | "contentImage": "__dirname/logo.png", 716 | "message": "Error: /entry.js 717 | SyntaxError: Unexpected token (1:8)", 718 | "title": "build error ❌", 719 | } 720 | `; 721 | 722 | exports[`webpack@3 WebpackNotifierPlugin title ["successful"] {"title":"Webpack"}: after "successful" build 1`] = ` 723 | Object { 724 | "contentImage": "__dirname/logo.png", 725 | "message": "Build successful", 726 | "title": "Webpack", 727 | } 728 | `; 729 | 730 | exports[`webpack@3 WebpackNotifierPlugin title ["successful"] {}: after "successful" build 1`] = ` 731 | Object { 732 | "contentImage": "__dirname/logo.png", 733 | "message": "Build successful", 734 | "title": "build complete ✅", 735 | } 736 | `; 737 | 738 | exports[`webpack@3 WebpackNotifierPlugin title ["warning"] {}: after "warning" build 1`] = ` 739 | Object { 740 | "contentImage": "__dirname/logo.png", 741 | "message": "Warning: /entry.js 742 | require.extensions is not supported by webpack. Use a loader instead.", 743 | "title": "build warning ⚠️", 744 | } 745 | `; 746 | 747 | exports[`webpack@3 WebpackNotifierPlugin title new title function API ["error"] {}: after "error" build 1`] = ` 748 | Object { 749 | "contentImage": "__dirname/logo.png", 750 | "message": "Error: /entry.js 751 | SyntaxError: Unexpected token (1:8)", 752 | "title": "Build status is error with message Error: /entry.js 753 | SyntaxError: Unexpected token (1:8)", 754 | } 755 | `; 756 | 757 | exports[`webpack@3 WebpackNotifierPlugin title new title function API ["successful"] {"title":"Webpack"}: after "successful" build 1`] = ` 758 | Object { 759 | "contentImage": "__dirname/logo.png", 760 | "message": "Build successful", 761 | "title": "Webpack", 762 | } 763 | `; 764 | 765 | exports[`webpack@3 WebpackNotifierPlugin title new title function API ["successful"] {}: after "successful" build 1`] = ` 766 | Object { 767 | "contentImage": "__dirname/logo.png", 768 | "message": "Build successful", 769 | "title": "Build status is success with message Build successful", 770 | } 771 | `; 772 | 773 | exports[`webpack@3 WebpackNotifierPlugin title new title function API ["warning"] {}: after "warning" build 1`] = ` 774 | Object { 775 | "contentImage": "__dirname/logo.png", 776 | "message": "Warning: /entry.js 777 | require.extensions is not supported by webpack. Use a loader instead.", 778 | "title": "Build status is warning with message Warning: /entry.js 779 | require.extensions is not supported by webpack. Use a loader instead.", 780 | } 781 | `; 782 | 783 | exports[`webpack@3 WebpackNotifierPlugin verbosity level configuration Always Notify ["successful","successful"] {"alwaysNotify":true}: after "successful" build 1`] = ` 784 | Object { 785 | "alwaysNotify": true, 786 | "contentImage": "__dirname/logo.png", 787 | "message": "Build successful", 788 | "title": "Webpack", 789 | } 790 | `; 791 | 792 | exports[`webpack@3 WebpackNotifierPlugin verbosity level configuration Always Notify ["successful","successful"] {"alwaysNotify":true}: after "successful" build 2`] = ` 793 | Object { 794 | "alwaysNotify": true, 795 | "contentImage": "__dirname/logo.png", 796 | "message": "Build successful", 797 | "title": "Webpack", 798 | } 799 | `; 800 | 801 | exports[`webpack@3 WebpackNotifierPlugin verbosity level configuration Default ["error","error","successful"] undefined: after "error" build 1`] = ` 802 | Object { 803 | "contentImage": "__dirname/logo.png", 804 | "message": "Error: /entry.js 805 | SyntaxError: Unexpected token (1:8)", 806 | "title": "Webpack", 807 | } 808 | `; 809 | 810 | exports[`webpack@3 WebpackNotifierPlugin verbosity level configuration Default ["error","error","successful"] undefined: after "error" build 2`] = ` 811 | Object { 812 | "contentImage": "__dirname/logo.png", 813 | "message": "Error: /entry.js 814 | SyntaxError: Unexpected token (1:8)", 815 | "title": "Webpack", 816 | } 817 | `; 818 | 819 | exports[`webpack@3 WebpackNotifierPlugin verbosity level configuration Default ["error","error","successful"] undefined: after "successful" build 1`] = ` 820 | Object { 821 | "contentImage": "__dirname/logo.png", 822 | "message": "Build successful", 823 | "title": "Webpack", 824 | } 825 | `; 826 | 827 | exports[`webpack@3 WebpackNotifierPlugin verbosity level configuration Default ["successful","successful","successful"] undefined: after "successful" build 1`] = ` 828 | Object { 829 | "contentImage": "__dirname/logo.png", 830 | "message": "Build successful", 831 | "title": "Webpack", 832 | } 833 | `; 834 | 835 | exports[`webpack@3 WebpackNotifierPlugin verbosity level configuration Default ["successful","successful","successful"] undefined: after "successful" build 2`] = `Array []`; 836 | 837 | exports[`webpack@3 WebpackNotifierPlugin verbosity level configuration Default ["successful","successful","successful"] undefined: after "successful" build 3`] = `Array []`; 838 | 839 | exports[`webpack@3 WebpackNotifierPlugin verbosity level configuration Exclude Warnings ["warning"] {"excludeWarnings":true}: after "warning" build 1`] = ` 840 | Object { 841 | "contentImage": "__dirname/logo.png", 842 | "excludeWarnings": true, 843 | "message": "Build successful", 844 | "title": "Webpack", 845 | } 846 | `; 847 | 848 | exports[`webpack@3 WebpackNotifierPlugin verbosity level configuration Notify on error ["successful","warning","error"] {"onlyOnError":true}: after "error" build 1`] = ` 849 | Object { 850 | "contentImage": "__dirname/logo.png", 851 | "message": "Error: /entry.js 852 | SyntaxError: Unexpected token (1:8)", 853 | "onlyOnError": true, 854 | "title": "Webpack", 855 | } 856 | `; 857 | 858 | exports[`webpack@3 WebpackNotifierPlugin verbosity level configuration Notify on error ["successful","warning","error"] {"onlyOnError":true}: after "successful" build 1`] = `Array []`; 859 | 860 | exports[`webpack@3 WebpackNotifierPlugin verbosity level configuration Notify on error ["successful","warning","error"] {"onlyOnError":true}: after "warning" build 1`] = `Array []`; 861 | 862 | exports[`webpack@3 WebpackNotifierPlugin verbosity level configuration Skip Notification on the First Build ["successful","successful"] {"skipFirstNotification":true}: after "successful" build 1`] = `Array []`; 863 | 864 | exports[`webpack@3 WebpackNotifierPlugin verbosity level configuration Skip Notification on the First Build ["successful","successful"] {"skipFirstNotification":true}: after "successful" build 2`] = ` 865 | Object { 866 | "contentImage": "__dirname/logo.png", 867 | "message": "Build successful", 868 | "skipFirstNotification": true, 869 | "title": "Webpack", 870 | } 871 | `; 872 | 873 | exports[`webpack@4 WebpackNotifierPlugin child compilation errors ["successful"] undefined {"plugins":[{"level":"Error","levelCollectionKey":"errors"}]}: after "successful" build 1`] = ` 874 | Object { 875 | "contentImage": "__dirname/logo.png", 876 | "message": "Warning: Child Compilation Error", 877 | "title": "Webpack", 878 | } 879 | `; 880 | 881 | exports[`webpack@4 WebpackNotifierPlugin child compilation errors ["successful"] undefined {"plugins":[{"level":"Warning","levelCollectionKey":"warnings"}]}: after "successful" build 1`] = ` 882 | Object { 883 | "contentImage": "__dirname/logo.png", 884 | "message": "Warning: Child Compilation Warning", 885 | "title": "Webpack", 886 | } 887 | `; 888 | 889 | exports[`webpack@4 WebpackNotifierPlugin child compilation errors ["successful"] undefined {"plugins":[{"level":false},{"level":"Warning","levelCollectionKey":"warnings"}]}: after "successful" build 1`] = ` 890 | Object { 891 | "contentImage": "__dirname/logo.png", 892 | "message": "Warning: Child Compilation Warning", 893 | "title": "Webpack", 894 | } 895 | `; 896 | 897 | exports[`webpack@4 WebpackNotifierPlugin contentImage ["error"] {contentImage: {success: "../successImage.png"}, error: "../errorImage.png"}, warning: "../warningImage.png"}}: after "error" build 1`] = ` 898 | Object { 899 | "contentImage": "__dirname/errorsImage.png", 900 | "message": "Error: /entry.js 901 | SyntaxError: Unexpected token (1:8)", 902 | "title": "Webpack", 903 | } 904 | `; 905 | 906 | exports[`webpack@4 WebpackNotifierPlugin contentImage ["successful"] {contentImage: "../another-logo.png"}: after "successful" build 1`] = ` 907 | Object { 908 | "contentImage": "__dirname/another-logo.png", 909 | "message": "Build successful", 910 | "title": "Webpack", 911 | } 912 | `; 913 | 914 | exports[`webpack@4 WebpackNotifierPlugin contentImage ["successful"] {contentImage: {success: "../successImage.png"}, error: "../errorImage.png"}, warning: "../warningImage.png"}}: after "successful" build 1`] = ` 915 | Object { 916 | "contentImage": "__dirname/successImage.png", 917 | "message": "Build successful", 918 | "title": "Webpack", 919 | } 920 | `; 921 | 922 | exports[`webpack@4 WebpackNotifierPlugin contentImage ["warning"] {contentImage: {success: "../successImage.png"}, error: "../errorImage.png"}, warning: "../warningImage.png"}}: after "warning" build 1`] = ` 923 | Object { 924 | "contentImage": "__dirname/warningsImage.png", 925 | "message": "Warning: /entry.js 926 | require.extensions is not supported by webpack. Use a loader instead.", 927 | "title": "Webpack", 928 | } 929 | `; 930 | 931 | exports[`webpack@4 WebpackNotifierPlugin custom warning ["successful"] undefined: after "successful" build 1`] = ` 932 | Object { 933 | "contentImage": "__dirname/logo.png", 934 | "message": "Warning: Custom Warning message", 935 | "title": "Webpack", 936 | } 937 | `; 938 | 939 | exports[`webpack@4 WebpackNotifierPlugin emoji message ["error"] {"emoji":true} %j: after "error" build 1`] = ` 940 | Object { 941 | "contentImage": "__dirname/logo.png", 942 | "emoji": true, 943 | "message": "❌ Error: /entry.js 944 | SyntaxError: Unexpected token (1:8)", 945 | "title": "Webpack", 946 | } 947 | `; 948 | 949 | exports[`webpack@4 WebpackNotifierPlugin emoji message ["successful"] {"emoji":true} %j: after "successful" build 1`] = ` 950 | Object { 951 | "contentImage": "__dirname/logo.png", 952 | "emoji": true, 953 | "message": "✅ Build successful", 954 | "title": "Webpack", 955 | } 956 | `; 957 | 958 | exports[`webpack@4 WebpackNotifierPlugin emoji message ["successful"] {"emoji":true} {"plugins":[{}]}: after "successful" build 1`] = ` 959 | Object { 960 | "contentImage": "__dirname/logo.png", 961 | "emoji": true, 962 | "message": "⚠️ Warning: Custom Warning message", 963 | "title": "Webpack", 964 | } 965 | `; 966 | 967 | exports[`webpack@4 WebpackNotifierPlugin emoji message ["warning"] {"emoji":true} %j: after "warning" build 1`] = ` 968 | Object { 969 | "contentImage": "__dirname/logo.png", 970 | "emoji": true, 971 | "message": "⚠️ Warning: /entry.js 972 | require.extensions is not supported by webpack. Use a loader instead.", 973 | "title": "Webpack", 974 | } 975 | `; 976 | 977 | exports[`webpack@4 WebpackNotifierPlugin one compilation ["error"] undefined: after "error" build 1`] = ` 978 | Object { 979 | "contentImage": "__dirname/logo.png", 980 | "message": "Error: /entry.js 981 | SyntaxError: Unexpected token (1:8)", 982 | "title": "Webpack", 983 | } 984 | `; 985 | 986 | exports[`webpack@4 WebpackNotifierPlugin one compilation ["successful"] undefined: after "successful" build 1`] = ` 987 | Object { 988 | "contentImage": "__dirname/logo.png", 989 | "message": "Build successful", 990 | "title": "Webpack", 991 | } 992 | `; 993 | 994 | exports[`webpack@4 WebpackNotifierPlugin one compilation ["warning"] undefined: after "warning" build 1`] = ` 995 | Object { 996 | "contentImage": "__dirname/logo.png", 997 | "message": "Warning: /entry.js 998 | require.extensions is not supported by webpack. Use a loader instead.", 999 | "title": "Webpack", 1000 | } 1001 | `; 1002 | 1003 | exports[`webpack@4 WebpackNotifierPlugin title ["error"] {}: after "error" build 1`] = ` 1004 | Object { 1005 | "contentImage": "__dirname/logo.png", 1006 | "message": "Error: /entry.js 1007 | SyntaxError: Unexpected token (1:8)", 1008 | "title": "build error ❌", 1009 | } 1010 | `; 1011 | 1012 | exports[`webpack@4 WebpackNotifierPlugin title ["successful"] {"title":"Webpack"}: after "successful" build 1`] = ` 1013 | Object { 1014 | "contentImage": "__dirname/logo.png", 1015 | "message": "Build successful", 1016 | "title": "Webpack", 1017 | } 1018 | `; 1019 | 1020 | exports[`webpack@4 WebpackNotifierPlugin title ["successful"] {}: after "successful" build 1`] = ` 1021 | Object { 1022 | "contentImage": "__dirname/logo.png", 1023 | "message": "Build successful", 1024 | "title": "build complete ✅", 1025 | } 1026 | `; 1027 | 1028 | exports[`webpack@4 WebpackNotifierPlugin title ["warning"] {}: after "warning" build 1`] = ` 1029 | Object { 1030 | "contentImage": "__dirname/logo.png", 1031 | "message": "Warning: /entry.js 1032 | require.extensions is not supported by webpack. Use a loader instead.", 1033 | "title": "build warning ⚠️", 1034 | } 1035 | `; 1036 | 1037 | exports[`webpack@4 WebpackNotifierPlugin title new title function API ["error"] {}: after "error" build 1`] = ` 1038 | Object { 1039 | "contentImage": "__dirname/logo.png", 1040 | "message": "Error: /entry.js 1041 | SyntaxError: Unexpected token (1:8)", 1042 | "title": "Build status is error with message Error: /entry.js 1043 | SyntaxError: Unexpected token (1:8)", 1044 | } 1045 | `; 1046 | 1047 | exports[`webpack@4 WebpackNotifierPlugin title new title function API ["successful"] {"title":"Webpack"}: after "successful" build 1`] = ` 1048 | Object { 1049 | "contentImage": "__dirname/logo.png", 1050 | "message": "Build successful", 1051 | "title": "Webpack", 1052 | } 1053 | `; 1054 | 1055 | exports[`webpack@4 WebpackNotifierPlugin title new title function API ["successful"] {}: after "successful" build 1`] = ` 1056 | Object { 1057 | "contentImage": "__dirname/logo.png", 1058 | "message": "Build successful", 1059 | "title": "Build status is success with message Build successful", 1060 | } 1061 | `; 1062 | 1063 | exports[`webpack@4 WebpackNotifierPlugin title new title function API ["warning"] {}: after "warning" build 1`] = ` 1064 | Object { 1065 | "contentImage": "__dirname/logo.png", 1066 | "message": "Warning: /entry.js 1067 | require.extensions is not supported by webpack. Use a loader instead.", 1068 | "title": "Build status is warning with message Warning: /entry.js 1069 | require.extensions is not supported by webpack. Use a loader instead.", 1070 | } 1071 | `; 1072 | 1073 | exports[`webpack@4 WebpackNotifierPlugin verbosity level configuration Always Notify ["successful","successful"] {"alwaysNotify":true}: after "successful" build 1`] = ` 1074 | Object { 1075 | "alwaysNotify": true, 1076 | "contentImage": "__dirname/logo.png", 1077 | "message": "Build successful", 1078 | "title": "Webpack", 1079 | } 1080 | `; 1081 | 1082 | exports[`webpack@4 WebpackNotifierPlugin verbosity level configuration Always Notify ["successful","successful"] {"alwaysNotify":true}: after "successful" build 2`] = ` 1083 | Object { 1084 | "alwaysNotify": true, 1085 | "contentImage": "__dirname/logo.png", 1086 | "message": "Build successful", 1087 | "title": "Webpack", 1088 | } 1089 | `; 1090 | 1091 | exports[`webpack@4 WebpackNotifierPlugin verbosity level configuration Default ["error","error","successful"] undefined: after "error" build 1`] = ` 1092 | Object { 1093 | "contentImage": "__dirname/logo.png", 1094 | "message": "Error: /entry.js 1095 | SyntaxError: Unexpected token (1:8)", 1096 | "title": "Webpack", 1097 | } 1098 | `; 1099 | 1100 | exports[`webpack@4 WebpackNotifierPlugin verbosity level configuration Default ["error","error","successful"] undefined: after "error" build 2`] = ` 1101 | Object { 1102 | "contentImage": "__dirname/logo.png", 1103 | "message": "Error: /entry.js 1104 | SyntaxError: Unexpected token (1:8)", 1105 | "title": "Webpack", 1106 | } 1107 | `; 1108 | 1109 | exports[`webpack@4 WebpackNotifierPlugin verbosity level configuration Default ["error","error","successful"] undefined: after "successful" build 1`] = ` 1110 | Object { 1111 | "contentImage": "__dirname/logo.png", 1112 | "message": "Build successful", 1113 | "title": "Webpack", 1114 | } 1115 | `; 1116 | 1117 | exports[`webpack@4 WebpackNotifierPlugin verbosity level configuration Default ["successful","successful","successful"] undefined: after "successful" build 1`] = ` 1118 | Object { 1119 | "contentImage": "__dirname/logo.png", 1120 | "message": "Build successful", 1121 | "title": "Webpack", 1122 | } 1123 | `; 1124 | 1125 | exports[`webpack@4 WebpackNotifierPlugin verbosity level configuration Default ["successful","successful","successful"] undefined: after "successful" build 2`] = `Array []`; 1126 | 1127 | exports[`webpack@4 WebpackNotifierPlugin verbosity level configuration Default ["successful","successful","successful"] undefined: after "successful" build 3`] = `Array []`; 1128 | 1129 | exports[`webpack@4 WebpackNotifierPlugin verbosity level configuration Exclude Warnings ["warning"] {"excludeWarnings":true}: after "warning" build 1`] = ` 1130 | Object { 1131 | "contentImage": "__dirname/logo.png", 1132 | "excludeWarnings": true, 1133 | "message": "Build successful", 1134 | "title": "Webpack", 1135 | } 1136 | `; 1137 | 1138 | exports[`webpack@4 WebpackNotifierPlugin verbosity level configuration Notify on error ["successful","warning","error"] {"onlyOnError":true}: after "error" build 1`] = ` 1139 | Object { 1140 | "contentImage": "__dirname/logo.png", 1141 | "message": "Error: /entry.js 1142 | SyntaxError: Unexpected token (1:8)", 1143 | "onlyOnError": true, 1144 | "title": "Webpack", 1145 | } 1146 | `; 1147 | 1148 | exports[`webpack@4 WebpackNotifierPlugin verbosity level configuration Notify on error ["successful","warning","error"] {"onlyOnError":true}: after "successful" build 1`] = `Array []`; 1149 | 1150 | exports[`webpack@4 WebpackNotifierPlugin verbosity level configuration Notify on error ["successful","warning","error"] {"onlyOnError":true}: after "warning" build 1`] = `Array []`; 1151 | 1152 | exports[`webpack@4 WebpackNotifierPlugin verbosity level configuration Skip Notification on the First Build ["successful","successful"] {"skipFirstNotification":true}: after "successful" build 1`] = `Array []`; 1153 | 1154 | exports[`webpack@4 WebpackNotifierPlugin verbosity level configuration Skip Notification on the First Build ["successful","successful"] {"skipFirstNotification":true}: after "successful" build 2`] = ` 1155 | Object { 1156 | "contentImage": "__dirname/logo.png", 1157 | "message": "Build successful", 1158 | "skipFirstNotification": true, 1159 | "title": "Webpack", 1160 | } 1161 | `; 1162 | 1163 | exports[`webpack@5 WebpackNotifierPlugin child compilation errors ["successful"] undefined {"plugins":[{"level":"Error","levelCollectionKey":"errors"}]}: after "successful" build 1`] = ` 1164 | Object { 1165 | "contentImage": "__dirname/logo.png", 1166 | "message": "Warning: Child Compilation Error", 1167 | "title": "Webpack", 1168 | } 1169 | `; 1170 | 1171 | exports[`webpack@5 WebpackNotifierPlugin child compilation errors ["successful"] undefined {"plugins":[{"level":"Warning","levelCollectionKey":"warnings"}]}: after "successful" build 1`] = ` 1172 | Object { 1173 | "contentImage": "__dirname/logo.png", 1174 | "message": "Warning: Child Compilation Warning", 1175 | "title": "Webpack", 1176 | } 1177 | `; 1178 | 1179 | exports[`webpack@5 WebpackNotifierPlugin child compilation errors ["successful"] undefined {"plugins":[{"level":false},{"level":"Warning","levelCollectionKey":"warnings"}]}: after "successful" build 1`] = ` 1180 | Object { 1181 | "contentImage": "__dirname/logo.png", 1182 | "message": "Warning: Child Compilation Warning", 1183 | "title": "Webpack", 1184 | } 1185 | `; 1186 | 1187 | exports[`webpack@5 WebpackNotifierPlugin contentImage ["error"] {contentImage: {success: "../successImage.png"}, error: "../errorImage.png"}, warning: "../warningImage.png"}}: after "error" build 1`] = ` 1188 | Object { 1189 | "contentImage": "__dirname/errorsImage.png", 1190 | "message": "Error: /entry.js 1191 | SyntaxError: Unexpected token (1:8)", 1192 | "title": "Webpack", 1193 | } 1194 | `; 1195 | 1196 | exports[`webpack@5 WebpackNotifierPlugin contentImage ["successful"] {contentImage: "../another-logo.png"}: after "successful" build 1`] = ` 1197 | Object { 1198 | "contentImage": "__dirname/another-logo.png", 1199 | "message": "Build successful", 1200 | "title": "Webpack", 1201 | } 1202 | `; 1203 | 1204 | exports[`webpack@5 WebpackNotifierPlugin contentImage ["successful"] {contentImage: {success: "../successImage.png"}, error: "../errorImage.png"}, warning: "../warningImage.png"}}: after "successful" build 1`] = ` 1205 | Object { 1206 | "contentImage": "__dirname/successImage.png", 1207 | "message": "Build successful", 1208 | "title": "Webpack", 1209 | } 1210 | `; 1211 | 1212 | exports[`webpack@5 WebpackNotifierPlugin contentImage ["warning"] {contentImage: {success: "../successImage.png"}, error: "../errorImage.png"}, warning: "../warningImage.png"}}: after "warning" build 1`] = ` 1213 | Object { 1214 | "contentImage": "__dirname/warningsImage.png", 1215 | "message": "Warning: /entry.js 1216 | require.extensions is not supported by webpack. Use a loader instead.", 1217 | "title": "Webpack", 1218 | } 1219 | `; 1220 | 1221 | exports[`webpack@5 WebpackNotifierPlugin custom warning ["successful"] undefined: after "successful" build 1`] = ` 1222 | Object { 1223 | "contentImage": "__dirname/logo.png", 1224 | "message": "Warning: Custom Warning message", 1225 | "title": "Webpack", 1226 | } 1227 | `; 1228 | 1229 | exports[`webpack@5 WebpackNotifierPlugin emoji message ["error"] {"emoji":true} %j: after "error" build 1`] = ` 1230 | Object { 1231 | "contentImage": "__dirname/logo.png", 1232 | "emoji": true, 1233 | "message": "❌ Error: /entry.js 1234 | SyntaxError: Unexpected token (1:8)", 1235 | "title": "Webpack", 1236 | } 1237 | `; 1238 | 1239 | exports[`webpack@5 WebpackNotifierPlugin emoji message ["successful"] {"emoji":true} %j: after "successful" build 1`] = ` 1240 | Object { 1241 | "contentImage": "__dirname/logo.png", 1242 | "emoji": true, 1243 | "message": "✅ Build successful", 1244 | "title": "Webpack", 1245 | } 1246 | `; 1247 | 1248 | exports[`webpack@5 WebpackNotifierPlugin emoji message ["successful"] {"emoji":true} {"plugins":[{}]}: after "successful" build 1`] = ` 1249 | Object { 1250 | "contentImage": "__dirname/logo.png", 1251 | "emoji": true, 1252 | "message": "⚠️ Warning: Custom Warning message", 1253 | "title": "Webpack", 1254 | } 1255 | `; 1256 | 1257 | exports[`webpack@5 WebpackNotifierPlugin emoji message ["warning"] {"emoji":true} %j: after "warning" build 1`] = ` 1258 | Object { 1259 | "contentImage": "__dirname/logo.png", 1260 | "emoji": true, 1261 | "message": "⚠️ Warning: /entry.js 1262 | require.extensions is not supported by webpack. Use a loader instead.", 1263 | "title": "Webpack", 1264 | } 1265 | `; 1266 | 1267 | exports[`webpack@5 WebpackNotifierPlugin one compilation ["error"] undefined: after "error" build 1`] = ` 1268 | Object { 1269 | "contentImage": "__dirname/logo.png", 1270 | "message": "Error: /entry.js 1271 | SyntaxError: Unexpected token (1:8)", 1272 | "title": "Webpack", 1273 | } 1274 | `; 1275 | 1276 | exports[`webpack@5 WebpackNotifierPlugin one compilation ["successful"] undefined: after "successful" build 1`] = ` 1277 | Object { 1278 | "contentImage": "__dirname/logo.png", 1279 | "message": "Build successful", 1280 | "title": "Webpack", 1281 | } 1282 | `; 1283 | 1284 | exports[`webpack@5 WebpackNotifierPlugin one compilation ["warning"] undefined: after "warning" build 1`] = ` 1285 | Object { 1286 | "contentImage": "__dirname/logo.png", 1287 | "message": "Warning: /entry.js 1288 | require.extensions is not supported by webpack. Use a loader instead.", 1289 | "title": "Webpack", 1290 | } 1291 | `; 1292 | 1293 | exports[`webpack@5 WebpackNotifierPlugin title ["error"] {}: after "error" build 1`] = ` 1294 | Object { 1295 | "contentImage": "__dirname/logo.png", 1296 | "message": "Error: /entry.js 1297 | SyntaxError: Unexpected token (1:8)", 1298 | "title": "build error ❌", 1299 | } 1300 | `; 1301 | 1302 | exports[`webpack@5 WebpackNotifierPlugin title ["successful"] {"title":"Webpack"}: after "successful" build 1`] = ` 1303 | Object { 1304 | "contentImage": "__dirname/logo.png", 1305 | "message": "Build successful", 1306 | "title": "Webpack", 1307 | } 1308 | `; 1309 | 1310 | exports[`webpack@5 WebpackNotifierPlugin title ["successful"] {}: after "successful" build 1`] = ` 1311 | Object { 1312 | "contentImage": "__dirname/logo.png", 1313 | "message": "Build successful", 1314 | "title": "build complete ✅", 1315 | } 1316 | `; 1317 | 1318 | exports[`webpack@5 WebpackNotifierPlugin title ["warning"] {}: after "warning" build 1`] = ` 1319 | Object { 1320 | "contentImage": "__dirname/logo.png", 1321 | "message": "Warning: /entry.js 1322 | require.extensions is not supported by webpack. Use a loader instead.", 1323 | "title": "build warning ⚠️", 1324 | } 1325 | `; 1326 | 1327 | exports[`webpack@5 WebpackNotifierPlugin title new title function API ["error"] {}: after "error" build 1`] = ` 1328 | Object { 1329 | "contentImage": "__dirname/logo.png", 1330 | "message": "Error: /entry.js 1331 | SyntaxError: Unexpected token (1:8)", 1332 | "title": "Build status is error with message Error: /entry.js 1333 | SyntaxError: Unexpected token (1:8)", 1334 | } 1335 | `; 1336 | 1337 | exports[`webpack@5 WebpackNotifierPlugin title new title function API ["successful"] {"title":"Webpack"}: after "successful" build 1`] = ` 1338 | Object { 1339 | "contentImage": "__dirname/logo.png", 1340 | "message": "Build successful", 1341 | "title": "Webpack", 1342 | } 1343 | `; 1344 | 1345 | exports[`webpack@5 WebpackNotifierPlugin title new title function API ["successful"] {}: after "successful" build 1`] = ` 1346 | Object { 1347 | "contentImage": "__dirname/logo.png", 1348 | "message": "Build successful", 1349 | "title": "Build status is success with message Build successful", 1350 | } 1351 | `; 1352 | 1353 | exports[`webpack@5 WebpackNotifierPlugin title new title function API ["warning"] {}: after "warning" build 1`] = ` 1354 | Object { 1355 | "contentImage": "__dirname/logo.png", 1356 | "message": "Warning: /entry.js 1357 | require.extensions is not supported by webpack. Use a loader instead.", 1358 | "title": "Build status is warning with message Warning: /entry.js 1359 | require.extensions is not supported by webpack. Use a loader instead.", 1360 | } 1361 | `; 1362 | 1363 | exports[`webpack@5 WebpackNotifierPlugin verbosity level configuration Always Notify ["successful","successful"] {"alwaysNotify":true}: after "successful" build 1`] = ` 1364 | Object { 1365 | "alwaysNotify": true, 1366 | "contentImage": "__dirname/logo.png", 1367 | "message": "Build successful", 1368 | "title": "Webpack", 1369 | } 1370 | `; 1371 | 1372 | exports[`webpack@5 WebpackNotifierPlugin verbosity level configuration Always Notify ["successful","successful"] {"alwaysNotify":true}: after "successful" build 2`] = ` 1373 | Object { 1374 | "alwaysNotify": true, 1375 | "contentImage": "__dirname/logo.png", 1376 | "message": "Build successful", 1377 | "title": "Webpack", 1378 | } 1379 | `; 1380 | 1381 | exports[`webpack@5 WebpackNotifierPlugin verbosity level configuration Default ["error","error","successful"] undefined: after "error" build 1`] = ` 1382 | Object { 1383 | "contentImage": "__dirname/logo.png", 1384 | "message": "Error: /entry.js 1385 | SyntaxError: Unexpected token (1:8)", 1386 | "title": "Webpack", 1387 | } 1388 | `; 1389 | 1390 | exports[`webpack@5 WebpackNotifierPlugin verbosity level configuration Default ["error","error","successful"] undefined: after "error" build 2`] = ` 1391 | Object { 1392 | "contentImage": "__dirname/logo.png", 1393 | "message": "Error: /entry.js 1394 | SyntaxError: Unexpected token (1:8)", 1395 | "title": "Webpack", 1396 | } 1397 | `; 1398 | 1399 | exports[`webpack@5 WebpackNotifierPlugin verbosity level configuration Default ["error","error","successful"] undefined: after "successful" build 1`] = ` 1400 | Object { 1401 | "contentImage": "__dirname/logo.png", 1402 | "message": "Build successful", 1403 | "title": "Webpack", 1404 | } 1405 | `; 1406 | 1407 | exports[`webpack@5 WebpackNotifierPlugin verbosity level configuration Default ["successful","successful","successful"] undefined: after "successful" build 1`] = ` 1408 | Object { 1409 | "contentImage": "__dirname/logo.png", 1410 | "message": "Build successful", 1411 | "title": "Webpack", 1412 | } 1413 | `; 1414 | 1415 | exports[`webpack@5 WebpackNotifierPlugin verbosity level configuration Default ["successful","successful","successful"] undefined: after "successful" build 2`] = `Array []`; 1416 | 1417 | exports[`webpack@5 WebpackNotifierPlugin verbosity level configuration Default ["successful","successful","successful"] undefined: after "successful" build 3`] = `Array []`; 1418 | 1419 | exports[`webpack@5 WebpackNotifierPlugin verbosity level configuration Exclude Warnings ["warning"] {"excludeWarnings":true}: after "warning" build 1`] = ` 1420 | Object { 1421 | "contentImage": "__dirname/logo.png", 1422 | "excludeWarnings": true, 1423 | "message": "Build successful", 1424 | "title": "Webpack", 1425 | } 1426 | `; 1427 | 1428 | exports[`webpack@5 WebpackNotifierPlugin verbosity level configuration Notify on error ["successful","warning","error"] {"onlyOnError":true}: after "error" build 1`] = ` 1429 | Object { 1430 | "contentImage": "__dirname/logo.png", 1431 | "message": "Error: /entry.js 1432 | SyntaxError: Unexpected token (1:8)", 1433 | "onlyOnError": true, 1434 | "title": "Webpack", 1435 | } 1436 | `; 1437 | 1438 | exports[`webpack@5 WebpackNotifierPlugin verbosity level configuration Notify on error ["successful","warning","error"] {"onlyOnError":true}: after "successful" build 1`] = `Array []`; 1439 | 1440 | exports[`webpack@5 WebpackNotifierPlugin verbosity level configuration Notify on error ["successful","warning","error"] {"onlyOnError":true}: after "warning" build 1`] = `Array []`; 1441 | 1442 | exports[`webpack@5 WebpackNotifierPlugin verbosity level configuration Skip Notification on the First Build ["successful","successful"] {"skipFirstNotification":true}: after "successful" build 1`] = `Array []`; 1443 | 1444 | exports[`webpack@5 WebpackNotifierPlugin verbosity level configuration Skip Notification on the First Build ["successful","successful"] {"skipFirstNotification":true}: after "successful" build 2`] = ` 1445 | Object { 1446 | "contentImage": "__dirname/logo.png", 1447 | "message": "Build successful", 1448 | "skipFirstNotification": true, 1449 | "title": "Webpack", 1450 | } 1451 | `; 1452 | 1453 | exports[`webpack@latest WebpackNotifierPlugin child compilation errors ["successful"] undefined {"plugins":[{"level":"Error","levelCollectionKey":"errors"}]}: after "successful" build 1`] = ` 1454 | Object { 1455 | "contentImage": "__dirname/logo.png", 1456 | "message": "Warning: Child Compilation Error", 1457 | "title": "Webpack", 1458 | } 1459 | `; 1460 | 1461 | exports[`webpack@latest WebpackNotifierPlugin child compilation errors ["successful"] undefined {"plugins":[{"level":"Warning","levelCollectionKey":"warnings"}]}: after "successful" build 1`] = ` 1462 | Object { 1463 | "contentImage": "__dirname/logo.png", 1464 | "message": "Warning: Child Compilation Warning", 1465 | "title": "Webpack", 1466 | } 1467 | `; 1468 | 1469 | exports[`webpack@latest WebpackNotifierPlugin child compilation errors ["successful"] undefined {"plugins":[{"level":false},{"level":"Warning","levelCollectionKey":"warnings"}]}: after "successful" build 1`] = ` 1470 | Object { 1471 | "contentImage": "__dirname/logo.png", 1472 | "message": "Warning: Child Compilation Warning", 1473 | "title": "Webpack", 1474 | } 1475 | `; 1476 | 1477 | exports[`webpack@latest WebpackNotifierPlugin contentImage ["error"] {contentImage: {success: "../successImage.png"}, error: "../errorImage.png"}, warning: "../warningImage.png"}}: after "error" build 1`] = ` 1478 | Object { 1479 | "contentImage": "__dirname/errorsImage.png", 1480 | "message": "Error: /entry.js 1481 | SyntaxError: Unexpected token (1:8)", 1482 | "title": "Webpack", 1483 | } 1484 | `; 1485 | 1486 | exports[`webpack@latest WebpackNotifierPlugin contentImage ["successful"] {contentImage: "../another-logo.png"}: after "successful" build 1`] = ` 1487 | Object { 1488 | "contentImage": "__dirname/another-logo.png", 1489 | "message": "Build successful", 1490 | "title": "Webpack", 1491 | } 1492 | `; 1493 | 1494 | exports[`webpack@latest WebpackNotifierPlugin contentImage ["successful"] {contentImage: {success: "../successImage.png"}, error: "../errorImage.png"}, warning: "../warningImage.png"}}: after "successful" build 1`] = ` 1495 | Object { 1496 | "contentImage": "__dirname/successImage.png", 1497 | "message": "Build successful", 1498 | "title": "Webpack", 1499 | } 1500 | `; 1501 | 1502 | exports[`webpack@latest WebpackNotifierPlugin contentImage ["warning"] {contentImage: {success: "../successImage.png"}, error: "../errorImage.png"}, warning: "../warningImage.png"}}: after "warning" build 1`] = ` 1503 | Object { 1504 | "contentImage": "__dirname/warningsImage.png", 1505 | "message": "Warning: /entry.js 1506 | require.extensions is not supported by webpack. Use a loader instead.", 1507 | "title": "Webpack", 1508 | } 1509 | `; 1510 | 1511 | exports[`webpack@latest WebpackNotifierPlugin custom warning ["successful"] undefined: after "successful" build 1`] = ` 1512 | Object { 1513 | "contentImage": "__dirname/logo.png", 1514 | "message": "Warning: Custom Warning message", 1515 | "title": "Webpack", 1516 | } 1517 | `; 1518 | 1519 | exports[`webpack@latest WebpackNotifierPlugin emoji message ["error"] {"emoji":true} %j: after "error" build 1`] = ` 1520 | Object { 1521 | "contentImage": "__dirname/logo.png", 1522 | "emoji": true, 1523 | "message": "❌ Error: /entry.js 1524 | SyntaxError: Unexpected token (1:8)", 1525 | "title": "Webpack", 1526 | } 1527 | `; 1528 | 1529 | exports[`webpack@latest WebpackNotifierPlugin emoji message ["successful"] {"emoji":true} %j: after "successful" build 1`] = ` 1530 | Object { 1531 | "contentImage": "__dirname/logo.png", 1532 | "emoji": true, 1533 | "message": "✅ Build successful", 1534 | "title": "Webpack", 1535 | } 1536 | `; 1537 | 1538 | exports[`webpack@latest WebpackNotifierPlugin emoji message ["successful"] {"emoji":true} {"plugins":[{}]}: after "successful" build 1`] = ` 1539 | Object { 1540 | "contentImage": "__dirname/logo.png", 1541 | "emoji": true, 1542 | "message": "⚠️ Warning: Custom Warning message", 1543 | "title": "Webpack", 1544 | } 1545 | `; 1546 | 1547 | exports[`webpack@latest WebpackNotifierPlugin emoji message ["warning"] {"emoji":true} %j: after "warning" build 1`] = ` 1548 | Object { 1549 | "contentImage": "__dirname/logo.png", 1550 | "emoji": true, 1551 | "message": "⚠️ Warning: /entry.js 1552 | require.extensions is not supported by webpack. Use a loader instead.", 1553 | "title": "Webpack", 1554 | } 1555 | `; 1556 | 1557 | exports[`webpack@latest WebpackNotifierPlugin one compilation ["error"] undefined: after "error" build 1`] = ` 1558 | Object { 1559 | "contentImage": "__dirname/logo.png", 1560 | "message": "Error: /entry.js 1561 | SyntaxError: Unexpected token (1:8)", 1562 | "title": "Webpack", 1563 | } 1564 | `; 1565 | 1566 | exports[`webpack@latest WebpackNotifierPlugin one compilation ["successful"] undefined: after "successful" build 1`] = ` 1567 | Object { 1568 | "contentImage": "__dirname/logo.png", 1569 | "message": "Build successful", 1570 | "title": "Webpack", 1571 | } 1572 | `; 1573 | 1574 | exports[`webpack@latest WebpackNotifierPlugin one compilation ["warning"] undefined: after "warning" build 1`] = ` 1575 | Object { 1576 | "contentImage": "__dirname/logo.png", 1577 | "message": "Warning: /entry.js 1578 | require.extensions is not supported by webpack. Use a loader instead.", 1579 | "title": "Webpack", 1580 | } 1581 | `; 1582 | 1583 | exports[`webpack@latest WebpackNotifierPlugin title ["error"] {}: after "error" build 1`] = ` 1584 | Object { 1585 | "contentImage": "__dirname/logo.png", 1586 | "message": "Error: /entry.js 1587 | SyntaxError: Unexpected token (1:8)", 1588 | "title": "build error ❌", 1589 | } 1590 | `; 1591 | 1592 | exports[`webpack@latest WebpackNotifierPlugin title ["successful"] {"title":"Webpack"}: after "successful" build 1`] = ` 1593 | Object { 1594 | "contentImage": "__dirname/logo.png", 1595 | "message": "Build successful", 1596 | "title": "Webpack", 1597 | } 1598 | `; 1599 | 1600 | exports[`webpack@latest WebpackNotifierPlugin title ["successful"] {}: after "successful" build 1`] = ` 1601 | Object { 1602 | "contentImage": "__dirname/logo.png", 1603 | "message": "Build successful", 1604 | "title": "build complete ✅", 1605 | } 1606 | `; 1607 | 1608 | exports[`webpack@latest WebpackNotifierPlugin title ["warning"] {}: after "warning" build 1`] = ` 1609 | Object { 1610 | "contentImage": "__dirname/logo.png", 1611 | "message": "Warning: /entry.js 1612 | require.extensions is not supported by webpack. Use a loader instead.", 1613 | "title": "build warning ⚠️", 1614 | } 1615 | `; 1616 | 1617 | exports[`webpack@latest WebpackNotifierPlugin title new title function API ["error"] {}: after "error" build 1`] = ` 1618 | Object { 1619 | "contentImage": "__dirname/logo.png", 1620 | "message": "Error: /entry.js 1621 | SyntaxError: Unexpected token (1:8)", 1622 | "title": "Build status is error with message Error: /entry.js 1623 | SyntaxError: Unexpected token (1:8)", 1624 | } 1625 | `; 1626 | 1627 | exports[`webpack@latest WebpackNotifierPlugin title new title function API ["successful"] {"title":"Webpack"}: after "successful" build 1`] = ` 1628 | Object { 1629 | "contentImage": "__dirname/logo.png", 1630 | "message": "Build successful", 1631 | "title": "Webpack", 1632 | } 1633 | `; 1634 | 1635 | exports[`webpack@latest WebpackNotifierPlugin title new title function API ["successful"] {}: after "successful" build 1`] = ` 1636 | Object { 1637 | "contentImage": "__dirname/logo.png", 1638 | "message": "Build successful", 1639 | "title": "Build status is success with message Build successful", 1640 | } 1641 | `; 1642 | 1643 | exports[`webpack@latest WebpackNotifierPlugin title new title function API ["warning"] {}: after "warning" build 1`] = ` 1644 | Object { 1645 | "contentImage": "__dirname/logo.png", 1646 | "message": "Warning: /entry.js 1647 | require.extensions is not supported by webpack. Use a loader instead.", 1648 | "title": "Build status is warning with message Warning: /entry.js 1649 | require.extensions is not supported by webpack. Use a loader instead.", 1650 | } 1651 | `; 1652 | 1653 | exports[`webpack@latest WebpackNotifierPlugin verbosity level configuration Always Notify ["successful","successful"] {"alwaysNotify":true}: after "successful" build 1`] = ` 1654 | Object { 1655 | "alwaysNotify": true, 1656 | "contentImage": "__dirname/logo.png", 1657 | "message": "Build successful", 1658 | "title": "Webpack", 1659 | } 1660 | `; 1661 | 1662 | exports[`webpack@latest WebpackNotifierPlugin verbosity level configuration Always Notify ["successful","successful"] {"alwaysNotify":true}: after "successful" build 2`] = ` 1663 | Object { 1664 | "alwaysNotify": true, 1665 | "contentImage": "__dirname/logo.png", 1666 | "message": "Build successful", 1667 | "title": "Webpack", 1668 | } 1669 | `; 1670 | 1671 | exports[`webpack@latest WebpackNotifierPlugin verbosity level configuration Default ["error","error","successful"] undefined: after "error" build 1`] = ` 1672 | Object { 1673 | "contentImage": "__dirname/logo.png", 1674 | "message": "Error: /entry.js 1675 | SyntaxError: Unexpected token (1:8)", 1676 | "title": "Webpack", 1677 | } 1678 | `; 1679 | 1680 | exports[`webpack@latest WebpackNotifierPlugin verbosity level configuration Default ["error","error","successful"] undefined: after "error" build 2`] = ` 1681 | Object { 1682 | "contentImage": "__dirname/logo.png", 1683 | "message": "Error: /entry.js 1684 | SyntaxError: Unexpected token (1:8)", 1685 | "title": "Webpack", 1686 | } 1687 | `; 1688 | 1689 | exports[`webpack@latest WebpackNotifierPlugin verbosity level configuration Default ["error","error","successful"] undefined: after "successful" build 1`] = ` 1690 | Object { 1691 | "contentImage": "__dirname/logo.png", 1692 | "message": "Build successful", 1693 | "title": "Webpack", 1694 | } 1695 | `; 1696 | 1697 | exports[`webpack@latest WebpackNotifierPlugin verbosity level configuration Default ["successful","successful","successful"] undefined: after "successful" build 1`] = ` 1698 | Object { 1699 | "contentImage": "__dirname/logo.png", 1700 | "message": "Build successful", 1701 | "title": "Webpack", 1702 | } 1703 | `; 1704 | 1705 | exports[`webpack@latest WebpackNotifierPlugin verbosity level configuration Default ["successful","successful","successful"] undefined: after "successful" build 2`] = `Array []`; 1706 | 1707 | exports[`webpack@latest WebpackNotifierPlugin verbosity level configuration Default ["successful","successful","successful"] undefined: after "successful" build 3`] = `Array []`; 1708 | 1709 | exports[`webpack@latest WebpackNotifierPlugin verbosity level configuration Exclude Warnings ["warning"] {"excludeWarnings":true}: after "warning" build 1`] = ` 1710 | Object { 1711 | "contentImage": "__dirname/logo.png", 1712 | "excludeWarnings": true, 1713 | "message": "Build successful", 1714 | "title": "Webpack", 1715 | } 1716 | `; 1717 | 1718 | exports[`webpack@latest WebpackNotifierPlugin verbosity level configuration Notify on error ["successful","warning","error"] {"onlyOnError":true}: after "error" build 1`] = ` 1719 | Object { 1720 | "contentImage": "__dirname/logo.png", 1721 | "message": "Error: /entry.js 1722 | SyntaxError: Unexpected token (1:8)", 1723 | "onlyOnError": true, 1724 | "title": "Webpack", 1725 | } 1726 | `; 1727 | 1728 | exports[`webpack@latest WebpackNotifierPlugin verbosity level configuration Notify on error ["successful","warning","error"] {"onlyOnError":true}: after "successful" build 1`] = `Array []`; 1729 | 1730 | exports[`webpack@latest WebpackNotifierPlugin verbosity level configuration Notify on error ["successful","warning","error"] {"onlyOnError":true}: after "warning" build 1`] = `Array []`; 1731 | 1732 | exports[`webpack@latest WebpackNotifierPlugin verbosity level configuration Skip Notification on the First Build ["successful","successful"] {"skipFirstNotification":true}: after "successful" build 1`] = `Array []`; 1733 | 1734 | exports[`webpack@latest WebpackNotifierPlugin verbosity level configuration Skip Notification on the First Build ["successful","successful"] {"skipFirstNotification":true}: after "successful" build 2`] = ` 1735 | Object { 1736 | "contentImage": "__dirname/logo.png", 1737 | "message": "Build successful", 1738 | "skipFirstNotification": true, 1739 | "title": "Webpack", 1740 | } 1741 | `; 1742 | -------------------------------------------------------------------------------- /test/helpers/ChildCompilationPlugin.ts: -------------------------------------------------------------------------------- 1 | import {Compiler} from 'webpack'; 2 | export default class ChildCompilationPlugin { 3 | private levelCollectionKey: string; 4 | 5 | constructor(private level: string | boolean = false) { 6 | if (typeof level === 'string') { 7 | this.levelCollectionKey = level.toLowerCase() + 's'; 8 | } 9 | } 10 | 11 | apply(compiler: Compiler) { 12 | if ('hooks' in compiler) { 13 | compiler.hooks.thisCompilation.tap('ChildCompilationPlugin', this.handleHook.bind(this)); 14 | } else { 15 | (compiler as any).plugin('this-compilation', this.handleHook.bind(this)); 16 | } 17 | } 18 | 19 | handleHook(compilation: any) { 20 | const childCompiler = (compilation as any).createChildCompiler(`CHILD COMPILATION`); 21 | childCompiler.runAsChild((err: Error, entries: any, compilation: any) => { 22 | if (this.level) { 23 | (compilation as any)[this.levelCollectionKey] 24 | .push(new Error(`Child Compilation ${this.level}`)); 25 | } 26 | }); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /test/helpers/CustomWarningPlugin.ts: -------------------------------------------------------------------------------- 1 | import {Compiler} from 'webpack'; 2 | export default class CustomWarningPlugin { 3 | apply(compiler: Compiler) { 4 | if ('hooks' in compiler) { 5 | compiler.hooks.shouldEmit.tap('CustomWarningPlugin', this.handleHook); 6 | } else { 7 | (compiler as any).plugin('should-emit', this.handleHook); 8 | } 9 | } 10 | handleHook(compilation: any) { 11 | (compilation.warnings as Error[]).push(Object.assign( 12 | new Error('Custom Warning'), 13 | {warning: 'Custom Warning message'} 14 | )); 15 | return false; 16 | } 17 | }; -------------------------------------------------------------------------------- /test/helpers/fixtures.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | simple: { 3 | successful: { 4 | '/entry.js': '// require.extensions[".js"];' 5 | }, 6 | error: { 7 | '/entry.js': '(syntax error)require.extensions[".js"];' 8 | }, 9 | warning: { 10 | '/entry.js': 'require.extensions[".js"];' 11 | } 12 | } 13 | }; -------------------------------------------------------------------------------- /test/helpers/utils.ts: -------------------------------------------------------------------------------- 1 | import {join} from 'path'; 2 | import {Compiler, Configuration, Stats} from 'webpack'; 3 | import {createFsFromVolume, Volume} from 'memfs'; 4 | import {notify} from 'node-notifier'; 5 | import {satisfies} from 'semver'; 6 | import fixtures from './fixtures'; 7 | import WebpackNotifierPlugin, {Options} from '../../'; 8 | 9 | function getCompiler(webpackVersion: string, webpack: (...args: any[]) => any, compilerOpts: Configuration): Compiler { 10 | const config: Configuration = { 11 | entry: '/entry.js', 12 | output: { 13 | path: '/', 14 | filename: 'bundle.js' 15 | }, 16 | ...compilerOpts 17 | }; 18 | if (satisfies(webpackVersion, '>=4', {includePrerelease: true})) { 19 | config['mode'] = 'development'; 20 | } 21 | 22 | return webpack(config); 23 | } 24 | function patchCompiler(compiler: Compiler, fs: any, webpackVersion: string) { 25 | compiler.inputFileSystem = fs; 26 | compiler.outputFileSystem = fs; 27 | // compiler.watchFileSystem = fs; 28 | 29 | if (satisfies(webpackVersion, '<5')) { 30 | (compiler as any)['resolvers'].normal.fileSystem = fs; 31 | // compiler['resolvers'].loader.fileSystem = fs; 32 | // compiler['resolvers'].context.fileSystem = fs; 33 | } 34 | } 35 | async function compile(compiler: Compiler): Promise { 36 | return new Promise((resolve, reject) => { 37 | compiler.run((err?: Error, res?: Stats) => { 38 | if (err) { 39 | return reject(err); 40 | } 41 | resolve(res); 42 | }); 43 | }); 44 | } 45 | 46 | function prepareFs(webpackVersion: string) { 47 | const vol = new Volume(); 48 | const fs = createFsFromVolume(vol); 49 | 50 | if (satisfies(webpackVersion, '<5')) { 51 | (fs as any)['join'] = join; 52 | } 53 | 54 | return {fs, vol}; 55 | } 56 | 57 | function updateFs(vol: any, json: any) { 58 | vol.reset(); 59 | vol.fromJSON(json, '/'); 60 | } 61 | 62 | export const reduceArraySerializer: jest.SnapshotSerializerPlugin = { 63 | test(val) { 64 | return Array.isArray(val) && 65 | val.length === 1 && 66 | Array.isArray(val[0]) && 67 | val[0].length === 1 && 68 | typeof val[0][0] === 'object' && 69 | val[0][0].hasOwnProperty('title'); 70 | }, 71 | serialize(val, config, indentation, depth, refs, printer) { 72 | return printer(val[0][0], config, indentation, depth, refs); 73 | }, 74 | }; 75 | export const contentImageSerializer: jest.SnapshotSerializerPlugin = { 76 | test(val) { 77 | return typeof val === 'object' && 78 | val.contentImage && 79 | !val.contentImage.startsWith('__dirname'); 80 | }, 81 | serialize(val, config, indentation, depth, refs, printer) { 82 | var modifiedVal = { 83 | ...val, 84 | contentImage: val.contentImage.replace(join(__dirname, '../../'), '__dirname/') 85 | } 86 | delete modifiedVal.icon; 87 | return printer(modifiedVal, config, indentation, depth, refs); 88 | }, 89 | }; 90 | 91 | export type Sources = string[]; 92 | export type PluginOptions = Options | undefined; 93 | export type CompilerOptions = {}; 94 | export type PartialTestArguments = [Sources, PluginOptions, CompilerOptions?]; 95 | export type TestArguments = [string, (...args: any[]) => any, Sources, PluginOptions, CompilerOptions?]; 96 | 97 | // intermediate, so that the jest does not pass done-callback, in case of last optional argument 98 | export function testChangesFlow(...args: TestArguments) { 99 | return runTest(...args); 100 | }; 101 | 102 | async function runTest(...[webpackVersion, webpack, sources, opts, compilerOpts = {}]: TestArguments) { 103 | const compiler = getCompiler(webpackVersion, webpack, compilerOpts); 104 | const {fs, vol} = prepareFs(webpackVersion); 105 | const plugin = new WebpackNotifierPlugin(opts); 106 | plugin.apply(compiler); 107 | patchCompiler(compiler, fs, webpackVersion); 108 | 109 | for (const name of sources) { 110 | (notify as jest.Mock).mockClear(); 111 | updateFs(vol, (fixtures.simple as any)[name]); 112 | await compile(compiler); 113 | expect((notify as jest.Mock).mock.calls).toMatchSnapshot(`after "${name}" build`); 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "esModuleInterop": true, 4 | "resolveJsonModule": true, 5 | "downlevelIteration": true, 6 | "noImplicitAny": true, 7 | "noImplicitThis": true, 8 | "strictNullChecks": true, 9 | "strictFunctionTypes": true 10 | } 11 | } --------------------------------------------------------------------------------