Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: migrate jest-util to TypeScript #7844

Merged
merged 6 commits into from
Feb 10, 2019
Merged

chore: migrate jest-util to TypeScript #7844

merged 6 commits into from
Feb 10, 2019

Conversation

SimenB
Copy link
Member

@SimenB SimenB commented Feb 9, 2019

Summary

Cheated a bit since jest-mock is not migrated yet, but jest-util is a dependency of so many other packages (adn jest-mock is just used for types to FakeTimers) that I think it's fine.

Built diff:

diff --git c/packages/jest-util/build/BufferedConsole.js w/packages/jest-util/build/BufferedConsole.js
index 41a049558..508ebd92b 100644
--- c/packages/jest-util/build/BufferedConsole.js
+++ w/packages/jest-util/build/BufferedConsole.js
@@ -35,6 +35,16 @@ function _util() {
   return data;
 }
 
+function _readableStream() {
+  const data = require('readable-stream');
+
+  _readableStream = function _readableStream() {
+    return data;
+  };
+
+  return data;
+}
+
 function _chalk() {
   const data = _interopRequireDefault(require('chalk'));
 
@@ -56,16 +66,16 @@ function _interopRequireDefault(obj) {
  *
  * This source code is licensed under the MIT license found in the
  * LICENSE file in the root directory of this source tree.
- *
- *
  */
 class BufferedConsole extends _console().Console {
   constructor(getSourceMaps) {
     const buffer = [];
-    super({
-      write: message =>
-        BufferedConsole.write(buffer, 'log', message, null, getSourceMaps())
-    });
+    super(
+      new (_readableStream()).Writable({
+        write: message =>
+          BufferedConsole.write(buffer, 'log', message, null, getSourceMaps())
+      })
+    );
     this._getSourceMaps = getSourceMaps;
     this._buffer = buffer;
     this._counters = {};
@@ -97,9 +107,9 @@ class BufferedConsole extends _console().Console {
     );
   }
 
-  assert(...args) {
+  assert(value, message) {
     try {
-      (0, _assert().default)(...args);
+      (0, _assert().default)(value, message);
     } catch (error) {
       this._log('assert', error.toString());
     }
@@ -120,37 +130,40 @@ class BufferedConsole extends _console().Console {
     this._counters[label] = 0;
   }
 
-  debug(...args) {
-    this._log('debug', (0, _util().format)(...args));
+  debug(firstArg, ...rest) {
+    this._log('debug', (0, _util().format)(firstArg, ...rest));
   }
 
-  dir(...args) {
-    this._log('dir', (0, _util().format)(...args));
+  dir(firstArg, ...rest) {
+    this._log('dir', (0, _util().format)(firstArg, ...rest));
   }
 
-  dirxml(...args) {
-    this._log('dirxml', (0, _util().format)(...args));
+  dirxml(firstArg, ...rest) {
+    this._log('dirxml', (0, _util().format)(firstArg, ...rest));
   }
 
-  error(...args) {
-    this._log('error', (0, _util().format)(...args));
+  error(firstArg, ...rest) {
+    this._log('error', (0, _util().format)(firstArg, ...rest));
   }
 
-  group(...args) {
+  group(title, ...rest) {
     this._groupDepth++;
 
-    if (args.length > 0) {
-      this._log('group', _chalk().default.bold((0, _util().format)(...args)));
+    if (title || rest.length > 0) {
+      this._log(
+        'group',
+        _chalk().default.bold((0, _util().format)(title, ...rest))
+      );
     }
   }
 
-  groupCollapsed(...args) {
+  groupCollapsed(title, ...rest) {
     this._groupDepth++;
 
-    if (args.length > 0) {
+    if (title || rest.length > 0) {
       this._log(
         'groupCollapsed',
-        _chalk().default.bold((0, _util().format)(...args))
+        _chalk().default.bold((0, _util().format)(title, ...rest))
       );
     }
   }
@@ -161,12 +174,12 @@ class BufferedConsole extends _console().Console {
     }
   }
 
-  info(...args) {
-    this._log('info', (0, _util().format)(...args));
+  info(firstArg, ...rest) {
+    this._log('info', (0, _util().format)(firstArg, ...rest));
   }
 
-  log(...args) {
-    this._log('log', (0, _util().format)(...args));
+  log(firstArg, ...rest) {
+    this._log('log', (0, _util().format)(firstArg, ...rest));
   }
 
   time(label = 'default') {
@@ -182,7 +195,7 @@ class BufferedConsole extends _console().Console {
 
     if (startTime) {
       const endTime = new Date();
-      const time = endTime - startTime;
+      const time = endTime.getTime() - startTime.getTime();
 
       this._log('time', (0, _util().format)(`${label}: ${time}ms`));
 
@@ -190,8 +203,8 @@ class BufferedConsole extends _console().Console {
     }
   }
 
-  warn(...args) {
-    this._log('warn', (0, _util().format)(...args));
+  warn(firstArg, ...rest) {
+    this._log('warn', (0, _util().format)(firstArg, ...rest));
   }
 
   getBuffer() {
diff --git c/packages/jest-util/build/CustomConsole.js w/packages/jest-util/build/CustomConsole.js
index 9e004d6af..2b6a9d80b 100644
--- c/packages/jest-util/build/CustomConsole.js
+++ w/packages/jest-util/build/CustomConsole.js
@@ -56,17 +56,12 @@ function _interopRequireDefault(obj) {
  *
  * This source code is licensed under the MIT license found in the
  * LICENSE file in the root directory of this source tree.
- *
- *
  */
-
-/* global stream$Writable */
 class CustomConsole extends _console().Console {
-  constructor(stdout, stderr, formatBuffer) {
+  constructor(stdout, stderr, formatBuffer = (_type, message) => message) {
     super(stdout, stderr);
-
-    this._formatBuffer = formatBuffer || ((type, message) => message);
-
+    this._stdout = stdout;
+    this._formatBuffer = formatBuffer;
     this._counters = {};
     this._timers = {};
     this._groupDepth = 0;
@@ -84,9 +79,9 @@ class CustomConsole extends _console().Console {
     );
   }
 
-  assert(...args) {
+  assert(value, message) {
     try {
-      (0, _assert().default)(...args);
+      (0, _assert().default)(value, message);
     } catch (error) {
       this._log('assert', error.toString());
     }
@@ -107,37 +102,40 @@ class CustomConsole extends _console().Console {
     this._counters[label] = 0;
   }
 
-  debug(...args) {
-    this._log('debug', (0, _util().format)(...args));
+  debug(firstArg, ...args) {
+    this._log('debug', (0, _util().format)(firstArg, ...args));
   }
 
-  dir(...args) {
-    this._log('dir', (0, _util().format)(...args));
+  dir(firstArg, ...args) {
+    this._log('dir', (0, _util().format)(firstArg, ...args));
   }
 
-  dirxml(...args) {
-    this._log('dirxml', (0, _util().format)(...args));
+  dirxml(firstArg, ...args) {
+    this._log('dirxml', (0, _util().format)(firstArg, ...args));
   }
 
-  error(...args) {
-    this._log('error', (0, _util().format)(...args));
+  error(firstArg, ...args) {
+    this._log('error', (0, _util().format)(firstArg, ...args));
   }
 
-  group(...args) {
+  group(title, ...args) {
     this._groupDepth++;
 
-    if (args.length > 0) {
-      this._log('group', _chalk().default.bold((0, _util().format)(...args)));
+    if (title || args.length > 0) {
+      this._log(
+        'group',
+        _chalk().default.bold((0, _util().format)(title, ...args))
+      );
     }
   }
 
-  groupCollapsed(...args) {
+  groupCollapsed(title, ...args) {
     this._groupDepth++;
 
-    if (args.length > 0) {
+    if (title || args.length > 0) {
       this._log(
         'groupCollapsed',
-        _chalk().default.bold((0, _util().format)(...args))
+        _chalk().default.bold((0, _util().format)(title, ...args))
       );
     }
   }
@@ -148,12 +146,12 @@ class CustomConsole extends _console().Console {
     }
   }
 
-  info(...args) {
-    this._log('info', (0, _util().format)(...args));
+  info(firstArg, ...args) {
+    this._log('info', (0, _util().format)(firstArg, ...args));
   }
 
-  log(...args) {
-    this._log('log', (0, _util().format)(...args));
+  log(firstArg, ...args) {
+    this._log('log', (0, _util().format)(firstArg, ...args));
   }
 
   time(label = 'default') {
@@ -168,8 +166,8 @@ class CustomConsole extends _console().Console {
     const startTime = this._timers[label];
 
     if (startTime) {
-      const endTime = new Date();
-      const time = endTime - startTime;
+      const endTime = new Date().getTime();
+      const time = endTime - startTime.getTime();
 
       this._log('time', (0, _util().format)(`${label}: ${time}ms`));
 
@@ -177,8 +175,8 @@ class CustomConsole extends _console().Console {
     }
   }
 
-  warn(...args) {
-    this._log('warn', (0, _util().format)(...args));
+  warn(firstArg, ...args) {
+    this._log('warn', (0, _util().format)(firstArg, ...args));
   }
 
   getBuffer() {
diff --git c/packages/jest-util/build/ErrorWithStack.js w/packages/jest-util/build/ErrorWithStack.js
index c7c6f1935..da7b9d2a1 100644
--- c/packages/jest-util/build/ErrorWithStack.js
+++ w/packages/jest-util/build/ErrorWithStack.js
@@ -10,8 +10,6 @@ exports.default = void 0;
  *
  * This source code is licensed under the MIT license found in the
  * LICENSE file in the root directory of this source tree.
- *
- *
  */
 class ErrorWithStack extends Error {
   constructor(message, callsite) {
diff --git c/packages/jest-util/build/FakeTimers.js w/packages/jest-util/build/FakeTimers.js
index 7ef55964c..69012086d 100644
--- c/packages/jest-util/build/FakeTimers.js
+++ w/packages/jest-util/build/FakeTimers.js
@@ -404,17 +404,11 @@ class FakeTimers {
     this._cancelledImmediates[uuid] = true;
   }
 
-  _fakeNextTick(callback) {
+  _fakeNextTick(callback, ...args) {
     if (this._disposed) {
       return;
     }
 
-    const args = [];
-
-    for (let ii = 1, ll = arguments.length; ii < ll; ii++) {
-      args.push(arguments[ii]);
-    }
-
     const uuid = String(this._uuidCounter++);
 
     this._ticks.push({
@@ -443,17 +437,11 @@ class FakeTimers {
     });
   }
 
-  _fakeSetImmediate(callback) {
+  _fakeSetImmediate(callback, ...args) {
     if (this._disposed) {
       return null;
     }
 
-    const args = [];
-
-    for (let ii = 1, ll = arguments.length; ii < ll; ii++) {
-      args.push(arguments[ii]);
-    }
-
     const uuid = this._uuidCounter++;
 
     this._immediates.push({
@@ -484,7 +472,7 @@ class FakeTimers {
     return uuid;
   }
 
-  _fakeSetInterval(callback, intervalDelay) {
+  _fakeSetInterval(callback, intervalDelay, ...args) {
     if (this._disposed) {
       return null;
     }
@@ -493,12 +481,6 @@ class FakeTimers {
       intervalDelay = 0;
     }
 
-    const args = [];
-
-    for (let ii = 2, ll = arguments.length; ii < ll; ii++) {
-      args.push(arguments[ii]);
-    }
-
     const uuid = this._uuidCounter++;
     this._timers[String(uuid)] = {
       callback: (function(_callback3) {
@@ -519,18 +501,12 @@ class FakeTimers {
     return this._timerConfig.idToRef(uuid);
   }
 
-  _fakeSetTimeout(callback, delay) {
+  _fakeSetTimeout(callback, delay, ...args) {
     if (this._disposed) {
       return null;
     } // eslint-disable-next-line no-bitwise
 
     delay = Number(delay) | 0;
-    const args = [];
-
-    for (let ii = 2, ll = arguments.length; ii < ll; ii++) {
-      args.push(arguments[ii]);
-    }
-
     const uuid = this._uuidCounter++;
     this._timers[String(uuid)] = {
       callback: (function(_callback4) {
@@ -545,7 +521,7 @@ class FakeTimers {
         return callback;
       })(() => callback.apply(null, args)),
       expiry: this._now + delay,
-      interval: null,
+      interval: undefined,
       type: 'timeout'
     };
     return this._timerConfig.idToRef(uuid);
@@ -584,7 +560,7 @@ class FakeTimers {
         break;
 
       case 'interval':
-        timer.expiry = this._now + timer.interval;
+        timer.expiry = this._now + (timer.interval || 0);
         timer.callback();
         break;
 
diff --git c/packages/jest-util/build/NullConsole.js w/packages/jest-util/build/NullConsole.js
index c74ce5a84..d0feaaf62 100644
--- c/packages/jest-util/build/NullConsole.js
+++ w/packages/jest-util/build/NullConsole.js
@@ -16,8 +16,6 @@ function _interopRequireDefault(obj) {
  *
  * This source code is licensed under the MIT license found in the
  * LICENSE file in the root directory of this source tree.
- *
- *
  */
 class NullConsole extends _CustomConsole.default {
   assert() {}
diff --git c/packages/jest-util/build/clearLine.js w/packages/jest-util/build/clearLine.js
index e4c943518..425f7d1d3 100644
--- c/packages/jest-util/build/clearLine.js
+++ w/packages/jest-util/build/clearLine.js
@@ -10,11 +10,7 @@ exports.default = void 0;
  *
  * This source code is licensed under the MIT license found in the
  * LICENSE file in the root directory of this source tree.
- *
- *
  */
-
-/* global stream$Writable */
 var _default = stream => {
   if (process.stdout.isTTY) {
     stream.write('\x1b[999D\x1b[K');
diff --git c/packages/jest-util/build/convertDescriptorToString.js w/packages/jest-util/build/convertDescriptorToString.js
index 040b18695..130fd68d9 100644
--- c/packages/jest-util/build/convertDescriptorToString.js
+++ w/packages/jest-util/build/convertDescriptorToString.js
@@ -10,8 +10,6 @@ exports.default = convertDescriptorToString;
  *
  * This source code is licensed under the MIT license found in the
  * LICENSE file in the root directory of this source tree.
- *
- *
  */
 // See: https://github.com/facebook/jest/pull/5154
 function convertDescriptorToString(descriptor) {
@@ -33,8 +31,9 @@ function convertDescriptorToString(descriptor) {
 
   const stringified = descriptor.toString();
   const typeDescriptorMatch = stringified.match(/class|function/);
-  const indexOfNameSpace =
-    typeDescriptorMatch.index + typeDescriptorMatch[0].length;
+  const indexOfNameSpace = // @ts-ignore
+    typeDescriptorMatch.index + typeDescriptorMatch[0].length; // @ts-ignore
+
   const indexOfNameAfterSpace = stringified.search(/\(|\{/, indexOfNameSpace);
   const name = stringified.substring(indexOfNameSpace, indexOfNameAfterSpace);
   return name.trim();
diff --git c/packages/jest-util/build/createDirectory.js w/packages/jest-util/build/createDirectory.js
index 10f36bc1f..5caa8c40e 100644
--- c/packages/jest-util/build/createDirectory.js
+++ w/packages/jest-util/build/createDirectory.js
@@ -24,8 +24,6 @@ function _interopRequireDefault(obj) {
  *
  * This source code is licensed under the MIT license found in the
  * LICENSE file in the root directory of this source tree.
- *
- *
  */
 function createDirectory(path) {
   try {
diff --git c/packages/jest-util/build/createProcessObject.js w/packages/jest-util/build/createProcessObject.js
index bb950e122..126aed5bb 100644
--- c/packages/jest-util/build/createProcessObject.js
+++ w/packages/jest-util/build/createProcessObject.js
@@ -16,8 +16,6 @@ function _interopRequireDefault(obj) {
  *
  * This source code is licensed under the MIT license found in the
  * LICENSE file in the root directory of this source tree.
- *
- *
  */
 const BLACKLIST = new Set(['env', 'mainModule', '_events']); // The "process.env" object has a bunch of particularities: first, it does not
 // directly extend from Object; second, it converts any assigned value to a
@@ -33,7 +31,7 @@ function createProcessEnv() {
   const real = Object.create(proto);
   const lookup = {};
   const proxy = new Proxy(real, {
-    deleteProperty(target, key) {
+    deleteProperty(_target, key) {
       for (const name in real) {
         if (real.hasOwnProperty(name)) {
           if (typeof key === 'string' && process.platform === 'win32') {
@@ -53,7 +51,7 @@ function createProcessEnv() {
       return true;
     },
 
-    get(target, key) {
+    get(_target, key) {
       if (typeof key === 'string' && process.platform === 'win32') {
         return lookup[key in proto ? key : key.toLowerCase()];
       } else {
@@ -61,7 +59,7 @@ function createProcessEnv() {
       }
     },
 
-    set(target, key, value) {
+    set(_target, key, value) {
       const strValue = '' + value;
 
       if (typeof key === 'string') {
diff --git c/packages/jest-util/build/deepCyclicCopy.js w/packages/jest-util/build/deepCyclicCopy.js
index 410494a47..3bbf028ee 100644
--- c/packages/jest-util/build/deepCyclicCopy.js
+++ w/packages/jest-util/build/deepCyclicCopy.js
@@ -10,23 +10,23 @@ exports.default = deepCyclicCopy;
  *
  * This source code is licensed under the MIT license found in the
  * LICENSE file in the root directory of this source tree.
- *
- *
  */
 const EMPTY = new Set();
 
-// $FlowFixMe: Node 6 does not have gOPDs, so we define a simple polyfill for it.
+// Node 6 does not have gOPDs, so we define a simple polyfill for it.
 if (!Object.getOwnPropertyDescriptors) {
-  // $FlowFixMe: polyfill
+  // @ts-ignore: polyfill
   Object.getOwnPropertyDescriptors = obj => {
     const list = {};
-    Object.getOwnPropertyNames(obj)
-      .concat(Object.getOwnPropertySymbols(obj)) // $FlowFixMe: assignment with a Symbol is OK.
+    Object.getOwnPropertyNames(obj) // @ts-ignore: assignment with a Symbol is OK.
+      .concat(Object.getOwnPropertySymbols(obj))
       .forEach(key => (list[key] = Object.getOwnPropertyDescriptor(obj, key)));
     return list;
   };
 }
 
+Symbol.for('hello');
+
 function deepCyclicCopy(
   value,
   options = {
@@ -78,7 +78,7 @@ function deepCyclicCopyObject(object, options, cycles) {
 }
 
 function deepCyclicCopyArray(array, options, cycles) {
-  const newArray = options.keepPrototype // $FlowFixMe: getPrototypeOf an array is OK.
+  const newArray = options.keepPrototype
     ? new (Object.getPrototypeOf(array)).constructor(array.length)
     : [];
   const length = array.length;
diff --git c/packages/jest-util/build/formatTestResults.js w/packages/jest-util/build/formatTestResults.js
index 1994ce21d..4887e9343 100644
--- c/packages/jest-util/build/formatTestResults.js
+++ w/packages/jest-util/build/formatTestResults.js
@@ -10,8 +10,6 @@ exports.default = formatTestResults;
  *
  * This source code is licensed under the MIT license found in the
  * LICENSE file in the root directory of this source tree.
- *
- *
  */
 const formatResult = (testResult, codeCoverageFormatter, reporter) => {
   const now = Date.now();
diff --git c/packages/jest-util/build/getCallsite.js w/packages/jest-util/build/getCallsite.js
index 2e54e4317..f9f733813 100644
--- c/packages/jest-util/build/getCallsite.js
+++ w/packages/jest-util/build/getCallsite.js
@@ -44,8 +44,6 @@ function _interopRequireDefault(obj) {
  *
  * This source code is licensed under the MIT license found in the
  * LICENSE file in the root directory of this source tree.
- *
- *
  */
 // Copied from https://github.com/rexxars/sourcemap-decorate-callsites/blob/5b9735a156964973a75dc62fd2c7f0c1975458e8/lib/index.js#L113-L158
 const addSourceMapConsumer = (callsite, consumer) => {
@@ -56,8 +54,8 @@ const addSourceMapConsumer = (callsite, consumer) => {
   function getPosition() {
     if (!position) {
       position = consumer.originalPositionFor({
-        column: getColumnNumber.call(callsite),
-        line: getLineNumber.call(callsite)
+        column: getColumnNumber.call(callsite) || -1,
+        line: getLineNumber.call(callsite) || -1
       });
     }
 
@@ -85,14 +83,14 @@ const addSourceMapConsumer = (callsite, consumer) => {
 var _default = (level, sourceMaps) => {
   const levelAfterThisCall = level + 1;
   const stack = (0, _callsites().default)()[levelAfterThisCall];
-  const sourceMapFileName = sourceMaps && sourceMaps[stack.getFileName()];
+  const sourceMapFileName = sourceMaps && sourceMaps[stack.getFileName() || ''];
 
   if (sourceMapFileName) {
     try {
       const sourceMap = _gracefulFs().default.readFileSync(
         sourceMapFileName,
         'utf8'
-      );
+      ); // @ts-ignore: Not allowed to pass string
 
       addSourceMapConsumer(
         stack,
diff --git c/packages/jest-util/build/getConsoleOutput.js w/packages/jest-util/build/getConsoleOutput.js
index 3acf84da7..3774196a6 100644
--- c/packages/jest-util/build/getConsoleOutput.js
+++ w/packages/jest-util/build/getConsoleOutput.js
@@ -44,8 +44,6 @@ function _interopRequireDefault(obj) {
  *
  * This source code is licensed under the MIT license found in the
  * LICENSE file in the root directory of this source tree.
- *
- *
  */
 var _default = (root, verbose, buffer) => {
   const TITLE_INDENT = verbose ? '  ' : '    ';
diff --git c/packages/jest-util/build/getFailedSnapshotTests.js w/packages/jest-util/build/getFailedSnapshotTests.js
index 6b061c2f8..f24176d10 100644
--- c/packages/jest-util/build/getFailedSnapshotTests.js
+++ w/packages/jest-util/build/getFailedSnapshotTests.js
@@ -10,8 +10,6 @@ exports.default = void 0;
  *
  * This source code is licensed under the MIT license found in the
  * LICENSE file in the root directory of this source tree.
- *
- *
  */
 function getFailedSnapshotTests(testResults) {
   const failedTestPaths = [];
diff --git c/packages/jest-util/build/index.js w/packages/jest-util/build/index.js
index 4c34a775c..173e186fc 100644
--- c/packages/jest-util/build/index.js
+++ w/packages/jest-util/build/index.js
@@ -78,8 +78,6 @@ function _interopRequireDefault(obj) {
  *
  * This source code is licensed under the MIT license found in the
  * LICENSE file in the root directory of this source tree.
- *
- *
  */
 module.exports = {
   BufferedConsole: _BufferedConsole.default,
diff --git c/packages/jest-util/build/installCommonGlobals.js w/packages/jest-util/build/installCommonGlobals.js
index 528b1a647..34cdd7967 100644
--- c/packages/jest-util/build/installCommonGlobals.js
+++ w/packages/jest-util/build/installCommonGlobals.js
@@ -30,8 +30,6 @@ function _interopRequireDefault(obj) {
  *
  * This source code is licensed under the MIT license found in the
  * LICENSE file in the root directory of this source tree.
- *
- *
  */
 const DTRACE = Object.keys(global).filter(key => key.startsWith('DTRACE'));
 
@@ -73,7 +71,9 @@ function _default(globalObject, globals) {
   }); // Forward some APIs.
 
   DTRACE.forEach(dtrace => {
+    // @ts-ignore
     globalObject[dtrace] = function(...args) {
+      // @ts-ignore
       return global[dtrace].apply(this, args);
     };
   }); // Forward some others (this breaks the sandbox but for now it's OK).
diff --git c/packages/jest-util/build/isInteractive.js w/packages/jest-util/build/isInteractive.js
index 068b36c2f..9c1bf160e 100644
--- c/packages/jest-util/build/isInteractive.js
+++ w/packages/jest-util/build/isInteractive.js
@@ -21,6 +21,6 @@ function _interopRequireDefault(obj) {
 
 // Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
 var _default =
-  process.stdout.isTTY && process.env.TERM !== 'dumb' && !_isCi().default;
+  !!process.stdout.isTTY && process.env.TERM !== 'dumb' && !_isCi().default;
 
 exports.default = _default;
diff --git c/packages/jest-util/build/replacePathSepForGlob.js w/packages/jest-util/build/replacePathSepForGlob.js
index d1f0e3f75..b7a1d0f90 100644
--- c/packages/jest-util/build/replacePathSepForGlob.js
+++ w/packages/jest-util/build/replacePathSepForGlob.js
@@ -10,8 +10,6 @@ exports.default = replacePathSepForGlob;
  *
  * This source code is licensed under the MIT license found in the
  * LICENSE file in the root directory of this source tree.
- *
- *
  */
 function replacePathSepForGlob(path) {
   return path.replace(/\\(?![{}()+?.^$])/g, '/');
diff --git c/packages/jest-util/build/setGlobal.js w/packages/jest-util/build/setGlobal.js
index b5d1af5d4..3ff3cc67a 100644
--- c/packages/jest-util/build/setGlobal.js
+++ w/packages/jest-util/build/setGlobal.js
@@ -10,9 +10,10 @@ exports.default = void 0;
  *
  * This source code is licensed under the MIT license found in the
  * LICENSE file in the root directory of this source tree.
- *
- *
  */
-var _default = (global, key, value) => (global[key] = value);
+var _default = (globalToMutate, key, value) => {
+  // @ts-ignore: no index
+  globalToMutate[key] = value;
+};
 
 exports.default = _default;
diff --git c/packages/jest-util/build/specialChars.js w/packages/jest-util/build/specialChars.js
index 1497c4407..1f9ddcc4e 100644
--- c/packages/jest-util/build/specialChars.js
+++ w/packages/jest-util/build/specialChars.js
@@ -10,8 +10,6 @@ exports.CLEAR = exports.ICONS = exports.ARROW = void 0;
  *
  * This source code is licensed under the MIT license found in the
  * LICENSE file in the root directory of this source tree.
- *
- *
  */
 const isWindows = process.platform === 'win32';
 const ARROW = ' \u203A ';

Test plan

Green CI

packages/jest-util/src/CustomConsole.ts Show resolved Hide resolved
packages/jest-util/src/FakeTimers.ts Show resolved Hide resolved
packages/jest-util/src/FakeTimers.ts Show resolved Hide resolved
packages/jest-util/src/convertDescriptorToString.ts Outdated Show resolved Hide resolved
packages/jest-util/src/isInteractive.ts Show resolved Hide resolved
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants