Skip to content

Commit be0bfe7

Browse files
bestandergrabbou
authored andcommitted
added new property to mock in chalk.js
Summary: Tests started [failing](https://travis-ci.org/facebook/react-native/jobs/163517412) with release of new babel that uses chalk.white.bgRed in code. Jest does not like chalk and needs it mocked. Removed code duplication and patched the mock. Closes #10169 Differential Revision: D3943493 Pulled By: davidaurelio fbshipit-source-id: 11f57f60ed909a394f15de7b9cc511400aeff510
1 parent c40ba02 commit be0bfe7

2 files changed

Lines changed: 6 additions & 23 deletions

File tree

  • local-cli/__mocks__
  • packager/react-packager/src/Activity/__mocks__

local-cli/__mocks__/chalk.js

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,5 @@
88
*/
99
'use strict';
1010

11-
const mockColor = () => {
12-
return {
13-
bold: () => { return { }; },
14-
};
15-
};
16-
17-
mockColor.bold = function() {
18-
return {};
19-
};
20-
21-
module.exports = {
22-
dim: s => s,
23-
magenta: mockColor,
24-
white: mockColor,
25-
blue: mockColor,
26-
yellow: mockColor,
27-
green: mockColor,
28-
bold: mockColor,
29-
red: mockColor,
30-
cyan: mockColor,
31-
gray: mockColor,
32-
black: mockColor,
33-
};
11+
module.exports =
12+
require('../../packager/react-packager/src/Activity/__mocks__/chalk.js');

packager/react-packager/src/Activity/__mocks__/chalk.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ mockColor.bold = function() {
1818
return {};
1919
};
2020

21+
mockColor.bgRed = function() {
22+
return {};
23+
};
24+
2125
module.exports = {
2226
dim: s => s,
2327
magenta: mockColor,

0 commit comments

Comments
 (0)