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

Use karma-browserify for tests. Add browser test coverage reporter. #1376

Merged
merged 4 commits into from Jan 27, 2015

Conversation

eiriksm
Copy link
Member

@eiriksm eiriksm commented Jan 26, 2015

Hey.

So I started writing some more browser tests. But before I did that, I wanted to make the test runner to compile browserify by itself, and also add some coverage checking (to make it easier to write tests).

This PR does the following:

  • Modifies the scripts in package.json to not compile with browserify directly.
  • Modifies the clean script to delete the coverage folder (not sure if this is preferred over adding it to .*ignore)
  • Add some new dependencies.
  • Make sure karma does both coverage and browserify.
  • Also added stderr from the child process that runs karma.

I have some follow up questions about how we should structure the actual test suite, but let's do that in another issue.

@nylen
Copy link
Member

nylen commented Jan 26, 2015

Can you use ~ instead of ^ in the versions for the new dependencies?

Don't we still need to remove tests/browser/test-browser.js in the clean script?

nikku/karma-browserify#91 + a new release of karma-browserify should fix the build failure.

@eiriksm
Copy link
Member Author

eiriksm commented Jan 26, 2015

Ah. I didn't even notice the test failed. Sorry. And now that I see it I have actually run into the issue before, hehe. Nice work on patching so quickly!

Don't we still need to remove tests/browser/test-browser.js in the clean script?

No. test-browser.js will never get built with this change. It was the bundled version of test.js and now if we use karma-browserify it will get built in a temp file in the os temp dir (as you probably got from the referenced issue).

The reason I added rm coverage instead is because there is a js file in there that messes with the linting. Also, we don't want that in the repo or npm. So there's the question: Should we add it to .npmignore .eslintignore and .gitignore?

Updated dependency syntax in a new commit. Will probably fail testing again though, so better leave this open pending the issue above?

For reference: The reason I locked karma-coverage to version 0.2.6 is this issue: karma-runner/karma-coverage#123

@nylen
Copy link
Member

nylen commented Jan 26, 2015

Yeah, let's ignore it and get rid of the clean script. We shouldn't need to put it in .eslintignore because we explicitly specify which paths are to be linted, right?

@eiriksm eiriksm force-pushed the feat/karma-browserify-coverage branch from 51d82ba to 695fbeb Compare January 27, 2015 06:51
@eiriksm eiriksm force-pushed the feat/karma-browserify-coverage branch from 695fbeb to c2c1fdf Compare January 27, 2015 06:52
@eiriksm
Copy link
Member Author

eiriksm commented Jan 27, 2015

Added coverage to .npmignore (it was already in .gitignore). Removed clean script.

You are right, we do specify paths explicitly for eslint, so no worries there.

@nylen
Copy link
Member

nylen commented Jan 27, 2015

karma-browserify 3.0.1 is out, if you can explicitly upgrade to that version then I think we're good to go here.

@eiriksm
Copy link
Member Author

eiriksm commented Jan 27, 2015

done!

@nylen
Copy link
Member

nylen commented Jan 27, 2015

👍 thanks!

nylen added a commit that referenced this pull request Jan 27, 2015
Use karma-browserify for tests. Add browser test coverage reporter.
@nylen nylen merged commit defc3b6 into request:master Jan 27, 2015
@eiriksm eiriksm mentioned this pull request Jan 29, 2015
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.

None yet

2 participants