Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
4c10b5f
Initial commit
takikawa Feb 28, 2024
e45ca63
Rename
takikawa Feb 28, 2024
5cbde6e
Dummy JS files
takikawa Feb 28, 2024
f32b2a3
Add Firefox harness patch
takikawa Feb 28, 2024
d3c0d32
Fix test files
takikawa Feb 28, 2024
18c934a
Add Firefox example test
takikawa Feb 28, 2024
cf8ed45
Add test-specific README info
takikawa Feb 28, 2024
ba4bb79
Adjust README
takikawa Feb 28, 2024
f8213ff
Update README
takikawa Feb 28, 2024
0c2525f
Move test resources to a separate directory
takikawa Feb 29, 2024
52edb89
Add initial JSON test file
takikawa Feb 29, 2024
fe23e11
Add name fields to tests
takikawa Feb 29, 2024
a4d49fb
Add updated Firefox harness
takikawa Feb 29, 2024
0fa59ac
Update Firefox patch
takikawa Feb 29, 2024
3b992da
Move patch file to subdirectory, update README
takikawa Feb 29, 2024
3862259
Add a test for unrecognized properties (sec 4.3)
takikawa Feb 29, 2024
0a4a58c
Add a test to check basic name mappings
takikawa Feb 29, 2024
b96b7a2
Update FF patch
takikawa Mar 1, 2024
037f732
Use a better hack for preserving test case name
takikawa Mar 5, 2024
2a23caa
Add a numeric string test case for the version
takikawa Mar 5, 2024
a94ebf9
Add WebKit test harness
takikawa Mar 20, 2024
c869f00
Fix source mapping comment in tests
takikawa Mar 20, 2024
09badfe
Update build instructions
takikawa Mar 21, 2024
55aff10
Fix some details in the instructions to be clearer
takikawa Mar 21, 2024
8fc8bd5
Add new tests for correct mapping format
takikawa Mar 26, 2024
5c67f20
Add tests for negative non-relative fields
takikawa Mar 27, 2024
7203d11
Add description fields to test cases
takikawa Mar 27, 2024
ec6c907
Add tests for field values being too large
takikawa Mar 28, 2024
3716d76
Add several more mappings tests
takikawa Mar 28, 2024
528a4c8
Add a test for segments with zero fields
takikawa Mar 28, 2024
f42908b
Add a test for a mapping with many empty groups
takikawa Mar 28, 2024
0f8c662
Update WebKit harness
takikawa Mar 29, 2024
b651166
Add all the mappings for basic-mappings.js.map
takikawa Mar 29, 2024
8402fee
Add tests for index out of bounds
takikawa Apr 4, 2024
5e31fba
Add a test using null as an original source
takikawa Apr 4, 2024
63eedab
Add tests for invalid names/sources list
takikawa Apr 4, 2024
912edf2
Fix sources/file fields in some tests
takikawa Apr 5, 2024
fb619d2
Add tests for missing sources/names fields
takikawa Apr 5, 2024
492c81b
Add a version of basic mapping with index maps
takikawa Apr 6, 2024
be5c912
Update WebKit test harness
takikawa Apr 6, 2024
f99f1c0
Add more error cases for version, sources, names
takikawa Apr 8, 2024
f4772b7
Add some invalid test cases for index maps
takikawa Apr 8, 2024
a059ec9
Fix unintentionally wrong version fields
takikawa Apr 8, 2024
39c63a3
Add a test for index map order (and fix typo)
takikawa Apr 9, 2024
412a895
Add additional tests for index map structure
takikawa Apr 10, 2024
14d506a
Refine testing for sources/sourcesContent fields
takikawa Apr 12, 2024
0d07110
Fix JSON format errors
takikawa Apr 18, 2024
b65ad32
add chrome test harness
abelkius Apr 9, 2024
e5a238d
remove logging
abelkius Apr 9, 2024
4168188
update chrome harness
abelkius Apr 19, 2024
dc8056f
Update README.md
takikawa Apr 19, 2024
857e6f5
Add a checklist of test cases to the README
takikawa Apr 25, 2024
f41f130
Change behavior of basic-mapping-as-index-map test
takikawa Apr 26, 2024
d24b020
Add a new test with an index map with multiple sections
takikawa Apr 29, 2024
43d4c57
Add a transitive mapping test.
takikawa May 4, 2024
75157f8
Add a three-step transitive mapping test
takikawa May 11, 2024
37f9617
Add a test for missing continuation digits
takikawa May 11, 2024
04e70be
Add test cases for relative fields that are negative
takikawa May 14, 2024
4666447
add checks for valid sourcemaps
abelkius Apr 30, 2024
c56193e
add more tests for invalid sourcemaps
abelkius May 2, 2024
d50e48c
Change both null sources/sourcesContent case to valid
takikawa May 18, 2024
e34854a
Rename case for null source and non-null sourcesContent
takikawa May 19, 2024
31204d0
Add new test case for null sourcesContent
takikawa May 19, 2024
8670fd0
Minor fix to valid-mapping-empty-groups
takikawa May 24, 2024
02f2b1b
Add basic tests for ignore lists
takikawa May 25, 2024
8cd510c
Fix README headings
takikawa May 29, 2024
aa3ce8e
Remove outdated files
takikawa May 29, 2024
2e9b098
Update Firefox info in README
takikawa May 29, 2024
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
150 changes: 149 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Source Map Tests

This repository holds testing discussions for the the Source Map debugging format. Specifically, we're looking to encourage discussion around:
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
Expand All @@ -9,3 +9,151 @@ This repository holds testing discussions for the the Source Map debugging forma
Open discussion happens in the [GitHub issues](https://github.com/source-map/source-map-tests/issues).

Source Map spec: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#

## Test cases

These test cases are still a work-in-progress 🚧.

#### Running the tests

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)

For Firefox, see the Mozilla [source-map](https://github.com/mozilla/source-map) library:
* There is a [branch](https://github.com/takikawa/source-map/tree/add-spec-tests) for adding the spec tests to the package.

### Goals of tests

* Thoroughly test all aspects of the source maps spec that can be tested.
* Strictly follow the spec when determining test behavior.

### Test coverage

#### Core spec

* Encoding
- [ ] Source map must be a valid JSON document.
- Base64 VLQ
* VLQs should decode correctly
- [X] A VLQ with a non-base64 character will fail to decode.
- [ ] A VLQ with one digit and no continuation digits should decode.
- [ ] A negative VLQ with the sign bit set to 1 should decode.
- [ ] A VLQ with non-zero continuation bits (and more than one digit) should decode.
- [X] A VLQ with a non-zero continuation bit with no further digits should fail to decode.
- [ ] A VLQ should decode with the correct order of digits (least to most significant).
- [x] A long VLQ with many trailing zero digits will decode.
* [x] A VLQ exceeding the 32-bit size limit is invalid (note: the spec is unclear on the details of this limit)
* [x] A VLQ at exactly the 32-bit size limit should be decoded (positive and negative).
* Basic format
- `version` field
* [X] Must be present
* [X] Must be a number
* [X] Must be 3
- `file` field
* [ ] Optional, allow missing
* [ ] Must be a string? (spec is not clear)
- `sourceRoot` field
* [ ] Optional, allow missing
* [ ] Must be a string? (spec is not clear)
- `sources` field
* [X] Must be present
* [X] Must be an array
* [X] Array elements must be `null` or a string
- `sourcesContent` field
* [X] Must be present
* [X] Must be an array
* [X] Array elements must be `null` or a string
- `names` field
* [X] Must be present (note: the spec implies this but implementations may not agree)
* [X] Must be an array
* [X] Array elements must be strings
- `mappings` field
* [X] Must be present
* [X] Must be a string
* [ ] Empty string is valid
- `ignoreList` field
* [ ] Optional, allow missing
* [ ] Must be an array
* [ ] Array elements must be numbers
* [ ] Elements must not be out of bounds for the `sources` list
- [X] Extra unrecognized fields are allowed
* Index maps
- ? Must be mutually exclusive with non-index map?
- `file` field
* [ ] Optional, allow missing
* [ ] Must be a string? (spec is not clear)
- `sections` field
* [X] Must be present
* [X] Must be an array
* [ ] An empty sections array is valid
* [X] Array elements are valid section objects
- `offset` field
* [X] Must be present
* `line` field
- [X] Must be present
- [X] Must be a number
* `column` field
- [X] Must be present
- [X] Must be a number
- `map` field
* [X] Must be present
* [X] Must be an object
* [ ] Must be a valid source map
- [X] Sections are in order (the spec is not 100% clear, but assumption is increasing numeric order, may need subtests)
- [X] Sections are non-overlapping (the definition of overlap is not clear, may need subtests)
* Mappings format
- [X] Each line is separated by ";"
- [X] A line may consist of zero segments (e.g., ";;")
- [X] Each line consists only of segments separated by ","
- [X] Must have greater than zero fields (note: many implementations don't check)
- [X] Must have 1, 4, or 5 fields
- [X] The source index must not be out of bounds of the sources array
- [X] The name index must not be out of bounds of the names array
- Absolute VLQ values must be non-negative
* [X] The column must be non-negative
* [X] The source index must be non-negative
* [X] The original line must be non-negative
* [X] The original column must be non-negative
* [X] The name index must be non-negative
- Relative VLQ values must be non-negative after adding to previous value
* [X] The column must be non-negative
* [X] The source index must be non-negative
* [X] The original line must be non-negative
* [X] The original column must be non-negative
* [X] The name index must be non-negative
* Ignore list
- [X] An ignore list is optional, may be missing
- [X] An ignore list can't be a non-array value
* [X] An ignore list can be empty
* [X] An ignore list entry must be a number
* [X] An ignore list entry cannot be out-of-bounds of the sources array
- [X] Ignore list entries are detected and are present
- [X] Items not specified in the ignore list don't show up as ignored
* Mappings semantics
- [ ] A source map with no mappings does not map any position.
- [ ] A single field segment gets mapped to the correct line and column.
- [X] A four field segment gets mapped to the correct line and column.
- [X] A five field segment gets mapped to the correct line and column.
- [X] When a name is present in a segment, it is correctly mapped.
- [X] When a source is present in a segment, it is correctly mapped.
- [ ] The second occurence of a field segment in a line is mapped relative to the previous one.
- [ ] When a new line starts, the generated column field resets to zero rather than being relative to the previous line.
- [ ] For fields other than the generated column, a segment field that has occured once in a previous line is mapped relatively when it occurs in the next line.
- [ ] Ensure that a transitive source map mapping works as expected
- Index maps are correctly used in mappings
* [ ] An index map with one sub-map will map correctly.
* [X] An index map with multiple sub-maps will map correctly, with appropriate offsets for the second and later sub-maps.
* Resolution of sources
- [ ] When `sourceRoot` is provided, it is prepended to any `sources` entries and will be mapped with the full URL.
- [ ] If the source URL is an absolute URL, it is resolved as an absolute URL.
- [ ] If the source URL is a relative URL, it is resolved relative to the source map path.
* Wasm support
- [ ] Create versions of the tests that use a Wasm source.

### Scopes Proposal

TODO
Loading