From ed4edd890cf24a48b234b4ae707708c300efe4c9 Mon Sep 17 00:00:00 2001 From: Anthony Astige Date: Wed, 10 Jul 2019 08:20:18 -0700 Subject: [PATCH] red --- .../src/lib/__tests__/dependencyExtractor.test.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/jest-haste-map/src/lib/__tests__/dependencyExtractor.test.js b/packages/jest-haste-map/src/lib/__tests__/dependencyExtractor.test.js index e13ed50c735f..c3e8859ab1f2 100644 --- a/packages/jest-haste-map/src/lib/__tests__/dependencyExtractor.test.js +++ b/packages/jest-haste-map/src/lib/__tests__/dependencyExtractor.test.js @@ -11,12 +11,22 @@ import isRegExpSupported from '../isRegExpSupported'; const COMMENT_NO_NEG_LB = isRegExpSupported('(? { + // https://github.com/facebook/jest/issues/8547 + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#Import_a_module_for_its_side_effects_only + it('should extract dependencies from side-effect only imports', () => { + const code = ` + import './side-effect-dep'; + `; + expect(extract(code)).toEqual(new Set(['./side-effect-dep'])); + }); + it('should not extract dependencies inside comments', () => { const code = ` // import a from 'ignore-line-comment'; // require('ignore-line-comment'); /* * import a from 'ignore-block-comment'; + * import './ignore-block-comment'; * require('ignore-block-comment'); */ `;