{"id":15929546,"url":"https://github.com/ipfs-examples/test-ipfs-example","last_synced_at":"2026-04-28T08:32:15.282Z","repository":{"id":158105002,"uuid":"633782178","full_name":"ipfs-examples/test-ipfs-example","owner":"ipfs-examples","description":"A test suite for testing examples using playwright for browsers and simple output matching for node","archived":false,"fork":false,"pushed_at":"2024-04-23T07:57:09.000Z","size":221,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-23T11:46:41.839Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ipfs-examples.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}},"created_at":"2023-04-28T09:07:47.000Z","updated_at":"2024-08-05T17:08:05.268Z","dependencies_parsed_at":null,"dependency_job_id":"54b479f1-df18-44fb-83c5-4dd22b9e7094","html_url":"https://github.com/ipfs-examples/test-ipfs-example","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipfs-examples%2Ftest-ipfs-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipfs-examples%2Ftest-ipfs-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipfs-examples%2Ftest-ipfs-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipfs-examples%2Ftest-ipfs-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ipfs-examples","download_url":"https://codeload.github.com/ipfs-examples/test-ipfs-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246777819,"owners_count":20832032,"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-10-07T00:04:38.634Z","updated_at":"2026-04-28T08:32:10.233Z","avatar_url":"https://github.com/ipfs-examples.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# test-ipfs-example \u003c!-- omit in toc --\u003e\n\n[![codecov](https://img.shields.io/codecov/c/github/ipfs-examples/test-ipfs-example.svg?style=flat-square)](https://codecov.io/gh/ipfs-examples/test-ipfs-example)\n[![CI](https://img.shields.io/github/actions/workflow/status/ipfs-examples/test-ipfs-example/js-test-and-release.yml?branch=main\\\u0026style=flat-square)](https://github.com/ipfs-examples/test-ipfs-example/actions/workflows/js-test-and-release.yml?query=branch%3Amain)\n\n\u003e A test suite for testing examples using playwright for browsers and simple output matching for node\n\n# Install\n\n```console\n$ npm i test-ipfs-example\n```\n\n## Browser `\u003cscript\u003e` tag\n\nLoading this module through a script tag will make it's exports available as `TestIpfsExample` in the global namespace.\n\n```html\n\u003cscript src=\"https://unpkg.com/test-ipfs-example/dist/index.min.js\"\u003e\u003c/script\u003e\n```\n\n## Table of contents \u003c!-- omit in toc --\u003e\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Node.js tests](#nodejs-tests)\n  - [Browser tests](#browser-tests)\n- [API Docs](#api-docs)\n- [License](#license)\n- [Contribution](#contribution)\n\n## Usage\n\n### Node.js tests\n\nTo run node js tests, create a test file similar to:\n\n```js\nimport { waitForOutput } from 'test-ipfs-example/node'\n\nawait waitForOutput('the output to expect', 'path/to/example.js')\n```\n\nRun it from your package.json\n\n```json\n{\n  \"scripts\": {\n    \"test\": \"test-node-example ./my-test.spec.js\"\n  }\n}\n```\n\n### Browser tests\n\nTo run browser tests, create a test file similar to:\n\n```js\nimport { setup, expect } from 'test-ipfs-example/browser'\n\nconst test = setup({\n  // optionally configure server(s) - if omitted one will be created listening\n  // on a random high port that serves the contents of the `dist` folder in\n  // the root of the example\n  servers: [{\n    port: 0,\n    host: '127.0.0.1',\n    path: 'dist'\n  }]\n})\n\ntest.describe('test a browser app', () =\u003e {\n  test.beforeEach(async ({ servers, page }) =\u003e {\n    await page.goto(servers[0].url)\n  })\n\n  test('should have browser success', async ({ page }) =\u003e {\n    // make some playwright assertions here\n    await page.waitForSelector('#app')\n    const connections = await page.textContent('#app')\n    expect(connections).toContain('hello world')\n  })\n})\n```\n\nRun it from your package.json\n\n```json\n{\n  \"scripts\": {\n    \"test\": \"test-browser-example ./my-test.spec.js\"\n  }\n}\n```\n\n# API Docs\n\n- \u003chttps://ipfs-examples.github.io/test-ipfs-example\u003e\n\n# License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / \u003chttp://opensource.org/licenses/MIT\u003e)\n\n# Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fipfs-examples%2Ftest-ipfs-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fipfs-examples%2Ftest-ipfs-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fipfs-examples%2Ftest-ipfs-example/lists"}