| Index: test/source_map_stack_trace_test.dart
|
| diff --git a/test/source_map_stack_trace_test.dart b/test/source_map_stack_trace_test.dart
|
| index 64145a63de1b5dc310b60a294fc9b88f4a7e7866..c5d907bdaeab313f7908ab33a4439941f0fb0f17 100644
|
| --- a/test/source_map_stack_trace_test.dart
|
| +++ b/test/source_map_stack_trace_test.dart
|
| @@ -3,6 +3,7 @@
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| import 'package:package_resolver/package_resolver.dart';
|
| +import 'package:path/path.dart' as p;
|
| import 'package:source_maps/source_maps.dart';
|
| import 'package:source_span/source_span.dart';
|
| import 'package:stack_trace/stack_trace.dart';
|
| @@ -62,6 +63,40 @@ foo.dart.js 10:11 baz
|
| expect(frames.last.member, equals("baz"));
|
| });
|
|
|
| + test("include JS frames from external libraries with source map bundle", () {
|
| + var trace = new Trace.parse("""
|
| +foo.dart.js 10:11 foo
|
| +jquery.js 10:1 foo
|
| +""");
|
| + var builder = new SourceMapBuilder()
|
| + ..addSpan(
|
| + new SourceMapSpan.identifier(
|
| + new SourceLocation(1,
|
| + line: 1, column: 3, sourceUrl: "packages/foo/foo.dart"),
|
| + "qux"),
|
| + new SourceSpan(new SourceLocation(8, line: 5, column: 0),
|
| + new SourceLocation(12, line: 9, column: 1), "\n" * 4));
|
| + var sourceMapJson = builder.build("foo.dart.js.map");
|
| + sourceMapJson['file'] = "foo.dart.js";
|
| +
|
| + var bundle = [sourceMapJson];
|
| + var mapping = parseJsonExtended(bundle);
|
| + var frames = _mapTrace(mapping, trace,
|
| + packageResolver: new SyncPackageResolver.root("packages/"))
|
| + .frames;
|
| +
|
| + expect(frames.length, equals(2));
|
| +
|
| + var frame = frames.first;
|
| + expect(frame.uri, equals(Uri.parse("package:foo/foo.dart")));
|
| + expect(frame.line, equals(2));
|
| + expect(frame.column, equals(4));
|
| +
|
| + frame = frames.last;
|
| + expect(p.basename(frame.uri.toString()), equals("jquery.js"));
|
| + expect(frame.line, equals(10));
|
| + });
|
| +
|
| test("falls back to column 0 for unlisted column", () {
|
| var trace = new Trace.parse("foo.dart.js 10 foo");
|
| var builder = new SourceMapBuilder()
|
|
|