Open denismaier opened 5 years ago
Local installations mean that CI tools can test it and be on the same version. You can add many styles to the same repo if you like, just add separate configs for each and then you can test each separately. Put a different scripts
entry for each of the configurations, might be better.
I can’t help much with that error. Any number of things could be wrong, depending on the way you installed Node, Yarn etc. The jest
invocation in the yarn script runner expects to find it in the PATH, which includes $DIR/node_modules/bin
where DIR is where your package.json is found. Adding jest globally will not satisfy this, so it seems it isn’t even in your normal PATH.
Ok. That sounds good. Could you give me a hint how such a multi-style test setup might look like?
Basically follow the readme but do bits more than once. For each style called $STYLE
you will need:
a style file, src/$STYLE.csl
test/$STYLE.test.js
: a test configuration
module.exports = {
csl: "./src/$STYLE.csl",
... etc
some tests, test/$STYLE/*.yaml
an entry in "scripts"
{
"scripts": {
"test": "jest --noStackTrace",
"test-$STYLE": "jest --watchAll --noStackTrace test/$STYLE.test.js"
}
}
Then run yarn test-my-first-style
or yarn test-other-style
as you wish. yarn test
for all of them in one hit.
If it's a bit tedious matching styles to their respective directories in test
, you could group them as styles/$STYLE/$STYLE.test.js
styles/$STYLE/$STYLE.csl
+ styles/$STYLE/tests/*.yaml
instead. It's quite flexible. (It might be harder for a non-techie to navigate the repo in that case, but maybe not too bad.)
Thanks a lot. That really helps...
yarn add -D jest jest-csl
leads to a local installation of jest-csl. Doing this for every csl style might be a bit cumbersome. Is there a reason why you don't suggest a global installation for this?By the way, I've tried a global installation with
yarn global add -D jest jest-csl
but somehow I'm not able to runyarn test
afterwards. I am getting the message/bin/sh: 1: jest: not found