mirror of
https://github.com/docsifyjs/docsify.git
synced 2026-10-21 22:56:24 +08:00
Docsify Testing
Environment
- Jest: A test framework used for assertions, mocks, spies, etc.
- Playwright: A test automation tool for launching browsers and manipulating the DOM.
- Jest-Playwright: A Jest preset that simplifies using Jest and Playwright together
Test files
- E2E tests are located in
/tests/e2e/and use Jest and Playwright. - Integration tests are located in
/tests/integration/and use Jest. - Unit tests located in
/tests/unit/and use Jest.
CLI commands
# Run all tests
npm run test:jest
# Run test types
npm run test:jest-e2e
npm run test:jest-integration
npm run test:jest-unit
# Run test file
npm run test:jest -- -i /path/to/file.test.js
# Run matching test files
npm run test:jest -- -i /path/to/*.test.js
# Run matching test name(s)
npm run test:jest -- -t \"describe() or test() name\"
# Run matching test name(s) in file
npm run test:jest -- -i /path/to/file.test.js -t \"describe() or test() name\"
# Run all example tests
npm run test:jest -- -i /tests/**/example.test.js --testPathIgnorePatterns
# Run specific example test file
npm run test:jest -- -i /path/to/example.test.js --testPathIgnorePatterns
# ------------------------------------------------------------------------------
# Update snapshots for matching test files
npm run test:jest -- -u -i /path/to/*.test.js
# Update snapshots for matching test name(s)
npm run test:jest -- -u -t \"describe() or test() name\"
# Update snapshots for matching test name(s) in file
npm run test:jest -- -u -i /path/to/file.test.js -t \"describe() or test() name\"