This package, `test-ipfs-example`, provides a testing framework specifically designed for validating IPFS-related JavaScript examples. It offers distinct test harnesses for both Node.js and browser environments. For Node.js examples, it facilitates simple output matching, allowing developers to assert expected console or process outputs. For browser-based examples, it leverages Playwright, providing a robust end-to-end testing solution with full browser automation capabilities. The current stable version is `1.3.3`, with releases occurring at a moderate cadence, typically every few months, addressing bug fixes, dependency updates, and new features like Bun support. Key differentiators include its dual-environment testing capabilities and specialized focus on IPFS examples, providing an integrated setup for projects within that ecosystem. It ships with TypeScript types, promoting better developer experience and type safety.
npm install test-ipfs-exampleVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `waitForOutput` from the Node.js test harness to assert the console output of a JavaScript file. It is run as a module, typically via the `test-node-example` CLI tool.
Review the README and API documentation for the correct import paths (e.g., `test-ipfs-example/node`, `test-ipfs-example/browser`) and updated API usage.
Ensure your environment meets Playwright's requirements for browser installation. You might need to manually install specific browsers using `npx playwright install` or check system dependencies. Refer to Playwright's documentation for troubleshooting browser installation issues.
Install Playwright as a dependency: `npm install --save-dev playwright` or `npm install --save-dev playwright-chromium` if only chromium is needed. Ensure your testing environment has access to these packages.
Update your import statements to use ESM syntax: `import { symbol } from 'test-ipfs-example/path'` instead of `const { symbol } = require('test-ipfs-example/path')`. Ensure your project's `package.json` specifies `"type": "module"` if you are running in Node.js.Ensure you call `const test = setup({ /* ... config ... */ });` before trying to use `test.describe` or other Playwright test functions.