Skip to content

Commit

Permalink
chore: do not log isolated-vm error in tests (#15166)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB authored Jul 7, 2024
1 parent 1775865 commit 03ca693
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion e2e/__tests__/nativeEsm.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import {createRequire} from 'module';
import {resolve} from 'path';
import {isNativeError} from 'util/types';
import {onNodeVersions} from '@jest/test-utils';
import {extractSummary, runYarnInstall} from '../Utils';
import runJest, {getConfig} from '../runJest';
Expand All @@ -28,7 +29,14 @@ beforeAll(() => {
const ivm = require('isolated-vm');
isolatedVmInstalled = ivm != null;
} catch (error) {
console.warn('`isolated-vm` is not installed, skipping tests', error);
if (
isNativeError(error) &&
(error as NodeJS.ErrnoException).code === 'MODULE_NOT_FOUND'
) {
console.warn('`isolated-vm` is not installed, skipping its test');
} else {
throw error;
}
}
});

Expand Down

0 comments on commit 03ca693

Please sign in to comment.