Skip to content

Commit 28e0de0

Browse files
CaptainNicfacebook-github-bot
authored andcommitted
Fix HasteImpl Regex (#24628)
Summary: The jest HasteImpl's `pluginNameReducers` regex was not properly escaping a backslash, resulting in unintended behavior. The intent of the code is to strip the `.${name}` from the end of a filepath, where `name` is a platform name. The correct regex for that would be `^(.*)\.(myPlat)$`, but because the regex is being constructed from a string, the `\.` is being interpreted as an escaped period, resulting in the regex `^(.*).(myPlat)$`. To correct this, the backslash needs to be escaped so it makes it into the regex. [General] [Fixed] - Fix HasteImpl platform name regex Pull Request resolved: #24628 Differential Revision: D15224468 Pulled By: hramos fbshipit-source-id: 6eb507aa5410bdd7c247e6d301052d41995a2f11
1 parent 6cf784f commit 28e0de0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

jest/hasteImpl.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const pluginRoots /*: Array<string> */ = haste.providesModuleNodeModules.map(
2727
);
2828

2929
const pluginNameReducers /*: Array<[RegExp, string]> */ = haste.platforms.map(
30-
name => [new RegExp(`^(.*)\.(${name})$`), '$1'],
30+
name => [new RegExp(`^(.*)\\.(${name})$`), '$1'],
3131
);
3232

3333
const ROOTS = [path.resolve(__dirname, '..') + path.sep, ...pluginRoots];

0 commit comments

Comments
 (0)