From 90ef733a447ad54a8836bb4078f0a065d8876fe0 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Fri, 29 Dec 2023 17:15:04 +0100 Subject: [PATCH] chore: use consistent casing in escape characters (#14806) --- .eslintrc.cjs | 7 ++-- e2e/__tests__/coverageHandlebars.test.ts | 2 +- e2e/__tests__/coverageRemapping.test.ts | 2 +- .../coverageTransformInstrumented.test.ts | 2 +- e2e/__tests__/watchModeNoAccess.test.ts | 2 +- .../reporters/TestReporter.js | 2 +- packages/create-jest/src/runCreate.ts | 2 +- packages/jest-config/src/utils.ts | 2 +- packages/jest-haste-map/src/crawlers/node.ts | 2 +- .../__snapshots__/messages.test.ts.snap | 10 +++--- .../src/__tests__/messages.test.ts | 1 + packages/jest-message-util/src/index.ts | 2 +- .../jest-reporters/src/DefaultReporter.ts | 2 +- packages/jest-reporters/src/wrapAnsiString.ts | 2 +- packages/jest-resolve/src/utils.ts | 2 +- .../__tests__/runtime_require_resolve.test.ts | 6 ++-- .../src/__tests__/InlineSnapshots.test.ts | 36 +++++++++---------- .../src/runtimeErrorsAndWarnings.ts | 2 +- packages/jest-util/src/clearLine.ts | 2 +- packages/jest-validate/src/utils.ts | 2 +- .../jest-validate/src/validateCLIOptions.ts | 2 +- packages/jest-watcher/src/constants.ts | 10 +++--- .../workers/__tests__/WorkerEdgeCases.test.ts | 4 +-- scripts/checkChangelog.mjs | 2 +- scripts/checkCopyrightHeaders.mjs | 4 +-- 25 files changed, 54 insertions(+), 58 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index c06d9390ba68..13ce9c082b26 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -33,9 +33,9 @@ module.exports = { 'plugin:markdown/recommended', 'plugin:import/errors', 'plugin:eslint-comments/recommended', - 'plugin:prettier/recommended', 'plugin:unicorn/recommended', 'plugin:promise/recommended', + 'plugin:prettier/recommended', ], globals: { console: 'readonly', @@ -424,6 +424,7 @@ module.exports = { rules: { 'unicorn/prefer-code-point': 'off', 'unicorn/prefer-optional-catch-binding': 'off', + 'unicorn/text-encoding-identifier-case': 'off', }, }, { @@ -670,7 +671,6 @@ module.exports = { // nah 'unicorn/consistent-destructuring': 'off', - 'unicorn/no-nested-ternary': 'off', 'unicorn/no-lonely-if': 'off', 'unicorn/no-null': 'off', 'unicorn/no-process-exit': 'off', @@ -688,7 +688,6 @@ module.exports = { 'unicorn/catch-error-name': 'off', 'unicorn/consistent-function-scoping': 'off', 'unicorn/error-message': 'off', - 'unicorn/escape-case': 'off', 'unicorn/no-await-expression-member': 'off', 'unicorn/no-console-spaces': 'off', 'unicorn/no-empty-file': 'off', @@ -699,7 +698,6 @@ module.exports = { 'unicorn/no-typeof-undefined': 'off', 'unicorn/no-useless-promise-resolve-reject': 'off', 'unicorn/no-useless-undefined': 'off', - 'unicorn/number-literal-case': 'off', 'unicorn/prefer-date-now': 'off', 'unicorn/prefer-logical-operator-over-ternary': 'off', 'unicorn/prefer-math-trunc': 'off', @@ -710,7 +708,6 @@ module.exports = { 'unicorn/prefer-spread': 'off', 'unicorn/prefer-string-replace-all': 'off', 'unicorn/prevent-abbreviations': 'off', - 'unicorn/text-encoding-identifier-case': 'off', // enabling this is blocked by https://github.com/microsoft/rushstack/issues/2780 'unicorn/prefer-export-from': 'off', diff --git a/e2e/__tests__/coverageHandlebars.test.ts b/e2e/__tests__/coverageHandlebars.test.ts index 015ced1a09a6..91173419db50 100644 --- a/e2e/__tests__/coverageHandlebars.test.ts +++ b/e2e/__tests__/coverageHandlebars.test.ts @@ -25,7 +25,7 @@ it('code coverage for Handlebars', () => { expect(result.stdout).toMatchSnapshot(); const coverageMapFile = path.join(coverageDir, 'coverage-final.json'); - const coverageMap = JSON.parse(readFileSync(coverageMapFile, 'utf-8')); + const coverageMap = JSON.parse(readFileSync(coverageMapFile, 'utf8')); expect( Object.keys(coverageMap).map(filename => path.basename(filename)), diff --git a/e2e/__tests__/coverageRemapping.test.ts b/e2e/__tests__/coverageRemapping.test.ts index f37282ab2da5..c0574db35f01 100644 --- a/e2e/__tests__/coverageRemapping.test.ts +++ b/e2e/__tests__/coverageRemapping.test.ts @@ -24,7 +24,7 @@ it('maps code coverage against original source', () => { expect(result.exitCode).toBe(0); const coverageMapFile = path.join(coverageDir, 'coverage-final.json'); - const coverageMap = JSON.parse(readFileSync(coverageMapFile, 'utf-8')); + const coverageMap = JSON.parse(readFileSync(coverageMapFile, 'utf8')); // reduce absolute paths embedded in the coverage map to just filenames for (const filename of Object.keys(coverageMap)) { diff --git a/e2e/__tests__/coverageTransformInstrumented.test.ts b/e2e/__tests__/coverageTransformInstrumented.test.ts index 8704a81c6f32..592e3a1ed1b4 100644 --- a/e2e/__tests__/coverageTransformInstrumented.test.ts +++ b/e2e/__tests__/coverageTransformInstrumented.test.ts @@ -24,7 +24,7 @@ it('code coverage for transform instrumented code', () => { expect(result.exitCode).toBe(0); const coverageMapFile = path.join(coverageDir, 'coverage-final.json'); - const coverageMap = JSON.parse(readFileSync(coverageMapFile, 'utf-8')); + const coverageMap = JSON.parse(readFileSync(coverageMapFile, 'utf8')); // reduce absolute paths embedded in the coverage map to just filenames for (const filename of Object.keys(coverageMap)) { diff --git a/e2e/__tests__/watchModeNoAccess.test.ts b/e2e/__tests__/watchModeNoAccess.test.ts index f1b262033142..2a521a1f492e 100644 --- a/e2e/__tests__/watchModeNoAccess.test.ts +++ b/e2e/__tests__/watchModeNoAccess.test.ts @@ -81,6 +81,6 @@ test('does not re-run tests when only access time is modified', async () => { expect(numberOfTestRuns(testRun.getCurrentOutput().stderr)).toBe(2); // Should re-run the test - fs.writeFileSync(modulePath, 'module.exports = 1;', {encoding: 'utf-8'}); + fs.writeFileSync(modulePath, 'module.exports = 1;', 'utf8'); await testRun.waitUntil(({stderr}) => numberOfTestRuns(stderr) === 3); }); diff --git a/e2e/custom-reporters/reporters/TestReporter.js b/e2e/custom-reporters/reporters/TestReporter.js index 1db153329d0e..8ea2d81ec5d3 100644 --- a/e2e/custom-reporters/reporters/TestReporter.js +++ b/e2e/custom-reporters/reporters/TestReporter.js @@ -42,7 +42,7 @@ class TestReporter { */ clearLine() { if (process.stdout.isTTY) { - process.stderr.write('\x1b[999D\x1b[K'); + process.stderr.write('\x1B[999D\x1B[K'); } } diff --git a/packages/create-jest/src/runCreate.ts b/packages/create-jest/src/runCreate.ts index c379981593c1..7776f484d378 100644 --- a/packages/create-jest/src/runCreate.ts +++ b/packages/create-jest/src/runCreate.ts @@ -62,7 +62,7 @@ export async function runCreate(rootDir = process.cwd()): Promise { try { projectPackageJson = JSON.parse( - fs.readFileSync(projectPackageJsonPath, 'utf-8'), + fs.readFileSync(projectPackageJsonPath, 'utf8'), ) as ProjectPackageJson; } catch { throw new MalformedPackageJsonError(projectPackageJsonPath); diff --git a/packages/jest-config/src/utils.ts b/packages/jest-config/src/utils.ts index 220f57f1495d..51d4ec0fd6fe 100644 --- a/packages/jest-config/src/utils.ts +++ b/packages/jest-config/src/utils.ts @@ -17,7 +17,7 @@ type ResolveOptions = { optional?: boolean; }; -export const BULLET: string = chalk.bold('\u25cf '); +export const BULLET: string = chalk.bold('\u25CF '); export const DOCUMENTATION_NOTE = ` ${chalk.bold( 'Configuration Documentation:', )} diff --git a/packages/jest-haste-map/src/crawlers/node.ts b/packages/jest-haste-map/src/crawlers/node.ts index f06dcb86a760..320227906dda 100644 --- a/packages/jest-haste-map/src/crawlers/node.ts +++ b/packages/jest-haste-map/src/crawlers/node.ts @@ -164,7 +164,7 @@ function findNative( 'stdout is null - this should never happen. Please open up an issue at https://github.com/jestjs/jest', ); } - child.stdout.setEncoding('utf-8'); + child.stdout.setEncoding('utf8'); child.stdout.on('data', data => (stdout += data)); child.stdout.on('close', () => { diff --git a/packages/jest-message-util/src/__tests__/__snapshots__/messages.test.ts.snap b/packages/jest-message-util/src/__tests__/__snapshots__/messages.test.ts.snap index 49dc55e198bc..06603971e83f 100644 --- a/packages/jest-message-util/src/__tests__/__snapshots__/messages.test.ts.snap +++ b/packages/jest-message-util/src/__tests__/__snapshots__/messages.test.ts.snap @@ -116,16 +116,16 @@ exports[`on node >=15.0.0 should return the inner errors of an AggregateError 1` AggregateError: - at Object. (packages/jest-message-util/src/__tests__/messages.test.ts:586:22) + at Object. (packages/jest-message-util/src/__tests__/messages.test.ts:587:22) Errors contained in AggregateError: Err 1 - at Object. (packages/jest-message-util/src/__tests__/messages.test.ts:587:7) + at Object. (packages/jest-message-util/src/__tests__/messages.test.ts:588:7) Err 2 - at Object. (packages/jest-message-util/src/__tests__/messages.test.ts:588:7) + at Object. (packages/jest-message-util/src/__tests__/messages.test.ts:589:7) " `; @@ -177,12 +177,12 @@ exports[`should return the error cause if there is one 1`] = ` Test exception - at Object. (packages/jest-message-util/src/__tests__/messages.test.ts:565:17) + at Object. (packages/jest-message-util/src/__tests__/messages.test.ts:566:17) Cause: Cause Error - at Object. (packages/jest-message-util/src/__tests__/messages.test.ts:568:17) + at Object. (packages/jest-message-util/src/__tests__/messages.test.ts:569:17) " `; diff --git a/packages/jest-message-util/src/__tests__/messages.test.ts b/packages/jest-message-util/src/__tests__/messages.test.ts index 3f3528c9c45a..08b4de246e76 100644 --- a/packages/jest-message-util/src/__tests__/messages.test.ts +++ b/packages/jest-message-util/src/__tests__/messages.test.ts @@ -78,6 +78,7 @@ const vendorStack = const babelStack = ' ' + + // eslint-disable-next-line unicorn/escape-case ` packages/react/src/forwardRef.js: Unexpected token, expected , (20:10) \u001b[0m \u001b[90m 18 | \u001b[39m \u001b[36mfalse\u001b[39m\u001b[33m,\u001b[39m diff --git a/packages/jest-message-util/src/index.ts b/packages/jest-message-util/src/index.ts index 055f611c4ba3..f51b7def8187 100644 --- a/packages/jest-message-util/src/index.ts +++ b/packages/jest-message-util/src/index.ts @@ -58,7 +58,7 @@ const TITLE_INDENT = ' '; const MESSAGE_INDENT = ' '; const STACK_INDENT = ' '; const ANCESTRY_SEPARATOR = ' \u203A '; -const TITLE_BULLET = chalk.bold('\u25cf '); +const TITLE_BULLET = chalk.bold('\u25CF '); const STACK_TRACE_COLOR = chalk.dim; const STACK_PATH_REGEXP = /\s*at.*\(?(:\d*:\d*|native)\)?/; const EXEC_ERROR_MESSAGE = 'Test suite failed to run'; diff --git a/packages/jest-reporters/src/DefaultReporter.ts b/packages/jest-reporters/src/DefaultReporter.ts index aa3ac5c86b9f..288aafb26bd9 100644 --- a/packages/jest-reporters/src/DefaultReporter.ts +++ b/packages/jest-reporters/src/DefaultReporter.ts @@ -30,7 +30,7 @@ import type {ReporterOnStartOptions} from './types'; type write = WriteStream['write']; type FlushBufferedOutput = () => void; -const TITLE_BULLET = chalk.bold('\u25cf '); +const TITLE_BULLET = chalk.bold('\u25CF '); export default class DefaultReporter extends BaseReporter { private _clear: string; // ANSI clear sequence for the last printed status diff --git a/packages/jest-reporters/src/wrapAnsiString.ts b/packages/jest-reporters/src/wrapAnsiString.ts index a5cf57ddcff3..233a53260140 100644 --- a/packages/jest-reporters/src/wrapAnsiString.ts +++ b/packages/jest-reporters/src/wrapAnsiString.ts @@ -16,7 +16,7 @@ export default function wrapAnsiString( return string; } - const ANSI_REGEXP = /[\u001b\u009b]\[\d{1,2}m/gu; + const ANSI_REGEXP = /[\u001B\u009B]\[\d{1,2}m/gu; const tokens = []; let lastIndex = 0; let match; diff --git a/packages/jest-resolve/src/utils.ts b/packages/jest-resolve/src/utils.ts index 3ec15a9c7bb9..979a2f0921ac 100644 --- a/packages/jest-resolve/src/utils.ts +++ b/packages/jest-resolve/src/utils.ts @@ -10,7 +10,7 @@ import chalk = require('chalk'); import {ValidationError} from 'jest-validate'; import Resolver from './resolver'; -const BULLET: string = chalk.bold('\u25cf '); +const BULLET: string = chalk.bold('\u25CF '); const DOCUMENTATION_NOTE = ` ${chalk.bold('Configuration Documentation:')} https://jestjs.io/docs/configuration `; diff --git a/packages/jest-runtime/src/__tests__/runtime_require_resolve.test.ts b/packages/jest-runtime/src/__tests__/runtime_require_resolve.test.ts index 308895826d0d..9e8a0fac4ab9 100644 --- a/packages/jest-runtime/src/__tests__/runtime_require_resolve.test.ts +++ b/packages/jest-runtime/src/__tests__/runtime_require_resolve.test.ts @@ -40,7 +40,7 @@ describe('Runtime require.resolve', () => { await fs.writeFile( absoluteFilePath, 'module.exports = require.resolve(__filename);', - 'utf-8', + 'utf8', ); const runtime = await createRuntime(__filename); @@ -66,10 +66,10 @@ describe('Runtime require.resolve', () => { `module.exports = require.resolve(${JSON.stringify( target, )}, {paths: []});`, - 'utf-8', + 'utf8', ); - await fs.writeFile(target, 'module.exports = {}', 'utf-8'); + await fs.writeFile(target, 'module.exports = {}', 'utf8'); const runtime = await createRuntime(__filename); const resolved = runtime.requireModule(runtime.__mockRootPath, entrypoint); diff --git a/packages/jest-snapshot/src/__tests__/InlineSnapshots.test.ts b/packages/jest-snapshot/src/__tests__/InlineSnapshots.test.ts index 47e2153cd919..383b08c69ce3 100644 --- a/packages/jest-snapshot/src/__tests__/InlineSnapshots.test.ts +++ b/packages/jest-snapshot/src/__tests__/InlineSnapshots.test.ts @@ -58,7 +58,7 @@ test('saveInlineSnapshots() replaces empty function call with a template literal 'prettier', ); - expect(fs.readFileSync(filename, 'utf-8')).toBe( + expect(fs.readFileSync(filename, 'utf8')).toBe( 'expect(1).toMatchInlineSnapshot(`1`);\n', ); }); @@ -187,7 +187,7 @@ it('foos', async () => { null, ); - expect(fs.readFileSync(filename, 'utf-8')).toBe( + expect(fs.readFileSync(filename, 'utf8')).toBe( `${` it('foos', async () => { const Foo = (props: { foo: string }) =>
{props.foo}
; @@ -229,7 +229,7 @@ expect(a).toMatchInlineSnapshot(); null, ); - expect(fs.readFileSync(filename, 'utf-8')).toBe( + expect(fs.readFileSync(filename, 'utf8')).toBe( `${` const Foo = (props: { foo: string }) =>
{props.foo}
; const a = Foo({ foo: "hello" }); @@ -260,7 +260,7 @@ expect(a).toMatchInlineSnapshot(\`[1, 2]\`); 'prettier', ); - expect(fs.readFileSync(filename, 'utf-8')).toBe( + expect(fs.readFileSync(filename, 'utf8')).toBe( `const a = [1, 2]; expect(a).toMatchInlineSnapshot(\`[1, 2]\`); expect(a).toMatchInlineSnapshot(\`[1, 2]\`); @@ -292,7 +292,7 @@ test.each([['babel'], ['flow'], ['typescript']])( jest.mocked(prettier.resolveConfig.sync).mock.results[0].value, ).toEqual({parser}); - expect(fs.readFileSync(filename, 'utf-8')).toBe( + expect(fs.readFileSync(filename, 'utf8')).toBe( 'expect(1).toMatchInlineSnapshot(`1`);\n', ); }, @@ -313,7 +313,7 @@ test('saveInlineSnapshots() replaces existing template literal with property mat 'prettier', ); - expect(fs.readFileSync(filename, 'utf-8')).toBe( + expect(fs.readFileSync(filename, 'utf8')).toBe( 'expect(1).toMatchInlineSnapshot({}, `1`);\n', ); }); @@ -335,7 +335,7 @@ test.each(['prettier', null])( prettierModule, ); - expect(fs.readFileSync(filename, 'utf-8')).toBe( + expect(fs.readFileSync(filename, 'utf8')).toBe( 'expect(1).toMatchInlineSnapshot({}, `1`);\n', ); }, @@ -391,7 +391,7 @@ test('saveInlineSnapshots() uses escaped backticks', () => { const frame = {column: 13, file: filename, line: 1} as Frame; saveInlineSnapshots([{frame, snapshot: '`'}], dir, 'prettier'); - expect(fs.readFileSync(filename, 'utf-8')).toBe( + expect(fs.readFileSync(filename, 'utf8')).toBe( 'expect("`").toMatchInlineSnapshot(`\\``);\n', ); }); @@ -415,7 +415,7 @@ test('saveInlineSnapshots() works with non-literals in expect call', () => { 'prettier', ); - expect(fs.readFileSync(filename, 'utf-8')).toBe( + expect(fs.readFileSync(filename, 'utf8')).toBe( "expect({a: 'a'}).toMatchInlineSnapshot(`{a: 'a'}`);\n", ); }); @@ -444,7 +444,7 @@ test('saveInlineSnapshots() indents multi-line snapshots with spaces', () => { 'prettier', ); - expect(fs.readFileSync(filename, 'utf-8')).toBe( + expect(fs.readFileSync(filename, 'utf8')).toBe( "it('is a test', () => {\n" + " expect({a: 'a'}).toMatchInlineSnapshot(`\n" + ' Object {\n' + @@ -487,7 +487,7 @@ test('saveInlineSnapshots() does not re-indent error snapshots', () => { 'prettier', ); - expect(fs.readFileSync(filename, 'utf-8')).toBe( + expect(fs.readFileSync(filename, 'utf8')).toBe( "it('is an error test', () => {\n" + ' expect(() => {\n' + " throw new Error(['a', 'b'].join('\\n'));\n" + @@ -537,7 +537,7 @@ test('saveInlineSnapshots() does not re-indent already indented snapshots', () = 'prettier', ); - expect(fs.readFileSync(filename, 'utf-8')).toBe( + expect(fs.readFileSync(filename, 'utf8')).toBe( "it('is a test', () => {\n" + " expect({a: 'a'}).toMatchInlineSnapshot(`\n" + ' Object {\n' + @@ -580,7 +580,7 @@ test('saveInlineSnapshots() indents multi-line snapshots with tabs', () => { 'prettier', ); - expect(fs.readFileSync(filename, 'utf-8')).toBe( + expect(fs.readFileSync(filename, 'utf8')).toBe( "it('is a test', () => {\n" + "\texpect({a: 'a'}).toMatchInlineSnapshot(`\n" + '\t\tObject {\n' + @@ -613,7 +613,7 @@ test('saveInlineSnapshots() indents snapshots after prettier reformats', () => { 'prettier', ); - expect(fs.readFileSync(filename, 'utf-8')).toBe( + expect(fs.readFileSync(filename, 'utf8')).toBe( "it('is a test', () =>\n" + " expect({a: 'a'}).toMatchInlineSnapshot(`\n" + ' Object {\n' + @@ -645,7 +645,7 @@ test('saveInlineSnapshots() does not indent empty lines', () => { 'prettier', ); - expect(fs.readFileSync(filename, 'utf-8')).toBe( + expect(fs.readFileSync(filename, 'utf8')).toBe( "it('is a test', () =>\n" + ' expect(`hello\n\nworld`).toMatchInlineSnapshot(`\n' + ' hello\n' + @@ -680,7 +680,7 @@ test('saveInlineSnapshots() indents awaited snapshots with spaces', () => { 'prettier', ); - expect(fs.readFileSync(filename, 'utf-8')).toBe( + expect(fs.readFileSync(filename, 'utf8')).toBe( "it('is a test', async () => {\n" + " const a = Promise.resolve({a: 'a'});\n" + ' await expect(a).resolves.toMatchInlineSnapshot(`\n' + @@ -722,7 +722,7 @@ test('saveInlineSnapshots() prioritize parser from project/editor configuration' ); expect(prettierSpy).not.toHaveBeenCalled(); - expect(fs.readFileSync(filename, 'utf-8')).toBe( + expect(fs.readFileSync(filename, 'utf8')).toBe( 'const foo = {\n' + ' "1": "Some value",\n' + '};\n' + @@ -747,7 +747,7 @@ test('saveInlineSnapshots() replaces string literal, not just template literal', 'prettier', ); - expect(fs.readFileSync(filename, 'utf-8')).toBe( + expect(fs.readFileSync(filename, 'utf8')).toBe( 'expect("a").toMatchInlineSnapshot(`a`);\n', ); }); diff --git a/packages/jest-transform/src/runtimeErrorsAndWarnings.ts b/packages/jest-transform/src/runtimeErrorsAndWarnings.ts index 0d6d816c6f25..3d34830b5701 100644 --- a/packages/jest-transform/src/runtimeErrorsAndWarnings.ts +++ b/packages/jest-transform/src/runtimeErrorsAndWarnings.ts @@ -8,7 +8,7 @@ import chalk = require('chalk'); import slash = require('slash'); -const BULLET = '\u25cf '; +const BULLET = '\u25CF '; const DOCUMENTATION_NOTE = ` ${chalk.bold( 'Code Transformation Documentation:', )} diff --git a/packages/jest-util/src/clearLine.ts b/packages/jest-util/src/clearLine.ts index 5a87a7c422a8..876a58d48cd0 100644 --- a/packages/jest-util/src/clearLine.ts +++ b/packages/jest-util/src/clearLine.ts @@ -9,6 +9,6 @@ import type {WriteStream} from 'tty'; export default function clearLine(stream: WriteStream): void { if (stream.isTTY) { - stream.write('\x1b[999D\x1b[K'); + stream.write('\x1B[999D\x1B[K'); } } diff --git a/packages/jest-validate/src/utils.ts b/packages/jest-validate/src/utils.ts index 7bcd0670b379..daa40d659737 100644 --- a/packages/jest-validate/src/utils.ts +++ b/packages/jest-validate/src/utils.ts @@ -9,7 +9,7 @@ import chalk = require('chalk'); import leven from 'leven'; import {format as prettyFormat} from 'pretty-format'; -const BULLET: string = chalk.bold('\u25cf'); +const BULLET: string = chalk.bold('\u25CF'); export const DEPRECATION = `${BULLET} Deprecation Warning`; export const ERROR = `${BULLET} Validation Error`; export const WARNING = `${BULLET} Validation Warning`; diff --git a/packages/jest-validate/src/validateCLIOptions.ts b/packages/jest-validate/src/validateCLIOptions.ts index 405e1f178a25..e779e4a2e7e7 100644 --- a/packages/jest-validate/src/validateCLIOptions.ts +++ b/packages/jest-validate/src/validateCLIOptions.ts @@ -21,7 +21,7 @@ import { logValidationWarning, } from './utils'; -const BULLET: string = chalk.bold('\u25cf'); +const BULLET: string = chalk.bold('\u25CF'); export const DOCUMENTATION_NOTE = ` ${chalk.bold('CLI Options Documentation:')} https://jestjs.io/docs/cli `; diff --git a/packages/jest-watcher/src/constants.ts b/packages/jest-watcher/src/constants.ts index 4341bf717512..2f2906623ff3 100644 --- a/packages/jest-watcher/src/constants.ts +++ b/packages/jest-watcher/src/constants.ts @@ -8,14 +8,14 @@ const isWindows = process.platform === 'win32'; export const KEYS = { - ARROW_DOWN: '\u001b[B', - ARROW_LEFT: '\u001b[D', - ARROW_RIGHT: '\u001b[C', - ARROW_UP: '\u001b[A', + ARROW_DOWN: '\u001B[B', + ARROW_LEFT: '\u001B[D', + ARROW_RIGHT: '\u001B[C', + ARROW_UP: '\u001B[A', BACKSPACE: Buffer.from(isWindows ? '08' : '7f', 'hex').toString(), CONTROL_C: '\u0003', CONTROL_D: '\u0004', CONTROL_U: '\u0015', ENTER: '\r', - ESCAPE: '\u001b', + ESCAPE: '\u001B', }; diff --git a/packages/jest-worker/src/workers/__tests__/WorkerEdgeCases.test.ts b/packages/jest-worker/src/workers/__tests__/WorkerEdgeCases.test.ts index 32dd72fbcdeb..c026e8f1ede7 100644 --- a/packages/jest-worker/src/workers/__tests__/WorkerEdgeCases.test.ts +++ b/packages/jest-worker/src/workers/__tests__/WorkerEdgeCases.test.ts @@ -39,9 +39,7 @@ beforeAll(async () => { const result = await transformFileAsync(sourcePath); - await writeFile(writePath, result!.code!, { - encoding: 'utf-8', - }); + await writeFile(writePath, result!.code!, 'utf8'); } }); diff --git a/scripts/checkChangelog.mjs b/scripts/checkChangelog.mjs index 9eb9b738acc6..65c83ea29e9d 100644 --- a/scripts/checkChangelog.mjs +++ b/scripts/checkChangelog.mjs @@ -11,7 +11,7 @@ const linkRegex = /\[#(\d+)]\(https:\/\/github.com\/facebook\/jest\/(issues|pull)\/(\d+)\)/g; const changelogPath = 'CHANGELOG.md'; -const data = fs.readFileSync(changelogPath, 'utf-8'); +const data = fs.readFileSync(changelogPath, 'utf8'); let error = false; let lineNumber = 1; diff --git a/scripts/checkCopyrightHeaders.mjs b/scripts/checkCopyrightHeaders.mjs index fb29e03dc1a2..11fa7bfdedba 100755 --- a/scripts/checkCopyrightHeaders.mjs +++ b/scripts/checkCopyrightHeaders.mjs @@ -9,7 +9,7 @@ import {execSync} from 'child_process'; import fs from 'graceful-fs'; import {isBinaryFileSync} from 'isbinaryfile'; -const getFileContents = path => fs.readFileSync(path, {encoding: 'utf-8'}); +const getFileContents = path => fs.readFileSync(path, 'utf8'); const isDirectory = path => fs.lstatSync(path).isDirectory(); const createRegExp = pattern => new RegExp(pattern); @@ -130,7 +130,7 @@ function needsCopyrightHeader(file) { } function check() { - const allFiles = execSync('git ls-files', {encoding: 'utf-8'}) + const allFiles = execSync('git ls-files', {encoding: 'utf8'}) .trim() .split('\n');