How to use the @stryker-mutator/util.errorToString function in @stryker-mutator/util

To help you get started, we’ve selected a few @stryker-mutator/util 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 stryker-mutator / stryker / packages / stryker / src / test-runner / CommandTestRunner.ts View on Github external
function errorResult(error: Error): RunResult {
        return {
          errorMessages: [errorToString(error)],
          status: RunStatus.Error,
          tests: []
        };
      }
github stryker-mutator / stryker / packages / stryker / src / test-runner / RetryDecorator.ts View on Github external
public async run(options: RunOptions, attemptsLeft = 2, lastError?: Error): Promise {
    if (attemptsLeft > 0) {
      try {
        return await this.innerRunner.run(options);
      } catch (error) {
        if (error instanceof OutOfMemoryError) {
          this.log.info('Test runner process [%s] ran out of memory. You probably have a memory leak in your tests. Don\'t worry, Stryker will restart the process, but you might want to investigate this later, because this decreases performance.', error.pid);
        }
        await this.recover();
        return this.run(options, attemptsLeft - 1, error);
      }
    } else {
      await this.recover();
      return { status: RunStatus.Error, errorMessages: [ERROR_MESSAGE + errorToString(lastError)], tests: [] };
    }
  }
github stryker-mutator / stryker / packages / core / src / test-runner / RetryDecorator.ts View on Github external
if (attemptsLeft > 0) {
      try {
        return await this.innerRunner.run(options);
      } catch (error) {
        if (error instanceof OutOfMemoryError) {
          this.log.info(
            "Test runner process [%s] ran out of memory. You probably have a memory leak in your tests. Don't worry, Stryker will restart the process, but you might want to investigate this later, because this decreases performance.",
            error.pid
          );
        }
        await this.recover();
        return this.run(options, attemptsLeft - 1, error);
      }
    } else {
      await this.recover();
      return { status: RunStatus.Error, errorMessages: [`${ERROR_MESSAGE}${errorToString(lastError)}`], tests: [] };
    }
  }
github stryker-mutator / stryker / packages / core / src / test-runner / CommandTestRunner.ts View on Github external
function errorResult(error: Error): RunResult {
        return {
          errorMessages: [errorToString(error)],
          status: RunStatus.Error,
          tests: []
        };
      }
github stryker-mutator / stryker / packages / core / src / child-proxy / ChildProcessProxyWorker.ts View on Github external
.catch(error => {
            this.send({
              correlationId: message.correlationId,
              error: errorToString(error),
              kind: ParentMessageKind.Rejection
            });
          });
        this.removeAnyAdditionalMessageListeners(this.handleMessage);
github stryker-mutator / stryker / packages / stryker / src / transpiler / MutantTranspiler.ts View on Github external
      .catch(error => ({ outputFiles: [], error: errorToString(error) }));
  }
github stryker-mutator / stryker / packages / core / src / transpiler / MutantTranspileScheduler.ts View on Github external
private async transpileMutant(mutant: TestableMutant): Promise {
    const filesToTranspile: File[] = [];
    if (this.currentMutatedFile && this.currentMutatedFile.name !== mutant.fileName) {
      filesToTranspile.push(this.currentMutatedFile.file);
    }
    this.currentMutatedFile = mutant.sourceFile;
    const mutatedFile = new File(mutant.fileName, Buffer.from(mutant.mutatedCode));
    filesToTranspile.push(mutatedFile);
    try {
      const transpiledFiles = await this.transpiler.transpile(filesToTranspile);
      return this.createTranspiledMutant(mutant, { outputFiles: transpiledFiles, error: null });
    } catch (error) {
      return this.createTranspiledMutant(mutant, { outputFiles: [], error: errorToString(error) });
    }
  }
}
github stryker-mutator / stryker / packages / stryker / src / child-proxy / ChildProcessProxyWorker.ts View on Github external
}).catch(error => {
            this.send({
              correlationId: message.correlationId,
              error: errorToString(error),
              kind: ParentMessageKind.Rejection
            });
          });
        this.removeAnyAdditionalMessageListeners(this.handleMessage);
github stryker-mutator / stryker / packages / stryker / src / initializer / NpmClient.ts View on Github external
.catch(err => {
        this.log.error(`Unable to reach ${BASE_NPM_SEARCH} (for query ${query}). Please check your internet connection.`, errorToString(err));
        const result: NpmSearchResult = {
          results: [],
          total: 0
        };
        return result;
      });
  }