Files
docsify/tests
2020-07-24 01:15:44 -04:00
..
2020-07-24 01:15:44 -04:00
2020-07-21 10:35:45 -04:00
2020-07-21 10:35:45 -04: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\"

Resource