{"id":15017408,"url":"https://github.com/jamiemason/add-matchers","last_synced_at":"2026-03-06T23:32:33.986Z","repository":{"id":51706086,"uuid":"79379034","full_name":"JamieMason/add-matchers","owner":"JamieMason","description":"Write useful test matchers compatible with Jest and Jasmine.","archived":false,"fork":false,"pushed_at":"2021-05-10T16:14:37.000Z","size":1240,"stargazers_count":17,"open_issues_count":16,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2026-02-25T03:18:42.089Z","etag":null,"topics":["jasmine","jasmine-matchers","javascript-tests","jest","test-matchers","testing","unit-testing"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/add-matchers","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/JamieMason.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-01-18T20:05:00.000Z","updated_at":"2025-10-10T11:12:44.000Z","dependencies_parsed_at":"2022-08-03T09:45:40.893Z","dependency_job_id":null,"html_url":"https://github.com/JamieMason/add-matchers","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/JamieMason/add-matchers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamieMason%2Fadd-matchers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamieMason%2Fadd-matchers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamieMason%2Fadd-matchers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamieMason%2Fadd-matchers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JamieMason","download_url":"https://codeload.github.com/JamieMason/add-matchers/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamieMason%2Fadd-matchers/sbom","scorecard":{"id":70596,"data":{"date":"2025-08-11","repo":{"name":"github.com/JamieMason/add-matchers","commit":"5712d7326fc591ffa540b54e07d70979832e1199"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/28 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"63 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-h5c3-5r3r-rr8q","Warn: Project is vulnerable to: GHSA-rmvr-2pp2-xj38","Warn: Project is vulnerable to: GHSA-xx4v-prfh-6cgc","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx","Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44","Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22","Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-7wpw-2hjm-89gp","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-hxm2-r34f-qmc5","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g","Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p","Warn: Project is vulnerable to: GHSA-3j8f-xvm3-ffx4","Warn: Project is vulnerable to: GHSA-4p35-cfcx-8653","Warn: Project is vulnerable to: GHSA-7f3x-x4pr-wqhj","Warn: Project is vulnerable to: GHSA-jpp7-7chh-cf67","Warn: Project is vulnerable to: GHSA-q6wq-5p59-983w","Warn: Project is vulnerable to: GHSA-j9fq-vwqv-2fm2","Warn: Project is vulnerable to: GHSA-pqw5-jmp5-px4v","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-vx3p-948g-6vhq","Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9","Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw","Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc","Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh","Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v","Warn: Project is vulnerable to: GHSA-38fc-wpqx-33j7","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-15T03:45:14.179Z","repository_id":51706086,"created_at":"2025-08-15T03:45:14.179Z","updated_at":"2025-08-15T03:45:14.179Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29849811,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T22:37:40.667Z","status":"online","status_checked_at":"2026-02-26T02:00:06.774Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["jasmine","jasmine-matchers","javascript-tests","jest","test-matchers","testing","unit-testing"],"created_at":"2024-09-24T19:50:25.140Z","updated_at":"2026-03-06T23:32:33.947Z","avatar_url":"https://github.com/JamieMason.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# add-matchers\n\n\u003e Write useful test matchers compatible with Jest and Jasmine.\n\n[![NPM version](http://img.shields.io/npm/v/add-matchers.svg?style=flat-square)](https://www.npmjs.com/package/add-matchers) [![NPM downloads](http://img.shields.io/npm/dm/add-matchers.svg?style=flat-square)](https://www.npmjs.com/package/add-matchers) [![Build Status](http://img.shields.io/travis/JamieMason/add-matchers/master.svg?style=flat-square)](https://travis-ci.org/JamieMason/add-matchers) [![Maintainability](https://api.codeclimate.com/v1/badges/b724d1eb54706d0752f4/maintainability)](https://codeclimate.com/github/JamieMason/add-matchers/maintainability)\n\n## Table of Contents\n\n-   [🌩 Installation](#-installation)\n-   [📝 API](#-api)\n-   [➕ Writing Matchers](#-writing-matchers)\n-   [🙋🏽‍♂️ Getting Help](#♂️-getting-help)\n-   [👀 Other Projects](#-other-projects)\n-   [🤓 Author](#-author)\n\n## 🌩 Installation\n\n    npm install --save-dev add-matchers\n\nInclude add-matchers after your test framework but before your tests, and register your matchers before your tests as well.\n\n## 📝 API\n\n### Add Custom Matchers\n\n```js\nimport { addMatchers } from \"add-matchers\";\n\naddMatchers({\n  toBeFoo(value) {\n    return value === \"foo\";\n  },\n  toInclude(other, value) {\n    return value.includes(other);\n  }\n});\n```\n\n```js\nexpect(\"foo\").toBeFoo();\nexpect(\"jamie\").toInclude(\"jam\");\n```\n\n### Add Custom Asymmetric Matchers\n\n```js\nimport { addMatchers } from \"add-matchers\";\n\naddMatchers.asymmetric({\n  toBeFoo(value) {\n    return value === \"foo\";\n  },\n  toInclude(other, value) {\n    return value.includes(other);\n  }\n});\n```\n\n```js\nexpect({ key: \"foo\", prop: \"bar\" }).toEqual({\n  key: any.toBeFoo(),\n  prop: any.toInclude(\"ar\")\n});\n```\n\n## ➕ Writing Matchers\n\nThe argument passed to `expect` is always the last argument passed to your Matcher, with any other arguments appearing before it in the order they were supplied.\n\nThis means that, in the case of `expect(received).toBeAwesome(arg1, arg2, arg3)`, your function will be called with `fn(arg1, arg2, arg3, received)`.\n\nArguments are ordered in this way to support [partial application](http://ejohn.org/blog/partial-functions-in-javascript/) and increase re-use of matchers.\n\n### Examples\n\nIf we wanted to use the following Matchers in our tests;\n\n```js\n// matcher with 0 arguments\nexpect(4).toBeEvenNumber();\n\n// matcher with 1 argument\nexpect({}).toBeOfType(\"Object\");\n\n// matcher with Many arguments\nexpect([100, 14, 15, 2]).toContainItems(2, 15, 100);\n```\n\nWe would create them as follows;\n\n```js\nimport { addMatchers } from \"add-matchers\";\n\naddMatchers({\n  // matcher with 0 arguments\n  toBeEvenNumber: function(received) {\n    // received : 4\n    return received % 2 === 0;\n  },\n  // matcher with 1 argument\n  toBeOfType: function(type, received) {\n    // type     : 'Object'\n    // received : {}\n    return Object.prototype.toString.call(received) === \"[object \" + type + \"]\";\n  },\n  // matcher with many arguments\n  toContainItems: function(arg1, arg2, arg3, received) {\n    // arg1     : 2\n    // arg2     : 15\n    // arg3     : 100\n    // received : [100, 14, 15, 2]\n    return (\n      received.indexOf(arg1) !== -1 \u0026\u0026\n      received.indexOf(arg2) !== -1 \u0026\u0026\n      received.indexOf(arg3) !== -1\n    );\n  }\n});\n```\n\nFor more examples, see [Jasmine Matchers](https://github.com/JamieMason/Jasmine-Matchers/tree/master/src) which is built using this library.\n\n## 🙋🏽‍♂️ Getting Help\n\nGet help with issues by creating a [Bug Report] or discuss ideas by opening a [Feature Request].\n\n[bug report]: https://github.com/JamieMason/add-matchers/issues/new?template=bug_report.md\n\n[feature request]: https://github.com/JamieMason/add-matchers/issues/new?template=feature_request.md\n\n## 👀 Other Projects\n\nIf you find my Open Source projects useful, please share them ❤️\n\n-   [**eslint-formatter-git-log**](https://github.com/JamieMason/eslint-formatter-git-log)\u003cbr\u003eESLint Formatter featuring Git Author, Date, and Hash\n-   [**eslint-plugin-move-files**](https://github.com/JamieMason/eslint-plugin-move-files)\u003cbr\u003eMove and rename files while keeping imports up to date\n-   [**eslint-plugin-prefer-arrow-functions**](https://github.com/JamieMason/eslint-plugin-prefer-arrow-functions)\u003cbr\u003eConvert functions to arrow functions\n-   [**ImageOptim-CLI**](https://github.com/JamieMason/ImageOptim-CLI)\u003cbr\u003eAutomates ImageOptim, ImageAlpha, and JPEGmini for Mac to make batch optimisation of images part of your automated build process.\n-   [**Jasmine-Matchers**](https://github.com/JamieMason/Jasmine-Matchers)\u003cbr\u003eWrite Beautiful Specs with Custom Matchers\n-   [**karma-benchmark**](https://github.com/JamieMason/karma-benchmark)\u003cbr\u003eRun Benchmark.js over multiple Browsers, with CI compatible output\n-   [**self-help**](https://github.com/JamieMason/self-help#readme)\u003cbr\u003eInteractive Q\u0026A Guides for Web and the Command Line\n-   [**syncpack**](https://github.com/JamieMason/syncpack#readme)\u003cbr\u003eManage multiple package.json files, such as in Lerna Monorepos and Yarn Workspaces\n\n## 🤓 Author\n\n\u003cimg src=\"https://www.gravatar.com/avatar/acdf106ce071806278438d8c354adec8?s=100\" align=\"left\"\u003e\n\nI'm [Jamie Mason] from [Leeds] in England, I began Web Design and Development in 1999 and have been Contracting and offering Consultancy as Fold Left Ltd since 2012. Who I've worked with includes [Sky Sports], [Sky Bet], [Sky Poker], The [Premier League], [William Hill], [Shell], [Betfair], and Football Clubs including [Leeds United], [Spurs], [West Ham], [Arsenal], and more.\n\n\u003cdiv align=\"center\"\u003e\n\n[![Follow JamieMason on GitHub][github badge]][github]      [![Follow fold_left on Twitter][twitter badge]][twitter]\n\n\u003c/div\u003e\n\n\u003c!-- images --\u003e\n\n[github badge]: https://img.shields.io/github/followers/JamieMason.svg?style=social\u0026label=Follow\n\n[twitter badge]: https://img.shields.io/twitter/follow/fold_left.svg?style=social\u0026label=Follow\n\n\u003c!-- links --\u003e\n\n[arsenal]: https://www.arsenal.com\n\n[betfair]: https://www.betfair.com\n\n[github]: https://github.com/JamieMason\n\n[jamie mason]: https://www.linkedin.com/in/jamiemasonleeds\n\n[leeds united]: https://www.leedsunited.com/\n\n[leeds]: https://www.instagram.com/visitleeds\n\n[premier league]: https://www.premierleague.com\n\n[shell]: https://www.shell.com\n\n[sky bet]: https://www.skybet.com\n\n[sky poker]: https://www.skypoker.com\n\n[sky sports]: https://www.skysports.com\n\n[spurs]: https://www.tottenhamhotspur.com\n\n[twitter]: https://twitter.com/fold_left\n\n[west ham]: https://www.whufc.com\n\n[william hill]: https://www.williamhill.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamiemason%2Fadd-matchers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamiemason%2Fadd-matchers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamiemason%2Fadd-matchers/lists"}