-
Notifications
You must be signed in to change notification settings - Fork 522
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a438a1e
commit 4592fbe
Showing
5 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test") | ||
load("@npm_bazel_terser//:index.from_src.bzl", "terser_minified") | ||
|
||
terser_minified( | ||
name = "case1", | ||
src = "src1.js", | ||
) | ||
|
||
jasmine_node_test( | ||
name = "test", | ||
srcs = [ | ||
"terser_spec.js", | ||
], | ||
data = ["@npm//source-map"], | ||
deps = [ | ||
":case1", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
The src1.js{,.map} files were generated from running `tsc` on src1.ts containing: | ||
|
||
``` | ||
export class MyClass { | ||
constructor(s: string) { | ||
console.log(s); | ||
} | ||
field: string|undefined; | ||
} | ||
``` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const fs = require('fs'); | ||
const sm = require('source-map'); | ||
const DIR = 'build_bazel_rules_nodejs/packages/terser/test/sourcemap'; | ||
|
||
describe('terser sourcemap handling', () => { | ||
it('should produce a sourcemap output', async () => { | ||
const file = require.resolve(DIR + '/case1.js.map'); | ||
const rawSourceMap = JSON.parse(fs.readFileSync(file, 'utf-8')); | ||
await sm.SourceMapConsumer.with(rawSourceMap, null, consumer => { | ||
const pos = consumer.originalPositionFor({ | ||
// FIXME: this data doesn't seem right. src1.js doesn't have this on line 1 | ||
line: 1, | ||
column: 17 | ||
}); | ||
expect(pos.name).toBe('MyClass'); | ||
}); | ||
}); | ||
}); |