metro-bundler: bundle test: fix test for no polyfills

Reviewed By: mjesun

Differential Revision: D5481856

fbshipit-source-id: b5516d7d74ba15886f1126f6d881a66559d0fb1e
This commit is contained in:
Jean Lauliac 2017-07-24 22:28:31 -07:00 committed by Facebook Github Bot
parent 5ba56250b5
commit 9f1cce4e89
3 changed files with 15 additions and 31 deletions

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`basic_bundle bundles package with polyfills as expected 1`] = `
exports[`basic_bundle bundles package with polyfills 1`] = `
"(function(global) {
global.__DEV__ = false;
@ -267,7 +267,7 @@ __d(/* /AssetRegistry.js */function(global, require, module, exports) {
;require(0);"
`;
exports[`basic_bundle bundles package without polyfills as expected 1`] = `
exports[`basic_bundle bundles package without polyfills 1`] = `
"(function(global) {
global.__DEV__ = false;
@ -484,28 +484,12 @@ if (__DEV__) {
})();
}
})(typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : this);
(function(global) {
'use strict';
if (!Object.keys) {
Object.keys = function () {};
}
})(typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : this);
(function(global) {
'use strict';
if (!String.prototype.repeat) {
String.prototype.repeat = function () {};
}
})(typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : this);
__d(/* /TestBundle.js */function(global, require, module, exports) {
'use strict';
var Bar = require(5); // 5 = ./Bar
var Foo = require(6); // 6 = ./Foo
var Bar = require(3); // 3 = ./Bar
var Foo = require(4); // 4 = ./Foo
module.exports = { Foo: Foo, Bar: Bar };
}, 0);
@ -513,23 +497,23 @@ __d(/* /Bar.js */function(global, require, module, exports) {
'use strict';
var Foo = require(6); // 6 = ./Foo
var Foo = require(4); // 4 = ./Foo
module.exports = { type: 'bar', foo: Foo.type };
}, 5);
}, 3);
__d(/* /Foo.js */function(global, require, module, exports) {
'use strict';
var asset = require(7); // 7 = ./test.png
var asset = require(5); // 5 = ./test.png
module.exports = { type: 'foo', asset: asset };
}, 6);
__d(/* /test.png */function(global, require, module, exports) {module.exports=require(8).registerAsset({\\"__packager_asset\\":true,\\"httpServerLocation\\":\\"/assets\\",\\"width\\":8,\\"height\\":8,\\"scales\\":[1],\\"hash\\":\\"77d45c1f7fa73c0f6c444a830dc42f67\\",\\"name\\":\\"test\\",\\"type\\":\\"png\\"}); // 8 = /AssetRegistry
}, 7);
}, 4);
__d(/* /test.png */function(global, require, module, exports) {module.exports=require(6).registerAsset({\\"__packager_asset\\":true,\\"httpServerLocation\\":\\"/assets\\",\\"width\\":8,\\"height\\":8,\\"scales\\":[1],\\"hash\\":\\"77d45c1f7fa73c0f6c444a830dc42f67\\",\\"name\\":\\"test\\",\\"type\\":\\"png\\"}); // 6 = /AssetRegistry
}, 5);
__d(/* /AssetRegistry.js */function(global, require, module, exports) {
'use strict';
}, 8);
}, 6);
;require(0);"
`;

View File

@ -92,7 +92,7 @@ describe('basic_bundle', () => {
).toMatchSnapshot();
}
it('bundles package with polyfills as expected', async () => {
it('bundles package with polyfills', async () => {
const bundleWithPolyfills = await Packager.buildBundle(
{
assetRegistryPath: ASSET_REGISTRY_PATH,
@ -111,11 +111,11 @@ describe('basic_bundle', () => {
verifyResultCode(bundleWithPolyfills.getSource());
});
it('bundles package without polyfills as expected', async () => {
it('bundles package without polyfills', async () => {
const bundleWithoutPolyfills = await Packager.buildBundle(
{
assetRegistryPath: ASSET_REGISTRY_PATH,
getPolyfills: () => [polyfill1, polyfill2],
getPolyfills: () => [],
projectRoots: [INPUT_PATH, POLYFILLS_PATH],
transformCache: Packager.TransformCaching.none(),
transformModulePath: require.resolve('../../transformer'),

View File

@ -31,7 +31,7 @@ function toLocalPath(
}
throw new Error(
'Expected root module to be relative to one of the project roots',
`Expected path \`${absolutePath}\` to be relative to one of the project roots`,
);
}