From 9815cd6e6f1b6c95f98a40875db17bb9616381da Mon Sep 17 00:00:00 2001 From: Jean Lauliac Date: Tue, 18 Jul 2017 07:57:42 -0700 Subject: [PATCH] metro-bunder: fix DependencyGraph-test for new jest-haste-map duplicates API Summary: Now we have a nice specific error type for duplicates errors. This changeset have been commited before but was reverted as part of a stack, so here we go again. Reviewed By: cpojer Differential Revision: D5442363 fbshipit-source-id: 068c8decaf20cd4f9a73d9d54984030c79cff606 --- .../src/node-haste/__tests__/DependencyGraph-test.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/metro-bundler/src/node-haste/__tests__/DependencyGraph-test.js b/packages/metro-bundler/src/node-haste/__tests__/DependencyGraph-test.js index 277d36b7..ae8cfe32 100644 --- a/packages/metro-bundler/src/node-haste/__tests__/DependencyGraph-test.js +++ b/packages/metro-bundler/src/node-haste/__tests__/DependencyGraph-test.js @@ -5294,7 +5294,10 @@ describe('DependencyGraph', function() { await getOrderedDependenciesAsJSON(dgraph, root + '/index.js'); throw new Error('expected `getOrderedDependenciesAsJSON` to fail'); } catch (error) { - if (error.type !== 'UnableToResolveError') { + const { + DuplicateHasteCandidatesError, + } = require('jest-haste-map/build/module_map'); + if (!(error instanceof DuplicateHasteCandidatesError)) { throw error; } expect(console.warn).toBeCalled();