Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make source maps plain objects for use with
t.valueToNode
(#14283)
Co-authored-by: Adam J. Hines <ahines@factset.com> Co-authored-by: Nicol貌 Ribaudo <nicolo.ribaudo@gmail.com>
- Loading branch information
1 parent
ea1c44e
commit b7631ff
Showing
2 changed files
with
34 additions
and
1 deletion.
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 @@ | ||
import _mergeSourceMap from "../lib/transformation/file/merge-map.js"; | ||
const mergeSourceMap = _mergeSourceMap.default; | ||
|
||
describe("merge-map", () => { | ||
it("returns a plain js object", () => { | ||
const inputMap = { | ||
file: "file.js", | ||
mappings: [], | ||
names: [], | ||
sources: ["file.ts"], | ||
version: 3, | ||
}; | ||
|
||
const outputMap = { | ||
file: "file.transpiled.js", | ||
mappings: [], | ||
names: [], | ||
sources: ["file.js"], | ||
version: 3, | ||
}; | ||
|
||
const map = mergeSourceMap(inputMap, outputMap, "file.transpiled.js"); | ||
expect(typeof map).toBe("object"); | ||
expect(Object.prototype.toString.call(map)).toBe("[object Object]"); | ||
expect(Object.getPrototypeOf(map)).toBe(Object.prototype); | ||
}); | ||
}); |