Stubs for using Jest to unit test Meteor modules
npm install jest-meteor-stubsmeteor test command.node_modules directory. Use the setup below which does most ofnpm i -D jest-meteor-stubs or yarn add -D jest-meteor-stubsrequire (in ES6 import), similar to the defaultnode_modules. However, Meteor injects additional modules when running meteorlib/ directory to the modulePaths in your Jest config.moduleNameMapper to rewrite the_ instead of : for the namespaces as : is not allowedjest.config.js in Jest 20 because ofHere is a working example:
``javascript``
module.exports = {
transform: {
'^.+\\.jsx?$': 'babel-jest',
},
moduleFileExtensions: [
'js',
'jsx',
],
modulePaths: [
'
'
],
moduleNameMapper: {
'^(.):(.)$': '$1_$2',
},
unmockedModulePathPatterns: [
'/^imports\\/.*\\.jsx?$/',
'/^node_modules/',
],
};