Skip to content

Latest commit

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..

README.md

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 + Playwright.
  • Integration tests are located in /tests/integration/ and use Jest.
  • Unit tests located in /tests/unit/ and use Jest.

Global Variables

  • TEST_URL: Test server base URL (http://localhost:3001)
  • DOCS_PATH: File system path to docsify's /docs directory
  • DOCS_URL: Test server route to docsify's /docs directory
  • LIB_PATH: File system path to docsify's /lib directory
  • LIB_URL: Test server route to docsify's /lib directory

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 example tests
npm run test:jest-examples

# 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\"

# ------------------------------------------------------------------------------

# Start manual test server instance. Useful for previewing test fixtures.
# Root: /tests/e2e/fixtures/
# Routes: /docs, /lib,
node ./tests/e2e/config/server.js --start

Resource