-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Not Needed
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Use Case
As a... BSON user
I want... BSONRegExp to render in a way that's copy-paste-able
So that... it is easy to recreate the value on a prompt or while coding
User Experience
Expected (node 24):
$ node -p "var BSON = require('.'); console.log('Node.js', process.version); new BSON.BSONRegExp('abc', 'imx');" Node.js v24.18.0 new BSONRegExp('abc', 'imx')
Actual (node 26):
$ node -p "var BSON = require('.'); console.log('Node.js', process.version); new BSON.BSONRegExp('abc', 'imx');" Node.js v26.7.0 new BSONRegExp(/abc'/, /imx'/)
There's something in the Node.js changelog starting in v25.0.0 about changing regex stylize but unsure if that's directly related to this.
Dependencies
- None
Risks/Unknowns
- Historical context: I believe we only used the regex stylize method to get the arguments to the constructor to appear red, not because red was important but because the color matched the rendering of normal regexes and that helped the string value standout as being a special format. I think it would be fine if this just stylized the strings as strings.
Acceptance Criteria
Implementation Requirements
- Ensure the rendering produces an accurate string
Testing Requirements
- There are tests that check if the BSON's inspect string when evaluated produces the same runtime value, theses should be failing on v26
Documentation Requirements
- None
Follow Up Requirements
- None