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
Recover vows
tests, drop proof
tests
#59
Conversation
- Strict checks throw when `process.env.XMLDOM_ASSERT_STRICT` is truthy, otherwise they are only logged when they fail - `assert.skip(...)` can be used for failing assertions (and need to be removed when they no longer fail) - tests for `assert` and `assert.skip` are part of `npm run test`
Renamed the qualifying `.js` files to `.vows.js` to simplify filtering.
The `assert.throw` fails since the code no longer throws exceptions when parsing fails.
I may need a few days to review. I have some quick questions:
|
No, the question whether moving a test suite from loose asserts to strict asserts could allow future breaking changes got me thinking and I made me write this, so we can observe and treat this question in a central place.
I have written some assertion helpers before, and this might be the most complex piece so far.
So currently I'll not invest time into that, but I'm planning to create an article about that question on dev.to and we will see how it evolves from there.
I went "back in time" as described here again (with the tests from this branch) and discovered:
which was fixed here which I would consider a bugfix (released in 0.2.0) and not a breaking change. Just to be sure we are on the same page, here is my basic assumption:
Please let me know in case you disagree. |
Thanks. Your disposition concerning the asserts makes more sense to me now. I will try to take a closer look this weekend, don't expect to find any more blockers at this point. But I think it would be great if we could raise issues for the following:
|
I did also try running Stryker on edit: I would also be fine to include Stryker in this PR, otherwise I can just take your configuration from #51 (and give you the primary author credit). Part of #60 will be to get this on the Stryker dashboard. I am going off email pretty soon, will come back later this weekend. |
If you are referring to using strict asserts everywhere I can do it, if you have more in mind, maybe you should create that issue.
You mean creating issues just to close them? Or one to list all of them? I'm not sure what to create an issue for. So maybe it's easier for you to do it?
Are you referring to this checklist? Thx for running stryker against the |
I just raised #61 to improve the test assertions.
Let's start with one to list them all for now, but let's keep the regression in #57 open. My purpose is to avoid losing track.
In that case, my idea would be to keep it open as a draft PR, maybe put something in brackets at the beginning of the title. Again my purpose is to avoid losing track. I will do a final review and merge this weekend. Please do me a favor and ping me, multiple times if needed, just in case I drop it for any reason. I am definitely with you to resolve the line endings and finish that checklist. For the record, I think this PR needs to be merged in a merge commit. But I think this should be an exception, general preference should be squash commit. And thanks again for your contributions! |
Since you asked for it, @brodybits here is your first ping. |
Pong, thanks! I will probably make the formatting edit, one last review & test, and merge this one. |
The primary purpose is to make it absolutely clear that the return expression spans multiple lines, should be a little more consistent with Prettier formatting.
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.
Approved to be merged in a merge commit. Thanks again!
fixes #35
I found that some part of the
test
folder are usingvows
for testing.vows
is able to handle when invoked from the cli. (test/**/.js
files that don't have the.vows.js
extension might still contain assertions. We need to digest them and decide whether and how to restore them.)vows
test "suite", drop useless proof tests #51 some files still contain CRLF line separatorsAll the
vows
tests can now be executed via the usualnpm test
.Tons of test cases where only calls to
console.assert
that logged an "Assertion failed: ...", I converted them into an equivalent assertion that fails a test.Due to the discussion in the first PR I introduced a helper module
test/assert.js
that is heavily covered by tests and==
and strict===
checking byXMLDOM_ASSERT_STRICT=1 npm run test
When these failed and it made sense, I changed the expectation to the current value.
In case we need to skip a test, we can use
assert.skip
(that logs the failed assertion and fails if the assertion no longer fails).I also drastically reduced the amount of
console.log
in tests, now the only thing that's printing in addition tovows
is the internal logging of xmldom.For reviewing it's much easier to go commit by commit! (Watching all changes in one go will look like history of the test files gets lost, but this is not true as long as commits are preserved when the PR lands.)