-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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: change OrmUtils.mergeDeep to not merge RegExp objects #5182
Conversation
Before entity column values are transformed, changes are deeply merged using OrmUtils.mergeDeep. This mergeDeep function attempts to merge objects, but wrongly attempted to merge RegExp objects. This merging of RegExp objects breaks the object, rendering them unusable. This commit changes mergeDeep to not merge RegExp objects but overwrite them instead. Closes typeorm#3534
7dcd3c9
to
bbd38ff
Compare
before(async () => { | ||
connections = await createTestingConnections({ | ||
entities: [__dirname + '/entity/*{.js,.ts}'], | ||
enabledDrivers: ['postgres'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please enable all drivers? since we don't have anything postgres specific
connections = await createTestingConnections({ | ||
entities: [__dirname + '/entity/*{.js,.ts}'], | ||
enabledDrivers: ['postgres'], | ||
dropSchema: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need it? (please remove if we don't)
after(() => closeTestingConnections(connections)); | ||
|
||
it('allows entities with regexp columns', () => PromiseUtils.runInSequence(connections, async connection => { | ||
await connection.synchronize(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't usually do it this way... can you please remove it? (just take a look on other tests how we do it in most of the times)...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im just trying to find why tests are passed but CI failed. Usually it happens on a "stucked promise", but I can't easily find the problem in this test
Looks like a valid feature request, we just need to find out why CI failed. |
I applied few changes let's see if tests won't fail. |
@pleerock Thanks for your review. I'll fix any remaining issues / feedback one of the next (work)days. :) |
@pleerock - The CI is 🍏 |
Thanks! |
Closes #3534
Before entity column values are transformed, changes are deeply merged using OrmUtils.mergeDeep. This mergeDeep function attempts to merge objects, but wrongly attempted to merge RegExp objects. This merging of RegExp objects breaks the object, rendering them unusable. This commit changes mergeDeep to not merge RegExp objects but overwrite them instead.
To cleanup the mergeDeep function, I also refactored
propertyKey
away, and I changed all references tosource[key]
orsource[propertyKey]
tovalue
, also removing the commented code.