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
feat: add support for typeof
, instanceof
({Function\|RegExp}
)
#10
feat: add support for typeof
, instanceof
({Function\|RegExp}
)
#10
Conversation
Codecov Report
@@ Coverage Diff @@
## master #10 +/- ##
==========================================
+ Coverage 94.11% 94.44% +0.32%
==========================================
Files 3 3
Lines 17 18 +1
Branches 3 3
==========================================
+ Hits 16 17 +1
Misses 1 1
Continue to review full report at Codecov.
|
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.
👍 Awesome thx, just nits 😛
test/index.test.js
Outdated
}; | ||
|
||
expect(() => validateOptions('test/fixtures/schema.json', options, '{Name}')) | ||
.toThrowError(/Validation Error\n\n{Name} Invalid Options\n\n/); | ||
const test = () => validateOptions('test/fixtures/schema.json', options, '{Name}') |
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
=> validate
test/index.test.js
Outdated
.toThrowError(/Validation Error\n\n{Name} Invalid Options\n\n/); | ||
const test = () => validateOptions('test/fixtures/schema.json', options, '{Name}') | ||
|
||
it('should throw error', () => { |
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
=> test
test/index.test.js
Outdated
expect(test).toThrowError(/Validation Error\n\n{Name} Invalid Options\n\n/); | ||
}) | ||
|
||
it('should have errors for every key in options', () => { |
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
=> test
test/index.test.js
Outdated
const errors = error.err.map(e => e.dataPath) | ||
|
||
expect(errors).toMatchObject(expected) | ||
} |
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.
Please also add a snapshot test after .toMatchObject
while you at it :)
expect(validate).toMatchSnapshot();
typeof
, instanceof
({Function\|RegExp}
)
@michael-ciniawsky fixed, thanks for the feedback! :) |
@gribnoysup I made a request for a release, should be released as soon as someone from the release team as the time 😛 |
Released in v0.4.0 🎉 |
Evidently nobody has permission to publish to schema-utils right now. NPM usually doesn't take too much time to get back to you for support requests, in the mean time you will have to use the git tag. I'll publish |
@d3viant0ne @michael-ciniawsky thanks everybody for the quick feedback and support! |
Noteable Changes
A possible solution for #3. The solution is the same as in main webpack lib but I also added a
typeof
keyword as it also can be useful.I also updated tests to check error behavior more thoroughly.
#3 also blocks webpack/webpack#5892
Issues