{"id":15013470,"url":"https://github.com/orangecms/jest-meteor-stubs","last_synced_at":"2025-04-12T04:44:25.909Z","repository":{"id":57280382,"uuid":"89677291","full_name":"orangecms/jest-meteor-stubs","owner":"orangecms","description":"Stubs for using Jest to unit test Meteor modules","archived":false,"fork":false,"pushed_at":"2018-12-11T20:26:08.000Z","size":16,"stargazers_count":14,"open_issues_count":6,"forks_count":22,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-26T00:13:11.046Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/orangecms.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-28T06:56:54.000Z","updated_at":"2020-12-09T15:20:44.000Z","dependencies_parsed_at":"2022-09-11T16:33:29.278Z","dependency_job_id":null,"html_url":"https://github.com/orangecms/jest-meteor-stubs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orangecms%2Fjest-meteor-stubs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orangecms%2Fjest-meteor-stubs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orangecms%2Fjest-meteor-stubs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orangecms%2Fjest-meteor-stubs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/orangecms","download_url":"https://codeload.github.com/orangecms/jest-meteor-stubs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248217077,"owners_count":21066633,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T19:44:19.732Z","updated_at":"2025-04-12T04:44:25.881Z","avatar_url":"https://github.com/orangecms.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## About\nTesting Meteor code is very slow when using the built-in `meteor test` command.\nThese stubs will help you get rid of the dependencies which are not present in\nyour project's `node_modules` directory. Use the setup below which does most of\nthe actual magic. :)\n\n## Installation\n`npm i -D jest-meteor-stubs` or `yarn add -D jest-meteor-stubs`\n\n## How it works\nJest preprocesses the files to be executed through the test runner. When pulling\nin dependencies, i.e. using `require` (in ES6 `import`), similar to the default\nbehavior of Node.js, the resolver will look for them in a local directory named\n`node_modules`. However, Meteor injects additional modules when running `meteor`\ninstead of plain Node.js, which do not reside in this directory. Jest allows you\nto overcome this issue by providing additional locations where the load should\nlook for modules.\n\n## Usage\nAdd this module's `lib/` directory to the `modulePaths` in your Jest config.\nFor Meteor packages, you will need to use `moduleNameMapper` to rewrite the\nmodule names to use `_` instead of `:` for the namespaces as `:` is not allowed\nby some file/operating systems.\nThe configuration has to be in `jest.config.js` in Jest 20 because of\n[a bug in the mapper](https://github.com/facebook/jest/issues/3716).\n\nHere is a working example:\n\n```javascript\nmodule.exports = {\n  transform: {\n    '^.+\\\\.jsx?$': 'babel-jest',\n  },\n  moduleFileExtensions: [\n    'js',\n    'jsx',\n  ],\n  modulePaths: [\n    '\u003crootDir\u003e/node_modules/',\n    '\u003crootDir\u003e/node_modules/jest-meteor-stubs/lib/',\n  ],\n  moduleNameMapper: {\n    '^(.*):(.*)$': '$1_$2',\n  },\n  unmockedModulePathPatterns: [\n    '/^imports\\\\/.*\\\\.jsx?$/',\n    '/^node_modules/',\n  ],\n};\n```\n\n## Examples\nPlease see [this demo](https://github.com/orangecms/jest-meteor-demo)\nfor a small example. :)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forangecms%2Fjest-meteor-stubs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Forangecms%2Fjest-meteor-stubs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forangecms%2Fjest-meteor-stubs/lists"}