From 592d50bf9a4bc1f97c742e0141ab60b2d36132f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 10 Jul 2018 17:22:42 +0200 Subject: [PATCH] use {dot: true} for all micromatches --- packages/jest-cli/src/run_jest.js | 1 + packages/jest-haste-map/src/haste_fs.js | 2 +- packages/jest-message-util/src/index.js | 2 +- packages/jest-runtime/src/should_instrument.js | 5 +++-- scripts/build.js | 4 ++-- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/jest-cli/src/run_jest.js b/packages/jest-cli/src/run_jest.js index caadcf170f08..d9f4b89fc736 100644 --- a/packages/jest-cli/src/run_jest.js +++ b/packages/jest-cli/src/run_jest.js @@ -176,6 +176,7 @@ export default (async function runJest({ !micromatch( [path.relative(globalConfig.rootDir, filename)], globalConfig.collectCoverageFrom, + {dot: true}, ).length ) { return false; diff --git a/packages/jest-haste-map/src/haste_fs.js b/packages/jest-haste-map/src/haste_fs.js index 5c2bd588bf92..a11080618c55 100644 --- a/packages/jest-haste-map/src/haste_fs.js +++ b/packages/jest-haste-map/src/haste_fs.js @@ -58,7 +58,7 @@ export default class HasteFS { const files = new Set(); for (const file in this._files) { const filePath = root ? path.relative(root, file) : file; - if (micromatch([filePath], globs).length) { + if (micromatch([filePath], globs, {dot: true}).length) { files.add(file); } } diff --git a/packages/jest-message-util/src/index.js b/packages/jest-message-util/src/index.js index 67bd810f795d..76b1db788e4a 100644 --- a/packages/jest-message-util/src/index.js +++ b/packages/jest-message-util/src/index.js @@ -216,7 +216,7 @@ const formatPaths = (config: StackTraceConfig, relativeTestPath, line) => { if ( (config.testMatch && config.testMatch.length && - micromatch(filePath, config.testMatch)) || + micromatch(filePath, config.testMatch, {dot: true})) || filePath === relativeTestPath ) { filePath = chalk.reset.cyan(filePath); diff --git a/packages/jest-runtime/src/should_instrument.js b/packages/jest-runtime/src/should_instrument.js index 0a663ee56378..78ac5a66c07d 100644 --- a/packages/jest-runtime/src/should_instrument.js +++ b/packages/jest-runtime/src/should_instrument.js @@ -30,7 +30,7 @@ export default function shouldInstrument( if ( config.forceCoverageMatch && config.forceCoverageMatch.length && - micromatch.any(filename, config.forceCoverageMatch) + micromatch.any(filename, config.forceCoverageMatch, {dot: true}) ) { return true; } @@ -42,7 +42,7 @@ export default function shouldInstrument( if ( config.testMatch && config.testMatch.length && - micromatch.any(filename, config.testMatch) + micromatch.any(filename, config.testMatch, {dot: true}) ) { return false; } @@ -63,6 +63,7 @@ export default function shouldInstrument( !micromatch( [path.relative(config.rootDir, filename)], options.collectCoverageFrom, + {dot: true}, ).length ) { return false; diff --git a/scripts/build.js b/scripts/build.js index 2a5f8b77aa91..a44c8b3b2566 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -125,14 +125,14 @@ function buildFile(file, silent) { const destPath = getBuildPath(file, BUILD_DIR); mkdirp.sync(path.dirname(destPath)); - if (micromatch.isMatch(file, IGNORE_PATTERN)) { + if (micromatch.isMatch(file, IGNORE_PATTERN, {dot: true})) { silent || process.stdout.write( chalk.dim(' \u2022 ') + path.relative(PACKAGES_DIR, file) + ' (ignore)\n' ); - } else if (!micromatch.isMatch(file, JS_FILES_PATTERN)) { + } else if (!micromatch.isMatch(file, JS_FILES_PATTERN, {dot: true})) { fs.createReadStream(file).pipe(fs.createWriteStream(destPath)); silent || process.stdout.write(