Skip to content

Latest commit

 

History

History
58 lines (38 loc) · 1.79 KB

BUILDING.md

File metadata and controls

58 lines (38 loc) · 1.79 KB

Building BlockSuite

Table of Contents

Prerequisites

Please ensure you have installed Node.js and pnpm.

Play with Playground

pnpm install
pnpm dev

The playground page should work at http://localhost:5173/starter/?init

Build Packages

pnpm build

Testing

Adding test cases is strongly encouraged when you contribute new features and bug fixes.

We use Playwright for E2E test, and vitest for unit test.

To test locally, please make sure browser binaries are already installed via npx playwright install. Then there are multi commands to choose from:

# run tests in headless mode in another terminal window
pnpm test

# or run tests in headed mode for debugging
pnpm test:headed

In headed mode, await page.pause() can be used in test cases to suspend the test runner. Note that the usage of the Playwright VSCode extension is also highly recommended.

To test browser compatibility, the BROWSER environment variable can be used:

# supports `firefox|webkit|chromium`
BROWSER=firefox pnpm test

# passing playwright params with the -- syntax
BROWSER=webkit pnpm test -- --debug

To investigate flaky tests, we can mark a test case as test.only, then perform npx playwright test --repeat-each=10 to reproduce the problem by repeated execution. It's also very helpful to run pnpm test -- --debug with await page.pause() added before certain asserters.