Skip to content

Commit

Permalink
chore(jest-core): use pluralize from util package (#14322)
Browse files Browse the repository at this point in the history
  • Loading branch information
eryue0220 authored Jul 14, 2023
1 parent e04947c commit 2499cf2
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 20 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

### Chore & Maintenance

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

### Performance

## 29.6.1
Expand Down
3 changes: 1 addition & 2 deletions packages/jest-core/src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import type {ChangedFilesPromise} from 'jest-changed-files';
import {readConfigs} from 'jest-config';
import type {IHasteMap} from 'jest-haste-map';
import Runtime from 'jest-runtime';
import {createDirectory, preRunMessage} from 'jest-util';
import {createDirectory, pluralize, preRunMessage} from 'jest-util';
import {TestWatcher} from 'jest-watcher';
import {formatHandleErrors} from '../collectHandles';
import getChangedFilesPromise from '../getChangedFilesPromise';
Expand All @@ -26,7 +26,6 @@ import getSelectProjectsMessage from '../getSelectProjectsMessage';
import createContext from '../lib/createContext';
import handleDeprecationWarnings from '../lib/handleDeprecationWarnings';
import logDebugMessages from '../lib/logDebugMessages';
import pluralize from '../pluralize';
import runJest from '../runJest';
import type {Filter} from '../types';
import watch from '../watch';
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-core/src/getNoTestFound.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import chalk = require('chalk');
import type {Config} from '@jest/types';
import pluralize from './pluralize';
import {pluralize} from 'jest-util';
import type {TestRunData} from './types';

export default function getNoTestFound(
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-core/src/getNoTestFoundVerbose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

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

export default function getNoTestFoundVerbose(
Expand Down
14 changes: 0 additions & 14 deletions packages/jest-core/src/pluralize.ts

This file was deleted.

8 changes: 6 additions & 2 deletions packages/jest-util/src/pluralize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
* LICENSE file in the root directory of this source tree.
*/

export default function pluralize(word: string, count: number): string {
return `${count} ${word}${count === 1 ? '' : 's'}`;
export default function pluralize(
word: string,
count: number,
ending = 's',
): string {
return `${count} ${word}${count === 1 ? '' : ending}`;
}

0 comments on commit 2499cf2

Please sign in to comment.