{"id":19664881,"url":"https://github.com/small-tech/esm-tape-runner","last_synced_at":"2025-04-28T22:30:58.780Z","repository":{"id":57160987,"uuid":"344162036","full_name":"small-tech/esm-tape-runner","owner":"small-tech","description":"Basic test runner for tape that supports ECMAScript Modules (ESM; es6 modules). Runs your tests in isolation, one after the other.","archived":false,"fork":false,"pushed_at":"2022-03-21T12:40:06.000Z","size":13,"stargazers_count":8,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-21T14:37:21.284Z","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":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/small-tech.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":"2021-03-03T14:52:51.000Z","updated_at":"2022-03-21T13:02:33.000Z","dependencies_parsed_at":"2022-09-05T19:00:42.530Z","dependency_job_id":null,"html_url":"https://github.com/small-tech/esm-tape-runner","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/small-tech%2Fesm-tape-runner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/small-tech%2Fesm-tape-runner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/small-tech%2Fesm-tape-runner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/small-tech%2Fesm-tape-runner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/small-tech","download_url":"https://codeload.github.com/small-tech/esm-tape-runner/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251397576,"owners_count":21583034,"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-11T16:19:28.586Z","updated_at":"2025-04-28T22:30:58.495Z","avatar_url":"https://github.com/small-tech.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ESM Tape Runner\n\nBasic test runner for [tape](https://github.com/substack/tape) that supports ECMAScript Modules (ESM; es6 modules).\n\nRuns your tests in isolation, one after the other.\n\nI originally created this module because [tape runner did not support ESM files](https://github.com/substack/tape/issues/514). [This has now been fixed](https://github.com/substack/tape/pull/547) so:\n\n__For most purposes, you can simply use Tape directly now without need of this module.__\n\nWhere version 2.x of this module is still useful is if you need to run your tests using a custom [ES Module Loaders](https://nodejs.org/docs/latest-v16.x/api/esm.html#loaders) because your application uses one. You cannot specify this with Tape directly as tape is a CJS application.\n\n## Install\n\n```sh\nnpm i --save-dev @small-tech/esm-tape-runner\n```\n\n## Usage\n\nRun all the tests in the _test_ folder:\n\n```sh\nnpx esm-tape-runner 'test/**/*.js'\n```\n\nRun all the tests in the _test_ folder and pipe the output to [tap-monkey](https://github.com/small-tech/tap-monkey) for a monkeyrific experience.\n\n```sh\nnpx esm-tape-runner 'test/**/*.js' | npx tap-monkey\n```\n\nDo the same thing as above, but from a test script in your _package.json_ file:\n\n```json\n\"scripts\": {\n  \"test\": \"esm-tape-runner 'test/**/*.js' | tap-monkey\",\n}\n```\n\n(Now your tests will run whenever you invoke `npm test`.)\n\n## Advanced usage (with custom ES Module Loaders)\n\nPass the glob as your first argument as usual. Follow that with any environment variables and/or Node flags you want the runner to pass onto the Node process, including specifying your ES Module Loader.\n\nFor example:\n\n```json\n\"scripts\": {\n  \"test\": \"esm-tape-runner tests/utils.js NODE_OPTIONS='--require=./suppress-experimental.cjs' --enable-source-maps --experimental-modules --experimental-specifier-resolution=node --experimental-vm-modules --experimental-loader ./lib/processes/loader.js | tap-monkey\",\n}\n```\n\nIn the example above, the environment variable `NODE_OPTIONS` will be passed to the Node process (in this case, to require the [suppress-experimental.cjs](https://github.com/small-tech/nodekit/blob/main/suppress-experimental.cjs) CJS script to hide Node warnings about using experimental features), it will also pass all the Node flags to Node, including the `--experimental-loader` flag to load your custom ES Module Loader. The example also pipes the output to tap-monkey.\n\nNote that if you have a broadcast channel open between your ES Module Loader process and your main process while running your tests, you will have to manually exit your tests once they’re finished. e.g., \n\n```js\nimport test from '@small-tech/tape-with-promises'\n\ntest.onFinish(() =\u003e {\n  // We must exit manually as we are using a custom ES Module Loader.\n  process.exit()\n})\n```\n\n## Coverage\n\nFor code coverage, run your tests using [c8](https://github.com/bcoe/c8) and pipe your output to [tap-monkey](https://github.com/small-tech/tap-monkey) because you like beautiful borders and rounded corners in your coverage output (admit it, you do, and the monkey knows it).\n\n```sh\nnpx c8 esm-tape-runner 'test/**/*.js' | npx tap-monkey\n```\n\nAs with testing, you don’t need npx to run coverage when invoking it from a test script:\n\n```json\n\"scripts\": {\n  \"test\": \"c8 esm-tape-runner 'test/**/*.js' | tap-monkey\",\n}\n```\n\n(Now your coverage will run whenever you invoke `npm run coverage`.)\n\n## Similar libraries\n\nI initially tried using [tape-es](https://github.com/vanillaes/tape-es) but I ran into a bunch of problems due to it running tests in parallel. If you’re smarter than I am, you might want to give it a shot and see if it works for you.\n\nThe tape readme recommends using [bable-tape-runner](https://www.npmjs.com/package/babel-tape-runner) and [buble-tape-runner](https://www.npmjs.com/package/buble-tape-runner) but my stuff doesn’t use or need babel/buble/Bublé. If yours does, those might be the right test runners for you.\n\n## Like this? Fund us!\n\n[Small Technology Foundation](https://small-tech.org) is a tiny, independent not-for-profit.\n\nWe exist in part thanks to patronage by people like you. If you share [our vision](https://small-tech.org/about/#small-technology) and want to support our work, please [become a patron or donate to us](https://small-tech.org/fund-us) today and help us continue to exist.\n\n## Copyright\n\n\u0026copy; 2021 [Aral Balkan](https://ar.al), [Small Technology Foundation](https://small-tech.org).\n\n## License\n\nISC.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmall-tech%2Fesm-tape-runner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmall-tech%2Fesm-tape-runner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmall-tech%2Fesm-tape-runner/lists"}