|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
791 bytes
|
| Line | |
|---|
| 1 | "use strict";
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
|---|
| 4 | value: true
|
|---|
| 5 | });
|
|---|
| 6 | exports.detectJestVersion = void 0;
|
|---|
| 7 | let cachedJestVersion = null;
|
|---|
| 8 |
|
|---|
| 9 | const detectJestVersion = () => {
|
|---|
| 10 | if (cachedJestVersion) {
|
|---|
| 11 | return cachedJestVersion;
|
|---|
| 12 | }
|
|---|
| 13 |
|
|---|
| 14 | try {
|
|---|
| 15 | const jestPath = require.resolve('jest/package.json');
|
|---|
| 16 |
|
|---|
| 17 | const jestPackageJson = // eslint-disable-next-line @typescript-eslint/no-require-imports
|
|---|
| 18 | require(jestPath);
|
|---|
| 19 |
|
|---|
| 20 | if (jestPackageJson.version) {
|
|---|
| 21 | const [majorVersion] = jestPackageJson.version.split('.');
|
|---|
| 22 | return cachedJestVersion = parseInt(majorVersion, 10);
|
|---|
| 23 | }
|
|---|
| 24 | } catch {}
|
|---|
| 25 |
|
|---|
| 26 | throw new Error('Unable to detect Jest version - please ensure jest package is installed, or otherwise set version explicitly');
|
|---|
| 27 | };
|
|---|
| 28 |
|
|---|
| 29 | exports.detectJestVersion = detectJestVersion; |
|---|
Note:
See
TracBrowser
for help on using the repository browser.