| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
The test directory holds two subdirectories, unit and integration. The unit directory mirrors the structure of the src directory. The integration directory somewhat mirrors the structure of src, but also includes additional files and directories for doing full e2e integration tests.
This structure will continue to evolve as we add more tests and improve our project directory structure. 🚧
The following commands are supported:
npm test # run all tests
npm run test:unit # run unit tests for eleventy and our front-end js
npm run test:lib # run unit tests *only* for our front-end js
npm run test:integration # run integration tests
npm run debug:test:unit # run eleventy unit tests with node debugger
npm run debug:test:lib # run front-end unit tests and leave browser open
npm run debug:test:integration # run integration tests with node debugger
npm run watch:test:unit # run front-end unit tests in watch modeEleventy tests check the filters/transforms/collections/etc. that we've added to eleventy. These tests run using mocha and Node's built-in assert module.
Unit tests for front-end code use Karma to run Chrome. A normal test run will run Chrome in headless mode. A debug test run will actually open a Chrome window and leave it open so you can inspect the tests.
The tests themselves are written using mocha.
The build.js file located at the root of the project handles creating the rollup bundle that karma uses to execute these tests.
Test should use the client-side assert helper library located in the test/unit/lib directory.
The integration tests verify that our eleventy build produces the files we expect and that changes to eleventy don't cause us to silently stop outputting certain files (like our sitemap or RSS feed).
These tests run using mocha and Node's built-in assert module.
We would like to eventually add puppeteer integration tests to check that clicking through the site works as expected.
In addition to the automated tests mentioned above, we also use Percy to do screenshot testing of key pages. These tests are run as part of a GitHub Actions workflow that lives in .github/workflows/percy-workflow.yml.
The code which actually does the snapshotting lives in tools/percy.
Percy tests run automatically against every pull request that modifies a non-markdown file (.njk, .css. .js, etc.)
| Back | FazBrowse Home | New Git URL |