Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 74bf072

Browse files
rogeliogcpojer
authored andcommitted
Add changelog for fileChange and update fs -> file (#5713)
1 parent f7171b9 commit 74bf072

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434

3535
### Chore & Maintenance
3636

37+
* `[#5708]` Add fileChange hook for plugins
38+
([#5648](https://github.com/facebook/jest/pull/5708))
3739
* `[docs]` Add docs on using `jest.mock(...)`
3840
([#5648](https://github.com/facebook/jest/pull/5648))
3941

packages/jest-cli/src/jest_hooks.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ type JestHookExposedFS = {
1414
projects: Array<{config: ProjectConfig, testPaths: Array<Path>}>,
1515
};
1616

17-
type FsChange = (fs: JestHookExposedFS) => void;
17+
type FileChange = (fs: JestHookExposedFS) => void;
1818
type ShouldRunTestSuite = (testPath: string) => Promise<boolean>;
1919
type TestRunComplete = (results: AggregatedResult) => void;
2020

2121
export type JestHookSubscriber = {
22-
fileChange: (fn: FsChange) => void,
22+
fileChange: (fn: FileChange) => void,
2323
shouldRunTestSuite: (fn: ShouldRunTestSuite) => void,
2424
testRunComplete: (fn: TestRunComplete) => void,
2525
};
@@ -32,7 +32,7 @@ export type JestHookEmitter = {
3232

3333
class JestHooks {
3434
_listeners: {
35-
fileChange: Array<FsChange>,
35+
fileChange: Array<FileChange>,
3636
shouldRunTestSuite: Array<ShouldRunTestSuite>,
3737
testRunComplete: Array<TestRunComplete>,
3838
};

packages/jest-cli/src/watch.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export default function watch(
154154
let shouldDisplayWatchUsage = true;
155155
let isWatchUsageDisplayed = false;
156156

157-
const emitFsChange = () => {
157+
const emitFileChange = () => {
158158
if (hooks.isUsed('fileChange')) {
159159
const projects = searchSources.map(({context, searchSource}) => ({
160160
config: context.config,
@@ -164,7 +164,7 @@ export default function watch(
164164
}
165165
};
166166

167-
emitFsChange();
167+
emitFileChange();
168168

169169
hasteMapInstances.forEach((hasteMapInstance, index) => {
170170
hasteMapInstance.on('change', ({eventsQueue, hasteFS, moduleMap}) => {
@@ -188,7 +188,7 @@ export default function watch(
188188
context,
189189
searchSource: new SearchSource(context),
190190
};
191-
emitFsChange();
191+
emitFileChange();
192192
startRun(globalConfig);
193193
}
194194
});

0 commit comments

Comments
 (0)