(assert, rawSourceMap, action)
| 123 | } |
| 124 | |
| 125 | async function testTransitiveMappingAction(assert, rawSourceMap, action) { |
| 126 | return SourceMapConsumer.with(rawSourceMap, null, async consumer => { |
| 127 | assert.ok( |
| 128 | Array.isArray(action.intermediateMaps), |
| 129 | "transitive mapping case requires intermediate maps" |
| 130 | ); |
| 131 | |
| 132 | let mappedPosition = consumer.originalPositionFor({ |
| 133 | line: mapLine(action.generatedLine), |
| 134 | column: action.generatedColumn, |
| 135 | }); |
| 136 | |
| 137 | for (const intermediateMapPath of action.intermediateMaps) { |
| 138 | const intermediateMap = await readJSON( |
| 139 | `./source-map-tests/resources/${intermediateMapPath}` |
| 140 | ); |
| 141 | await SourceMapConsumer.with( |
| 142 | intermediateMap, |
| 143 | null, |
| 144 | consumerIntermediate => { |
| 145 | mappedPosition = consumerIntermediate.originalPositionFor({ |
| 146 | line: mappedPosition.line, |
| 147 | column: mappedPosition.column, |
| 148 | }); |
| 149 | } |
| 150 | ); |
| 151 | } |
| 152 | |
| 153 | assert.equal( |
| 154 | mappedPosition.line, |
| 155 | mapLine(action.originalLine), |
| 156 | `original line didn't match, expected ${mapLine( |
| 157 | action.originalLine |
| 158 | )} got ${mappedPosition.line}` |
| 159 | ); |
| 160 | assert.equal( |
| 161 | mappedPosition.column, |
| 162 | action.originalColumn, |
| 163 | `original column didn't match, expected ${action.originalColumn} got ${mappedPosition.column}` |
| 164 | ); |
| 165 | assert.equal( |
| 166 | mappedPosition.source, |
| 167 | action.originalSource, |
| 168 | `original source didn't match, expected ${action.originalSource} got ${mappedPosition.source}` |
| 169 | ); |
| 170 | }); |
| 171 | } |
| 172 | |
| 173 | for (const testCase of sourceMapSpecTests.tests) { |
| 174 | if (skippedTests.includes(testCase.name)) { |
no test coverage detected
searching dependent graphs…