-
Notifications
You must be signed in to change notification settings - Fork 30.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! src,lib: retrieve parsed source map url from v8
- Loading branch information
1 parent
df4e7df
commit 86de757
Showing
2 changed files
with
29 additions
and
2 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
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,27 @@ | ||
'use strict'; | ||
|
||
require('../common'); | ||
const assert = require('assert'); | ||
const vm = require('vm'); | ||
|
||
function checkSourceMapUrl(source, expectedSourceMapURL) { | ||
const script = new vm.Script(source); | ||
assert.strictEqual(script.sourceMapURL, expectedSourceMapURL); | ||
} | ||
|
||
// No magic comment | ||
checkSourceMapUrl(` | ||
function myFunc() {} | ||
`, undefined); | ||
|
||
// Malformed magic comment | ||
checkSourceMapUrl(` | ||
function myFunc() {} | ||
// sourceMappingURL=sourcemap.json | ||
`, undefined); | ||
|
||
// Expected magic comment | ||
checkSourceMapUrl(` | ||
function myFunc() {} | ||
//# sourceMappingURL=sourcemap.json | ||
`, 'sourcemap.json'); |