How to use the jest-validate.logValidationWarning 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 jest-community / jest-junit / index.js View on Github external
function JestJUnit (globalConfig, options) {
  // See if constructor was invoked statically
  // which indicates jest-junit was invoked as a testResultsProcessor
  // and show deprecation warning

  if (globalConfig.hasOwnProperty('testResults')) {
    const newConfig = JSON.stringify({
      reporters: ['jest-junit']
    }, null, 2);

    jestValidate.logValidationWarning('testResultsProcessor support is deprecated. Please use jest reporter. See https://github.com/jest-community/jest-junit#usage', newConfig);
    return processor(globalConfig);
  }

  this._globalConfig = globalConfig;
  this._options = options;

  this.onTestResult = (test, testResult, aggregatedResult) => {
    if (testResult.console && testResult.console.length > 0) {
      consoleBuffer[testResult.testFilePath] = testResult.console;
    }
  };

  this.onRunComplete = (contexts, results) => {
    processor(results, this._options, this._globalConfig.rootDir);
  };
}

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 8 months ago

Package Health Score

91 / 100
Full package analysis

Similar packages