Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions LayoutTests/imported/tc39-tg4/source-map-tests/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
Comment on lines +1 to +14
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jdatapple do you know if this license is problematic for WebKit? it's almost identical to the license already used by JSTests/test262/LICENSE so hopefully it's fine?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I understand it, BSD is fine for WebKit. Most code is BSD and these are tests, not distributed code anyway.

9 changes: 9 additions & 0 deletions LayoutTests/imported/tc39-tg4/source-map-tests/README.WebKit
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
This directory contains the imported TG4 source map tests

- URL: https://github.com/tc39/source-map-tests.git
- Commit: 73e6c123c71b4dae17e3b81c46b29225731258f9

To update the tests, run the script at Tools/Scripts/import-source-map-tests
with no arguments. This will checkout out the repo above and copy the new
tests over. You can also specify a different repo and branch (see usage
info with the -h flag).
60 changes: 60 additions & 0 deletions LayoutTests/imported/tc39-tg4/source-map-tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Source Map Tests

This repository holds discussions on testing and tests for 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 Source 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)
Comment on lines +33 to +38
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be updated now or later to be upstreamed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm planning to update this upstream once this patch makes it in. Since there's a couple other test tweaks I plan to make, I can PR all of those together in a test update patch.


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)

#### Node.js

Follow the [running Node.js tests guide](https://github.com/nodejs/node/blob/main/BUILDING.md#running-tests) to build Node.js and run tests locally.
Read more about running the source map tests at [here](https://github.com/nodejs/node/tree/main/test/test426).
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
{
"resourceBasePath": "proposals/range-mappings",
"tests": [
{
"name": "rangeMappingsWrongType1",
"description": "Test an invalid source map with a malformed rangeMappings field",
"baseFile": "wrong-type-1.js",
"sourceMapFile": "wrong-type-1.js.map",
"sourceMapIsValid": false
},
{
"name": "rangeMappingsWrongType2",
"description": "Test an invalid source map with a malformed rangeMappings field",
"baseFile": "wrong-type-2.js",
"sourceMapFile": "wrong-type-2.js.map",
"sourceMapIsValid": false
},
{
"name": "rangeMappingsWrongType3",
"description": "Test an invalid source map with a malformed rangeMappings field",
"baseFile": "wrong-type-3.js",
"sourceMapFile": "wrong-type-3.js.map",
"sourceMapIsValid": false
},
{
"name": "rangeMappingsInvalidBase64Char1",
"description": "Test an invalid range mapping with an invalid base64 character",
"baseFile": "invalid-base64-char-1.js",
"sourceMapFile": "invalid-base64-char-1.js.map",
"sourceMapIsValid": false
},
{
"name": "rangeMappingsInvalidBase64Char2",
"description": "Test an invalid range mapping with an invalid base64 character",
"baseFile": "invalid-base64-char-2.js",
"sourceMapFile": "invalid-base64-char-2.js.map",
"sourceMapIsValid": false
},
{
"name": "rangeMappingsOutOfRange",
"description": "Test an invalid range mapping which is outside the mappings length",
"baseFile": "out-of-range.js",
"sourceMapFile": "out-of-range.js.map",
"sourceMapIsValid": false
},
{
"name": "rangeMappingsEmpty",
"description": "Test a trivial range mapping that is the empty string",
"baseFile": "empty-string.js",
"sourceMapFile": "empty-string.js.map",
"sourceMapIsValid": true
},
{
"name": "rangeMappingsNonFullLineCoverage",
"description": "Test a non-empty range mapping where not all lines in the generated source are covered",
"baseFile": "non-full-line-coverage.js",
"sourceMapFile": "non-full-line-coverage.js.map",
"sourceMapIsValid": true
},
{
"name": "rangeMappingsSimple",
"description": "Test a simple, single-entry rangeMappings",
"baseFile": "simple.js",
"sourceMapFile": "simple.js.map",
"sourceMapIsValid": true,
"testActions": [
{
"actionType": "checkMapping",
"generatedLine": 1,
"generatedColumn": 1,
"originalSource": "simple-original.js",
"originalLine": 0,
"originalColumn": 0,
"mappedName": null
},
{
"actionType": "checkMapping",
"generatedLine": 1,
"generatedColumn": 2,
"originalSource": "simple-original.js",
"originalLine": 0,
"originalColumn": 1,
"mappedName": null
},
{
"actionType": "checkMapping",
"generatedLine": 1,
"generatedColumn": 3,
"originalSource": "simple-original.js",
"originalLine": 0,
"originalColumn": 2,
"mappedName": null
}
]
},
{
"name": "rangeMappingsNewline",
"description": "Test rangeMappings entry continues through newlines",
"baseFile": "newline-semantics.js",
"sourceMapFile": "newline-semantics.js.map",
"sourceMapIsValid": true,
"testActions": [
{
"actionType": "checkMapping",
"generatedLine": 0,
"generatedColumn": 1,
"originalSource": "newline-semantics-original.js",
"originalLine": 0,
"originalColumn": 0,
"mappedName": null
},
{
"actionType": "checkMapping",
"generatedLine": 0,
"generatedColumn": 7,
"originalSource": "newline-semantics-original.js",
"originalLine": 0,
"originalColumn": 6,
"mappedName": null
},
{
"actionType": "checkMapping",
"generatedLine": 1,
"generatedColumn": 0,
"originalSource": "newline-semantics-original.js",
"originalLine": 0,
"originalColumn": 7,
"mappedName": null
},
{
"actionType": "checkMapping",
"generatedLine": 1,
"generatedColumn": 5,
"originalSource": "newline-semantics-original.js",
"originalLine": 0,
"originalColumn": 12,
"mappedName": null
}
]
}
]
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
function foo() {
return 42;
}
function bar() {
return 24;
}
foo();
bar();

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading