diff --git a/test/fixtures/test426/decoding/scopes/README.md b/test/fixtures/test426/decoding/scopes/README.md new file mode 100644 index 00000000000000..7b3271adb3ada7 --- /dev/null +++ b/test/fixtures/test426/decoding/scopes/README.md @@ -0,0 +1,18 @@ +## Test cases + +- **empty-scopes-field**: Empty original scopes field +- **nil-scopes**: Multiple null original scopes +- **close-start-end-position-scopes**: Scopes with very close start and end + positions +- **single-root-original-scope**: A single global root original scope +- **nested-scopes**: Nested original scopes representing functions and blocks +- **sibling-scopes**: Multiple sibling top-level functions +- **scope-variables**: Scopes containing variable declarations +- **multiple-root-original-scopes-with-nil**: Multiple global root scopes with a + null scope in between +- **sibling-ranges**: Multiple sibling root ranges +- **nested-ranges**: A root range with a nested function range +- **range-values**: A root range with a non-function range with bindings +- **sub-range-values**: A root range with sub-range bindings +- **range-call-site**: A function inlined into the root scope +- **hidden-ranges**: A function range corresponding to an original block scope diff --git a/test/fixtures/test426/decoding/scopes/hidden-ranges.map b/test/fixtures/test426/decoding/scopes/hidden-ranges.map new file mode 100644 index 00000000000000..779a24269ff2a4 --- /dev/null +++ b/test/fixtures/test426/decoding/scopes/hidden-ranges.map @@ -0,0 +1,13 @@ +{ + "version": 3, + "file": "hidden-ranges.js", + "sources": [ + "original_0.js" + ], + "mappings": "", + "names": [ + "global", + "block" + ], + "scopes": "BCAAA,BCBAC,CEA,CFA,ECAA,EPBAC,FEA,FFA" +} \ No newline at end of file diff --git a/test/fixtures/test426/decoding/scopes/hidden-ranges.map.golden b/test/fixtures/test426/decoding/scopes/hidden-ranges.map.golden new file mode 100644 index 00000000000000..6564cca5ea4e9d --- /dev/null +++ b/test/fixtures/test426/decoding/scopes/hidden-ranges.map.golden @@ -0,0 +1,75 @@ +{ + "file": "hidden-ranges.js", + "mappings": [], + "sources": [ + { + "url": "original_0.js", + "content": null, + "ignored": false, + "scope": { + "start": { + "line": 0, + "column": 0 + }, + "end": { + "line": 10, + "column": 0 + }, + "name": null, + "kind": "global", + "isStackFrame": false, + "variables": [], + "children": [ + { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 0 + }, + "name": null, + "kind": "block", + "isStackFrame": false, + "variables": [], + "children": [] + } + ] + } + } + ], + "ranges": [ + { + "start": { + "line": 0, + "column": 0 + }, + "end": { + "line": 10, + "column": 0 + }, + "definitionIndex": 0, + "stackFrameType": "none", + "callSite": null, + "bindings": [], + "children": [ + { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 0 + }, + "definitionIndex": 1, + "stackFrameType": "hidden", + "callSite": null, + "bindings": [], + "children": [] + } + ] + } + ] +} \ No newline at end of file diff --git a/test/fixtures/test426/decoding/scopes/nested-ranges.map b/test/fixtures/test426/decoding/scopes/nested-ranges.map new file mode 100644 index 00000000000000..2ab612337ed9a5 --- /dev/null +++ b/test/fixtures/test426/decoding/scopes/nested-ranges.map @@ -0,0 +1,14 @@ +{ + "version": 3, + "file": "nested-ranges.js", + "sources": [ + "original_0.js" + ], + "mappings": "", + "names": [ + "global", + "foo", + "function" + ], + "scopes": "BCAAA,BHBACE,CEA,CFA,ECAA,EGCC,FC,FG" +} \ No newline at end of file diff --git a/test/fixtures/test426/decoding/scopes/nested-ranges.map.golden b/test/fixtures/test426/decoding/scopes/nested-ranges.map.golden new file mode 100644 index 00000000000000..4d4138f113d10e --- /dev/null +++ b/test/fixtures/test426/decoding/scopes/nested-ranges.map.golden @@ -0,0 +1,75 @@ +{ + "file": "nested-ranges.js", + "mappings": [], + "sources": [ + { + "url": "original_0.js", + "content": null, + "ignored": false, + "scope": { + "start": { + "line": 0, + "column": 0 + }, + "end": { + "line": 10, + "column": 0 + }, + "name": null, + "kind": "global", + "isStackFrame": false, + "variables": [], + "children": [ + { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 0 + }, + "name": "foo", + "kind": "function", + "isStackFrame": true, + "variables": [], + "children": [] + } + ] + } + } + ], + "ranges": [ + { + "start": { + "line": 0, + "column": 0 + }, + "end": { + "line": 0, + "column": 10 + }, + "definitionIndex": 0, + "stackFrameType": "none", + "callSite": null, + "bindings": [], + "children": [ + { + "start": { + "line": 0, + "column": 2 + }, + "end": { + "line": 0, + "column": 4 + }, + "definitionIndex": 1, + "stackFrameType": "original", + "callSite": null, + "bindings": [], + "children": [] + } + ] + } + ] +} \ No newline at end of file diff --git a/test/fixtures/test426/decoding/scopes/range-call-site.map b/test/fixtures/test426/decoding/scopes/range-call-site.map new file mode 100644 index 00000000000000..61e5a4c5a5dcee --- /dev/null +++ b/test/fixtures/test426/decoding/scopes/range-call-site.map @@ -0,0 +1,14 @@ +{ + "version": 3, + "file": "range-call-site.js", + "sources": [ + "original_0.js" + ], + "mappings": "", + "names": [ + "global", + "inlineMe", + "function" + ], + "scopes": "BCAAA,BHBACE,CEA,CFA,ECAA,EDBAC,IAGC,FK,FJA" +} \ No newline at end of file diff --git a/test/fixtures/test426/decoding/scopes/range-call-site.map.golden b/test/fixtures/test426/decoding/scopes/range-call-site.map.golden new file mode 100644 index 00000000000000..b3ee2302946c44 --- /dev/null +++ b/test/fixtures/test426/decoding/scopes/range-call-site.map.golden @@ -0,0 +1,79 @@ +{ + "file": "range-call-site.js", + "mappings": [], + "sources": [ + { + "url": "original_0.js", + "content": null, + "ignored": false, + "scope": { + "start": { + "line": 0, + "column": 0 + }, + "end": { + "line": 10, + "column": 0 + }, + "name": null, + "kind": "global", + "isStackFrame": false, + "variables": [], + "children": [ + { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 0 + }, + "name": "inlineMe", + "kind": "function", + "isStackFrame": true, + "variables": [], + "children": [] + } + ] + } + } + ], + "ranges": [ + { + "start": { + "line": 0, + "column": 0 + }, + "end": { + "line": 10, + "column": 0 + }, + "definitionIndex": 0, + "stackFrameType": "none", + "callSite": null, + "bindings": [], + "children": [ + { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + }, + "definitionIndex": 1, + "stackFrameType": "none", + "callSite": { + "sourceIndex": 0, + "line": 6, + "column": 2 + }, + "bindings": [], + "children": [] + } + ] + } + ] +} \ No newline at end of file diff --git a/test/fixtures/test426/decoding/scopes/range-values.map b/test/fixtures/test426/decoding/scopes/range-values.map new file mode 100644 index 00000000000000..c397423a2431c8 --- /dev/null +++ b/test/fixtures/test426/decoding/scopes/range-values.map @@ -0,0 +1,20 @@ +{ + "version": 3, + "file": "range-values.js", + "sources": [ + "original_0.js" + ], + "mappings": "", + "names": [ + "global", + "x", + "y", + "z", + "block", + "a", + "x_val", + "z_val", + "a_val" + ], + "scopes": "BCAAA,DCCC,BCBAI,DE,CEA,CFA,ECAA,GHAI,ECCC,GJ,FC,FG" +} \ No newline at end of file diff --git a/test/fixtures/test426/decoding/scopes/range-values.map.golden b/test/fixtures/test426/decoding/scopes/range-values.map.golden new file mode 100644 index 00000000000000..a7cdec5139da88 --- /dev/null +++ b/test/fixtures/test426/decoding/scopes/range-values.map.golden @@ -0,0 +1,119 @@ +{ + "file": "range-values.js", + "mappings": [], + "sources": [ + { + "url": "original_0.js", + "content": null, + "ignored": false, + "scope": { + "start": { + "line": 0, + "column": 0 + }, + "end": { + "line": 10, + "column": 0 + }, + "name": null, + "kind": "global", + "isStackFrame": false, + "variables": [ + "x", + "y", + "z" + ], + "children": [ + { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 0 + }, + "name": null, + "kind": "block", + "isStackFrame": false, + "variables": [ + "a" + ], + "children": [] + } + ] + } + } + ], + "ranges": [ + { + "start": { + "line": 0, + "column": 0 + }, + "end": { + "line": 0, + "column": 10 + }, + "definitionIndex": 0, + "stackFrameType": "none", + "callSite": null, + "bindings": [ + [ + { + "binding": "x_val", + "from": { + "line": 0, + "column": 0 + } + } + ], + [ + { + "binding": null, + "from": { + "line": 0, + "column": 0 + } + } + ], + [ + { + "binding": "z_val", + "from": { + "line": 0, + "column": 0 + } + } + ] + ], + "children": [ + { + "start": { + "line": 0, + "column": 2 + }, + "end": { + "line": 0, + "column": 4 + }, + "definitionIndex": 1, + "stackFrameType": "none", + "callSite": null, + "bindings": [ + [ + { + "binding": "a_val", + "from": { + "line": 0, + "column": 2 + } + } + ] + ], + "children": [] + } + ] + } + ] +} \ No newline at end of file diff --git a/test/fixtures/test426/decoding/scopes/sibling-ranges.map b/test/fixtures/test426/decoding/scopes/sibling-ranges.map new file mode 100644 index 00000000000000..ea90f645612cc4 --- /dev/null +++ b/test/fixtures/test426/decoding/scopes/sibling-ranges.map @@ -0,0 +1,13 @@ +{ + "version": 3, + "file": "sibling-ranges.js", + "sources": [ + "original_0.js", + "original_1.js" + ], + "mappings": "", + "names": [ + "global" + ], + "scopes": "BCAAA,CKA,BCKAA,CKA,ECAA,FK,EDKAC,FK,EBKA,FK" +} \ No newline at end of file diff --git a/test/fixtures/test426/decoding/scopes/sibling-ranges.map.golden b/test/fixtures/test426/decoding/scopes/sibling-ranges.map.golden new file mode 100644 index 00000000000000..dc1975d40d00a5 --- /dev/null +++ b/test/fixtures/test426/decoding/scopes/sibling-ranges.map.golden @@ -0,0 +1,93 @@ +{ + "file": "sibling-ranges.js", + "mappings": [], + "sources": [ + { + "url": "original_0.js", + "content": null, + "ignored": false, + "scope": { + "start": { + "line": 0, + "column": 0 + }, + "end": { + "line": 10, + "column": 0 + }, + "name": null, + "kind": "global", + "isStackFrame": false, + "variables": [], + "children": [] + } + }, + { + "url": "original_1.js", + "content": null, + "ignored": false, + "scope": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 20, + "column": 0 + }, + "name": null, + "kind": "global", + "isStackFrame": false, + "variables": [], + "children": [] + } + } + ], + "ranges": [ + { + "start": { + "line": 0, + "column": 0 + }, + "end": { + "line": 0, + "column": 10 + }, + "definitionIndex": 0, + "stackFrameType": "none", + "callSite": null, + "bindings": [], + "children": [] + }, + { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 10 + }, + "definitionIndex": 1, + "stackFrameType": "none", + "callSite": null, + "bindings": [], + "children": [] + }, + { + "start": { + "line": 20, + "column": 0 + }, + "end": { + "line": 20, + "column": 10 + }, + "definitionIndex": null, + "stackFrameType": "none", + "callSite": null, + "bindings": [], + "children": [] + } + ] +} \ No newline at end of file diff --git a/test/fixtures/test426/decoding/scopes/sub-range-values.map b/test/fixtures/test426/decoding/scopes/sub-range-values.map new file mode 100644 index 00000000000000..40155a819383c4 --- /dev/null +++ b/test/fixtures/test426/decoding/scopes/sub-range-values.map @@ -0,0 +1,17 @@ +{ + "version": 3, + "file": "sub-range-values.js", + "sources": [ + "original_0.js" + ], + "mappings": "", + "names": [ + "global", + "x", + "y", + "x_sub_val1", + "y_val", + "x_sub_val2" + ], + "scopes": "BCAAA,DCC,CKA,ECAA,GEF,HAADAADG,FK" +} \ No newline at end of file diff --git a/test/fixtures/test426/decoding/scopes/sub-range-values.map.golden b/test/fixtures/test426/decoding/scopes/sub-range-values.map.golden new file mode 100644 index 00000000000000..c0662102819561 --- /dev/null +++ b/test/fixtures/test426/decoding/scopes/sub-range-values.map.golden @@ -0,0 +1,79 @@ +{ + "file": "sub-range-values.js", + "mappings": [], + "sources": [ + { + "url": "original_0.js", + "content": null, + "ignored": false, + "scope": { + "start": { + "line": 0, + "column": 0 + }, + "end": { + "line": 10, + "column": 0 + }, + "name": null, + "kind": "global", + "isStackFrame": false, + "variables": [ + "x", + "y" + ], + "children": [] + } + } + ], + "ranges": [ + { + "start": { + "line": 0, + "column": 0 + }, + "end": { + "line": 0, + "column": 10 + }, + "definitionIndex": 0, + "stackFrameType": "none", + "callSite": null, + "bindings": [ + [ + { + "binding": "x_sub_val1", + "from": { + "line": 0, + "column": 0 + } + }, + { + "binding": null, + "from": { + "line": 0, + "column": 3 + } + }, + { + "binding": "x_sub_val2", + "from": { + "line": 0, + "column": 6 + } + } + ], + [ + { + "binding": "y_val", + "from": { + "line": 0, + "column": 0 + } + } + ] + ], + "children": [] + } + ] +} \ No newline at end of file diff --git a/test/fixtures/test426/range-mappings-proposal-tests.json b/test/fixtures/test426/range-mappings-proposal-tests.json index 42d47d57650338..7b108e7e5e15bd 100644 --- a/test/fixtures/test426/range-mappings-proposal-tests.json +++ b/test/fixtures/test426/range-mappings-proposal-tests.json @@ -36,6 +36,13 @@ "sourceMapFile": "invalid-base64-char-2.js.map", "sourceMapIsValid": false }, + { + "name": "rangeMappingsInvalidVLQZero", + "description": "VLQ of zero is invalid because offsets are 1-based", + "baseFile": "invalid-vlq-zero.js", + "sourceMapFile": "invalid-vlq-zero.js.map", + "sourceMapIsValid": false + }, { "name": "rangeMappingsOutOfRange", "description": "Test an invalid range mapping which is outside the mappings length", diff --git a/test/fixtures/test426/resources/proposals/range-mappings/invalid-vlq-zero.js b/test/fixtures/test426/resources/proposals/range-mappings/invalid-vlq-zero.js new file mode 100644 index 00000000000000..c19bce975ac9e5 --- /dev/null +++ b/test/fixtures/test426/resources/proposals/range-mappings/invalid-vlq-zero.js @@ -0,0 +1 @@ +//# sourceMappingURL=invalid-vlq-zero.js.map diff --git a/test/fixtures/test426/resources/proposals/range-mappings/invalid-vlq-zero.js.map b/test/fixtures/test426/resources/proposals/range-mappings/invalid-vlq-zero.js.map new file mode 100644 index 00000000000000..fe13e8f5225acd --- /dev/null +++ b/test/fixtures/test426/resources/proposals/range-mappings/invalid-vlq-zero.js.map @@ -0,0 +1,9 @@ +{ + "version": 3, + "names": [], + "file": "invalid-vlq-zero.js", + "sources": ["empty-original.js"], + "sourcesContent": [""], + "mappings": "A", + "rangeMappings": "A" +} diff --git a/test/fixtures/test426/resources/proposals/range-mappings/multiple-mappings.js.map b/test/fixtures/test426/resources/proposals/range-mappings/multiple-mappings.js.map index 2fab6bd1977c25..c7ffc83e012283 100644 --- a/test/fixtures/test426/resources/proposals/range-mappings/multiple-mappings.js.map +++ b/test/fixtures/test426/resources/proposals/range-mappings/multiple-mappings.js.map @@ -4,5 +4,5 @@ "sources": ["multiple-mappings-original.js"], "sourcesContent": ["\"Hello World\"; function f() { } "], "mappings": ";CAAA,aAAa,EAAG,iBAAoB;A", - "rangeMappings": ";AC;" + "rangeMappings": ";BC;" } diff --git a/test/fixtures/test426/resources/proposals/range-mappings/newline-semantics.js.map b/test/fixtures/test426/resources/proposals/range-mappings/newline-semantics.js.map index 9f9e581b9edd17..b6f7b44282c3ff 100644 --- a/test/fixtures/test426/resources/proposals/range-mappings/newline-semantics.js.map +++ b/test/fixtures/test426/resources/proposals/range-mappings/newline-semantics.js.map @@ -5,5 +5,5 @@ "sources": ["newline-semantics-original.js"], "sourcesContent": ["1234\n5678"], "mappings": "CAAA;GACG", - "rangeMappings": "A;" + "rangeMappings": "B;" } diff --git a/test/fixtures/test426/resources/proposals/range-mappings/non-full-line-coverage.js.map b/test/fixtures/test426/resources/proposals/range-mappings/non-full-line-coverage.js.map index a381b123995747..952a3c30b1d084 100644 --- a/test/fixtures/test426/resources/proposals/range-mappings/non-full-line-coverage.js.map +++ b/test/fixtures/test426/resources/proposals/range-mappings/non-full-line-coverage.js.map @@ -5,5 +5,5 @@ "sources": ["simple-original.js"], "sourcesContent": ["\"Hello World\""], "mappings": ";CAAA;A", - "rangeMappings": ";A" + "rangeMappings": ";B" } diff --git a/test/fixtures/test426/resources/proposals/range-mappings/out-of-range-2.js.map b/test/fixtures/test426/resources/proposals/range-mappings/out-of-range-2.js.map index 152fd6653a8546..f573e035dca549 100644 --- a/test/fixtures/test426/resources/proposals/range-mappings/out-of-range-2.js.map +++ b/test/fixtures/test426/resources/proposals/range-mappings/out-of-range-2.js.map @@ -5,5 +5,5 @@ "sources": ["foo.js"], "sourcesContent": ["\"foo\""], "mappings": "AAA", - "rangeMappings": "B;A;A" + "rangeMappings": "C;B;B" } diff --git a/test/fixtures/test426/resources/proposals/range-mappings/out-of-range.js.map b/test/fixtures/test426/resources/proposals/range-mappings/out-of-range.js.map index 5ad9a234d91120..5da575a7a6355d 100644 --- a/test/fixtures/test426/resources/proposals/range-mappings/out-of-range.js.map +++ b/test/fixtures/test426/resources/proposals/range-mappings/out-of-range.js.map @@ -5,5 +5,5 @@ "sources": ["foo.js"], "sourcesContent": ["\"foo\""], "mappings": "AAA", - "rangeMappings": "B" + "rangeMappings": "C" } diff --git a/test/fixtures/test426/resources/proposals/range-mappings/simple.js.map b/test/fixtures/test426/resources/proposals/range-mappings/simple.js.map index 0cd782bcee0638..856d31a9c84e14 100644 --- a/test/fixtures/test426/resources/proposals/range-mappings/simple.js.map +++ b/test/fixtures/test426/resources/proposals/range-mappings/simple.js.map @@ -5,5 +5,5 @@ "sources": ["simple-original.js"], "sourcesContent": ["\"Hello World\""], "mappings": ";CAAA;A", - "rangeMappings": ";A;" + "rangeMappings": ";B;" } diff --git a/test/test426/README.md b/test/test426/README.md index 58b499920f7087..00f249c8d36a29 100644 --- a/test/test426/README.md +++ b/test/test426/README.md @@ -7,7 +7,7 @@ suite ensures that the Node.js source map implementation conforms to the The [`test/fixtures/test426`](../fixtures/test426/) contains a copy of the set of [Source Map Tests][] suite. The last updated hash is: -* +* See the json files in [the `status` folder](./status) for prerequisites, expected failures, and support status for specific tests.