Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

- `[docs]` Update V30 migration guide to notify users on `jest.mock()` work with case-sensitive path ([#15849](https://github.com/jestjs/jest/pull/15849))
- `[deps]` Update to sinon/fake-timers v15
- `[jest-util]` Replace `slash` package with inline implementation ([#15971](https://github.com/jestjs/jest/pull/15971))
- Updated Twitter icon to match the latest brand guidelines.([#15868](https://github.com/jestjs/jest/pull/15869))
- `[*]` Replace remaining micromatch uses with picomatch

Expand Down
4 changes: 2 additions & 2 deletions e2e/__tests__/__snapshots__/moduleNameMapper.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ exports[`moduleNameMapper wrong array configuration 1`] = `
12 | module.exports = () => 'test';
13 |

at createNoMappedModuleFoundError (../../packages/jest-resolve/build/index.js:1117:17)
at createNoMappedModuleFoundError (../../packages/jest-resolve/build/index.js:1109:17)
at Object.require (index.js:10:1)
at Object.require (__tests__/index.js:10:20)"
`;
Expand Down Expand Up @@ -71,7 +71,7 @@ exports[`moduleNameMapper wrong configuration 1`] = `
12 | module.exports = () => 'test';
13 |

at createNoMappedModuleFoundError (../../packages/jest-resolve/build/index.js:1117:17)
at createNoMappedModuleFoundError (../../packages/jest-resolve/build/index.js:1109:17)
at Object.require (index.js:10:1)
at Object.require (__tests__/index.js:10:20)"
`;
2 changes: 1 addition & 1 deletion e2e/__tests__/__snapshots__/requireMissingExt.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ exports[`shows a proper error from deep requires 1`] = `
12 | test('dummy', () => {
13 | expect(1).toBe(1);

at Resolver._throwModNotFoundError (../../packages/jest-resolve/build/index.js:863:11)
at Resolver._throwModNotFoundError (../../packages/jest-resolve/build/index.js:855:11)
at Object.<anonymous> (node_modules/discord.js/src/index.js:21:12)
at Object.require (__tests__/test.js:10:1)"
`;
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ exports[`show error message with matching files 1`] = `
| ^
9 |

at Resolver._throwModNotFoundError (../../packages/jest-resolve/build/index.js:863:11)
at Resolver._throwModNotFoundError (../../packages/jest-resolve/build/index.js:855:11)
at Object.require (index.js:8:18)
at Object.require (__tests__/test.js:8:11)"
`;
2 changes: 1 addition & 1 deletion e2e/__tests__/jest.config.js.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test('works with jest.config.js', () => {
test('traverses directory tree up until it finds jest.config', () => {
writeFiles(DIR, {
'__tests__/a-banana.js': `
const slash = require('slash');
const slash = p => p.replaceAll('\\\\', '/');
test('banana', () => expect(1).toBe(1));
test('abc', () => console.log(slash(process.cwd())));
`,
Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/jest.config.ts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
test('traverses directory tree up until it finds jest.config', () => {
writeFiles(DIR, {
'__tests__/a-giraffe.js': `
const slash = require('slash');
const slash = p => p.replaceAll('\\\\', '/');
test('giraffe', () => expect(1).toBe(1));
test('abc', () => console.log(slash(process.cwd())));
`,
Expand Down Expand Up @@ -224,7 +224,7 @@
/(Error: Jest: Failed to parse the TypeScript config file).*$/m,
'$1 <<REPLACED>>',
),
).toMatchSnapshot();

Check failure on line 227 in e2e/__tests__/jest.config.ts.test.ts

View workflow job for this annotation

GitHub Actions / Windows with shard 1/4 / Node LTS using jest-jasmine2

on node >=24 › invalid JS in jest.config.ts (node with native TS support)

expect(received).toMatchSnapshot() Snapshot name: `on node >=24 invalid JS in jest.config.ts (node with native TS support) 1` - Snapshot - 1 + Received + 1 "Error: Jest: Failed to parse the TypeScript config file <<REPLACED>> both with the native node TypeScript support and configured TypeScript loaders. Errors were: - - SyntaxError [ERR_INVALID_TYPESCRIPT_SYNTAX]: Expected ';', got 'string literal (ll break this file yo, 'll break this file yo)' + - SyntaxError [ERR_INVALID_TYPESCRIPT_SYNTAX]: Expected ';', got 'string literal' - TSError: ⨯ Unable to compile TypeScript: jest.config.ts(1,16): error TS2304: Cannot find name 'i'. jest.config.ts(1,17): error TS1005: ';' expected. jest.config.ts(1,39): error TS1002: Unterminated string literal." at Object.toMatchSnapshot (e2e/__tests__/jest.config.ts.test.ts:227:7)

Check failure on line 227 in e2e/__tests__/jest.config.ts.test.ts

View workflow job for this annotation

GitHub Actions / Windows with shard 1/4 / Node LTS using jest-jasmine2

on node >=24 › invalid JS in jest.config.ts (node with native TS support)

expect(received).toMatchSnapshot() Snapshot name: `on node >=24 invalid JS in jest.config.ts (node with native TS support) 1` - Snapshot - 1 + Received + 1 "Error: Jest: Failed to parse the TypeScript config file <<REPLACED>> both with the native node TypeScript support and configured TypeScript loaders. Errors were: - - SyntaxError [ERR_INVALID_TYPESCRIPT_SYNTAX]: Expected ';', got 'string literal (ll break this file yo, 'll break this file yo)' + - SyntaxError [ERR_INVALID_TYPESCRIPT_SYNTAX]: Expected ';', got 'string literal' - TSError: ⨯ Unable to compile TypeScript: jest.config.ts(1,16): error TS2304: Cannot find name 'i'. jest.config.ts(1,17): error TS1005: ';' expected. jest.config.ts(1,39): error TS1002: Unterminated string literal." at Object.toMatchSnapshot (e2e/__tests__/jest.config.ts.test.ts:227:7)

Check failure on line 227 in e2e/__tests__/jest.config.ts.test.ts

View workflow job for this annotation

GitHub Actions / Windows with shard 1/4 / Node LTS using jest-jasmine2

on node >=24 › invalid JS in jest.config.ts (node with native TS support)

expect(received).toMatchSnapshot() Snapshot name: `on node >=24 invalid JS in jest.config.ts (node with native TS support) 1` - Snapshot - 1 + Received + 1 "Error: Jest: Failed to parse the TypeScript config file <<REPLACED>> both with the native node TypeScript support and configured TypeScript loaders. Errors were: - - SyntaxError [ERR_INVALID_TYPESCRIPT_SYNTAX]: Expected ';', got 'string literal (ll break this file yo, 'll break this file yo)' + - SyntaxError [ERR_INVALID_TYPESCRIPT_SYNTAX]: Expected ';', got 'string literal' - TSError: ⨯ Unable to compile TypeScript: jest.config.ts(1,16): error TS2304: Cannot find name 'i'. jest.config.ts(1,17): error TS1005: ';' expected. jest.config.ts(1,39): error TS1002: Unterminated string literal." at Object.toMatchSnapshot (e2e/__tests__/jest.config.ts.test.ts:227:7)
expect(exitCode).toBe(1);
});
});
2 changes: 1 addition & 1 deletion e2e/__tests__/jestChangedFiles.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {tmpdir} from 'os';
import * as path from 'path';
import * as fs from 'graceful-fs';
import * as semver from 'semver';
import slash from 'slash';
import {slash} from 'jest-util';
import {findRepos, getChangedFilesForRoots} from 'jest-changed-files';
import {
cleanup,
Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/multipleConfigs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import * as path from 'path';
import slash from 'slash';
import {slash} from 'jest-util';
import runJest from '../runJest';

const MULTIPLE_CONFIGS_WARNING_TEXT = 'Multiple configurations found';
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
"resolve": "^1.20.0",
"rimraf": "^5.0.10",
"semver": "^7.7.2",
"slash": "^3.0.0",
"strip-json-comments": "^3.1.1",
"tempy": "^1.0.1",
"ts-node": "^10.5.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-jest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"babel-preset-jest": "workspace:*",
"chalk": "^4.1.2",
"graceful-fs": "^4.2.11",
"slash": "^3.0.0"
"jest-util": "workspace:*"
},
"devDependencies": {
"@babel-8/core": "npm:@babel/core@8.0.0-beta.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-jest/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import type {
} from '@babel/core';
import chalk from 'chalk';
import * as fs from 'graceful-fs';
import slash from 'slash';
import type {
TransformOptions as JestTransformOptions,
SyncTransformer,
TransformerCreator,
} from '@jest/transform';
import {slash} from 'jest-util';
import {
transformSync as babelTransform,
transformAsync as babelTransformAsync,
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-jest/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"include": ["./src/**/*"],
"exclude": ["./**/__tests__/**/*"],
// TODO: include `babel-preset-jest` if it's ever in TS even though we don't care about its types
"references": [{"path": "../jest-transform"}]
"references": [{"path": "../jest-transform"}, {"path": "../jest-util"}]
}
1 change: 0 additions & 1 deletion packages/jest-circus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"p-limit": "^3.1.0",
"pretty-format": "workspace:*",
"pure-rand": "^7.0.0",
"slash": "^3.0.0",
"stack-utils": "^2.0.6"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-circus/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import * as path from 'path';
import co from 'co';
import dedent from 'dedent';
import isGeneratorFn from 'is-generator-fn';
import slash from 'slash';
import StackUtils from 'stack-utils';
import type {Status, TestCaseResult} from '@jest/test-result';
import type {Circus, Global} from '@jest/types';
Expand All @@ -19,6 +18,7 @@ import {
formatTime,
invariant,
isPromise,
slash,
} from 'jest-util';
import {format as prettyFormat} from 'pretty-format';
import {ROOT_DESCRIBE_BLOCK_NAME, getState} from './state';
Expand Down
1 change: 0 additions & 1 deletion packages/jest-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
"jest-validate": "workspace:*",
"parse-json": "^5.2.0",
"pretty-format": "workspace:*",
"slash": "^3.0.0",
"strip-json-comments": "^3.1.1"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-config/src/resolveConfigPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import * as path from 'path';
import chalk from 'chalk';
import * as fs from 'graceful-fs';
import slash from 'slash';
import {slash} from 'jest-util';
import {ValidationError} from 'jest-validate';
import {
JEST_CONFIG_BASE_NAME,
Expand Down
3 changes: 1 addition & 2 deletions packages/jest-console/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
"@types/node": "*",
"chalk": "^4.1.2",
"jest-message-util": "workspace:*",
"jest-util": "workspace:*",
"slash": "^3.0.0"
"jest-util": "workspace:*"
},
"devDependencies": {
"@jest/test-utils": "workspace:*"
Expand Down
3 changes: 1 addition & 2 deletions packages/jest-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
"jest-util": "workspace:*",
"jest-validate": "workspace:*",
"jest-watcher": "workspace:*",
"pretty-format": "workspace:*",
"slash": "^3.0.0"
"pretty-format": "workspace:*"
},
"devDependencies": {
"@jest/test-sequencer": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-core/src/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import type {WriteStream} from 'tty';
import ansiEscapes from 'ansi-escapes';
import chalk from 'chalk';
import exit from 'exit-x';
import slash from 'slash';
import {TestPathPatterns} from '@jest/pattern';
import type {TestContext} from '@jest/test-result';
import type {Config} from '@jest/types';
Expand All @@ -20,6 +19,7 @@ import {
isInteractive,
preRunMessage,
requireOrImportModule,
slash,
specialChars,
} from 'jest-util';
import {ValidationError} from 'jest-validate';
Expand Down
3 changes: 1 addition & 2 deletions packages/jest-haste-map/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
"devDependencies": {
"@types/fb-watchman": "^2.0.5",
"@types/graceful-fs": "^4.1.9",
"@types/picomatch": "^4.0.0",
"slash": "^3.0.0"
"@types/picomatch": "^4.0.0"
},
"optionalDependencies": {
"fsevents": "^2.3.3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jest.mock('child_process', () => ({
}));

jest.mock('graceful-fs', () => {
const slash = require('slash');
const slash = p => p.replaceAll('\\', '/');
let mtime = 32;
const size = 42;
const stat = (path, callback) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-message-util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
"@types/stack-utils": "^2.0.3",
"chalk": "^4.1.2",
"graceful-fs": "^4.2.11",
"jest-util": "workspace:*",
"picomatch": "^4.0.3",
"pretty-format": "workspace:*",
"slash": "^3.0.0",
"stack-utils": "^2.0.6"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-message-util/src/__tests__/messages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import {readFileSync} from 'graceful-fs';
import slash from 'slash';
import {slash} from 'jest-util';
import tempy from 'tempy';
import {
formatExecError,
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-message-util/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import {codeFrameColumns} from '@babel/code-frame';
import chalk from 'chalk';
import * as fs from 'graceful-fs';
import picomatch from 'picomatch';
import slash from 'slash';
import StackUtils from 'stack-utils';
import type {Config, TestResult} from '@jest/types';
import {slash} from 'jest-util';
import {format as prettyFormat} from 'pretty-format';
import type {Frame} from './types';

Expand Down
6 changes: 5 additions & 1 deletion packages/jest-message-util/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,9 @@
},
"include": ["./src/**/*"],
"exclude": ["./**/__tests__/**/*"],
"references": [{"path": "../jest-types"}, {"path": "../pretty-format"}]
"references": [
{"path": "../jest-types"},
{"path": "../jest-util"},
{"path": "../pretty-format"}
]
}
1 change: 0 additions & 1 deletion packages/jest-reporters/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"jest-message-util": "workspace:*",
"jest-util": "workspace:*",
"jest-worker": "workspace:*",
"slash": "^3.0.0",
"string-length": "^4.0.2",
"v8-to-istanbul": "^9.0.1"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-reporters/src/formatTestPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import * as path from 'path';
import chalk from 'chalk';
import slash from 'slash';
import type {Config} from '@jest/types';
import {slash} from 'jest-util';
import relativePath from './relativePath';

export default function formatTestPath(
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-reporters/src/trimAndFormatPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import * as path from 'path';
import chalk from 'chalk';
import slash from 'slash';
import type {Config} from '@jest/types';
import {slash} from 'jest-util';
import relativePath from './relativePath';

export default function trimAndFormatPath(
Expand Down
1 change: 0 additions & 1 deletion packages/jest-resolve/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"jest-pnp-resolver": "^1.2.3",
"jest-util": "workspace:*",
"jest-validate": "workspace:*",
"slash": "^3.0.0",
"unrs-resolver": "^1.7.11"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-resolve/src/ModuleNotFoundError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import * as path from 'path';
import slash from 'slash';
import {slash} from 'jest-util';

export default class ModuleNotFoundError extends Error {
public code = 'MODULE_NOT_FOUND';
Expand Down
3 changes: 1 addition & 2 deletions packages/jest-resolve/src/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
import {isBuiltin} from 'module';
import * as path from 'path';
import chalk from 'chalk';
import slash from 'slash';
import type {IModuleMap} from 'jest-haste-map';
import {tryRealpath} from 'jest-util';
import {slash, tryRealpath} from 'jest-util';
import ModuleNotFoundError from './ModuleNotFoundError';
import defaultResolver, {
type AsyncResolver,
Expand Down
1 change: 0 additions & 1 deletion packages/jest-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"jest-resolve": "workspace:*",
"jest-snapshot": "workspace:*",
"jest-util": "workspace:*",
"slash": "^3.0.0",
"strip-bom": "^4.0.0"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import {builtinModules, createRequire} from 'module';
import * as path from 'path';
import {pathToFileURL} from 'url';
import slash from 'slash';
import {slash} from 'jest-util';

let createRuntime;

Expand Down
2 changes: 1 addition & 1 deletion packages/jest-runtime/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import * as path from 'path';
import {glob} from 'glob';
import slash from 'slash';
import type {Config} from '@jest/types';
import {slash} from 'jest-util';

const OUTSIDE_JEST_VM_PROTOCOL = 'jest-main:';
// String manipulation is easier here, fileURLToPath is only in newer Nodes,
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-runtime/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
import {parse as parseCjs} from 'cjs-module-lexer';
import {CoverageInstrumenter, type V8Coverage} from 'collect-v8-coverage';
import * as fs from 'graceful-fs';
import slash from 'slash';
import stripBOM from 'strip-bom';
import type {
Jest,
Expand Down Expand Up @@ -53,6 +52,7 @@ import {
invariant,
isNonNullable,
protectProperties,
slash,
} from 'jest-util';
import {
createOutsideJestVmPath,
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-test-sequencer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@jest/test-result": "workspace:*",
"graceful-fs": "^4.2.11",
"jest-haste-map": "workspace:*",
"slash": "^3.0.0"
"jest-util": "workspace:*"
},
"devDependencies": {
"@jest/test-utils": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-test-sequencer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import * as crypto from 'crypto';
import * as path from 'path';
import * as fs from 'graceful-fs';
import slash from 'slash';
import type {AggregatedResult, Test, TestContext} from '@jest/test-result';
import type {Config} from '@jest/types';
import HasteMap from 'jest-haste-map';
import {slash} from 'jest-util';

const FAIL = 0;
const SUCCESS = 1;
Expand Down
6 changes: 5 additions & 1 deletion packages/jest-test-sequencer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,9 @@
},
"include": ["./src/**/*"],
"exclude": ["./**/__tests__/**/*"],
"references": [{"path": "../jest-haste-map"}, {"path": "../jest-test-result"}]
"references": [
{"path": "../jest-haste-map"},
{"path": "../jest-test-result"},
{"path": "../jest-util"}
]
}
1 change: 0 additions & 1 deletion packages/jest-transform/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"jest-regex-util": "workspace:*",
"jest-util": "workspace:*",
"pirates": "^4.0.7",
"slash": "^3.0.0",
"write-file-atomic": "^5.0.1"
},
"devDependencies": {
Expand Down
Loading
Loading