Skip to content

test: Add jest and first tests#114

Merged
brody2consult merged 4 commits into
xmldom:masterfrom
karfau:jest
Aug 28, 2020
Merged

test: Add jest and first tests#114
brody2consult merged 4 commits into
xmldom:masterfrom
karfau:jest

Conversation

@karfau

@karfau karfau commented Aug 26, 2020

Copy link
Copy Markdown
Member

as discussed in #72 and #112 so we can get started using jest for new tests.

  • npm run test run everything there is
  • npm run jest just runs the jest tests (test/*.test.js)

(The tests have been picked from cases that stryker identified in my run in #112 .)

@brody2consult brody2consult left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really nice in general. I left a couple comments.

In general, I am wondering whether or not we need to keep all comments in the generated jest.config.js file. The positive is that it may be easier for us to select some more Jest options in the future.

OTOH, I do actually recall running Jest with no extra config file in some other projects.

Comment thread jest.config.js Outdated
Comment thread package.json Outdated
Comment thread test/dom-parser.test.js
Comment on lines +50 to +51
const XML = `
<pdf2xml producer="poppler" version="0.26.5">

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a nit, I think this will give us a string with an extra blank line. I think it would be ideal to use something like dedent or outdent. But probably not worth changing in this PR.

@brody2consult brody2consult left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with a few nits that I think are not worth fixing in this PR:

  • I generally like to avoid adding TODO / FIXME items.
  • I think it would be ideal to move the executable example test for issue #93 into a separate PR. I would like to remove the fixes message when merging this PR, and get the answer to #93 documented someday.
  • I left a comment that a template string will get an extra blank line.

@brody2consult brody2consult merged commit 4cf7840 into xmldom:master Aug 28, 2020
@karfau

karfau commented Aug 28, 2020

Copy link
Copy Markdown
Member Author

I totally agree on your comments. Maybe I should rather have put the "Todo/Fixme comments into this PR instead of in the code, since my intention was not to land them, but to get feedback on them.
Will Do it differently next time.

@brody2consult

Copy link
Copy Markdown
Member

my intention was not to land them, but to get feedback on them

Got it now, that was not clear to me when I reviewed the changes.

I did want to get this PR finished and merged pretty quickly in order to unblock other progress, considering that I think test coverage is way more important than dealing with some other loose ends. That is what I tried to say by my nits "not worth fixing in this PR".

In case we do expect any loose ends in a PR, I think it would be a nice bonus to raise an issue. But comments like TBD, TODO, FIXME are fine with me as well if they make sense.

Thanks again for your contributions.

This was referenced Mar 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants