How to use crashedError method in stryker-parent

Best JavaScript code snippet using stryker-parent

retry-rejected-decorator.spec.ts

Source:retry-rejected-decorator.spec.ts Github

copy

Full Screen

1import { Logger } from '@stryker-mutator/api/logging';2import { errorToString } from '@stryker-mutator/util';3import { TestRunner, DryRunOptions, MutantRunOptions, DryRunResult, MutantRunResult } from '@stryker-mutator/api/test-runner';4import { expect } from 'chai';5import { factory, assertions } from '@stryker-mutator/test-helpers';6import { ChildProcessCrashedError } from '../../../src/child-proxy/child-process-crashed-error';7import { OutOfMemoryError } from '../../../src/child-proxy/out-of-memory-error';8import { RetryRejectedDecorator } from '../../../src/test-runner/retry-rejected-decorator';9import { TestRunnerDecorator } from '../../../src/test-runner/test-runner-decorator';10import { currentLogMock } from '../../helpers/log-mock';11describe(RetryRejectedDecorator.name, () => {12 let sut: RetryRejectedDecorator;13 let testRunner1: sinon.SinonStubbedInstance<Required<TestRunner>>;14 let testRunner2: sinon.SinonStubbedInstance<Required<TestRunner>>;15 let availableTestRunners: Array<sinon.SinonStubbedInstance<Required<TestRunner>>>;16 let logMock: sinon.SinonStubbedInstance<Logger>;17 const crashedError = new ChildProcessCrashedError(42, '');18 beforeEach(() => {19 testRunner1 = factory.testRunner();20 testRunner2 = factory.testRunner();21 logMock = currentLogMock();22 availableTestRunners = [testRunner1, testRunner2];23 sut = new RetryRejectedDecorator(() => availableTestRunners.shift() ?? factory.testRunner());24 });25 it('should not override `init`', () => {26 expect(sut.init).to.be.eq(TestRunnerDecorator.prototype.init);27 });28 it('should not override `dispose`', () => {29 expect(sut.dispose).to.be.eq(TestRunnerDecorator.prototype.dispose);30 });31 describeRun(32 'dryRun',33 (suite, options) => suite.dryRun(options),34 () => factory.dryRunOptions({ timeout: 23 }),35 () => factory.completeDryRunResult()36 );37 describeRun(38 'mutantRun',39 (suite, options) => suite.mutantRun(options),40 () => factory.mutantRunOptions({ timeout: 23 }),41 () => factory.survivedMutantRunResult()42 );43 interface RunOptionsByMethod {44 dryRun: DryRunOptions;45 mutantRun: MutantRunOptions;46 }47 interface RunResultByMethod {48 dryRun: DryRunResult;49 mutantRun: MutantRunResult;50 }51 function describeRun<T extends keyof RunOptionsByMethod>(52 runMethod: T,53 act: (sut: RetryRejectedDecorator, options: RunOptionsByMethod[T]) => Promise<RunResultByMethod[T]>,54 optionsFactory: () => RunOptionsByMethod[T],55 resultFactory: () => ReturnType<TestRunner[T]> extends Promise<infer R> ? R : never56 ) {57 describe(runMethod, () => {58 let options: RunOptionsByMethod[T];59 let expectedResult: ReturnType<TestRunner[T]> extends Promise<infer R> ? R : never;60 beforeEach(() => {61 options = optionsFactory();62 expectedResult = resultFactory();63 });64 it('should pass through resolved values', async () => {65 // @ts-expect-error TS isn't smart enough66 testRunner1[runMethod].resolves(expectedResult);67 const result = await act(sut, options);68 expect(testRunner1[runMethod]).to.have.been.calledWith(options);69 expect(result).to.eq(expectedResult);70 });71 it('should retry on a new test runner if a run is rejected', async () => {72 testRunner1[runMethod].rejects(new Error('Error'));73 // @ts-expect-error TS isn't smart enough74 testRunner2[runMethod].resolves(expectedResult);75 const result = await act(sut, options);76 expect(result).to.eq(expectedResult);77 });78 it('should retry if a `ChildProcessCrashedError` occurred reject appears', async () => {79 testRunner1[runMethod].rejects(crashedError);80 // @ts-expect-error TS isn't smart enough81 testRunner2[runMethod].resolves(expectedResult);82 const result = await act(sut, options);83 expect(result).to.eq(expectedResult);84 });85 it('should log and retry when an `OutOfMemoryError` occurred.', async () => {86 testRunner1[runMethod].rejects(new OutOfMemoryError(123, 123));87 // @ts-expect-error TS isn't smart enough88 testRunner2[runMethod].resolves(expectedResult);89 const result = await act(sut, options);90 expect(result).to.eq(expectedResult);91 expect(logMock.info).calledWith(92 "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.",93 12394 );95 });96 it('should dispose a test runner when it rejected, before creating a new one', async () => {97 testRunner1[runMethod].rejects(crashedError);98 // @ts-expect-error TS isn't smart enough99 testRunner2[runMethod].resolves(expectedResult);100 await act(sut, options);101 expect(testRunner1.dispose).calledBefore(testRunner2.init);102 });103 it('should retry at most 1 times before rejecting', async () => {104 const finalError = new Error('foo');105 testRunner1[runMethod].rejects(new Error('bar'));106 testRunner2[runMethod].rejects(finalError);107 const result = await act(sut, options);108 assertions.expectErrored(result);109 expect((result as any).errorMessage).to.be.deep.eq(110 `Test runner crashed. Tried twice to restart it without any luck. Last time the error message was: ${errorToString(finalError)}`111 );112 expect(availableTestRunners).to.have.lengthOf(0);113 });114 });115 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var stryker = require('stryker-parent');2stryker.crashedError('test');3var stryker = require('stryker-parent');4stryker.crashedError('test2');5var stryker = require('stryker-parent');6stryker.crashedError('test3');7var stryker = require('stryker-parent');8stryker.crashedError('test4');9var stryker = require('stryker-parent');10stryker.crashedError('test5');11var stryker = require('stryker-parent');12stryker.crashedError('test6');13var stryker = require('stryker-parent');14stryker.crashedError('test7');15var stryker = require('stryker-parent');16stryker.crashedError('test8');17var stryker = require('stryker-parent');18stryker.crashedError('test9');19var stryker = require('stryker-parent');20stryker.crashedError('test10');21var stryker = require('stryker-parent');22stryker.crashedError('test11');23var stryker = require('stryker-parent');24stryker.crashedError('test12');25var stryker = require('stryker-parent');26stryker.crashedError('test13');

Full Screen

Using AI Code Generation

copy

Full Screen

1var strykerParent = require('stryker-parent');2strykerParent.crashedError('test message');3var strykerParent = require('stryker-parent');4strykerParent.crashedError('test message');5var strykerParent = require('stryker-parent');6strykerParent.crashedError('test message');7module.exports = function(config) {8 config.set({9 });10};11module.exports = function(config) {12 config.set({

Full Screen

Using AI Code Generation

copy

Full Screen

1const {crashedError} = require('stryker-parent');2crashedError();3const {crashedError} = require('stryker-parent');4crashedError();5const {crashedError} = require('stryker-parent');6crashedError();7const {crashedError} = require('stryker-parent');8crashedError();9const {crashedError} = require('stryker-parent');10crashedError();11const {crashedError} = require('stryker-parent');12crashedError();13const {crashedError} = require('stryker-parent');14crashedError();15const {crashedError} = require('stryker-parent');16crashedError();17const {crashedError} = require('stryker-parent');18crashedError();19const {crashedError} = require('stryker-parent');20crashedError();21const {crashedError} = require('stryker-parent');22crashedError();23const {crashedError} = require('stryker-parent');24crashedError();25const {crashedError} = require('stryker-parent');26crashedError();27const {crashedError} = require('stryker-parent');28crashedError();

Full Screen

Using AI Code Generation

copy

Full Screen

1const {crashedError} = require('stryker-parent');2crashedError('test');3const {crashedError} = require('stryker-parent');4crashedError('test2');5module.exports = function(config) {6 config.set({7 commandRunner: {8 }9 });10};11[2019-05-26 12:33:04.163] [INFO] Stryker 3.0.1 (beta) (in C:\Users\user\Documents\Projects\stryker-parent-test)

Full Screen

Using AI Code Generation

copy

Full Screen

1const strykerParent = require('stryker-parent');2strykerParent.crashedError('some error message');3const strykerParent = require('stryker-parent');4strykerParent.crashedError('some error message');5const strykerParent = require('stryker-parent');6strykerParent.crashedError('some error message');7const strykerParent = require('stryker-parent');8strykerParent.crashedError('some error message');9const strykerParent = require('stryker-parent');10strykerParent.crashedError('some error message');11const strykerParent = require('stryker-parent');12strykerParent.crashedError('some error message');13const strykerParent = require('stryker-parent');14strykerParent.crashedError('some error message');15const strykerParent = require('stryker-parent');16strykerParent.crashedError('some error message');17const strykerParent = require('stryker-parent');18strykerParent.crashedError('some error message');19const strykerParent = require('stryker-parent');20strykerParent.crashedError('some error message');21const strykerParent = require('stryker-parent');22strykerParent.crashedError('some error message');23const strykerParent = require('stryker-parent');24strykerParent.crashedError('some error message');

Full Screen

Using AI Code Generation

copy

Full Screen

1const stryker = require('stryker-parent');2stryker.crashedError('something went wrong');3const stryker = require('stryker-parent');4stryker.crashedError('something went wrong');5const stryker = require('stryker-parent');6stryker.crashedError('something went wrong');7const stryker = require('stryker-parent');8stryker.crashedError('something went wrong');9const stryker = require('stryker-parent');10stryker.crashedError('something went wrong');11const stryker = require('stryker-parent');12stryker.crashedError('something went wrong');13const stryker = require('stryker-parent');14stryker.crashedError('something went wrong');15const stryker = require('stryker-parent');16stryker.crashedError('something went wrong');17const stryker = require('stryker-parent');18stryker.crashedError('something went wrong');19const stryker = require('stryker-parent');20stryker.crashedError('something went wrong');21const stryker = require('stryker-parent');22stryker.crashedError('something went wrong');23const stryker = require('stryker-parent');24stryker.crashedError('something went wrong');25const stryker = require('

Full Screen

Using AI Code Generation

copy

Full Screen

1var stryker = require('stryker-parent');2stryker.crashedError();3module.exports = {4 crashedError: function () {5 throw new Error("Crashed Error");6 }7}8import {crashedError} from 'stryker-parent';9crashedError();10export function crashedError() {11 throw new Error("Crashed Error");12}13var stryker = require('stryker-parent');14stryker.crashedError();15module.exports = {16 crashedError: function () {17 throw new Error("Crashed Error");18 }19}20import {crashedError} from 'stryker-parent';21crashedError();22export function crashedError() {23 throw new Error("Crashed Error");24}25var stryker = require('stryker-parent');26stryker.crashedError();27module.exports = {28 crashedError: function () {29 throw new Error("Crashed Error");30 }31}

Full Screen

Using AI Code Generation

copy

Full Screen

1const strykerParent = require('stryker-parent');2strykerParent.crashedError('test error', 'test message');3const strykerParent = require('stryker-parent');4strykerParent.crashedError('test error', 'test message');5const strykerParent = require('stryker-parent');6strykerParent.crashedError('test error', 'test message');7const strykerParent = require('stryker-parent');8strykerParent.crashedError('test error', 'test message');9const strykerParent = require('stryker-parent');10strykerParent.crashedError('test error', 'test message');11const strykerParent = require('stryker-parent');12strykerParent.crashedError('test error', 'test message');13const strykerParent = require('stryker-parent');14strykerParent.crashedError('test error', 'test message');15const strykerParent = require('stryker-parent');16strykerParent.crashedError('test error', 'test message');17const strykerParent = require('stryker-parent');18strykerParent.crashedError('test error', 'test message');19const strykerParent = require('stryker-parent');20strykerParent.crashedError('test error', 'test message');21const strykerParent = require('stryker-parent');22strykerParent.crashedError('test error', 'test message');

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run stryker-parent automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful