Skip to content

Commit 4953d81

Browse files
authored
chore: fix typos (#15629)
1 parent e1bd133 commit 4953d81

File tree

3 files changed

+22
-23
lines changed

3 files changed

+22
-23
lines changed

packages/jest-haste-map/src/watchers/NodeWatcher.js

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ module.exports = class NodeWatcher extends EventEmitter {
3636

3737
this.watched = Object.create(null);
3838
this.changeTimers = Object.create(null);
39-
this.dirRegistery = Object.create(null);
39+
this.dirRegistry = Object.create(null);
4040
this.root = path.resolve(dir);
4141
this.watchdir = this.watchdir.bind(this);
4242
this.register = this.register.bind(this);
@@ -57,7 +57,7 @@ module.exports = class NodeWatcher extends EventEmitter {
5757
* Register files that matches our globs to know what to type of event to
5858
* emit in the future.
5959
*
60-
* Registery looks like the following:
60+
* Registry looks like the following:
6161
*
6262
* dirRegister => Map {
6363
* dirpath => Map {
@@ -79,46 +79,46 @@ module.exports = class NodeWatcher extends EventEmitter {
7979
}
8080

8181
const dir = path.dirname(filepath);
82-
if (!this.dirRegistery[dir]) {
83-
this.dirRegistery[dir] = Object.create(null);
82+
if (!this.dirRegistry[dir]) {
83+
this.dirRegistry[dir] = Object.create(null);
8484
}
8585

8686
const filename = path.basename(filepath);
87-
this.dirRegistery[dir][filename] = true;
87+
this.dirRegistry[dir][filename] = true;
8888

8989
return true;
9090
}
9191

9292
/**
93-
* Removes a file from the registery.
93+
* Removes a file from the registry.
9494
*
9595
* @param {string} filepath
9696
* @private
9797
*/
9898

9999
unregister(filepath) {
100100
const dir = path.dirname(filepath);
101-
if (this.dirRegistery[dir]) {
101+
if (this.dirRegistry[dir]) {
102102
const filename = path.basename(filepath);
103-
delete this.dirRegistery[dir][filename];
103+
delete this.dirRegistry[dir][filename];
104104
}
105105
}
106106

107107
/**
108-
* Removes a dir from the registery.
108+
* Removes a dir from the registry.
109109
*
110110
* @param {string} dirpath
111111
* @private
112112
*/
113113

114114
unregisterDir(dirpath) {
115-
if (this.dirRegistery[dirpath]) {
116-
delete this.dirRegistery[dirpath];
115+
if (this.dirRegistry[dirpath]) {
116+
delete this.dirRegistry[dirpath];
117117
}
118118
}
119119

120120
/**
121-
* Checks if a file or directory exists in the registery.
121+
* Checks if a file or directory exists in the registry.
122122
*
123123
* @param {string} fullpath
124124
* @return {boolean}
@@ -128,9 +128,8 @@ module.exports = class NodeWatcher extends EventEmitter {
128128
registered(fullpath) {
129129
const dir = path.dirname(fullpath);
130130
return (
131-
this.dirRegistery[fullpath] ||
132-
(this.dirRegistery[dir] &&
133-
this.dirRegistery[dir][path.basename(fullpath)])
131+
this.dirRegistry[fullpath] ||
132+
(this.dirRegistry[dir] && this.dirRegistry[dir][path.basename(fullpath)])
134133
);
135134
}
136135

@@ -211,15 +210,15 @@ module.exports = class NodeWatcher extends EventEmitter {
211210
*/
212211

213212
detectChangedFile(dir, event, callback) {
214-
if (!this.dirRegistery[dir]) {
213+
if (!this.dirRegistry[dir]) {
215214
return;
216215
}
217216

218217
let found = false;
219218
let closest = {mtime: 0};
220219
let c = 0;
221220
// eslint-disable-next-line unicorn/no-array-for-each
222-
Object.keys(this.dirRegistery[dir]).forEach((file, i, arr) => {
221+
Object.keys(this.dirRegistry[dir]).forEach((file, i, arr) => {
223222
fs.lstat(path.join(dir, file), (error, stat) => {
224223
if (found) {
225224
return;

packages/jest-transform/src/__tests__/ScriptTransformer.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,7 +1004,7 @@ describe('ScriptTransformer', () => {
10041004
);
10051005
});
10061006

1007-
it('warns of unparseable inlined source maps from the preprocessor', async () => {
1007+
it('warns of unparsable inlined source maps from the preprocessor', async () => {
10081008
const warn = console.warn;
10091009
console.warn = jest.fn();
10101010

@@ -1048,7 +1048,7 @@ describe('ScriptTransformer', () => {
10481048
console.warn = warn;
10491049
});
10501050

1051-
it('in async mode, warns of unparseable inlined source maps from the preprocessor', async () => {
1051+
it('in async mode, warns of unparsable inlined source maps from the preprocessor', async () => {
10521052
const warn = console.warn;
10531053
console.warn = jest.fn();
10541054

@@ -1092,7 +1092,7 @@ describe('ScriptTransformer', () => {
10921092
console.warn = warn;
10931093
});
10941094

1095-
it('warns of unparseable inlined source maps from the async preprocessor', async () => {
1095+
it('warns of unparsable inlined source maps from the async preprocessor', async () => {
10961096
const warn = console.warn;
10971097
console.warn = jest.fn();
10981098

packages/jest-transform/src/__tests__/__snapshots__/ScriptTransformer.test.ts.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ exports[`ScriptTransformer in async mode, uses the supplied preprocessor 1`] = `
154154

155155
exports[`ScriptTransformer in async mode, uses the supplied preprocessor 2`] = `"module.exports = "react";"`;
156156

157-
exports[`ScriptTransformer in async mode, warns of unparseable inlined source maps from the preprocessor 1`] = `
157+
exports[`ScriptTransformer in async mode, warns of unparsable inlined source maps from the preprocessor 1`] = `
158158
"<yellow><bold>● Invalid source map:</intensity></color>
159159
<yellow> The source map for "/fruits/banana.js" returned by "preprocessor-with-sourcemaps" is invalid.</color>
160160
<yellow> Proceeding without source mapping for that file.</color>"
@@ -866,13 +866,13 @@ exports[`ScriptTransformer uses the supplied preprocessor 1`] = `
866866
867867
exports[`ScriptTransformer uses the supplied preprocessor 2`] = `"module.exports = "react";"`;
868868
869-
exports[`ScriptTransformer warns of unparseable inlined source maps from the async preprocessor 1`] = `
869+
exports[`ScriptTransformer warns of unparsable inlined source maps from the async preprocessor 1`] = `
870870
"<yellow><bold>● Invalid source map:</intensity></color>
871871
<yellow> The source map for "/fruits/banana.js" returned by "async-preprocessor-with-sourcemaps" is invalid.</color>
872872
<yellow> Proceeding without source mapping for that file.</color>"
873873
`;
874874
875-
exports[`ScriptTransformer warns of unparseable inlined source maps from the preprocessor 1`] = `
875+
exports[`ScriptTransformer warns of unparsable inlined source maps from the preprocessor 1`] = `
876876
"<yellow><bold>● Invalid source map:</intensity></color>
877877
<yellow> The source map for "/fruits/banana.js" returned by "preprocessor-with-sourcemaps" is invalid.</color>
878878
<yellow> Proceeding without source mapping for that file.</color>"

0 commit comments

Comments
 (0)