Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(utils): support diff.printBasicPrototype, Adding possibility to get rid of prototypes from the output #6504

Closed
wants to merge 12 commits into from
8 changes: 8 additions & 0 deletions docs/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2294,6 +2294,7 @@ export default {
aIndicator: c.bold('--'),
bIndicator: c.bold('++'),
omitAnnotationLines: true,
printBasicPrototype: false,
} satisfies DiffOptions
```

Expand Down Expand Up @@ -2330,6 +2331,13 @@ Annotation that is output at the end of diff result if it's truncated.

Color of truncate annotation, default is output with no color.

#### diff.printBasicPrototype

- **Type**: `boolean`
- **Default**: `true`

Allows to set pretty-format option printBasicPrototype for diff output
hi-ogawa marked this conversation as resolved.
Show resolved Hide resolved

### fakeTimers

- **Type:** `FakeTimerInstallOpts`
Expand Down
4 changes: 3 additions & 1 deletion packages/utils/src/diff/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
]
const FORMAT_OPTIONS = {
plugins: PLUGINS,
printBasicPrototype: true

Check failure on line 56 in packages/utils/src/diff/index.ts

View workflow job for this annotation

GitHub Actions / Lint: node-latest, ubuntu-latest

Missing trailing comma
}
const FALLBACK_FORMAT_OPTIONS = {
callToJSON: false,
Expand Down Expand Up @@ -180,11 +181,12 @@
formatOptions: PrettyFormatOptions,
options?: DiffOptions,
): PrettyFormatOptions {
const { compareKeys } = normalizeDiffOptions(options)
const { compareKeys, printBasicPrototype } = normalizeDiffOptions(options)

return {
...formatOptions,
compareKeys,
printBasicPrototype

Check failure on line 189 in packages/utils/src/diff/index.ts

View workflow job for this annotation

GitHub Actions / Lint: node-latest, ubuntu-latest

Missing trailing comma
}
}

Expand Down
2 changes: 2 additions & 0 deletions packages/utils/src/diff/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface DiffOptions {
includeChangeCounts?: boolean
omitAnnotationLines?: boolean
patchColor?: DiffOptionsColor
printBasicPrototype?: boolean
compareKeys?: CompareKeys
truncateThreshold?: number
truncateAnnotation?: string
Expand All @@ -51,6 +52,7 @@ export interface DiffOptionsNormalized {
includeChangeCounts: boolean
omitAnnotationLines: boolean
patchColor: DiffOptionsColor
printBasicPrototype: boolean
truncateThreshold: number
truncateAnnotation: string
truncateAnnotationColor: DiffOptionsColor
Expand Down
Loading