From cb01ce762db8545c36bc075a415619a76a7f6402 Mon Sep 17 00:00:00 2001 From: Dmitrii Abramov Date: Tue, 5 Jul 2016 16:58:51 -0700 Subject: [PATCH 1/2] flow-bin@0.28.0 --- package.json | 2 +- packages/jest-cli/src/SearchSource.js | 15 +++++++++------ packages/jest-mock/src/index.js | 2 +- packages/jest-snapshot/src/SnapshotFile.js | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 89aea2844f60..81c886b59730 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "eslint": "^2.13.1", "eslint-plugin-babel": "^3.3.0", "fbjs-scripts": "^0.7.1", - "flow-bin": "^0.27.0", + "flow-bin": "^0.28.0", "glob": "^7.0.4", "graceful-fs": "^4.1.4", "lerna": "2.0.0-beta.20", diff --git a/packages/jest-cli/src/SearchSource.js b/packages/jest-cli/src/SearchSource.js index 4e3e7cb8c0e5..43ed42c23398 100644 --- a/packages/jest-cli/src/SearchSource.js +++ b/packages/jest-cli/src/SearchSource.js @@ -51,8 +51,11 @@ const determineSCM = path => Promise.all([ hg.isHGRepository(path), ]); const pathToRegex = p => utils.replacePathSepForRegex(p); -const pluralize = - (word, count, ending) => `${count} ${word}${count === 1 ? '' : ending}`; +const pluralize = ( + word: string, + count: number, + ending: string, +) => `${count} ${word}${count === 1 ? '' : ending}`; class SearchSource { _hasteMap: Promise; @@ -206,10 +209,10 @@ class SearchSource { const pattern = patternInfo.testPathPattern; const input = patternInfo.input; - const formattedPattern = `/${pattern}/`; + const formattedPattern = `/${pattern || ''}/`; const formattedInput = patternInfo.shouldTreatInputAsPattern - ? `/${input}/` - : `"${input}"`; + ? `/${input || ''}/` + : `"${input || ''}"`; const testPathPattern = (input === pattern) ? formattedInput : formattedPattern; @@ -225,7 +228,7 @@ class SearchSource { return ( `${chalk.bold.red('NO TESTS FOUND')}. ` + - `${pluralize('file', data.total, 's')} checked.\n${statsMessage}` + `${pluralize('file', data.total || 1, 's')} checked.\n${statsMessage}` ); } diff --git a/packages/jest-mock/src/index.js b/packages/jest-mock/src/index.js index 3820e3703cc6..594eb98d5e90 100644 --- a/packages/jest-mock/src/index.js +++ b/packages/jest-mock/src/index.js @@ -364,7 +364,7 @@ function generateFromMetadata(_metadata: MockFunctionMetadata): Mock { function getMetadata( component: any, - _refs?: Map, + _refs?: Map, ): ?MockFunctionMetadata { const refs = _refs || new Map(); const ref = refs.get(component); diff --git a/packages/jest-snapshot/src/SnapshotFile.js b/packages/jest-snapshot/src/SnapshotFile.js index 68870ce29a0f..8c3968714874 100644 --- a/packages/jest-snapshot/src/SnapshotFile.js +++ b/packages/jest-snapshot/src/SnapshotFile.js @@ -58,7 +58,7 @@ class SnapshotFile { _content: SnapshotData; _dirty: boolean; _filename: Path; - _uncheckedKeys: Set; + _uncheckedKeys: Set; constructor(filename: Path): void { this._filename = filename; From ced15b4c3a402b4bcae9585f1d07e0576585fbc0 Mon Sep 17 00:00:00 2001 From: Dmitrii Abramov Date: Tue, 5 Jul 2016 17:09:01 -0700 Subject: [PATCH 2/2] Update index.js --- packages/jest-mock/src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/jest-mock/src/index.js b/packages/jest-mock/src/index.js index 594eb98d5e90..55bc412b49a9 100644 --- a/packages/jest-mock/src/index.js +++ b/packages/jest-mock/src/index.js @@ -364,7 +364,7 @@ function generateFromMetadata(_metadata: MockFunctionMetadata): Mock { function getMetadata( component: any, - _refs?: Map, + _refs?: Map, ): ?MockFunctionMetadata { const refs = _refs || new Map(); const ref = refs.get(component);