How to use the jest/package.json.version 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 tunnckoCore / opensource / @hela / dev / src / index.js View on Github external
const flags = toFlags(opts, { allowCamelCase: true });

      const configDir = path.join(__dirname, 'configs', name);
      const configPath = path.join(configDir, 'config.js');

      // const createConfig = require(configDir);
      const { default: createConfig } = await import(configDir);

      const config = createConfig({ ...opts, ignores, input: inputs });
      const contents = `module.exports=${JSON.stringify(config)}`;

      fs.writeFileSync(configPath, contents);

      // eslint-disable-next-line global-require
      console.log('Jest', require('jest/package.json').version);

      console.log(`jest -c ${configPath} ${flags}`);

      return exec(`jest -c ${configPath} ${flags}`, { stdio: 'inherit' });
    });
}
github kulshekhar / ts-jest / e2e / __cases__ / deep / src / Tests / jest.config.js View on Github external
const cfg = {}

if (require('jest/package.json').version.split('.').shift() === '22') {
  Object.assign(cfg, require('ts-jest/presets').defaults)
} else {
  cfg.preset = 'ts-jest'
}

module.exports = Object.assign({}, cfg, {
  collectCoverage: true,
  collectCoverageFrom: ["**/*.ts", "!**/*.d.ts", "!**/build/**", "!/FrontEnd/**"],
  forceCoverageMatch: ["**/*.test.ts"],
  coverageDirectory: "Tests/coverage",
  coverageReporters: ["lcov"],
  rootDir: "..",
  testMatch: ["**/*.test.ts"],
  testEnvironment: "node",
  globals: {
    "ts-jest": {
github stryker-mutator / stryker / packages / jest-runner / src / JestTestRunner.ts View on Github external
export function jestTestRunnerFactory(injector: Injector) {
  return injector
    .provideValue(PROCESS_ENV_TOKEN, process.env)
    .provideValue(JEST_VERSION_TOKEN, require('jest/package.json').version as string)
    .provideFactory(JEST_TEST_ADAPTER_TOKEN, jestTestAdapterFactory)
    .injectClass(JestTestRunner);
}
jestTestRunnerFactory.inject = tokens(commonTokens.injector);
github mzgoddard / jest-webpack / jest-webpack.js View on Github external
function versionInfo() {
  return `jest-webpack ${require('./package.json').version}\n` +
  `jest ${require('jest/package.json').version}\n` +
  `webpack ${require('webpack/package.json').version}`;
}
github stryker-mutator / stryker / packages / stryker-jest-runner / src / JestTestRunner.ts View on Github external
export function jestTestRunnerFactory(injector: Injector) {
  return injector
    .provideValue(PROCESS_ENV_TOKEN, process.env)
    .provideValue(JEST_VERSION_TOKEN, require('jest/package.json').version as string)
    .provideFactory(JEST_TEST_ADAPTER_TOKEN, jestTestAdapterFactory)
    .injectClass(JestTestRunner);
}
jestTestRunnerFactory.inject = tokens(commonTokens.injector);