Skip to content
Asumu Takikawa edited this page Jun 23, 2024 · 3 revisions

Contributing to Source Map Tests

Official repo: https://github.com/tc39/source-map-tests (this repo)

git clone https://github.com/tc39/source-map-tests.git

Test cases are described in source-map-tests/source-map-spec-tests.json (in the future maybe this may change to core-spec-tests.json or similar as we expect to have more test cases) The cases depend on resource files in source-map-tests/resources (usually a JS file and a source map file)

To add a new test case

  • Edit source-map-spec-tests.json to add a new entry for the test.
  • Add new JS generated file and source map file under resources/ with the names used in the test entry.
  • Test it out with the source map validator and/or source-map library

If you think of a case that should be covered, you can also add an entry to the wiki in https://github.com/tc39/source-map-tests/wiki/Core-Spec-Test-Coverage so that someone else can write a test.

How to run test cases

  • Both the validator and source-map libraries have integrated the tests as submodules.
  • You can check out the submodules with git submodule update --init in those repos.
  • Go to source-map-validator/source-map-tests or source-map/tests/source-map-tests submodules and apply your local changes to tests.
  • npm test

If tests fail due to limitations in the implementation, there is a list of "skipped" tests in both the validator and source-map library for known failures. It may be worth filing an issue if there isn't one already for the limitation though.

How to upstream the test case

Additional test harnesses

(there are some instructions in the repo README for some of these)

  • Chrome: TODO
  • WebKit: TODO
  • Firefox: note: this harness isn't maintained as it was superceded by the source-map library one.