{"id":17344732,"url":"https://github.com/jamonserrano/karma-calling","last_synced_at":"2025-03-27T10:20:14.959Z","repository":{"id":57288369,"uuid":"55359444","full_name":"jamonserrano/karma-calling","owner":"jamonserrano","description":"Karma plugin to test function parameters and errors in BDD-style assertions","archived":false,"fork":false,"pushed_at":"2016-11-24T16:09:31.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-03T17:04:22.556Z","etag":null,"topics":["bdd-style","functions","karma","parameters","testing"],"latest_commit_sha":null,"homepage":"","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/jamonserrano.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":"2016-04-03T17:35:18.000Z","updated_at":"2016-11-11T15:33:15.000Z","dependencies_parsed_at":"2022-08-24T23:33:30.036Z","dependency_job_id":null,"html_url":"https://github.com/jamonserrano/karma-calling","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamonserrano%2Fkarma-calling","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamonserrano%2Fkarma-calling/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamonserrano%2Fkarma-calling/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamonserrano%2Fkarma-calling/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamonserrano","download_url":"https://codeload.github.com/jamonserrano/karma-calling/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245823316,"owners_count":20678173,"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":["bdd-style","functions","karma","parameters","testing"],"created_at":"2024-10-15T16:26:24.609Z","updated_at":"2025-03-27T10:20:14.930Z","avatar_url":"https://github.com/jamonserrano.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# karma-calling\nTest function parameters and errors in BDD-style assertions\n\nBased on http://stackoverflow.com/a/34590246\n\n\n## Installation\n\n1\\. Install the plugin from npm:\n\n```sh\n$ npm install karma-calling --save-dev\n```\n\n2\\. Add `calling` to the `frameworks` array in your Karma configuration:\n\n```javascript\nmodule.exports = function(config){\n  config.set({\n    // ...\n    frameworks: ['mocha', 'calling'],\n    // ...\n```\n---\nIf you are not using Karma, you can still use `calling` with import or require:\n\n```javascript\nimport calling from 'karma-calling';\n```\n\n```javascript\nvar calling = require('karma-calling');\n```\n\nOr just by inserting the script in your page:\n\n```javascript\n\u003cscript src='karma-calling.js'\u003e\u003c/script\u003e\n```\n\n\n## Usage\n\nInstead of wrapping your functions in an anonymous function, use a more natural BDD-style chaining:\n\n### Expect\n\n```javascript\n  // Instead of\n  expect(function () { myFunction.apply(myObject, [param1, param2]); }).to.throw(Error);\n  \n  // You can use\n  expect(calling(myFunction).on(myObject).with(param1, param2)).to.throw(Error);\n```\n\n### Should\n```javascript\n  // Instead of\n  function () { myFunction.apply(myObject, [param1, param2]); }.should.throw(Error);\n  \n  // You can use\n  calling(myFunction).on(myObject).with(param1, param2).should.throw(Error);\n```\n\n\u003e You can swap the order of `on` and `with` according to your preference.\n\n\n## API\n\n### calling(function)\n\nThe function/method to call.\n\n### .on(context)\n\nOptional binding context.\n\n### .with(param1, ..., paramN)\n\nOptional parameters.\n\n\n\n## License\n\nMIT License\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamonserrano%2Fkarma-calling","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamonserrano%2Fkarma-calling","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamonserrano%2Fkarma-calling/lists"}