From 122b239ce0c1df1918c17fbd8413c5d00d265465 Mon Sep 17 00:00:00 2001 From: Jean Lauliac Date: Thu, 25 May 2017 07:37:42 -0700 Subject: [PATCH] packager: enable throwOnModuleCollision for jest-haste-map Reviewed By: davidaurelio Differential Revision: D5129231 fbshipit-source-id: dbb8f0096c29efaca865a788fb25c21c9cbbc5cb --- packager/src/node-haste/DependencyGraph.js | 1 + packager/src/node-haste/__tests__/DependencyGraph-test.js | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packager/src/node-haste/DependencyGraph.js b/packager/src/node-haste/DependencyGraph.js index 0897cbcf2..d71ebbcb4 100644 --- a/packager/src/node-haste/DependencyGraph.js +++ b/packager/src/node-haste/DependencyGraph.js @@ -120,6 +120,7 @@ class DependencyGraph extends EventEmitter { resetCache: opts.resetCache, retainAllFiles: true, roots: opts.roots, + throwOnModuleCollision: true, useWatchman: opts.useWatchman, watch: opts.watch, }); diff --git a/packager/src/node-haste/__tests__/DependencyGraph-test.js b/packager/src/node-haste/__tests__/DependencyGraph-test.js index 34b0cf413..c2cb54e96 100644 --- a/packager/src/node-haste/__tests__/DependencyGraph-test.js +++ b/packager/src/node-haste/__tests__/DependencyGraph-test.js @@ -1127,14 +1127,13 @@ describe('DependencyGraph', function() { return dgraph.catch(err => { expect(err.message).toEqual( - `Failed to build DependencyGraph: @providesModule naming collision:\n` + + 'jest-haste-map: @providesModule naming collision:\n' + ` Duplicate module name: index\n` + ` Paths: /root/b.js collides with /root/index.js\n\n` + 'This error is caused by a @providesModule declaration ' + 'with the same name across two different files.', ); - expect(err.type).toEqual('DependencyGraphError'); - expect(console.warn).toBeCalled(); + expect(console.warn).not.toBeCalled(); }); });