{"id":20181707,"url":"https://github.com/nichoth/tap-ssc","last_synced_at":"2025-05-07T03:30:32.715Z","repository":{"id":63540380,"uuid":"568569045","full_name":"nichoth/tap-ssc","owner":"nichoth","description":"Run tests in a browser environment from the command line","archived":true,"fork":false,"pushed_at":"2025-01-29T20:40:43.000Z","size":147,"stargazers_count":6,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-29T10:53:10.902Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nichoth.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}},"created_at":"2022-11-20T23:15:19.000Z","updated_at":"2025-02-08T02:33:15.000Z","dependencies_parsed_at":"2024-05-07T21:35:54.603Z","dependency_job_id":null,"html_url":"https://github.com/nichoth/tap-ssc","commit_stats":{"total_commits":60,"total_committers":1,"mean_commits":60.0,"dds":0.0,"last_synced_commit":"478dc2f644b7e7db82312bccab96a4c990cd1d14"},"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nichoth%2Ftap-ssc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nichoth%2Ftap-ssc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nichoth%2Ftap-ssc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nichoth%2Ftap-ssc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nichoth","download_url":"https://codeload.github.com/nichoth/tap-ssc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252806321,"owners_count":21807188,"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-14T02:36:29.238Z","updated_at":"2025-05-07T03:30:32.401Z","avatar_url":"https://github.com/nichoth.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tap ssc\n![tests](https://github.com/nichoth/tap-ssc/actions/workflows/nodejs.yml/badge.svg)\n[![Socket Badge](https://socket.dev/api/badge/npm/package/@nichoth/tap-ssc)](https://socket.dev/npm/package/@nichoth/tap-ssc)\n[![semantic versioning](https://img.shields.io/badge/semver-2.0.0-blue?logo=semver\u0026style=flat-square)](https://semver.org/)\n[![license](https://img.shields.io/badge/license-MIT-brightgreen)](LICENSE)\n\n\nRun tests in a browser environment from the command line.\n\nThe interface is inspired by [tape-run](https://www.npmjs.com/package/tape-run). Just pipe some JS into the `tap-ssc` command, and your tests will run in a browser environment.\n\nInstead of [electron](https://www.electronjs.org/), a dependency of `tape-run`, this uses [@socketsupply/socket](https://socketsupply.co/) to create a browser-like environment.\n\n## install\n```sh\nnpm i -D @nichoth/tap-ssc\n```\n\n## use\nBundle your client side JS, then pipe it into this tool, which is installed as the `tap-ssc` command.\n\nYour tests will be running in a browser environment, but all tap output will go to the terminal.\n\nUse it as a part of `package.json` scripts:\n```js\n\"scripts\": {\n    \"test\": \"esbuild --bundle test/index.js | tap-ssc\"\n},\n```\n\nOr on the command line:\n```sh\nnpx esbuild --bundle test/index.js | npx tap-ssc\n```\n\n## example\n```js\n// example/test/index.js\nimport { test } from '@nichoth/tapzero'\n\ntest('browser environment', t =\u003e {\n    t.ok(window, 'window should exist')\n})\n```\n\nThen in the terminal:\n```sh\nnpx esbuild --bundle test/index.js | npx tap-ssc\n```\n\nsee [this example](https://github.com/nichoth/tap-ssc/blob/main/example/package.json#L2)\n\n### pass in your own html file\n\u003e [!NOTE]  \n\u003e This is in progress.\n\nUse command line argument `--html=filename.html`\n\n```sh\nesbuild --bundle --platform=browser --format=esm test/html.js | tap-ssc --html=test.html | tap-arc\n```\n\nIn your html, be sure to include a script tag pointing at `bundle.js`:\n```html\n\u003cscript charset=\"utf-8\" src=\"bundle.js\" type=\"module\"\u003e\u003c/script\u003e\n```\n\nThis is useful if your application code depends on another file that you are linking to via HTML, eg\n\n```html\n\u003chead\u003e\n    \u003cmeta charset=\"UTF-8\"\u003e\n    \u003ctitle\u003etests\u003c/title\u003e\n    \u003cscript src=\"https://example.com/my-js-dependency/dist/index.umd.min.js\"\u003e\u003c/script\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n    \u003cscript src=\"bundle.js\"\u003e\u003c/script\u003e\n\u003c/body\u003e\n```\n\n## how does this work?\nWe build an `ssc` binary [once after you install this package](./package.json#L16)\n\nThe package binary, `./cli.js`, takes javascript that is piped to `stdin`, and writes it to a file at the right location -- `target + /bundle.js`. Then it runs the ssc binary and pipes the output to `stdout`.\n\n## test this module\nThis will use the `example` directory to install this as a dependency, then run a given test.\n\n### A passing test\n```sh\nnpm test | npx tap-arc\n```\n\n### A failing test\n```sh\nnpm run test-fail\n```\n\n### A test that throws an error\n```sh\nnpm run test-err\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnichoth%2Ftap-ssc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnichoth%2Ftap-ssc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnichoth%2Ftap-ssc/lists"}