-
Notifications
You must be signed in to change notification settings - Fork 936
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: Return namespaces string when invoking disable() #624
Conversation
1 similar comment
Let me add test cases if you want and if you are okay with the implementation so we can get the coverage up again :) |
b828357
to
ac5a726
Compare
Sure, this is fine. :) Yes to test cases, please. |
They were added already ac5a726#diff-1dd241c4cd3fd1dd89c570cee98b79ddR85 But spotting a spelling error. Will just correct it. |
ac5a726
to
1844758
Compare
Fixed |
It might seem redundant but can you add a few tests that test passing the returned string back to |
1844758
to
99765cc
Compare
I added a test of using enable. I'm using the The initial |
expect(namespaces).to.equal('test,abc*,-abc'); | ||
debug.enable(namespaces); | ||
expect(oldNames.map(String)).to.deep.equal(debug.names.map(String)); | ||
expect(oldSkips.map(String)).to.deep.equal(debug.skips.map(String)); |
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 the .map(String)
here?
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.
They are RegExp objects, so they are not the same even though the regular expression is the same. Mapping to their string representation will make the chai deep equal happy.
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.
Sure, sounds good.
Last thing: could you add a bit of documentation to the readme? |
feat: Add unit tests for disable return value fix: Correct spelling in test case description feat: Test that disable-string works with enable again Closes debug-js#523 docs: Add section about disable return value
99765cc
to
692b107
Compare
There you go! |
Thank you again :) I'll get this released shortly. |
PR for feature request #523
I thought about adding a new property
createDebug
which would hold the untouched string passed toenable
but decided against it and instead let the disable deal with what it has:names
,skips
.Let me know if you prefer adding an untouched namespaces string to createDebug instead or you any other changes.
Closes #523
ps: Happy Hacktoberfest