mardi 17 décembre 2019

Mocha single test file works but fails when run as part of entire suite

I have a really annoying situation where I have a test file that, when run individually:

NODE_ENV=test mocha --require @babel/polyfill --require @babel/register --require mocha-setup.js --require ignore-styles --timeout 10000 './src/tests/MyComponent.test.js'

works fine and passes all tests.

But when run as part of the suite like so:

NODE_ENV=test mocha --require @babel/polyfill --require @babel/register --require mocha-setup.js --require ignore-styles --timeout 10000 './src/**/*.test.js'

I get massive failures. The predominant error message is:

Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

The only thing I can think is that mocha is building it wrong. Anyone come accross this before?

Aucun commentaire:

Enregistrer un commentaire