Skip to content

Commit 2c4cd84

Browse files
committedJan 23, 2023
fix: use node-util import compatible with node@14
1 parent 850d58c commit 2c4cd84

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed
 

‎src/errors.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { isNativeError } from 'node:util/types';
1+
import { types } from 'node:util';
22

33
import { $type } from './symbols';
44

@@ -9,6 +9,8 @@ import type {
99
Range
1010
} from './index';
1111

12+
const { isNativeError } = types;
13+
1214
/**
1315
* A collection of possible errors and warnings.
1416
*/

‎src/plugin-tester.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import assert from 'node:assert';
33
import path from 'node:path';
44
import fs from 'node:fs';
55
import { EOL } from 'node:os';
6-
import { isNativeError } from 'node:util/types';
6+
import { types } from 'node:util';
77
import mergeWith from 'lodash.mergewith';
88
import stripIndent from 'strip-indent';
99
import { createContext, Script } from 'node:vm';
@@ -32,6 +32,8 @@ import type {
3232

3333
import type { Class } from 'type-fest';
3434

35+
const { isNativeError } = types;
36+
3537
const parseErrorStackRegExp =
3638
/at (?:(?<fn>\S+) )?(?:.*? )?\(?(?<path>(?:\/|file:|\w:\\).*?)(?:\)|$)/i;
3739

‎test/helpers/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import fs from 'node:fs';
22
import path from 'node:path';
33
import { type AssertionError } from 'node:assert';
4-
import { isNativeError } from 'node:util/types';
4+
import { types } from 'node:util';
55

66
import { pluginTester } from '../../src/plugin-tester';
77

@@ -11,6 +11,8 @@ import type {
1111
PluginTesterOptions
1212
} from '../../src/index';
1313

14+
const { isNativeError } = types;
15+
1416
const dummyDoneCallback: jest.DoneCallback = () => {
1517
throw new Error('unexpected callback invocation');
1618
};

0 commit comments

Comments
 (0)
Please sign in to comment.