diff --git a/index.d.ts b/index.d.ts index edc662b..d60a36a 100644 --- a/index.d.ts +++ b/index.d.ts @@ -4,6 +4,7 @@ type DiffOptions = { expand?: boolean colors?: boolean contextLines?: number + stablePatchmarks?: boolean aAnnotation?: string bAnnotation?: string } diff --git a/src/index.js b/src/index.js index 820456c..d7c179d 100644 --- a/src/index.js +++ b/src/index.js @@ -9,13 +9,14 @@ const prettyFormat = require('pretty-format'); const { ReactElement } = prettyFormat.plugins; const reactElement = Symbol.for('react.element'); -type Options = { +type Options = {| expand?: boolean, colors?: boolean, contextLines?: number, + stablePatchmarks?: boolean, aAnnotation?: string, bAnnotation?: string, -}; +|}; const defaultOptions = { expand: false, @@ -30,7 +31,7 @@ const SNAPSHOT_TITLE = 'Snapshot Diff:\n'; const snapshotDiff = (valueA: any, valueB: any, options?: Options): string => { let difference; - const mergedOptions = Object.assign({}, defaultOptions, options); + const mergedOptions = { ...defaultOptions, ...options }; if (isReactComponent(valueA) && isReactComponent(valueB)) { difference = diffReactComponents(valueA, valueB, mergedOptions);