Skip to content

Commit 2499cf2

Browse files
authored
chore(jest-core): use pluralize from util package (#14322)
1 parent e04947c commit 2499cf2

File tree

6 files changed

+11
-20
lines changed

6 files changed

+11
-20
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
### Chore & Maintenance
1010

11+
- `[@jest/core]` Use `pluralize` from `jest-util` rather than own internal ([#14322](https://github.com/jestjs/jest/pull/14322))
12+
1113
### Performance
1214

1315
## 29.6.1

packages/jest-core/src/cli/index.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import type {ChangedFilesPromise} from 'jest-changed-files';
1616
import {readConfigs} from 'jest-config';
1717
import type {IHasteMap} from 'jest-haste-map';
1818
import Runtime from 'jest-runtime';
19-
import {createDirectory, preRunMessage} from 'jest-util';
19+
import {createDirectory, pluralize, preRunMessage} from 'jest-util';
2020
import {TestWatcher} from 'jest-watcher';
2121
import {formatHandleErrors} from '../collectHandles';
2222
import getChangedFilesPromise from '../getChangedFilesPromise';
@@ -26,7 +26,6 @@ import getSelectProjectsMessage from '../getSelectProjectsMessage';
2626
import createContext from '../lib/createContext';
2727
import handleDeprecationWarnings from '../lib/handleDeprecationWarnings';
2828
import logDebugMessages from '../lib/logDebugMessages';
29-
import pluralize from '../pluralize';
3029
import runJest from '../runJest';
3130
import type {Filter} from '../types';
3231
import watch from '../watch';

packages/jest-core/src/getNoTestFound.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import chalk = require('chalk');
99
import type {Config} from '@jest/types';
10-
import pluralize from './pluralize';
10+
import {pluralize} from 'jest-util';
1111
import type {TestRunData} from './types';
1212

1313
export default function getNoTestFound(

packages/jest-core/src/getNoTestFoundVerbose.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import chalk = require('chalk');
99
import type {Config} from '@jest/types';
10-
import pluralize from './pluralize';
10+
import {pluralize} from 'jest-util';
1111
import type {Stats, TestRunData} from './types';
1212

1313
export default function getNoTestFoundVerbose(

packages/jest-core/src/pluralize.ts

-14
This file was deleted.

packages/jest-util/src/pluralize.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
export default function pluralize(word: string, count: number): string {
9-
return `${count} ${word}${count === 1 ? '' : 's'}`;
8+
export default function pluralize(
9+
word: string,
10+
count: number,
11+
ending = 's',
12+
): string {
13+
return `${count} ${word}${count === 1 ? '' : ending}`;
1014
}

0 commit comments

Comments
 (0)