How to use the jest.getVersion function in jest

To help you get started, we’ve selected a few jest examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jest-community / jest-runner-eslint / src / watchFixPlugin / index.js View on Github external
const { getVersion: getJestVersion } = require('jest');
const chalk = require('chalk');
const configOverrides = require('../utils/configOverrides');

const majorJestVersion = parseInt(getJestVersion().split('.')[0], 10);

if (majorJestVersion < 23) {
  // eslint-disable-next-line no-console
  throw new Error(`Insufficient Jest version for jest-runner-eslint watch plugin
  
  Watch plugins are only available in Jest 23.0.0 and above.
  Upgrade your version of Jest in order to use it.
`);
}

class ESLintWatchFixPlugin {
  constructor({ stdout, config }) {
    this._stdout = stdout;
    this._key = config.key || 'F';
  }
github airbnb / jest-wrap / index.js View on Github external
'use strict';

/* globals WeakMap */

var isCallable = require('is-callable');
var isString = require('is-string');
var has = require('has');
var forEach = require('for-each');
var isArray = require('isarray');
var functionName = require('function.prototype.name');
var inspect = require('object-inspect');
var semver = require('semver');
var jestVersion = require('jest').getVersion();

var checkWithName = require('./helpers/checkWithName');

var withOverrides = require('./withOverrides');
var withOverride = require('./withOverride');
var withGlobal = require('./withGlobal');

var hasPrivacy = typeof WeakMap === 'function';
var wrapperMap = hasPrivacy ? new WeakMap() : /* istanbul ignore next */ null;
var modeMap = hasPrivacy ? new WeakMap() : /* istanbul ignore next */ null;

var MODE_ALL = 'all';
var MODE_SKIP = 'skip';
var MODE_ONLY = 'only';

var beforeMethods = ['beforeAll', 'beforeEach'];