{"id":51459710,"url":"https://github.com/vweevers/test-electron-main","last_synced_at":"2026-07-06T04:30:31.608Z","repository":{"id":363356070,"uuid":"1262829904","full_name":"vweevers/test-electron-main","owner":"vweevers","description":"Run node:test tests in an Electron main process.","archived":false,"fork":false,"pushed_at":"2026-07-03T08:11:24.000Z","size":14,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-07-03T10:14:13.616Z","etag":null,"topics":["electron","unit-testing","vite"],"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/vweevers.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,"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":"2026-06-08T11:10:28.000Z","updated_at":"2026-07-03T08:11:27.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/vweevers/test-electron-main","commit_stats":null,"previous_names":["vweevers/test-electron-main"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/vweevers/test-electron-main","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Ftest-electron-main","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Ftest-electron-main/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Ftest-electron-main/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Ftest-electron-main/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vweevers","download_url":"https://codeload.github.com/vweevers/test-electron-main/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Ftest-electron-main/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35178402,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-06T02:00:07.184Z","response_time":106,"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":["electron","unit-testing","vite"],"created_at":"2026-07-06T04:30:29.341Z","updated_at":"2026-07-06T04:30:31.603Z","avatar_url":"https://github.com/vweevers.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# test-electron-main\n\n**CLI to run [`node:test`](https://nodejs.org/api/test.html) tests in an Electron main process, with watch mode and TypeScript support.** Not intended for UI tests (I'd recommend Playwright) but for unit tests that need to import things from `electron`.\n\n[![npm status](http://img.shields.io/npm/v/test-electron-main.svg)](https://www.npmjs.org/package/test-electron-main)\n[![node](https://img.shields.io/node/v/test-electron-main.svg)](https://www.npmjs.org/package/test-electron-main)\n[![Test](https://img.shields.io/github/actions/workflow/status/vweevers/test-electron-main/test.yml?branch=main\\\u0026label=test)](https://github.com/vweevers/test-electron-main/actions/workflows/test.yml)\n[![Standard](https://img.shields.io/badge/standard-informational?logo=javascript\\\u0026logoColor=fff)](https://standardjs.com)\n[![Common Changelog](https://common-changelog.org/badge.svg)](https://common-changelog.org)\n\n## Usage\n\nCreate a `test/clipboard.js` file:\n\n```js\nimport test from 'node:test'\nimport assert from 'node:assert'\nimport { clipboard } from 'electron'\n\ntest('read and write clipboard', function () {\n  clipboard.writeText('hello world')\n  assert.equal(clipboard.readText(), 'hello world')\n})\n```\n\nRun it:\n\n```\n$ test-electron-main test/* | tap-arc\n\nSubtest: read and write clipboard\n    ✓ read and write clipboard\n\ntotal:     1\npassing:   1\n```\n\nThe runner produces TAP output, which can be piped to a reporter of choice. In this example we're using the excellent [`tap-arc`](https://github.com/architect/tap-arc) reporter.\n\nTest files can be authored in JavaScript, TypeScript or both. They are imported through Vite 8 for full TypeScript support at near-native speed. Alternatively you could run your test files with `electron` itself, if they only use erasable TypeScript syntax (that Node.js and Electron can strip).\n\n## Install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install test-electron-main --save-dev\n```\n\nElectron is included in dependencies. Ideally you'd bring your own version but atm I need a different version for my own use - which happens to be the latest version (v42 at the time of writing). If that doesn't work for you, I can be persuaded, with chocolates or world peace.\n\n## CLI\n\n### `test-electron-main [options] \u003cglob pattern...\u003e`\n\nOne or more glob patterns are required; `test-electron-main` exits with a non-zero code if no tests are found. Negation patterns (e.g. `!foo.js`) are not supported.\n\nOptions:\n\n- `--watch` or `-w`: Rerun tests on changes and new files.\n- `--inspect=\u003cport\u003e`: Let [debuggers](https://www.electronjs.org/docs/latest/tutorial/debugging-main-process) connect to the specified port. When set, `test-electron-main` automatically breaks on test files.\n- `--inspect-brk=\u003cport\u003e`: Like inspect but pauses execution on startup. Once you've attached a debugger, hit Continue once to jump to your tests.\n- `--help` or `-h`: Show help message and exit.\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvweevers%2Ftest-electron-main","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvweevers%2Ftest-electron-main","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvweevers%2Ftest-electron-main/lists"}