mirror of
https://github.com/hanzoai/jest.git
synced 2026-09-24 16:59:57 +00:00
fix(expect): revert node: protocol imports to restore webpack/browser compatibility (#16167)
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
### Fixes
|
||||
|
||||
- `[expect, jest-message-util, jest-pattern, jest-regex-util, jest-util]` Revert `node:` protocol imports to restore webpack/browser-bundle compatibility ([#16167](https://github.com/jestjs/jest/pull/16167))
|
||||
- `[jest-runtime]` Fall back to native ESM when a `.js` file contains ESM syntax but has no `"type":"module"` marker ([#16152](https://github.com/jestjs/jest/pull/16152))
|
||||
|
||||
### Chore & Maintenance
|
||||
|
||||
@@ -612,6 +612,17 @@ const config = defineConfig(
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: [
|
||||
'packages/jest-message-util/src/**/*',
|
||||
'packages/jest-pattern/src/**/*',
|
||||
'packages/jest-regex-util/src/**/*',
|
||||
'packages/jest-util/src/**/*',
|
||||
],
|
||||
rules: {
|
||||
'unicorn/prefer-node-protocol': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['packages/**/*.ts'],
|
||||
rules: {
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import * as path from 'node:path';
|
||||
import {fileURLToPath} from 'node:url';
|
||||
import * as path from 'path';
|
||||
import {fileURLToPath} from 'url';
|
||||
import {codeFrameColumns} from '@babel/code-frame';
|
||||
import chalk from 'chalk';
|
||||
import * as fs from 'graceful-fs';
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import * as path from 'node:path';
|
||||
import * as path from 'path';
|
||||
import {replacePathSepForRegex} from 'jest-regex-util';
|
||||
|
||||
export class TestPathPatterns {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import {sep} from 'node:path';
|
||||
import {sep} from 'path';
|
||||
|
||||
export const escapePathForRegex = (dir: string): string => {
|
||||
if (sep === '\\') {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import type {WriteStream} from 'node:tty';
|
||||
import type {WriteStream} from 'tty';
|
||||
|
||||
export default function clearLine(stream: WriteStream): void {
|
||||
if (stream.isTTY) {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import type * as Process from 'node:process';
|
||||
import type * as Process from 'process';
|
||||
import deepCyclicCopy from './deepCyclicCopy';
|
||||
|
||||
const BLACKLIST = new Set(['env', 'mainModule', '_events']);
|
||||
@@ -81,7 +81,7 @@ function createProcessEnv(): NodeJS.ProcessEnv {
|
||||
}
|
||||
|
||||
export default function createProcessObject(): typeof Process {
|
||||
const process = require('node:process');
|
||||
const process = require('process');
|
||||
const newProcess = deepCyclicCopy(process, {
|
||||
blacklist: BLACKLIST,
|
||||
keepPrototype: true,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import {isNativeError} from 'node:util/types';
|
||||
import {isNativeError} from 'util/types';
|
||||
|
||||
export const isError =
|
||||
typeof Error.isError === 'function' ? Error.isError : isNativeError;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import type {WriteStream} from 'node:tty';
|
||||
import type {WriteStream} from 'tty';
|
||||
import chalk from 'chalk';
|
||||
import clearLine from './clearLine';
|
||||
import isInteractive from './isInteractive';
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import {isAbsolute} from 'node:path';
|
||||
import {pathToFileURL} from 'node:url';
|
||||
import {isAbsolute} from 'path';
|
||||
import {pathToFileURL} from 'url';
|
||||
import interopRequireDefault from './interopRequireDefault';
|
||||
|
||||
async function importModule(
|
||||
|
||||
Reference in New Issue
Block a user