-
Notifications
You must be signed in to change notification settings - Fork 258
test(NODE-3719): reorganize spec tests and remove unneeded skips #486
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
Conversation
8517a36
to
6150a8d
Compare
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.
Along with the comment below:
- I noticed that specs/object-id might be dead code, I haven't been able to find any reference to vectors.json in the actual specs repo and nothing seems to be loading these ones
- decodeErrors only checks
expect(() => BSON.deserialize(B, deserializeOptions)).to.throw();
- is it intentionally general or should we be checking for a better error? If so, NODE-3637 may be a good ticket to tack that work onto - There are a number of skipped tests with comments but no TODOs, it would be good to either definitively say "we'll never implement this", or to file actual backlog tickets to make sure that if we do implement relevant functionality, those tests get unskipped
const skipBSON = {
'NaN with payload':
'passing this would require building a custom type to store the NaN payload data.'
};
// tests from the corpus that we need to skip, and explanations why
const skipExtendedJSON = {
'Timestamp with high-order bit set on both seconds and increment':
'Current BSON implementation of timestamp/long cannot hold these values - 1 too large.',
'Timestamp with high-order bit set on both seconds and increment (not UINT32_MAX)':
'Current BSON implementation of timestamp/long cannot hold these values - 1 too large.'
};
const SKIP_TESTS = new Map([
...Object.entries(skipBSON),
...Object.entries(skipExtendedJSON),
[
'All BSON types',
'there is just too much variation in the specified expectation to make this work'
]
]);
test/node/bson_corpus.prose.test.js
Outdated
|
||
it('Flags/options for a regular expression', () => { | ||
expect(() => BSON.serialize({ a: new BSONRegExp('a', 'i\x00m') })).to.throw(/null bytes/); | ||
// TODO: should we test RegExp, too? |
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 don't remember if there is a reason why we test RegExp in the block above but not in this one
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.
You can't put null bytes into the native regex constructor, it's a SyntaxError so we're covered 😎
> new RegExp('a', '\x00i')
Uncaught SyntaxError: Invalid flags supplied to RegExp constructor 'i'
> new RegExp('a', 'i\x00')
Uncaught SyntaxError: Invalid flags supplied to RegExp constructor 'i'
The |
CI failures aren't a blocker, I've opened #487 to address some issues. |
Description
NODE-3719
What is changing?
Spec test organization
Is there new documentation needed for these changes?
N/A
What is the motivation for this change?
Spec compliance review
Double check the following
npm run lint
script<type>(NODE-xxxx)<!>: <description>