{"id":18823859,"url":"https://github.com/eddyerburgh/conditional-specs","last_synced_at":"2025-04-14T01:30:39.674Z","repository":{"id":32420277,"uuid":"133095036","full_name":"eddyerburgh/conditional-specs","owner":"eddyerburgh","description":"Conditional spec methods for test suites that run in multiple environments ","archived":false,"fork":false,"pushed_at":"2022-12-09T08:37:59.000Z","size":255,"stargazers_count":4,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T15:47:33.407Z","etag":null,"topics":[],"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/eddyerburgh.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":"2018-05-11T22:41:08.000Z","updated_at":"2018-11-07T10:01:21.000Z","dependencies_parsed_at":"2023-01-14T21:09:27.798Z","dependency_job_id":null,"html_url":"https://github.com/eddyerburgh/conditional-specs","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddyerburgh%2Fconditional-specs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddyerburgh%2Fconditional-specs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddyerburgh%2Fconditional-specs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddyerburgh%2Fconditional-specs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eddyerburgh","download_url":"https://codeload.github.com/eddyerburgh/conditional-specs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248807308,"owners_count":21164662,"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-11-08T00:54:53.070Z","updated_at":"2025-04-14T01:30:39.635Z","avatar_url":"https://github.com/eddyerburgh.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# conditional-specs\n\nConditional spec methods for test suites that run in multiple environments.\n\nCan be used with [Mocha](https://mochajs.org/) or [Jest](https://facebook.github.io/jest/).\n\n## Example\n\n```js\nimport {\n  itDoNotRunIf,\n  describeRunIf\n} from 'conditional-specs'\n\ndescribe('#find()', () =\u003e {\n  itDoNotRunIf(BROWSER === 'phantomJS', 'returns node matching :not selector', () =\u003e {\n    // ..\n  });\n\n  it('returns node matching class selector', () =\u003e {\n    // ..\n  })\n})\n\ndescribeRunIf(TEST_ENV === \"node\", \"#findAll()\", () =\u003e {\n  // ..\n});\n```\n## Usage\n\nInstall with yarn:\n\n```\nyarn add --dev mocha-conditionals\n```\n\nor npm:\n\n```\nnpm install --save-dev mocha-conditionals\n```\n\nUse in test files:\n\n```js\nimport {\n  itDoNotSkipIf,\n  describeRunIf\n} from 'conditional-specs'\n\ndescribeRunIf(process.env.TEST_ENV === 'browser', '#find()', () =\u003e {\n  // ..\n})\n```\n\nYou can add `skip` and `only` to tests:\n\n```js\ndescribeRunIf.only(process.env.TEST_ENV === 'browser', '#find()', () =\u003e {\n  // ..\n})\n\ndescribeSkipIf.skip(process.env.TEST_ENV === 'browser', '#find()', () =\u003e {\n  // ..\n})\n```\n\n## API\n\n`itDoNotRunIf(condition, name, fn)`\n\n`itRunIf(condition, name, fn)`\n\n`itDoNotSkipIf(condition, name, fn)`\n\n`itSkipIf(condition, name, fn)`\n\n`describeDoNotRunIf(condition, name, fn)`\n\n`describeRunIf(condition, name, fn)`\n\n`describeDoNotSkipIf(condition, name, fn)`\n\n`describeSkipIf(condition, name, fn)`\n\n## Why?\n\nSome libraries are designed to run in multiple environments. If behavior changes across those environments, tests need to be conditional. \n\n`conditional-specs` provides methods to write easy-to-read conditional tests.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddyerburgh%2Fconditional-specs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feddyerburgh%2Fconditional-specs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddyerburgh%2Fconditional-specs/lists"}