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

fix(mutate config): don't warn about files not existing at the default mutate location #2509

Merged
merged 2 commits into from
Sep 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "perf/test/express"]
path = perf/test/express
url = git@github.com:expressjs/express.git
url = https://github.com/expressjs/express.git
2 changes: 1 addition & 1 deletion packages/util/src/deepMerge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function deepMerge<T>(defaults: T, overrides: DeepPartial<T>): void {
const defaultValue = (defaults as any)[key];
const overrideValue = (overrides as any)[key];
if (overrideValue !== undefined) {
if (defaultValue === undefined || typeof defaultValue !== 'object' || typeof overrideValue !== 'object') {
if (defaultValue === undefined || typeof defaultValue !== 'object' || typeof overrideValue !== 'object' || Array.isArray(defaultValue)) {
(defaults as any)[key] = overrideValue;
} else {
deepMerge(defaultValue, overrideValue);
Expand Down
6 changes: 3 additions & 3 deletions packages/util/test/unit/deepMerge.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ describe(deepMerge.name, () => {

it('should override arrays without merging them', () => {
// Arrange
const foo: Foo = { qux: ['1'] };
const baz = { qux: ['2'] };
const foo: Foo = { qux: ['1', '2'] };
const baz = { qux: ['3'] };

// Act
deepMerge(foo, baz);

// Assert
const expected: Foo = { qux: ['2'] };
const expected: Foo = { qux: ['3'] };
expect(foo).deep.eq(expected);
});

Expand Down