-
Notifications
You must be signed in to change notification settings - Fork 517
fix(package): update schema-utils
v0.3.0...0.4.1 (dependencies
)
#668
Conversation
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.
Test suite will need to be updated accordingly
Codecov Report
@@ Coverage Diff @@
## master #668 +/- ##
=======================================
Coverage 87.45% 87.45%
=======================================
Files 7 7
Lines 303 303
Branches 68 68
=======================================
Hits 265 265
Misses 36 36
Partials 2 2 Continue to review full report at Codecov.
|
Based on conversation in the #667 thread with @michael-ciniawsky, The correct fix was actually to update to the newest version of schema-utils, which now logs errors to the console. I have updated this pull request accordingly. Schema-utils will now log the error to the console and then exit, which required updating the validation failure test. |
@@ -15,9 +15,13 @@ describe('json schema validation', () => { | |||
}).doesNotThrow; | |||
}); | |||
|
|||
it('throws if an incorrect config is passed in', () => { |
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.
I'm sry about this 😅 I should have taken a look sooner but could you add process.env.JEST = true
on L3-4 instead so schema-utils
will rethrow the {Error}
instead of exiting while running tests ? The 'old' test should work then.
const err = () => new ExtractTextPlugin({ filename: 1 })
expect(err).toThrow()
// Test if we get the correct err.message
expect(err).toThrowErrorMatchingSnapshot()
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.
But in reality, doesn't it write to console and exit, not throw? My test was written to match that scenario.
The test you describe would essentially be "when in testing with a bad config, does it throw?" Unless I'm missing something, that doesn't seem like a very valuable test.
(Not sure why one of the checks is failing, I've been on holiday and but tests were passing on my computer before I left. Can look into this tomorrow, and will update based on your response.)
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.
The test should be changed back, but please hold on for ~1-2 days we resolved this in webpack core (#6035) and schema-utils
(#17)
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.
@michael-ciniawsky Can you explain why the test should be changed back? I am still confused about what it is testing.
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.
It's tests for malformed options based on a JSON Schema and should work without the need to mock anything in the test, please revert the test changes and I will finally land this on master
:)
schema-utils
v0.3.0...0.4.1
@dinkzilla friendly ping 👍 |
You caught me, been busy and totally forgot this was out here. I'll try to get to it this weekend. Thanks for the ping @evilebottnawi |
@@ -15,9 +15,13 @@ describe('json schema validation', () => { | |||
}).doesNotThrow; | |||
}); | |||
|
|||
it('throws if an incorrect config is passed in', () => { |
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.
It's tests for malformed options based on a JSON Schema and should work without the need to mock anything in the test, please revert the test changes and I will finally land this on master
:)
I will update it myself with the next patch release |
schema-utils
v0.3.0...0.4.1schema-utils
v0.3.0...0.4.1 (dependencies
)
Issues
Notable Changes
This pull request properly catches and throws validation errors within schema-utils so that they appear appropriately in the console.
As an example, a validation error which used to read as follows
now reads e.g