diff --git a/packages/metro/src/DeltaBundler/Serializers/Serializers.js b/packages/metro/src/DeltaBundler/Serializers/Serializers.js index 67605224..5534ed77 100644 --- a/packages/metro/src/DeltaBundler/Serializers/Serializers.js +++ b/packages/metro/src/DeltaBundler/Serializers/Serializers.js @@ -135,10 +135,7 @@ async function _getAllModules( lastModified: Date, deltaTransformer: DeltaTransformer, }> { - const hashedOptions = options; - delete hashedOptions.sourceMapUrl; - - const clientId = '__SERVER__' + stableHash(hashedOptions).toString('hex'); + const clientId = '__SERVER__' + stableHash(options).toString('hex'); const deltaPatcher = DeltaPatcher.get(clientId); diff --git a/packages/metro/src/DeltaBundler/__tests__/Serializers-test.js b/packages/metro/src/DeltaBundler/__tests__/Serializers-test.js index 327895f4..b212bcbc 100644 --- a/packages/metro/src/DeltaBundler/__tests__/Serializers-test.js +++ b/packages/metro/src/DeltaBundler/__tests__/Serializers-test.js @@ -50,12 +50,12 @@ describe('Serializers', () => { postProcessModules.mockImplementation(modules => modules); deltaBundler = { - async getDeltaTransformer() { - return { + getDeltaTransformer: jest.fn().mockReturnValue( + Promise.resolve({ getDelta, getDependenciesFn, - }; - }, + }), + ), getPostProcessModulesFn() { return postProcessModules; }, @@ -101,7 +101,11 @@ describe('Serializers', () => { }); it('should build the full JS bundle', async () => { - expect(await Serializers.fullBundle(deltaBundler, {})).toMatchSnapshot(); + expect( + await Serializers.fullBundle(deltaBundler, { + sourceMapUrl: 'http://localhost:8081/myBundle.js', + }), + ).toMatchSnapshot(); getDelta.mockReturnValueOnce( Promise.resolve({ @@ -121,6 +125,17 @@ describe('Serializers', () => { ).toMatchSnapshot(); }); + it('should pass the sourcemapURL param to the transformer', async () => { + await Serializers.fullBundle(deltaBundler, { + sourceMapUrl: 'http://localhost:8081/myBundle.js', + }); + + expect(deltaBundler.getDeltaTransformer.mock.calls[0][1]).toEqual({ + deltaBundleId: '1234', + sourceMapUrl: 'http://localhost:8081/myBundle.js', + }); + }); + // This test actually does not test the sourcemaps generation logic, which // is already tested in the source-map file. it('should build the full Source Maps', async () => {