Skip to content

Commit 3f25876

Browse files
psilosporeSimenB
authored andcommitted
icons might not show in some envs
1 parent 7bea23b commit 3f25876

File tree

2 files changed

+5
-30
lines changed

2 files changed

+5
-30
lines changed

packages/jest-cli/src/__tests__/__snapshots__/notify_reporter.test.js.snap

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,26 @@
33
exports[`test always 1`] = `
44
Array [
55
Object {
6-
"icon": true,
76
"message": "3 tests passed",
87
"title": "100% Passed",
98
},
109
Object {
11-
"icon": true,
1210
"message": "3 of 3 tests failed",
1311
"title": "100% Failed",
1412
},
1513
Object {
16-
"icon": true,
1714
"message": "3 tests passed",
1815
"title": "100% Passed",
1916
},
2017
Object {
21-
"icon": true,
2218
"message": "3 tests passed",
2319
"title": "100% Passed",
2420
},
2521
Object {
26-
"icon": true,
2722
"message": "3 of 3 tests failed",
2823
"title": "100% Failed",
2924
},
3025
Object {
31-
"icon": true,
3226
"message": "3 of 3 tests failed",
3327
"title": "100% Failed",
3428
},
@@ -38,22 +32,18 @@ Array [
3832
exports[`test change 1`] = `
3933
Array [
4034
Object {
41-
"icon": true,
4235
"message": "3 tests passed",
4336
"title": "100% Passed",
4437
},
4538
Object {
46-
"icon": true,
4739
"message": "3 of 3 tests failed",
4840
"title": "100% Failed",
4941
},
5042
Object {
51-
"icon": true,
5243
"message": "3 tests passed",
5344
"title": "100% Passed",
5445
},
5546
Object {
56-
"icon": true,
5747
"message": "3 of 3 tests failed",
5848
"title": "100% Failed",
5949
},
@@ -63,27 +53,22 @@ Array [
6353
exports[`test failure-change 1`] = `
6454
Array [
6555
Object {
66-
"icon": true,
6756
"message": "3 tests passed",
6857
"title": "100% Passed",
6958
},
7059
Object {
71-
"icon": true,
7260
"message": "3 of 3 tests failed",
7361
"title": "100% Failed",
7462
},
7563
Object {
76-
"icon": true,
7764
"message": "3 tests passed",
7865
"title": "100% Passed",
7966
},
8067
Object {
81-
"icon": true,
8268
"message": "3 of 3 tests failed",
8369
"title": "100% Failed",
8470
},
8571
Object {
86-
"icon": true,
8772
"message": "3 of 3 tests failed",
8873
"title": "100% Failed",
8974
},
@@ -93,17 +78,14 @@ Array [
9378
exports[`test success 1`] = `
9479
Array [
9580
Object {
96-
"icon": true,
9781
"message": "3 tests passed",
9882
"title": "100% Passed",
9983
},
10084
Object {
101-
"icon": true,
10285
"message": "3 tests passed",
10386
"title": "100% Passed",
10487
},
10588
Object {
106-
"icon": true,
10789
"message": "3 tests passed",
10890
"title": "100% Passed",
10991
},
@@ -113,27 +95,22 @@ Array [
11395
exports[`test success-change 1`] = `
11496
Array [
11597
Object {
116-
"icon": true,
11798
"message": "3 tests passed",
11899
"title": "100% Passed",
119100
},
120101
Object {
121-
"icon": true,
122102
"message": "3 of 3 tests failed",
123103
"title": "100% Failed",
124104
},
125105
Object {
126-
"icon": true,
127106
"message": "3 tests passed",
128107
"title": "100% Passed",
129108
},
130109
Object {
131-
"icon": true,
132110
"message": "3 tests passed",
133111
"title": "100% Passed",
134112
},
135113
Object {
136-
"icon": true,
137114
"message": "3 of 3 tests failed",
138115
"title": "100% Failed",
139116
},

packages/jest-cli/src/__tests__/notify_reporter.test.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ import NotifyReporter from '../reporters/notify_reporter';
1313
import type {TestSchedulerContext} from '../test_scheduler';
1414
import type {AggregatedResult} from '../../../../types/TestResult';
1515

16-
const ICON_PATH = '/assets/jest_logo.png';
17-
1816
jest.mock('../reporters/default_reporter');
1917
jest.mock('node-notifier', () => ({
2018
notify: jest.fn(),
@@ -57,8 +55,6 @@ const notifyEvents = [
5755
aggregatedResultsFailure,
5856
];
5957

60-
const iconShown = path => path.endsWith(ICON_PATH);
61-
6258
test('.addReporter() .removeReporter()', () => {
6359
const scheduler = new TestScheduler(
6460
{},
@@ -74,7 +70,6 @@ test('.addReporter() .removeReporter()', () => {
7470

7571
const testModes = (notifyMode: string, arl: Array<AggregatedResult>) => {
7672
const notify = require('node-notifier');
77-
notify.notify.mock.calls = [];
7873

7974
let previousContext = initialContext;
8075
arl.forEach((ar, i) => {
@@ -92,8 +87,7 @@ const testModes = (notifyMode: string, arl: Array<AggregatedResult>) => {
9287
});
9388

9489
expect(
95-
notify.notify.mock.calls.map(([{icon, message, title}]) => ({
96-
icon: iconShown(icon),
90+
notify.notify.mock.calls.map(([{message, title}]) => ({
9791
message: message.replace('\u26D4\uFE0F ', '').replace('\u2705 ', ''),
9892
title,
9993
})),
@@ -119,3 +113,7 @@ test('test success-change', () => {
119113
test('test failure-change', () => {
120114
testModes('failure-change', notifyEvents);
121115
});
116+
117+
afterEach(() => {
118+
jest.clearAllMocks();
119+
});

0 commit comments

Comments
 (0)