Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: tests/test_packagerWebExt.py

Issue 29762564: Issue 6625 - Expose webpack's resolve.alias to the packagers (Closed)
Patch Set: Created April 26, 2018, 11:40 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests/test_packagerWebExt.py
diff --git a/tests/test_packagerWebExt.py b/tests/test_packagerWebExt.py
index e99c852bb5f86675dd5517e72da0155389ec2d97..f2fd855fd16a57abb39883f289e5cce14885bfd0 100644
--- a/tests/test_packagerWebExt.py
+++ b/tests/test_packagerWebExt.py
@@ -230,11 +230,19 @@ def lib_files(tmpdir):
files = packager.Files(['lib'], set())
files['ext/a.js'] = 'require("./c.js");\nrequire("info");\nvar bar;'
files['lib/b.js'] = 'var foo;'
+ files['lib/aliased.js'] = 'require("mogo");'
+ files['lib/mogo.js'] = 'var this_is_mogo;'
+ files['lib/edge.js'] = 'var this_is_edge;'
files['ext/c.js'] = 'var this_is_c;'
+ files['ext/alias_c.js'] = 'var this_is_aliased_c;'
files['qunit/common.js'] = 'var qunit = {};'
files['qunit/tests/some_test.js'] = 'var passed = true;'
- tmpdir.mkdir('lib').join('b.js').write(files['lib/b.js'])
+ libdir = tmpdir.mkdir('lib')
+ libdir.join('b.js').write(files['lib/b.js'])
+ libdir.join('aliased.js').write(files['lib/aliased.js'])
+ libdir.join('mogo.js').write(files['lib/mogo.js'])
+ libdir.join('edge.js').write(files['lib/edge.js'])
ext_dir = tmpdir.mkdir('ext')
ext_dir.join('a.js').write(files['ext/a.js'])
ext_dir.join('c.js').write(files['ext/c.js'])
@@ -300,6 +308,13 @@ def assert_webpack_bundle(package, prefix, is_devbuild, excluded=False):
assert 'var this_is_c;' in libfoo
assert 'webpack:///./ext/c.js' in libfoomap
+ if prefix: # webpack 'resolve.alias' exposure
+ assert 'var this_is_edge;' in libfoo
+ assert 'webpack:///./lib/edge.js' in libfoomap
+ else:
+ assert 'var this_is_mogo;' in libfoo
+ assert 'webpack:///./lib/mogo.js' in libfoomap
+
assert ('var foo;' in libfoo) != excluded
assert ('webpack:///./lib/b.js' in libfoomap) != excluded
« tests/metadata.edge ('K') | « tests/metadata.edge ('k') | webpack_runner.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld