Skip to content
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

Write tests with jest (Coverage 100%) #15

Closed
wants to merge 15 commits into from

Conversation

timhagn
Copy link
Collaborator

@timhagn timhagn commented Oct 26, 2018

As promised, here the tests written in jest.
Created a second pull request, so that you have it easier to test your workflow with the
updated dependencies.

For the tests to work I did the following:

  • all the steps from my other PR Updated Styled Components to 4.0.2, Babel to 7.1.2 #14
  • cleaned up package.json and removed unneeded entries
  • added jest (^3.6.0), jest-styled-components (^6.2.2), react (^16.6.0), react-dom (^16.6.0),
    react-test-renderer (^16.6.0), @babel/preset-react (^7.0.0), babel-jest (^23.6.0) &
    babel-core (^7.0.0-bridge.0, needed for jest to work flawlessly with Babel 7) as devDependencies
  • wrote tests for convertors.js (Line, Function & Statement Coverage @ 100%,
    Branch Coverage @ 80%)
  • wrote tests for index.js (Line, Function & Statement Coverage @ 100%,
    Branch Coverage @ 83.33%)
=============================== Coverage summary ===============================
Statements   : 100% ( 36/36 )
Branches     : 81.82% ( 9/11 )
Functions    : 100% ( 14/14 )
Lines        : 100% ( 30/30 )
================================================================================

Things that might be further done:

  • bump Branch coverage to 100% (but as some of the branches jest complains about are private
    I have no clue at the moment, how this could be done)
  • Add test report to README.md to "brag about it" ^^

"Breaking" changes:

  • Adding react & react-dom at their latest version is necessary for the tests - but as they are deps
    for styled-components v4, too, Users should already have them, as mentioned in the last PR
  • Having all the new glitter (this does not really change anything, but adds a nice touch ; )

I squashed the commits for your convenience.

Edit: Nearly forgot: This PR closes #1

add jest

add test with jest script

test styled-components 4.0.2

bump babel & rollup to latest versions

update .babelrc to .babelrc.js, inlude in .babelrc

update rollup config

update rollup config to new format

dump .babelrc in favor of .babelrc.js

fix last warnings in yarn build for rollup.config.js

update packe-lock.json

clean package.json

add jest, write first tests

add react & react-dom as styled-components now needs them (16.6.0)

add @babel/preset-react, jest-styled-components & react-test-renderer - index.test not running

add React to index.test

run test with jsx

move tests to own folder

push branch ratio to 80%
@timhagn timhagn changed the title Write tests with jest (Coverage 100% Write tests with jest (Coverage 100%) Oct 26, 2018
# Conflicts:
#	.babelrc.js
#	package-lock.json
#	package.json
#	yarn.lock
@morajabi
Copy link
Owner

@timhagn do you think you can resolve the conflicts and rebase? that'd be helpful! but if you can't no worries :)

ApacheEx and others added 7 commits December 17, 2018 14:49
add jest

add test with jest script

test styled-components 4.0.2

bump babel & rollup to latest versions

update .babelrc to .babelrc.js, inlude in .babelrc

update rollup config

update rollup config to new format

dump .babelrc in favor of .babelrc.js

fix last warnings in yarn build for rollup.config.js

update packe-lock.json

clean package.json

add jest, write first tests

add react & react-dom as styled-components now needs them (16.6.0)

add @babel/preset-react, jest-styled-components & react-test-renderer - index.test not running

add React to index.test

run test with jsx

move tests to own folder

push branch ratio to 80%
@timhagn
Copy link
Collaborator Author

timhagn commented Dec 17, 2018

#done : )

package.json Outdated
"styled-components": ">= 1 < 4"
"react": ">= 16.3.0",
"react-dom": ">= 16.3.0",
"styled-components": ">= 4"
Copy link
Owner

Choose a reason for hiding this comment

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

Looks like to me this branch is not against the master?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh, had merged my latest master before the merge, but not afterwards.
Should be fixed now, unless you see more problems GitHub doesn't ; ).

@morajabi
Copy link
Owner

@timhagn Tim, please add your name into AUTHORS file. Also, I see @ApacheEx isn't there too. That's meant to have everyone.

Can you double check if this branch is rebased with current master? I see some unnecessary and outdated conflicts. For example the version range of styled-components doesn't match :)

@timhagn
Copy link
Collaborator Author

timhagn commented Jan 16, 2019

@morajabi Added myself to the AUTHORS file and updated the branch.

@timhagn timhagn mentioned this pull request Mar 6, 2019
@timhagn
Copy link
Collaborator Author

timhagn commented Oct 25, 2019

Will close this for now and open another, less intrusive one : ).

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.

Add tests with Jest
3 participants