diff options
Diffstat (limited to 'packages/cli/src/test-utils/mockCommandContext.ts')
| -rw-r--r-- | packages/cli/src/test-utils/mockCommandContext.ts | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/packages/cli/src/test-utils/mockCommandContext.ts b/packages/cli/src/test-utils/mockCommandContext.ts index 88da4a32..899d5747 100644 --- a/packages/cli/src/test-utils/mockCommandContext.ts +++ b/packages/cli/src/test-utils/mockCommandContext.ts @@ -76,15 +76,13 @@ export const createMockCommandContext = ( const targetValue = output[key]; if ( - sourceValue && - typeof sourceValue === 'object' && - !Array.isArray(sourceValue) && - targetValue && - typeof targetValue === 'object' && - !Array.isArray(targetValue) + // We only want to recursivlty merge plain objects + Object.prototype.toString.call(sourceValue) === '[object Object]' && + Object.prototype.toString.call(targetValue) === '[object Object]' ) { output[key] = merge(targetValue, sourceValue); } else { + // If not, we do a direct assignment. This preserves Date objects and others. output[key] = sourceValue; } } |
