Skip to content

Commit

Permalink
added new property to mock in chalk.js
Browse files Browse the repository at this point in the history
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 facebook#10169

Differential Revision: D3943493

Pulled By: davidaurelio

fbshipit-source-id: 11f57f60ed909a394f15de7b9cc511400aeff510
  • Loading branch information
bestander authored and grabbou committed Oct 11, 2016
1 parent c40ba02 commit be0bfe7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 23 deletions.
25 changes: 2 additions & 23 deletions local-cli/__mocks__/chalk.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,5 @@
*/
'use strict';

const mockColor = () => {
return {
bold: () => { return { }; },
};
};

mockColor.bold = function() {
return {};
};

module.exports = {
dim: s => s,
magenta: mockColor,
white: mockColor,
blue: mockColor,
yellow: mockColor,
green: mockColor,
bold: mockColor,
red: mockColor,
cyan: mockColor,
gray: mockColor,
black: mockColor,
};
module.exports =
require('../../packager/react-packager/src/Activity/__mocks__/chalk.js');
4 changes: 4 additions & 0 deletions packager/react-packager/src/Activity/__mocks__/chalk.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ mockColor.bold = function() {
return {};
};

mockColor.bgRed = function() {
return {};
};

module.exports = {
dim: s => s,
magenta: mockColor,
Expand Down

0 comments on commit be0bfe7

Please sign in to comment.