Hi,
Is there a way to create some code which will run before client tests will run.
Simply I want to extract this code:
import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
Enzyme.configure({ adapter: new Adapter() });
to write it once somewhere to avoid breaking DRY and I don’t want to rewrite this code in every test file.
I found some kind of solution.
Add to package.json
attribute “testModule” which points to entry point of your tests.
My content of this file:
if (Meteor.isServer) {
import './server.js';
} else if (Meteor.isClient) {
import './client.js';
}
Then in client.js in tests
folder I can add some preparation code and then import all client tests I need. Disadvantage is I must manually enter here every test file.