{"id":32267087,"url":"https://github.com/purescript-spec/purescript-spec-mocha","last_synced_at":"2026-01-11T13:29:33.151Z","repository":{"id":35518344,"uuid":"39788758","full_name":"purescript-spec/purescript-spec-mocha","owner":"purescript-spec","description":"A test runner and reporter for purescript-spec that integrates with Mocha","archived":false,"fork":false,"pushed_at":"2024-07-20T22:12:49.000Z","size":54,"stargazers_count":5,"open_issues_count":0,"forks_count":13,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-22T21:55:25.539Z","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/purescript-spec.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2015-07-27T17:42:05.000Z","updated_at":"2025-08-20T13:19:22.000Z","dependencies_parsed_at":"2024-01-04T16:45:00.430Z","dependency_job_id":"1f62adce-032b-473d-b0e1-4a792e758206","html_url":"https://github.com/purescript-spec/purescript-spec-mocha","commit_stats":null,"previous_names":["owickstrom/purescript-spec-mocha"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/purescript-spec/purescript-spec-mocha","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purescript-spec%2Fpurescript-spec-mocha","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purescript-spec%2Fpurescript-spec-mocha/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purescript-spec%2Fpurescript-spec-mocha/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purescript-spec%2Fpurescript-spec-mocha/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/purescript-spec","download_url":"https://codeload.github.com/purescript-spec/purescript-spec-mocha/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purescript-spec%2Fpurescript-spec-mocha/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280520820,"owners_count":26344439,"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","status":"online","status_checked_at":"2025-10-22T02:00:06.515Z","response_time":63,"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":[],"created_at":"2025-10-22T21:55:22.694Z","updated_at":"2025-10-22T21:55:27.298Z","avatar_url":"https://github.com/purescript-spec.png","language":"JavaScript","readme":"# purescript-spec-mocha\n\npurescript-spec-mocha is a runner and reporter for\n[purescript-spec](https://github.com/purescript-spec/purescript-spec) that run tests\nand reports the results using the Mocha interface (`describe`, `it` etc). This\nenables you to use purescript-spec together with `mocha` and `karma`, and thus\nrun tests in web browsers, as well as NodeJS.\n\n## Usage\n\n```bash\nspago install spec-mocha\n```\n\n```purescript\nmodule Main where\n\nimport Prelude\nimport Control.Monad.Eff (Eff)\nimport Test.Spec (SpecEffects, describe, it)\nimport Test.Spec.Assertions (shouldEqual)\nimport Test.Spec.Mocha (runMocha)\n\nmain :: Effect Unit\nmain = runMocha do\n  describe \"your feature\" do\n    it \"works\" $\n      (1 + 1) `shouldEqual` 2\n```\n\nSee `test/Main.purs` for a more detailed example. The `package.json` scripts in this repo, show a number of usage patterns further detailed below. Note that the example tests contain 2 passing tests, a pending test and 2 failing tests, to demonstrate both success and failure.\n\n### Usage with bundled Purescript\n\nYou can run `yarn test:node` or `npm run test:node` in this repo to see an example.\n\nIf you bundle your compiled PureScript it can be run with `mocha bundle.js` or\nusing Karma and [karma-mocha](https://github.com/karma-runner/karma-mocha).\n\n```bash\nspago bundle --outfile bundle.js\nmocha bundle.js\n```\n\n### Usage in the browser\n\nTo run mocha tests in the browser, you can run `yarn test:browser` or `npm run test:browser` in this repo to see an example using the `test/browser/index.html` file.\n\n```html\n\u003cscript\u003emocha.setup(\"bdd\");\u003c/script\u003e\n\u003cscript src=\"../../output/test.js\"\u003e\u003c/script\u003e\n\u003cscript\u003emocha.run();\u003c/script\u003e\n```\n\nIt's also possible to bundle the test as a module in which case you'll need to use `type=\"module\"`:\n\n```html\n\u003cscript type=\"module\" src=\"./index_module.js\"\u003e\u003c/script\u003e\n```\n\nand to import the test module as shown in the `test/browser/index_module.js` file:\n\n```javascript\nimport { main } from \"../../output/test_module.js\";\n\nmocha.setup(\"bdd\");\nmain();\nmocha.run();\n```\n\nRunning `npm run test:watch` in one terminal window and `npm run test:browser` in another will watch purescript source and tests files and automatically run node and browser tests.\n\n### Usage with headless browser\n\nYou can run `yarn test:headless` or `npm run test:headless` in this repo to see an example using the `test/index.html` file together with `mocha-headless-chrome`. Note that we need to disable-web-security in chromium to allow cross-origin requests.\n\n## API Documentation\n\nSee [docs on Pursuit](https://pursuit.purescript.org/packages/purescript-spec-mocha).\n\n## Contribute\n\nIf you have any issues or possible improvements please file them as\n[GitHub Issues](https://github.com/purescript-spec/purescript-spec-mocha/issues).\nPull requests requests are encouraged.\n\n### Running Tests\n\nThis project's tests include some failures to test the Mocha\nintegration. Thus, use `run_tests.sh` instead of `spago test` to check\nthat everything is all right.\n\n## License\n\n[MIT License](LICENSE.md).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpurescript-spec%2Fpurescript-spec-mocha","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpurescript-spec%2Fpurescript-spec-mocha","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpurescript-spec%2Fpurescript-spec-mocha/lists"}