mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-28 12:01:37 -04:00
49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
import { outdated } from '@pnpm/plugin-commands-outdated'
|
|
import semverDiff from '@pnpm/semver-diff'
|
|
import { type PackageManifest } from '@pnpm/types'
|
|
import { type OutdatedWithVersionDiff } from '../src/utils.js'
|
|
import chalk from 'chalk'
|
|
|
|
test('renderLatest: outdated and deprecated', () => {
|
|
const diffResult = semverDiff.default('0.0.1', '1.0.0')
|
|
const outdatedPkg: OutdatedWithVersionDiff = {
|
|
...diffResult,
|
|
alias: 'foo',
|
|
belongsTo: 'dependencies',
|
|
current: '0.0.1',
|
|
latestManifest: {
|
|
name: 'foo',
|
|
version: '1.0.0',
|
|
deprecated: 'This package is deprecated',
|
|
} as PackageManifest,
|
|
packageName: 'foo',
|
|
wanted: '0.0.1',
|
|
}
|
|
|
|
const output = outdated.renderLatest(outdatedPkg)
|
|
|
|
expect(output).toContain('1.0.0')
|
|
expect(output).toContain(chalk.redBright('(deprecated)'))
|
|
})
|
|
|
|
test('renderLatest: outdated and not deprecated', () => {
|
|
const diffResult = semverDiff.default('0.0.1', '1.0.0')
|
|
const outdatedPkg: OutdatedWithVersionDiff = {
|
|
...diffResult,
|
|
alias: 'foo',
|
|
belongsTo: 'dependencies',
|
|
current: '0.0.1',
|
|
latestManifest: {
|
|
name: 'foo',
|
|
version: '1.0.0',
|
|
} as PackageManifest,
|
|
packageName: 'foo',
|
|
wanted: '0.0.1',
|
|
}
|
|
|
|
const output = outdated.renderLatest(outdatedPkg)
|
|
|
|
expect(output).not.toContain('(deprecated)')
|
|
expect(output).toContain('1.0.0')
|
|
})
|