Skip to content

Commit

Permalink
skip test on node 6
Browse files Browse the repository at this point in the history
  • Loading branch information
lobsterkatie committed Aug 5, 2021
1 parent b8ba696 commit 2b4d0a8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/utils/test/object.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

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

describe('fill()', () => {
test('wraps a method by calling a replacement function on it', () => {
Expand Down Expand Up @@ -150,7 +151,7 @@ describe('normalize()', () => {
});
});

test('extracts data from `Event` objects', () => {
testOnlyIfNodeVersionAtLeast(8)('extracts data from `Event` objects', () => {
const isElement = jest.spyOn(isModule, 'isElement').mockReturnValue(true);
const getAttribute = () => undefined;

Expand Down
13 changes: 13 additions & 0 deletions packages/utils/test/testutils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export const testOnlyIfNodeVersionAtLeast = (minVersion: number): jest.It => {
const currentNodeVersion = process.env.NODE_VERSION;

try {
if (Number(currentNodeVersion?.split('.')[0]) < minVersion) {
return it.skip;
}
} catch (oO) {
// we can't tell, so err on the side of running the test
}

return it;
};

0 comments on commit 2b4d0a8

Please sign in to comment.