Skip to content

Commit

Permalink
icons might not show in some envs
Browse files Browse the repository at this point in the history
  • Loading branch information
psilospore committed Feb 5, 2018
1 parent 9135962 commit c98a36d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,26 @@
exports[`test always 1`] = `
Array [
Object {
"icon": true,
"message": "3 tests passed",
"title": "100% Passed",
},
Object {
"icon": true,
"message": "3 of 3 tests failed",
"title": "100% Failed",
},
Object {
"icon": true,
"message": "3 tests passed",
"title": "100% Passed",
},
Object {
"icon": true,
"message": "3 tests passed",
"title": "100% Passed",
},
Object {
"icon": true,
"message": "3 of 3 tests failed",
"title": "100% Failed",
},
Object {
"icon": true,
"message": "3 of 3 tests failed",
"title": "100% Failed",
},
Expand All @@ -38,22 +32,18 @@ Array [
exports[`test change 1`] = `
Array [
Object {
"icon": true,
"message": "3 tests passed",
"title": "100% Passed",
},
Object {
"icon": true,
"message": "3 of 3 tests failed",
"title": "100% Failed",
},
Object {
"icon": true,
"message": "3 tests passed",
"title": "100% Passed",
},
Object {
"icon": true,
"message": "3 of 3 tests failed",
"title": "100% Failed",
},
Expand All @@ -63,27 +53,22 @@ Array [
exports[`test failure-change 1`] = `
Array [
Object {
"icon": true,
"message": "3 tests passed",
"title": "100% Passed",
},
Object {
"icon": true,
"message": "3 of 3 tests failed",
"title": "100% Failed",
},
Object {
"icon": true,
"message": "3 tests passed",
"title": "100% Passed",
},
Object {
"icon": true,
"message": "3 of 3 tests failed",
"title": "100% Failed",
},
Object {
"icon": true,
"message": "3 of 3 tests failed",
"title": "100% Failed",
},
Expand All @@ -93,17 +78,14 @@ Array [
exports[`test success 1`] = `
Array [
Object {
"icon": true,
"message": "3 tests passed",
"title": "100% Passed",
},
Object {
"icon": true,
"message": "3 tests passed",
"title": "100% Passed",
},
Object {
"icon": true,
"message": "3 tests passed",
"title": "100% Passed",
},
Expand All @@ -113,27 +95,22 @@ Array [
exports[`test success-change 1`] = `
Array [
Object {
"icon": true,
"message": "3 tests passed",
"title": "100% Passed",
},
Object {
"icon": true,
"message": "3 of 3 tests failed",
"title": "100% Failed",
},
Object {
"icon": true,
"message": "3 tests passed",
"title": "100% Passed",
},
Object {
"icon": true,
"message": "3 tests passed",
"title": "100% Passed",
},
Object {
"icon": true,
"message": "3 of 3 tests failed",
"title": "100% Failed",
},
Expand Down
12 changes: 5 additions & 7 deletions packages/jest-cli/src/__tests__/notify_reporter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import NotifyReporter from '../reporters/notify_reporter';
import type {TestSchedulerContext} from '../test_scheduler';
import type {AggregatedResult} from '../../../../types/TestResult';

const ICON_PATH = '/assets/jest_logo.png';

jest.mock('../reporters/default_reporter');
jest.mock('node-notifier', () => ({
notify: jest.fn(),
Expand Down Expand Up @@ -57,8 +55,6 @@ const notifyEvents = [
aggregatedResultsFailure,
];

const iconShown = path => path.endsWith(ICON_PATH);

test('.addReporter() .removeReporter()', () => {
const scheduler = new TestScheduler(
{},
Expand All @@ -74,7 +70,6 @@ test('.addReporter() .removeReporter()', () => {

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

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

expect(
notify.notify.mock.calls.map(([{icon, message, title}]) => ({
icon: iconShown(icon),
notify.notify.mock.calls.map(([{message, title}]) => ({
message: message.replace('\u26D4\uFE0F ', '').replace('\u2705 ', ''),
title,
})),
Expand All @@ -119,3 +113,7 @@ test('test success-change', () => {
test('test failure-change', () => {
testModes('failure-change', notifyEvents);
});

afterEach(() => {
jest.clearAllMocks();
});

0 comments on commit c98a36d

Please sign in to comment.