React + scss testing

Hi,

what’s the best framework for testing React + scss? (Unit and full integration tests)

Have you encountered any problem using your framework of choice and if so, how did you manage to overcome it?

Thanks

1 Like

Ok, after hours of checking out every resource there is and following every step of meteor’s useless guides, seems like there’s simply no way to make it work. Also, all official sources (docs, guide, tutorials) recommend different packages and patterns.

Is there anyone using React and SCSS that could help please?

What have you tried so far?
There is nothing special about react and scss that should make it hard to test

Thanks for the answer.

I tried every step from meteor docs’ testing section.

To cut the long story short, apparently there is something special with css. It’s been answered finally by a MDG member - if you have any style sheet imports, you can’t run unit tests - you have to run a --full-app test.

Well, ok, let’s try that.
Pracicalmeteor:mocha, meteortesting:mocha, some other package? Docs - practicalmeteor, tutorial - meteortesting, community - almost no info at all.

Both packages cause errors, finally I managed to run tests with meteortesting. But as it turns out, I can’t make any imports - it throws an unexpected {. And without imports all tests are failed, because chai is undefined.

I use import { chai } from 'chai'; all the time without problems. It looks like you’ve lost the ecmascript package somewhere down the line. Try meteor add ecmascript.

Thanks for the suggestion, but it didn’t work.

What’s interesting - I rewrote it with require instead of imports and it worked - so you’re probably right, there’s something wrong with ES6. All my other files in the project contain multiple ES6 imports though, so it seems like that’s the case just for this particular file. I tried placing it in component’s folder, in tests folder etc, but it still behaves the same way.

It just got better.

I finally managed to run a full app test with meteortesting:mocha…

…and then I got slapped with Error: Cannot find module './[fileName].scss again.
MDG member claimed you need to run full app test if you import scss, but it turns out that wasn’t the case.

So the question still stands - is it possible to run any tests with React and SCSS?