Skip to content

Commit

Permalink
Add changelog for fileChange and update fs -> file (#5713)
Browse files Browse the repository at this point in the history
  • Loading branch information
rogeliog authored and cpojer committed Mar 4, 2018
1 parent f7171b9 commit 74bf072
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@

### Chore & Maintenance

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

Expand Down
6 changes: 3 additions & 3 deletions packages/jest-cli/src/jest_hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ type JestHookExposedFS = {
projects: Array<{config: ProjectConfig, testPaths: Array<Path>}>,
};

type FsChange = (fs: JestHookExposedFS) => void;
type FileChange = (fs: JestHookExposedFS) => void;
type ShouldRunTestSuite = (testPath: string) => Promise<boolean>;
type TestRunComplete = (results: AggregatedResult) => void;

export type JestHookSubscriber = {
fileChange: (fn: FsChange) => void,
fileChange: (fn: FileChange) => void,
shouldRunTestSuite: (fn: ShouldRunTestSuite) => void,
testRunComplete: (fn: TestRunComplete) => void,
};
Expand All @@ -32,7 +32,7 @@ export type JestHookEmitter = {

class JestHooks {
_listeners: {
fileChange: Array<FsChange>,
fileChange: Array<FileChange>,
shouldRunTestSuite: Array<ShouldRunTestSuite>,
testRunComplete: Array<TestRunComplete>,
};
Expand Down
6 changes: 3 additions & 3 deletions packages/jest-cli/src/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export default function watch(
let shouldDisplayWatchUsage = true;
let isWatchUsageDisplayed = false;

const emitFsChange = () => {
const emitFileChange = () => {
if (hooks.isUsed('fileChange')) {
const projects = searchSources.map(({context, searchSource}) => ({
config: context.config,
Expand All @@ -164,7 +164,7 @@ export default function watch(
}
};

emitFsChange();
emitFileChange();

hasteMapInstances.forEach((hasteMapInstance, index) => {
hasteMapInstance.on('change', ({eventsQueue, hasteFS, moduleMap}) => {
Expand All @@ -188,7 +188,7 @@ export default function watch(
context,
searchSource: new SearchSource(context),
};
emitFsChange();
emitFileChange();
startRun(globalConfig);
}
});
Expand Down

0 comments on commit 74bf072

Please sign in to comment.