Skip to content

Commit

Permalink
test: add initial test426 coverage
Browse files Browse the repository at this point in the history
Source map has been standardized as ECMA426, with a developing test
suite. Add an initial coverage of the source map tests.
  • Loading branch information
legendecas committed Jan 2, 2025
1 parent 98d4ebc commit 22285e7
Show file tree
Hide file tree
Showing 214 changed files with 18,233 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,10 @@ test-debug: BUILDTYPE_LOWER=debug ## Run tests on a debug build.
test-release test-debug: test-build ## Run tests on a release or debug build.
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER)

.PHONY: test-test426
test-test426: all ## Run the Web Platform Tests.
$(PYTHON) tools/test.py $(PARALLEL_ARGS) test426

.PHONY: test-wpt
test-wpt: all ## Run the Web Platform Tests.
$(PYTHON) tools/test.py $(PARALLEL_ARGS) wpt
Expand Down
14 changes: 14 additions & 0 deletions test/fixtures/test426/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
The Source Map Tests suite ("Software") is protected by copyright and is being made available under the "BSD License", included below. This Software may be subject to third party rights (rights from parties other than Ecma International), including patent rights, and no licenses under such third party rights are granted under this license even if the third party concerned is a member of Ecma International. SEE THE ECMA CODE OF CONDUCT IN PATENT MATTERS AVAILABLE AT https://www.ecma-international.org/ipr FOR INFORMATION REGARDING THE LICENSING OF PATENT CLAIMS THAT ARE REQUIRED TO IMPLEMENT ECMA INTERNATIONAL STANDARDS*.

Copyright (c) 2024, Ecma International
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

* Ecma International Standards hereafter means Ecma International Standards as well as Ecma Technical Reports
55 changes: 55 additions & 0 deletions test/fixtures/test426/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Source Map Tests

This repository holds testing discussions and tests for the the Source Map debugging format. Specifically, we're looking to encourage discussion around:

- Manual and automated testing strategies for Source Maps
- Gathering a list of Soure Map generators and consumers
- General discussion around deviations between source maps

Open discussion happens in the [GitHub issues](https://github.com/source-map/source-map-tests/issues).

Source Map spec:
* Repo: https://github.com/tc39/source-map
* Rendered spec: https://tc39.es/source-map/

## Test cases

This repo also contains cross-implementation test cases that can be run in test
suites for source map implementations, including browser devtool and library test
suites.

### Running the tests

#### Tools

[Source map validator](https://github.com/jkup/source-map-validator):
* The tests are included in the validator test suite [here](https://github.com/jkup/source-map-validator/blob/main/src/spec-tests.test.ts). You can run them with `npm test`.

#### Browsers

The tests for Firefox are in the Mozilla [source-map](https://github.com/mozilla/source-map) library:
* The upstream repo has a [test file](https://github.com/mozilla/source-map/blob/master/test/test-spec-tests.js) for running the spec tests from this repo. They can be run with `npm test`.

How to run in WebKit:
* Check out [WebKit](https://github.com/WebKit/WebKit/)
* `cd` to the checked out WebKit directory.
* Run `git am <this-repo>/webkit/0001-Add-harness-for-source-maps-spec-tests.patch`
* Run `Tools/Scripts/build-webkit` (depending on the platform you may need to pass `--gtk` or other flags)
* Run `Tools/Scripts/run-webkit-tests LayoutTests/inspector/model/source-map-spec.html` (again, you may need `--gtk` on Linux)

How to run in Chrome Devtools:
1. Setup:
* Install depot_tools following this [depot_tools guide](https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up)
* Check out [Chrome Devtools](https://chromium.googlesource.com/devtools/devtools-frontend):
* Run `gclient config https://chromium.googlesource.com/devtools/devtools-frontend --unmanaged`
* Run `cd devtools-frontend`
* Run `gclient sync`
* Run `gn gen out/Default`
2. Build:
* Run `autoninja -C out/Default`
3. Test:
* Run `npm run auto-unittest`
4. Apply patches from this repo:
* Run `git apply <path to .patch file>` in `devtools-frontend` repo

More information about running Chrome Devtools without building Chromium can be found [here](https://chromium.googlesource.com/devtools/devtools-frontend/+/refs/heads/chromium/3965/README.md)
Loading

0 comments on commit 22285e7

Please sign in to comment.