Skip to content

Commit 2b4d0a8

Browse files
committed
skip test on node 6
1 parent b8ba696 commit 2b4d0a8

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

packages/utils/test/object.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import * as isModule from '../src/is';
66
import { dropUndefinedKeys, extractExceptionKeysForMessage, fill, normalize, urlEncode } from '../src/object';
7+
import { testOnlyIfNodeVersionAtLeast } from './testutils';
78

89
describe('fill()', () => {
910
test('wraps a method by calling a replacement function on it', () => {
@@ -150,7 +151,7 @@ describe('normalize()', () => {
150151
});
151152
});
152153

153-
test('extracts data from `Event` objects', () => {
154+
testOnlyIfNodeVersionAtLeast(8)('extracts data from `Event` objects', () => {
154155
const isElement = jest.spyOn(isModule, 'isElement').mockReturnValue(true);
155156
const getAttribute = () => undefined;
156157

packages/utils/test/testutils.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export const testOnlyIfNodeVersionAtLeast = (minVersion: number): jest.It => {
2+
const currentNodeVersion = process.env.NODE_VERSION;
3+
4+
try {
5+
if (Number(currentNodeVersion?.split('.')[0]) < minVersion) {
6+
return it.skip;
7+
}
8+
} catch (oO) {
9+
// we can't tell, so err on the side of running the test
10+
}
11+
12+
return it;
13+
};

0 commit comments

Comments
 (0)