(relativePath, expectedSources)
| 355 | const foo = new SourceNode(1, 0, "foo.js", "foo(js);"); |
| 356 | |
| 357 | const test = async function (relativePath, expectedSources) { |
| 358 | const app = new SourceNode(); |
| 359 | |
| 360 | const map = await new SourceMapConsumer(coffeeBundle.map.toString()); |
| 361 | app.add( |
| 362 | SourceNode.fromStringWithSourceMap(coffeeBundle.code, map, relativePath) |
| 363 | ); |
| 364 | map.destroy(); |
| 365 | |
| 366 | app.add(foo); |
| 367 | let i = 0; |
| 368 | app.walk(function (chunk, loc) { |
| 369 | assert.equal(loc.source, expectedSources[i]); |
| 370 | i++; |
| 371 | }); |
| 372 | app.walkSourceContents(function (sourceFile, sourceContent) { |
| 373 | assert.equal(sourceFile, expectedSources[0]); |
| 374 | assert.equal(sourceContent, "foo coffee"); |
| 375 | }); |
| 376 | }; |
| 377 | |
| 378 | await test("../coffee/maps", ["../coffee/foo.coffee", "foo.js"]); |
| 379 |
no test coverage detected
searching dependent graphs…