cssinjs / jss

JSS is an authoring tool for CSS which uses JavaScript as a host language.
https://cssinjs.org
MIT License
7.07k stars 399 forks source link

Setup codecov #301

Open kof opened 8 years ago

kof commented 8 years ago

Current setup of codecov.io isn't working ...

nathanmarks commented 8 years ago

I can sort this out 👍

kof commented 7 years ago

There is a prob with node 7 #338 @nathanmarks can you help out with both issues?

avocadowastaken commented 7 years ago

Maybe it's worth to replace codecov with nyc (istanbul) ?

kof commented 7 years ago

Maybe, especially because we have multi repo approach and run tests from other repos here.

cvle commented 7 years ago

nyc has some issues with es6 modules. I recommend this project instead https://github.com/gotwarlost/istanbul.

cvle commented 7 years ago

But the two projects previously mentioned doesn't work with karma+webpack. We would need istanbul-instrumenter-loader. They are almost done solving the source-map issue in order to remap to the original source files. As far as I know, we cannot have codecov with karma+webpack+babel before this is solved. I am following this closely as I'm doing this for my own projects too. Once this blocking issue is resolved, I will apply it to my own projects, and I can definitely help out here as well.

kof commented 7 years ago

Recently @kentcdodds tweeted he workarounded this with ln -s node_modules/n_modules https://twitter.com/kentcdodds/status/803980884026146816 ... opinions?

kentcdodds commented 7 years ago

Sounds like the problem here isn't related to covering node_modules but in getting coverage working with karma and ES6. Have you tried babel-plugin-coverage?

I cover this in my Frontend Masters Webpack workshop (here's the diff) and in my Egghead course (here's the diff).

Hope that's helpful!

kof commented 7 years ago

Maybe it would be much simpler to just add coverage for jss itself here and for all other repositories separately in the corresponding repository the same way. Should be easy, right?

avocadowastaken commented 7 years ago

Basically jss needs plugins to transform stylesheets. So you only need to test actual and expected code. e.g.

const transformer = transformWith(require('jss-extend'))

assert.deepEqual(transformer({
   foo: {
      color: 'red',
   },
   bar: {
       extend: 'foo',
   },
}), {
   foo: {
      color: 'red',
   },
   bar: {
       color: 'red',
   },
})

And you don't need browser for it.

JSS needs karma only to test style injection AFAIK all other use cases can be solved inside node.

kof commented 7 years ago

Well if I use karma in one case, why to use something else additionally, seems like an overhead. And no, plugins do in some cases way more than transforming style object.

cvle commented 7 years ago

I started by adding code coverage to react-jss https://github.com/cssinjs/react-jss/pull/66. babel-plugin-istanbul seems to work well. @kentcdodds thanks for the tip.