How to use the jest-validate.multipleValidOptions function in jest-validate

To help you get started, we’ve selected a few jest-validate 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 ehmicky / gulp-execa / src / options / upstream.js View on Github external
import { Buffer } from 'buffer'

import { multipleValidOptions } from 'jest-validate'

// Examples for the core `child_process.spawn()` options
export const CHILD_PROCESS_OPTS = {
  cwd: '/home/user',
  env: { HOME: '/home/user' },
  argv0: 'command',
  stdio: multipleValidOptions('pipe', ['pipe', 'pipe', 'pipe']),
  serialization: 'json',
  detached: false,
  uid: 0,
  gid: 0,
  shell: multipleValidOptions(true, '/bin/bash'),
  windowsVerbatimArguments: true,
  windowsHide: true,
  encoding: 'utf8',
}

// Hack to make `jest-validate` validate Streams but print them nicely
const stream = {
  toJSON() {
    return 'Stream'
  },
}

// Examples for the `execa` options
export const EXECA_OPTS = {
  extendEnv: true,
  stripFinalNewline: true,
github ehmicky / gulp-execa / src / options / upstream.js View on Github external
extendEnv: true,
  stripFinalNewline: true,
  preferLocal: true,
  localDir: '/home/user',
  input: multipleValidOptions('input', Buffer.from(''), stream),
  reject: true,
  cleanup: true,
  all: true,
  execPath: '/usr/bin/noed',
  timeout: 5000,
  buffer: true,
  maxBuffer: 1e8,
  // eslint-disable-next-line no-magic-numbers
  killSignal: multipleValidOptions('SIGTERM', 9),
  stdin: multipleValidOptions('pipe', 0, stream),
  stdout: multipleValidOptions('pipe', 1, stream),
  stderr: multipleValidOptions('pipe', 2, stream),
}
github ehmicky / gulp-execa / src / options / upstream.js View on Github external
export const EXECA_OPTS = {
  extendEnv: true,
  stripFinalNewline: true,
  preferLocal: true,
  localDir: '/home/user',
  input: multipleValidOptions('input', Buffer.from(''), stream),
  reject: true,
  cleanup: true,
  all: true,
  execPath: '/usr/bin/noed',
  timeout: 5000,
  buffer: true,
  maxBuffer: 1e8,
  // eslint-disable-next-line no-magic-numbers
  killSignal: multipleValidOptions('SIGTERM', 9),
  stdin: multipleValidOptions('pipe', 0, stream),
  stdout: multipleValidOptions('pipe', 1, stream),
  stderr: multipleValidOptions('pipe', 2, stream),
}
github ehmicky / gulp-execa / src / options / upstream.js View on Github external
stripFinalNewline: true,
  preferLocal: true,
  localDir: '/home/user',
  input: multipleValidOptions('input', Buffer.from(''), stream),
  reject: true,
  cleanup: true,
  all: true,
  execPath: '/usr/bin/noed',
  timeout: 5000,
  buffer: true,
  maxBuffer: 1e8,
  // eslint-disable-next-line no-magic-numbers
  killSignal: multipleValidOptions('SIGTERM', 9),
  stdin: multipleValidOptions('pipe', 0, stream),
  stdout: multipleValidOptions('pipe', 1, stream),
  stderr: multipleValidOptions('pipe', 2, stream),
}
github facebook / jest / packages / jest-config / src / ValidConfig.ts View on Github external
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

import {Config} from '@jest/types';
import {replacePathSepForRegex} from 'jest-regex-util';
import {multipleValidOptions} from 'jest-validate';
import {NODE_MODULES} from './constants';

const NODE_MODULES_REGEXP = replacePathSepForRegex(NODE_MODULES);

const initialOptions: Config.InitialOptions = {
  automock: false,
  bail: multipleValidOptions(false, 0),
  browser: false,
  cache: true,
  cacheDirectory: '/tmp/user/jest',
  changedFilesWithAncestor: false,
  changedSince: 'master',
  clearMocks: false,
  collectCoverage: true,
  collectCoverageFrom: ['src', '!public'],
  collectCoverageOnlyFrom: {
    '/this-directory-is-covered/Covered.js': true,
  },
  coverageDirectory: 'coverage',
  coveragePathIgnorePatterns: [NODE_MODULES_REGEXP],
  coverageProvider: 'v8',
  coverageReporters: ['json', 'text', 'lcov', 'clover'],
  coverageThreshold: {
github facebook / jest / packages / jest-config / src / ValidConfig.ts View on Github external
'/this-directory-is-covered/Covered.js': true,
  },
  coverageDirectory: 'coverage',
  coveragePathIgnorePatterns: [NODE_MODULES_REGEXP],
  coverageProvider: 'v8',
  coverageReporters: ['json', 'text', 'lcov', 'clover'],
  coverageThreshold: {
    global: {
      branches: 50,
      functions: 100,
      lines: 100,
      statements: 100,
    },
  },
  dependencyExtractor: '/dependencyExtractor.js',
  displayName: multipleValidOptions('test-config', {
    color: 'blue',
    name: 'test-config',
  } as const),
  errorOnDeprecated: false,
  expand: false,
  extraGlobals: [],
  filter: '/filter.js',
  forceCoverageMatch: ['**/*.t.js'],
  forceExit: false,
  globalSetup: 'setup.js',
  globalTeardown: 'teardown.js',
  globals: {__DEV__: true},
  haste: {
    computeSha1: true,
    defaultPlatform: 'ios',
    hasteImplModulePath: '/haste_impl.js',
github facebook / jest / packages / jest-config / src / ValidConfig.ts View on Github external
runner: 'jest-runner',
  setupFiles: ['/setup.js'],
  setupFilesAfterEnv: ['/testSetupFile.js'],
  silent: true,
  skipFilter: false,
  skipNodeResolution: false,
  snapshotResolver: '/snapshotResolver.js',
  snapshotSerializers: ['my-serializer-module'],
  testEnvironment: 'jest-environment-jsdom',
  testEnvironmentOptions: {userAgent: 'Agent/007'},
  testFailureExitCode: 1,
  testLocationInResults: false,
  testMatch: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
  testNamePattern: 'test signature',
  testPathIgnorePatterns: [NODE_MODULES_REGEXP],
  testRegex: multipleValidOptions(
    '(/__tests__/.*|(\\.|/)(test|spec))\\.[jt]sx?$',
    ['/__tests__/\\.test\\.[jt]sx?$', '/__tests__/\\.spec\\.[jt]sx?$'],
  ),
  testResultsProcessor: 'processor-node-module',
  testRunner: 'jasmine2',
  testSequencer: '@jest/test-sequencer',
  testTimeout: 5000,
  testURL: 'http://localhost',
  timers: 'real',
  transform: {
    '^.+\\.js$': '/preprocessor.js',
  },
  transformIgnorePatterns: [NODE_MODULES_REGEXP],
  unmockedModulePathPatterns: ['mock'],
  updateSnapshot: true,
  useStderr: false,

jest-validate

Generic configuration validation tool that helps you with warnings, errors and deprecation messages as well as showing users examples of correct configuration.

MIT
Latest version published 11 months ago

Package Health Score

91 / 100
Full package analysis

Similar packages