Skip to content

Commit e609f50

Browse files
yurydelendikkripken
authored andcommitted
Fixes binaryen*.test_source_map (#5378)
* Update source-map package. * Fixes binaryen*.test_source_map tests. * Adds Yury to the AUTHORS
1 parent c099bbb commit e609f50

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+3728
-4275
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,3 +299,4 @@ a license to everyone to use it as detailed in LICENSE.)
299299
* Ryan Lester <[email protected]> (copyright owned by Cyph, Inc.)
300300
* Nikolay Zapolnov <[email protected]>
301301
* Nazar Mokrynskyi <[email protected]>
302+
* Yury Delendik <[email protected]> (copyright owned by Mozilla Foundation)

tests/test_core.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6825,6 +6825,7 @@ def test_source_map(self):
68256825
dirname = self.get_dir()
68266826
src_filename = os.path.join(dirname, 'src.cpp')
68276827
out_filename = os.path.join(dirname, 'a.out.js')
6828+
wasm_filename = os.path.join(dirname, 'a.out.wasm')
68286829
no_maps_filename = os.path.join(dirname, 'no-maps.out.js')
68296830

68306831
with open(src_filename, 'w') as f: f.write(src)
@@ -6842,12 +6843,13 @@ def build_and_check():
68426843
import json
68436844
Building.emcc(src_filename, Settings.serialize() + self.emcc_args +
68446845
Building.COMPILER_TEST_OPTS, out_filename, stderr=PIPE)
6846+
map_referent = out_filename if not Settings.BINARYEN else wasm_filename
68456847
# after removing the @line and @sourceMappingURL comments, the build
68466848
# result should be identical to the non-source-mapped debug version.
68476849
# this is worth checking because the parser AST swaps strings for token
68486850
# objects when generating source maps, so we want to make sure the
68496851
# optimizer can deal with both types.
6850-
map_filename = out_filename + '.map'
6852+
map_filename = map_referent + '.map'
68516853

68526854
def encode_utf8(data):
68536855
if isinstance(data, dict):
@@ -6864,10 +6866,16 @@ def encode_utf8(data):
68646866
return data
68656867

68666868
data = encode_utf8(json.load(open(map_filename, 'r')))
6867-
self.assertPathsIdentical(out_filename, data['file'])
6869+
if hasattr(data, 'file'):
6870+
# the file attribute is optional, but if it is present it needs to refer
6871+
# the output file.
6872+
self.assertPathsIdentical(map_referent, data['file'])
68686873
assert len(data['sources']) == 1, data['sources']
68696874
self.assertPathsIdentical(src_filename, data['sources'][0])
6870-
self.assertTextDataIdentical(src, data['sourcesContent'][0])
6875+
if hasattr(data, 'sourcesContent'):
6876+
# the sourcesContent attribute is optional, but if it is present it
6877+
# needs to containt valid source text.
6878+
self.assertTextDataIdentical(src, data['sourcesContent'][0])
68716879
mappings = encode_utf8(json.loads(jsrun.run_js(
68726880
path_from_root('tools', 'source-maps', 'sourcemap2json.js'),
68736881
tools.shared.NODE_JS, [map_filename])))

tools/node_modules/source-map/.npmignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

tools/node_modules/source-map/.travis.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.

tools/node_modules/source-map/CHANGELOG.md

Lines changed: 244 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)