The jsdom project uses two different test frameworks:
- web-platform-tests. They come in the form of
.htmlfiles which are run inside the jsdom. This is part of a large cross-browser testing effort that jsdom is participating in. - Mocha tests
For working on new tests:
- Tests for web platform features go in the
web-platform-tests/to-upstreamsubdirectory. This should be the majority of new work. - Tests for the jsdom API itself go in the
apisubdirectory. If you add a new test file, editindex.jsto include it.
Ignore all the rest.
All Mocha tests are run via the file index.js. This includes running web-platform-tests, which are wrapped as Mocha tests.
All files related to running web-platform-tests are inside the web-platform-tests subdirectory.
Ideally we would only use Mocha for testing the JSDOM API itself, from the outside. Unfortunately, a lot of web platform features are still tested using Mocha, instead of web-platform-tests. These are located in the to-port-to-wpts subdirectory.
Another complication is that we have two APIs, the old (pre-v10) jsdom API, and the current one. So there is an additional subdirectory, old-api, covering the old API in particular. Additionally, many of the to-port-to-wpts are based on the old API, as is the web platform tests runner (for now).