Skip to content

Commit

Permalink
Merge pull request #44 from unjs/full-results
Browse files Browse the repository at this point in the history
chore: record full test results
  • Loading branch information
ascorbic committed Mar 13, 2024
2 parents 8663ff0 + 9eebc16 commit f83a489
Show file tree
Hide file tree
Showing 21 changed files with 671,081 additions and 8,077 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ The generated data is available in the `packages/runtime-compat-data` directory.

The list of APIs is generated by the [browser-compat-data](https://githib.com/mdn/browser-compat-data) project. The features that we include can be found in the `api` and `javascript/builtins` directories. The tests are provided by the [mdn-bcd-collector](Hhttps://github.com/openwebdocs/mdn-bcd-collector/) project. These are a mixture of automatically-generated tests for globals and properties, and manually-written tests for individual options. You can find the current tests in the `data` directory. This file is automatically generated from the `mdn-bcd-collector` repo.

These tests are designed to be run in a browser environment, so we use a slightly modified version of the test harness to allow them to run in the runtimes we support. The code for testing each of the runtimes is found in the `src/runtimes` directory. It is slightly different for each runtime, depending on how each is designed to be used. Some (such as Bun, Deno and Node) can run the test file directly from the CLI, while others expect to be run via a server. For these we use the project's own development server, and then use `start-server-and-test` to run the server and make a request for a funciton that runs the test file. Each of these generates a JSON response that shows the passing tests.
These tests are designed to be run in a browser environment, so we use a slightly modified version of the test harness to allow them to run in the runtimes we support. The code for testing each of the runtimes is found in the `src/runtimes` directory. It is slightly different for each runtime, depending on how each is designed to be used. Some (such as Bun, Deno and Node) can run the test file directly from the CLI, while others expect to be run via a server. For these we use the project's own development server, and then use `start-server-and-test` to run the server and make a request for a function that runs the test file. The output of each of these is a `data.json` file in the runtime directory, which contains the results of the tests. If you want to check why a specific test failed, you should start by inspecting the contents of this file as it contains the code and error message for each test.

Another script then processes these, combines them with the metadata from the `browser-compat-data` project, and then writes the data as a JSON file to the `packages/runtime-compat-data` directory. This is then published to npm.
Another script then processes these files, combines them with the metadata from the `browser-compat-data` project, and then writes the data as a JSON file to the `packages/runtime-compat-data` directory. This is then published to npm.

The tests can be run locally, but the actual data generation process is run nightly on GitHib Actions, which opens a PR if there are any changes.

Expand All @@ -31,7 +31,7 @@ The tests can be run locally, but the actual data generation process is run nigh
- Install dependencies using `pnpm install`
- Generate the data using `pnpm run generate`

If you want to run the tests for an individual runtime, run `pnpm start` in the `src/runtimes/<runtime>` directory. If you set `DEBUG=1` then it will log messages for test failures.
If you want to run the tests for an individual runtime, run `pnpm start` in the `src/runtimes/<runtime>` directory.

## Limitations

Expand Down

0 comments on commit f83a489

Please sign in to comment.