From abd406ff665465b615758b551a9e59ccb00b80d2 Mon Sep 17 00:00:00 2001 From: Marcel Erz Date: Wed, 15 Jun 2016 15:20:59 -0700 Subject: [PATCH 1/7] Add growl notifications --- docs/API.md | 6 ++ package.json | 3 +- packages/jest-cli/src/Growler.js | 98 ++++++++++++++++++ packages/jest-cli/src/assets/jest_logo.png | Bin 0 -> 2396 bytes packages/jest-cli/src/cli/args.js | 6 ++ packages/jest-config/src/defaults.js | 1 + packages/jest-config/src/normalize.js | 1 + .../src/reporters/DefaultTestReporter.js | 6 ++ packages/jest-config/src/setFromArgv.js | 4 + scripts/test.js | 1 + types/Config.js | 2 + 11 files changed, 127 insertions(+), 1 deletion(-) create mode 100644 packages/jest-cli/src/Growler.js create mode 100644 packages/jest-cli/src/assets/jest_logo.png diff --git a/docs/API.md b/docs/API.md index be97d2b8c112..3fb613d1e2d9 100644 --- a/docs/API.md +++ b/docs/API.md @@ -76,6 +76,7 @@ Jest uses Jasmine 2 by default. An introduction to Jasmine 2 can be found - [`testRunner` [string]](#testrunner-string) - [`unmockedModulePathPatterns` [array]](#unmockedmodulepathpatterns-array-string) - [`verbose` [boolean]](#verbose-boolean) + - [`growl` [boolean]](#growl-boolean) #### Globally injected variables @@ -673,3 +674,8 @@ It is possible to override this setting in individual tests by explicitly callin (default: `false`) Indicates whether each individual test should be reported during the run. All errors will also still be shown on the bottom after execution. + +### `growl` [boolean] +(default: `false`) + +Actives Growl notifications for test results. diff --git a/package.json b/package.json index 9339d24a91cc..24956c4663b0 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,8 @@ "minimatch": "^3.0.0", "mkdirp": "^0.5.1", "progress": "^1.1.8", - "rimraf": "^2.5.2" + "rimraf": "^2.5.2", + "growl": "^1.9.2" }, "scripts": { "lint": "eslint .", diff --git a/packages/jest-cli/src/Growler.js b/packages/jest-cli/src/Growler.js new file mode 100644 index 000000000000..c68e9dc1c0b6 --- /dev/null +++ b/packages/jest-cli/src/Growler.js @@ -0,0 +1,98 @@ +/** +* Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +* +* @flow +* +* This source code is licensed under the BSD-style license found in the +* LICENSE file in the root directory of this source tree. An additional grant +* of patent rights can be found in the PATENTS file in the same directory. +*/ +'use strict'; + +import type {AggregatedResult} from 'types/TestResult'; + +const growl = require('growl'); +const path = require('path'); +const util = require('util'); + +const isDarwin = process.platform === 'darwin'; + +const APP_NAME = 'Jest'; + +const ICON = '/assets/jest_logo.png'; + +const NOTIFICATIONS = { + success: { + text: (isDarwin ? '✅ ' : '') + '%d tests passed', + options: { + title: '%d%% Passed', + image: ICON, + name: APP_NAME, + sticky: false, + priority: 0, + }, + }, + failure: { + text: (isDarwin ? '⛔️ ' : '') + '%d of %d tests failed', + options: { + title: '%d%% Failed', + image: ICON, + name: APP_NAME, + sticky: false, + priority: 1, + }, + }, +}; + +type Notification = { + text: string, + options: { + title: string, + image: string, + name: string, + sticky: boolean, + priority: ?number; + } +}; + +class Growler { + + static onTestResults(result: AggregatedResult): void { + let info; + let title; + let text; + + if (result.success) { + info = NOTIFICATIONS['success']; + title = util.format(info.options.title, 100); + text = util.format(info.text, result.numPassedTests); + } else { + info = NOTIFICATIONS['failure']; + title = util.format(info.options.title, Math.ceil( + (result.numFailedTests / result.numTotalTests) * 100, + )); + text = util.format( + info.text, + result.numFailedTests, + result.numTotalTests, + ); + } + const image = path.join(__dirname, info.options.image); + + const notification = { + text, + options: Object.assign({}, info.options, {title, image}), + }; + + this.trigger(notification); + } + + static trigger(notification: Notification): void { + growl( + notification.text, + notification.options + ); + } +} + +module.exports = Growler; diff --git a/packages/jest-cli/src/assets/jest_logo.png b/packages/jest-cli/src/assets/jest_logo.png new file mode 100644 index 0000000000000000000000000000000000000000..a339b1f25a2c9be339515df4b89d9cb5d4919a27 GIT binary patch literal 2396 zcmV-i38VIjP)KqvKzKyJ077gFDhKn2M+hyRW7KL-TU*6awE|Tv#|NlAtp_j_ z5egC#2oZ?LBM_62_hXZ6HhcShv-jSey?gIw6ZV$x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%A%I5NG?DyjUg2h8v#cROPa9y8dNASJ!HAzt~7Sq{T>bAp;&)gYhM^zawKGV;c zI3Vo=+wWI@4b5NtQ@7MJByxo8=#_|QC7IGSe!kCRAbRZVpo(;-sD3;MIx{z95V%s8 z|5OaMdtTKI1UXCYKCD^^WSR8f+Rop330{Ba6~0-DlTSuY6c6=r$yC#sIJda~YTtVe z^rZ9+UK#QZFNY|`Nmf^H4;-7F>LWa9&v6J#PM3X@xO=kmA>&ZFJ{NlHYjgz>d+$OR zTfALrwxh+0Qik!eCs(8LRXMzhnIsUH{J_<}mcYrpNxFluWqN)7xrC_KE~a6OVgw}+gdaS zbU7VRwP`Vny9k(GMB`hh-OH|nhW{uN!V=PyG1fr@G2gFm;DSPJKtTjSk+AJ&OVJW# zL0IZ&2(?(zB5As-KIE+k!mpE~6K^oPb7@^EEM+u|D%=cFnKQhiTt8GVrWa2m2u(ef zfOL|H9+r@%8-Td`@*s6}5pVsJdp(n@oOLiF=y z)MH!tgiH>Z#P9B*6~_r*x~VH#(T~tQKZ}h!zbS*$>*m}vfTYERkWx^D>Jz1WMJe%b zk^g{`cLgW(^1jzC^0`e6~_tkIVyO%bx+(eB=PMrUij3hFkR}kW!*b+uaiToYJ%1hYrvw^qF%gFU2`~V`A}f6a1k7px O0000 Date: Wed, 15 Jun 2016 15:52:54 -0700 Subject: [PATCH 2/7] Move Growler to Config package The reporters were moved from runtime to config, but the Growler class in this file did not move which broke the build. --- packages/jest-config/src/Growler.js | 98 +++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 packages/jest-config/src/Growler.js diff --git a/packages/jest-config/src/Growler.js b/packages/jest-config/src/Growler.js new file mode 100644 index 000000000000..c68e9dc1c0b6 --- /dev/null +++ b/packages/jest-config/src/Growler.js @@ -0,0 +1,98 @@ +/** +* Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +* +* @flow +* +* This source code is licensed under the BSD-style license found in the +* LICENSE file in the root directory of this source tree. An additional grant +* of patent rights can be found in the PATENTS file in the same directory. +*/ +'use strict'; + +import type {AggregatedResult} from 'types/TestResult'; + +const growl = require('growl'); +const path = require('path'); +const util = require('util'); + +const isDarwin = process.platform === 'darwin'; + +const APP_NAME = 'Jest'; + +const ICON = '/assets/jest_logo.png'; + +const NOTIFICATIONS = { + success: { + text: (isDarwin ? '✅ ' : '') + '%d tests passed', + options: { + title: '%d%% Passed', + image: ICON, + name: APP_NAME, + sticky: false, + priority: 0, + }, + }, + failure: { + text: (isDarwin ? '⛔️ ' : '') + '%d of %d tests failed', + options: { + title: '%d%% Failed', + image: ICON, + name: APP_NAME, + sticky: false, + priority: 1, + }, + }, +}; + +type Notification = { + text: string, + options: { + title: string, + image: string, + name: string, + sticky: boolean, + priority: ?number; + } +}; + +class Growler { + + static onTestResults(result: AggregatedResult): void { + let info; + let title; + let text; + + if (result.success) { + info = NOTIFICATIONS['success']; + title = util.format(info.options.title, 100); + text = util.format(info.text, result.numPassedTests); + } else { + info = NOTIFICATIONS['failure']; + title = util.format(info.options.title, Math.ceil( + (result.numFailedTests / result.numTotalTests) * 100, + )); + text = util.format( + info.text, + result.numFailedTests, + result.numTotalTests, + ); + } + const image = path.join(__dirname, info.options.image); + + const notification = { + text, + options: Object.assign({}, info.options, {title, image}), + }; + + this.trigger(notification); + } + + static trigger(notification: Notification): void { + growl( + notification.text, + notification.options + ); + } +} + +module.exports = Growler; From 914e67f07fa9b52e409d777e1b9efa43726b346d Mon Sep 17 00:00:00 2001 From: Marcel Erz Date: Wed, 15 Jun 2016 15:54:24 -0700 Subject: [PATCH 3/7] Move Growler to Config package The reporters were moved from runtime to config, but the Growler class in this file did not move which broke the build. --- package.json | 3 +- packages/jest-cli/src/Growler.js | 98 ------------------------------- packages/jest-config/package.json | 3 +- 3 files changed, 3 insertions(+), 101 deletions(-) delete mode 100644 packages/jest-cli/src/Growler.js diff --git a/package.json b/package.json index 24956c4663b0..9339d24a91cc 100644 --- a/package.json +++ b/package.json @@ -16,8 +16,7 @@ "minimatch": "^3.0.0", "mkdirp": "^0.5.1", "progress": "^1.1.8", - "rimraf": "^2.5.2", - "growl": "^1.9.2" + "rimraf": "^2.5.2" }, "scripts": { "lint": "eslint .", diff --git a/packages/jest-cli/src/Growler.js b/packages/jest-cli/src/Growler.js deleted file mode 100644 index c68e9dc1c0b6..000000000000 --- a/packages/jest-cli/src/Growler.js +++ /dev/null @@ -1,98 +0,0 @@ -/** -* Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -* -* @flow -* -* This source code is licensed under the BSD-style license found in the -* LICENSE file in the root directory of this source tree. An additional grant -* of patent rights can be found in the PATENTS file in the same directory. -*/ -'use strict'; - -import type {AggregatedResult} from 'types/TestResult'; - -const growl = require('growl'); -const path = require('path'); -const util = require('util'); - -const isDarwin = process.platform === 'darwin'; - -const APP_NAME = 'Jest'; - -const ICON = '/assets/jest_logo.png'; - -const NOTIFICATIONS = { - success: { - text: (isDarwin ? '✅ ' : '') + '%d tests passed', - options: { - title: '%d%% Passed', - image: ICON, - name: APP_NAME, - sticky: false, - priority: 0, - }, - }, - failure: { - text: (isDarwin ? '⛔️ ' : '') + '%d of %d tests failed', - options: { - title: '%d%% Failed', - image: ICON, - name: APP_NAME, - sticky: false, - priority: 1, - }, - }, -}; - -type Notification = { - text: string, - options: { - title: string, - image: string, - name: string, - sticky: boolean, - priority: ?number; - } -}; - -class Growler { - - static onTestResults(result: AggregatedResult): void { - let info; - let title; - let text; - - if (result.success) { - info = NOTIFICATIONS['success']; - title = util.format(info.options.title, 100); - text = util.format(info.text, result.numPassedTests); - } else { - info = NOTIFICATIONS['failure']; - title = util.format(info.options.title, Math.ceil( - (result.numFailedTests / result.numTotalTests) * 100, - )); - text = util.format( - info.text, - result.numFailedTests, - result.numTotalTests, - ); - } - const image = path.join(__dirname, info.options.image); - - const notification = { - text, - options: Object.assign({}, info.options, {title, image}), - }; - - this.trigger(notification); - } - - static trigger(notification: Notification): void { - growl( - notification.text, - notification.options - ); - } -} - -module.exports = Growler; diff --git a/packages/jest-config/package.json b/packages/jest-config/package.json index 9f3de71ab6cd..76ea68281d79 100644 --- a/packages/jest-config/package.json +++ b/packages/jest-config/package.json @@ -18,7 +18,8 @@ "jest-resolve": "^12.1.0", "jest-runtime": "^12.1.0", "jest-util": "^12.1.0", - "json-stable-stringify": "^1.0.0" + "json-stable-stringify": "^1.0.0", + "growl": "^1.9.2" }, "jest": { "rootDir": "./build", From 8a4a77364c1712a14dfc6cecce71d75fd6b6ed0a Mon Sep 17 00:00:00 2001 From: Marcel Erz Date: Wed, 15 Jun 2016 16:14:27 -0700 Subject: [PATCH 4/7] Fixing code according to abc-rule and fix typo in doc --- docs/API.md | 12 ++++++------ packages/jest-cli/src/cli/args.js | 2 +- packages/jest-config/package.json | 4 ++-- packages/jest-config/src/defaults.js | 2 +- packages/jest-config/src/normalize.js | 2 +- types/Config.js | 3 +-- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/docs/API.md b/docs/API.md index 3fb613d1e2d9..a8d51dd153d0 100644 --- a/docs/API.md +++ b/docs/API.md @@ -56,6 +56,7 @@ Jest uses Jasmine 2 by default. An introduction to Jasmine 2 can be found - [`collectCoverageOnlyFrom` [object]](#collectcoverageonlyfrom-object) - [`coverageThreshold` [object]](#coveragethreshold-object) - [`globals` [object]](#globals-object) + - [`growl` [boolean]](#growl-boolean) - [`mocksPattern` [string]](#mockspattern-string) - [`moduleDirectories` [array]](#moduledirectories-array-string) - [`moduleFileExtensions` [array]](#modulefileextensions-array-string) @@ -76,7 +77,6 @@ Jest uses Jasmine 2 by default. An introduction to Jasmine 2 can be found - [`testRunner` [string]](#testrunner-string) - [`unmockedModulePathPatterns` [array]](#unmockedmodulepathpatterns-array-string) - [`verbose` [boolean]](#verbose-boolean) - - [`growl` [boolean]](#growl-boolean) #### Globally injected variables @@ -491,6 +491,11 @@ For example, the following would create a global `__DEV__` variable set to `true Note that, if you specify a global reference value (like an object or array) here, and some code mutates that value in the midst of running a test, that mutation will *not* be persisted across test runs for other test files. +### `growl` [boolean] +(default: `false`) + +Activates Growl notifications for test results. + ### `mocksPattern` [string] (default: `(?:[\\/]|^)__mocks__[\\/]`) @@ -674,8 +679,3 @@ It is possible to override this setting in individual tests by explicitly callin (default: `false`) Indicates whether each individual test should be reported during the run. All errors will also still be shown on the bottom after execution. - -### `growl` [boolean] -(default: `false`) - -Actives Growl notifications for test results. diff --git a/packages/jest-cli/src/cli/args.js b/packages/jest-cli/src/cli/args.js index 600bd64925a6..db6ff872d7a5 100644 --- a/packages/jest-cli/src/cli/args.js +++ b/packages/jest-cli/src/cli/args.js @@ -165,7 +165,7 @@ const options = { }, growl: { description: wrap( - 'Actives Growl notifications for test results.' + 'Activates Growl notifications for test results.' ), type: 'boolean', }, diff --git a/packages/jest-config/package.json b/packages/jest-config/package.json index 76ea68281d79..bae1dc6cb805 100644 --- a/packages/jest-config/package.json +++ b/packages/jest-config/package.json @@ -9,6 +9,7 @@ "main": "build/index.js", "dependencies": { "chalk": "^1.1.1", + "growl": "^1.9.2", "istanbul": "^0.4.2", "jest-environment-jsdom": "^12.1.0", "jest-environment-node": "^12.1.0", @@ -18,8 +19,7 @@ "jest-resolve": "^12.1.0", "jest-runtime": "^12.1.0", "jest-util": "^12.1.0", - "json-stable-stringify": "^1.0.0", - "growl": "^1.9.2" + "json-stable-stringify": "^1.0.0" }, "jest": { "rootDir": "./build", diff --git a/packages/jest-config/src/defaults.js b/packages/jest-config/src/defaults.js index c41af56b867c..837a10ad0985 100644 --- a/packages/jest-config/src/defaults.js +++ b/packages/jest-config/src/defaults.js @@ -24,6 +24,7 @@ module.exports = ({ coverageCollector: require.resolve('./IstanbulCollector'), coverageReporters: ['json', 'text', 'lcov', 'clover'], globals: {}, + growl: false, haste: { providesModuleNodeModules: [], }, @@ -46,5 +47,4 @@ module.exports = ({ testURL: 'about:blank', useStderr: false, verbose: false, - growl: false, }: DefaultConfig); diff --git a/packages/jest-config/src/normalize.js b/packages/jest-config/src/normalize.js index fec244b883df..e2bc751c148d 100644 --- a/packages/jest-config/src/normalize.js +++ b/packages/jest-config/src/normalize.js @@ -253,6 +253,7 @@ function normalize(config, argv) { case 'coverageReporters': case 'coverageThreshold': case 'globals': + case 'growl': case 'haste': case 'logHeapUsage': case 'mocksPattern': @@ -273,7 +274,6 @@ function normalize(config, argv) { case 'testURL': case 'usesBabelJest': case 'verbose': - case 'growl': case 'watchman': value = config[key]; break; diff --git a/types/Config.js b/types/Config.js index 0ddb8624eba6..fd7f1978c0f3 100644 --- a/types/Config.js +++ b/types/Config.js @@ -27,6 +27,7 @@ type BaseConfig = { coverageReporters: Array, globals: ConfigGlobals, haste: HasteConfig, + growl: boolean, mocksPattern: string, moduleDirectories: Array, moduleFileExtensions: Array, @@ -43,7 +44,6 @@ type BaseConfig = { testURL: string, useStderr: boolean, verbose: boolean, - growl: boolean, }; export type DefaultConfig = BaseConfig & { @@ -73,5 +73,4 @@ export type Config = BaseConfig & { testDirectoryName: string, updateSnapshot: {}, watchman: boolean, - growl: boolean, }; From 761fc51138f206b719545eaff11e1569296e5b7f Mon Sep 17 00:00:00 2001 From: Marcel Erz Date: Wed, 15 Jun 2016 17:08:20 -0700 Subject: [PATCH 5/7] Add bigger jest logo for retina displays --- packages/jest-cli/src/assets/jest_logo.png | Bin 2396 -> 0 bytes packages/jest-config/src/assets/jest_logo.png | Bin 0 -> 7319 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 packages/jest-cli/src/assets/jest_logo.png create mode 100644 packages/jest-config/src/assets/jest_logo.png diff --git a/packages/jest-cli/src/assets/jest_logo.png b/packages/jest-cli/src/assets/jest_logo.png deleted file mode 100644 index a339b1f25a2c9be339515df4b89d9cb5d4919a27..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2396 zcmV-i38VIjP)KqvKzKyJ077gFDhKn2M+hyRW7KL-TU*6awE|Tv#|NlAtp_j_ z5egC#2oZ?LBM_62_hXZ6HhcShv-jSey?gIw6ZV$xobSxcz4OhT-^@4PW3E9E1TYv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b$R!_HsY+{DX9$qLKdz`fhHHK)R!xUOK~{^_Y`vIgNn)?uMRr_-IG&? zUmFRyYsk->TiFpcPhC<{bUQ6Jaj8DIj;JaU3?;bhf@x$ql;Y?LLRWjS$;ZuvubI{0 zH;tC>35bf~Yz=|gXnLaZk#?%u1IiYqwgMOnux-fYc276jX&9-oQB>lJKXhL>Hf(~` z`)AYC<*GxKl&+TkYN%Wal$NuHzMgvq^g+p1ycWw4{H3E#KcTL;Bk>vQoqg!FRYarZ zf=>I9q=`g%;z%xMd7uMd6!dxRjo)M%>DBO$lMUB=tUWr4fHc)utsq0*3R;NG$7M#) zwi#C+aoLIziyU3|q^?v0cQeBSo-4)sy30W?b^wwFNRt#1^SmJbY}rcyD^9Mz7a|CSc)Jfo)1PF%`ctPxZ=m8awUyVTYb@qR_5C^00y)6Di{G+w&%kG;A}Fi8 zm9(cr@)Py>N;rSx#lkM9QIj!>JgWu90@`NFYb7i6*SR<7pMQ2KpJ98VPEhmCYf?nG|FtpiG|0=0pv>6qrI}Ieu;>oL*qozt%X!y( z3=P&Zs6+k2AKNIb{w7!}tH&Q}_w+r9(c5O*VDG`45{?*&g zyK;)ut`W?a)cijr@Y)v~NR%nRl;;M%uaJA{QjKIc6Y?z~8W~F;42BL-Na!)SV7hI{ z*k~i-k0 ztF%!dy4Lo!ax^0M>XoSMee-}mtz4P(gF>zW9zF_%86Ea^b|`f8j6>lx+I{mcvo$Z>iZQ= Date: Wed, 15 Jun 2016 17:39:04 -0700 Subject: [PATCH 6/7] Use node-notifier for notifications and renamed class and parameter --- docs/API.md | 12 ++-- packages/jest-cli/src/cli/args.js | 4 +- packages/jest-config/package.json | 4 +- .../src/{Growler.js => Notifier.js} | 70 +++++++------------ packages/jest-config/src/defaults.js | 2 +- packages/jest-config/src/normalize.js | 2 +- .../src/reporters/DefaultTestReporter.js | 6 +- packages/jest-config/src/setFromArgv.js | 4 +- scripts/test.js | 2 +- types/Config.js | 2 +- 10 files changed, 44 insertions(+), 64 deletions(-) rename packages/jest-config/src/{Growler.js => Notifier.js} (51%) diff --git a/docs/API.md b/docs/API.md index a8d51dd153d0..d8e6ffe564ef 100644 --- a/docs/API.md +++ b/docs/API.md @@ -56,13 +56,13 @@ Jest uses Jasmine 2 by default. An introduction to Jasmine 2 can be found - [`collectCoverageOnlyFrom` [object]](#collectcoverageonlyfrom-object) - [`coverageThreshold` [object]](#coveragethreshold-object) - [`globals` [object]](#globals-object) - - [`growl` [boolean]](#growl-boolean) - [`mocksPattern` [string]](#mockspattern-string) - [`moduleDirectories` [array]](#moduledirectories-array-string) - [`moduleFileExtensions` [array]](#modulefileextensions-array-string) - [`moduleNameMapper` [object]](#modulenamemapper-object-string-string) - [`modulePaths` [array]](#modulepaths-array-string) - [`modulePathIgnorePatterns` [array]](#modulepathignorepatterns-array-string) + - [`notify` [boolean]](#notify-boolean) - [`preprocessorIgnorePatterns` [array]](#preprocessorignorepatterns-array-string) - [`rootDir` [string]](#rootdir-string) - [`scriptPreprocessor` [string]](#scriptpreprocessor-string) @@ -491,11 +491,6 @@ For example, the following would create a global `__DEV__` variable set to `true Note that, if you specify a global reference value (like an object or array) here, and some code mutates that value in the midst of running a test, that mutation will *not* be persisted across test runs for other test files. -### `growl` [boolean] -(default: `false`) - -Activates Growl notifications for test results. - ### `mocksPattern` [string] (default: `(?:[\\/]|^)__mocks__[\\/]`) @@ -546,6 +541,11 @@ Example: } ``` +### `notify` [boolean] +(default: `false`) + +Activates notifications for test results. + ### `rootDir` [string] (default: The root of the directory containing the `package.json` *or* the [`pwd`](http://en.wikipedia.org/wiki/Pwd) if no `package.json` is found) diff --git a/packages/jest-cli/src/cli/args.js b/packages/jest-cli/src/cli/args.js index db6ff872d7a5..18eda2176348 100644 --- a/packages/jest-cli/src/cli/args.js +++ b/packages/jest-cli/src/cli/args.js @@ -163,9 +163,9 @@ const options = { ), type: 'boolean', }, - growl: { + notify: { description: wrap( - 'Activates Growl notifications for test results.' + 'Activates notifications for test results.' ), type: 'boolean', }, diff --git a/packages/jest-config/package.json b/packages/jest-config/package.json index bae1dc6cb805..9a09ab720174 100644 --- a/packages/jest-config/package.json +++ b/packages/jest-config/package.json @@ -9,7 +9,6 @@ "main": "build/index.js", "dependencies": { "chalk": "^1.1.1", - "growl": "^1.9.2", "istanbul": "^0.4.2", "jest-environment-jsdom": "^12.1.0", "jest-environment-node": "^12.1.0", @@ -19,7 +18,8 @@ "jest-resolve": "^12.1.0", "jest-runtime": "^12.1.0", "jest-util": "^12.1.0", - "json-stable-stringify": "^1.0.0" + "json-stable-stringify": "^1.0.0", + "node-notifier": "^4.6.0" }, "jest": { "rootDir": "./build", diff --git a/packages/jest-config/src/Growler.js b/packages/jest-config/src/Notifier.js similarity index 51% rename from packages/jest-config/src/Growler.js rename to packages/jest-config/src/Notifier.js index c68e9dc1c0b6..677ae1b5f926 100644 --- a/packages/jest-config/src/Growler.js +++ b/packages/jest-config/src/Notifier.js @@ -1,98 +1,78 @@ /** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * -* @flow -* * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. +* +* @flow */ 'use strict'; import type {AggregatedResult} from 'types/TestResult'; -const growl = require('growl'); +const notifier = require('node-notifier'); const path = require('path'); const util = require('util'); const isDarwin = process.platform === 'darwin'; -const APP_NAME = 'Jest'; - const ICON = '/assets/jest_logo.png'; - const NOTIFICATIONS = { success: { - text: (isDarwin ? '✅ ' : '') + '%d tests passed', - options: { - title: '%d%% Passed', - image: ICON, - name: APP_NAME, - sticky: false, - priority: 0, - }, + title: '%d%% Passed', + message: (isDarwin ? '✅ ' : '') + '%d tests passed', + icon: ICON, }, failure: { - text: (isDarwin ? '⛔️ ' : '') + '%d of %d tests failed', - options: { - title: '%d%% Failed', - image: ICON, - name: APP_NAME, - sticky: false, - priority: 1, - }, + title: '%d%% Failed', + message: (isDarwin ? '⛔️ ' : '') + '%d of %d tests failed', + icon: ICON, }, }; type Notification = { - text: string, - options: { - title: string, - image: string, - name: string, - sticky: boolean, - priority: ?number; - } + title: string, + message: string, + icon: string, }; -class Growler { +class Notifier { static onTestResults(result: AggregatedResult): void { let info; let title; - let text; + let message; if (result.success) { info = NOTIFICATIONS['success']; - title = util.format(info.options.title, 100); - text = util.format(info.text, result.numPassedTests); + title = util.format(info.title, 100); + message = util.format(info.message, result.numPassedTests); } else { info = NOTIFICATIONS['failure']; - title = util.format(info.options.title, Math.ceil( + title = util.format(info.title, Math.ceil( (result.numFailedTests / result.numTotalTests) * 100, )); - text = util.format( - info.text, + message = util.format( + info.message, result.numFailedTests, result.numTotalTests, ); } - const image = path.join(__dirname, info.options.image); + const icon = path.join(__dirname, info.icon); const notification = { - text, - options: Object.assign({}, info.options, {title, image}), + title, + message, + icon, }; this.trigger(notification); } static trigger(notification: Notification): void { - growl( - notification.text, - notification.options - ); + notifier.notify(notification); } } -module.exports = Growler; +module.exports = Notifier; diff --git a/packages/jest-config/src/defaults.js b/packages/jest-config/src/defaults.js index 837a10ad0985..7174ebd00ddf 100644 --- a/packages/jest-config/src/defaults.js +++ b/packages/jest-config/src/defaults.js @@ -24,7 +24,6 @@ module.exports = ({ coverageCollector: require.resolve('./IstanbulCollector'), coverageReporters: ['json', 'text', 'lcov', 'clover'], globals: {}, - growl: false, haste: { providesModuleNodeModules: [], }, @@ -36,6 +35,7 @@ module.exports = ({ modulePathIgnorePatterns: [], noHighlight: false, noStackTrace: false, + notify: false, testEnvData: {}, testEnvironment: 'jest-environment-jsdom', testPathDirs: [''], diff --git a/packages/jest-config/src/normalize.js b/packages/jest-config/src/normalize.js index e2bc751c148d..a99c19790e61 100644 --- a/packages/jest-config/src/normalize.js +++ b/packages/jest-config/src/normalize.js @@ -253,7 +253,6 @@ function normalize(config, argv) { case 'coverageReporters': case 'coverageThreshold': case 'globals': - case 'growl': case 'haste': case 'logHeapUsage': case 'mocksPattern': @@ -264,6 +263,7 @@ function normalize(config, argv) { case 'name': case 'noHighlight': case 'noStackTrace': + case 'notify': case 'persistModuleRegistryBetweenSpecs': case 'rootDir': case 'updateSnapshot': diff --git a/packages/jest-config/src/reporters/DefaultTestReporter.js b/packages/jest-config/src/reporters/DefaultTestReporter.js index 94a9c6216a38..382f2845a870 100644 --- a/packages/jest-config/src/reporters/DefaultTestReporter.js +++ b/packages/jest-config/src/reporters/DefaultTestReporter.js @@ -15,7 +15,7 @@ import type {Process} from 'types/Process'; const chalk = require('chalk'); const formatFailureMessage = require('jest-util').formatFailureMessage; -const Growler = require('../Growler'); +const Notifier = require('../Notifier'); const path = require('path'); const VerboseLogger = require('./VerboseLogger'); @@ -185,8 +185,8 @@ class DefaultTestReporter { this._printSummary(aggregatedResults); this.log(results); - if (config.growl) { - Growler.onTestResults(aggregatedResults); + if (config.notify) { + Notifier.onTestResults(aggregatedResults); } return snapshotFailure ? false : aggregatedResults.success; diff --git a/packages/jest-config/src/setFromArgv.js b/packages/jest-config/src/setFromArgv.js index fc29c087fe9a..b5c3262ac72b 100644 --- a/packages/jest-config/src/setFromArgv.js +++ b/packages/jest-config/src/setFromArgv.js @@ -24,8 +24,8 @@ function setFromArgv(config, argv) { config.verbose = argv.verbose; } - if (argv.growl) { - config.growl = argv.growl; + if (argv.notify) { + config.notify = argv.notify; } if (argv.bail) { diff --git a/scripts/test.js b/scripts/test.js index 160bfd6a3f19..2f56e2a83296 100644 --- a/scripts/test.js +++ b/scripts/test.js @@ -82,7 +82,7 @@ runCommands('node bin/jest.js --runInBand', 'packages/jest-cli'); runCommands('node bin/jest.js --runInBand --logHeapUsage', 'packages/jest-cli'); runCommands('node bin/jest.js --json', 'packages/jest-cli'); runCommands('node bin/jest.js --verbose', 'packages/jest-cli'); -runCommands('node bin/jest.js --growl', 'packages/jest-cli'); +runCommands('node bin/jest.js --notify', 'packages/jest-cli'); examples.forEach(runExampleTests); diff --git a/types/Config.js b/types/Config.js index fd7f1978c0f3..476f2962d177 100644 --- a/types/Config.js +++ b/types/Config.js @@ -27,7 +27,6 @@ type BaseConfig = { coverageReporters: Array, globals: ConfigGlobals, haste: HasteConfig, - growl: boolean, mocksPattern: string, moduleDirectories: Array, moduleFileExtensions: Array, @@ -35,6 +34,7 @@ type BaseConfig = { modulePathIgnorePatterns: Array, noHighlight: boolean, noStackTrace: boolean, + notify: boolean, testEnvData: {}, testEnvironment: string, testPathDirs: Array, From a17dfca932dbb249ae2442fe03b52afa4a0b4353 Mon Sep 17 00:00:00 2001 From: Marcel Erz Date: Thu, 16 Jun 2016 13:05:44 -0700 Subject: [PATCH 7/7] Replace unicode string with escaped values --- packages/jest-config/src/Notifier.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/jest-config/src/Notifier.js b/packages/jest-config/src/Notifier.js index 677ae1b5f926..d4bcdc948eff 100644 --- a/packages/jest-config/src/Notifier.js +++ b/packages/jest-config/src/Notifier.js @@ -21,12 +21,12 @@ const ICON = '/assets/jest_logo.png'; const NOTIFICATIONS = { success: { title: '%d%% Passed', - message: (isDarwin ? '✅ ' : '') + '%d tests passed', + message: (isDarwin ? '\u2705 ' : '') + '%d tests passed', icon: ICON, }, failure: { title: '%d%% Failed', - message: (isDarwin ? '⛔️ ' : '') + '%d of %d tests failed', + message: (isDarwin ? '\u26D4\uFE0F ' : '') + '%d of %d tests failed', icon: ICON, }, }; @@ -45,11 +45,11 @@ class Notifier { let message; if (result.success) { - info = NOTIFICATIONS['success']; + info = NOTIFICATIONS.success; title = util.format(info.title, 100); message = util.format(info.message, result.numPassedTests); } else { - info = NOTIFICATIONS['failure']; + info = NOTIFICATIONS.failure; title = util.format(info.title, Math.ceil( (result.numFailedTests / result.numTotalTests) * 100, ));