How to use onGoingRun method in stryker-parent

Best JavaScript code snippet using stryker-parent

karma-test-runner.spec.ts

Source:karma-test-runner.spec.ts Github

copy

Full Screen

1import { LoggerFactoryMethod } from '@stryker-mutator/api/logging';2import { commonTokens } from '@stryker-mutator/api/plugin';3import { testInjector, assertions, factory, tick } from '@stryker-mutator/test-helpers';4import { expect } from 'chai';5import { TestResults } from 'karma';6import sinon from 'sinon';7// eslint-disable-next-line @typescript-eslint/no-require-imports8import { Task } from '@stryker-mutator/util';9import { DryRunOptions, MutantRunOptions, TestStatus } from '@stryker-mutator/api/test-runner';10import { MutantCoverage } from '@stryker-mutator/api/core';11import strykerKarmaConf from '../../src/starters/stryker-karma.conf';12import { KarmaTestRunner } from '../../src/karma-test-runner';13import * as projectStarter from '../../src/starters/project-starter';14import { StrykerKarmaSetup, NgConfigOptions } from '../../src-generated/karma-runner-options';15import { Browser, KarmaSpec, StrykerReporter } from '../../src/karma-plugins/stryker-reporter';16import { TestHooksMiddleware } from '../../src/karma-plugins/test-hooks-middleware';17import { karma } from '../../src/karma-wrapper';18// Unit tests for both the KarmaTestRunner and the StrykerReporter, as they are closely related19describe(KarmaTestRunner.name, () => {20 let projectStarterMock: sinon.SinonStubbedInstance<projectStarter.ProjectStarter>;21 let setGlobalsStub: sinon.SinonStubbedMember<typeof strykerKarmaConf.setGlobals>;22 let karmaRunStub: sinon.SinonStubbedMember<typeof karma.runner.run>;23 let getLogger: LoggerFactoryMethod;24 let testHooksMiddlewareMock: sinon.SinonStubbedInstance<TestHooksMiddleware>;25 beforeEach(() => {26 projectStarterMock = sinon.createStubInstance(projectStarter.ProjectStarter);27 testHooksMiddlewareMock = sinon.createStubInstance(TestHooksMiddleware);28 sinon.stub(projectStarter, 'ProjectStarter').returns(projectStarterMock);29 setGlobalsStub = sinon.stub(strykerKarmaConf, 'setGlobals');30 karmaRunStub = sinon.stub(karma.runner, 'run');31 sinon.stub(TestHooksMiddleware, 'instance').value(testHooksMiddlewareMock);32 getLogger = testInjector.injector.resolve(commonTokens.getLogger);33 });34 function createSut() {35 return testInjector.injector.injectClass(KarmaTestRunner);36 }37 it('should load default setup', () => {38 createSut();39 expect(setGlobalsStub).calledWith({40 getLogger,41 karmaConfig: undefined,42 karmaConfigFile: undefined,43 disableBail: false,44 });45 });46 it('should setup karma from stryker options', () => {47 const expectedSetup: StrykerKarmaSetup = {48 config: {49 basePath: 'foo/bar',50 },51 configFile: 'baz.conf.js',52 projectType: 'angular-cli',53 };54 testInjector.options.karma = expectedSetup;55 testInjector.options.disableBail = true;56 createSut();57 expect(setGlobalsStub).calledWith({58 getLogger,59 karmaConfig: expectedSetup.config,60 karmaConfigFile: expectedSetup.configFile,61 disableBail: true,62 });63 expect(testInjector.logger.warn).not.called;64 expect(projectStarter.ProjectStarter).calledWith(sinon.match.func, expectedSetup);65 });66 it('should run ng test with parameters from stryker options', () => {67 const ngConfig: NgConfigOptions = {};68 ngConfig.testArguments = {69 project: '@ns/mypackage',70 };71 const expectedSetup: StrykerKarmaSetup = {72 config: {73 basePath: 'foo/bar',74 },75 configFile: 'baz.conf.js',76 ngConfig,77 projectType: 'angular-cli',78 };79 testInjector.options.karma = expectedSetup;80 testInjector.options.disableBail = true;81 createSut();82 expect(setGlobalsStub).calledWith({83 getLogger,84 karmaConfig: expectedSetup.config,85 karmaConfigFile: expectedSetup.configFile,86 disableBail: true,87 });88 expect(testInjector.logger.warn).not.called;89 expect(projectStarter.ProjectStarter).calledWith(sinon.match.func, expectedSetup);90 });91 describe('init', () => {92 let sut: KarmaTestRunner;93 async function actInit() {94 const initPromise = sut.init();95 StrykerReporter.instance.onBrowsersReady();96 await initPromise;97 }98 beforeEach(async () => {99 sut = createSut();100 StrykerReporter.instance.karmaConfig = await karma.config.parseConfig(null, {}, { promiseConfig: true });101 });102 it('should start karma', async () => {103 projectStarterMock.start.resolves({ exitPromise: new Task<number>().promise });104 await actInit();105 expect(projectStarterMock.start).called;106 });107 it('should reject when karma start rejects', async () => {108 const expected = new Error('karma unavailable');109 projectStarterMock.start.rejects(expected);110 await expect(sut.init()).rejectedWith(expected);111 });112 it('should reject on browser errors', async () => {113 projectStarterMock.start.resolves({ exitPromise: new Task<number>().promise });114 const expected = new Error('karma unavailable');115 const onGoingInit = sut.init();116 StrykerReporter.instance.onBrowserError(createBrowser(), expected);117 await expect(onGoingInit).rejectedWith(expected);118 });119 it('should reject when karma exists during init', async () => {120 const exitTask = new Task<number>();121 projectStarterMock.start.resolves({ exitPromise: exitTask.promise });122 const onGoingInit = sut.init();123 exitTask.resolve(1);124 await expect(onGoingInit).rejectedWith(125 "Karma exited prematurely with exit code 1. Please run stryker with `--logLevel trace` to see the karma logging and figure out what's wrong."126 );127 });128 });129 describe('dryRun', () => {130 let sut: KarmaTestRunner;131 beforeEach(() => {132 sut = createSut();133 karmaRunStub.callsArgOnWith(1, null, 0);134 });135 function actDryRun({136 specResults = [],137 runResults = createKarmaTestResults(),138 options = factory.dryRunOptions(),139 mutantCoverage = factory.mutantCoverage(),140 browserError = undefined,141 }: {142 specResults?: KarmaSpec[];143 runResults?: TestResults;144 options?: DryRunOptions;145 mutantCoverage?: MutantCoverage;146 browserError?: [browser: Browser, error: any] | undefined;147 }) {148 const dryRunPromise = sut.dryRun(options);149 actRun({ browserError, specResults, mutantCoverage, hitCount: undefined, runResults });150 return dryRunPromise;151 }152 it('should report completed specs as test results', async () => {153 const specResults = [154 createKarmaSpec({ id: 'spec1', suite: ['foo'], description: 'should bar', time: 42, success: true }),155 createKarmaSpec({156 id: 'spec2',157 suite: ['bar', 'when baz'],158 description: 'should qux',159 log: ['expected quux to be qux', 'expected length of 1'],160 time: 44,161 success: false,162 }),163 createKarmaSpec({ id: 'spec3', suite: ['quux'], description: 'should corge', time: 45, skipped: true }),164 ];165 const expectedTests = [166 factory.testResult({ id: 'spec1', status: TestStatus.Success, timeSpentMs: 42, name: 'foo should bar' }),167 factory.testResult({168 id: 'spec2',169 status: TestStatus.Failed,170 timeSpentMs: 44,171 name: 'bar when baz should qux',172 failureMessage: 'expected quux to be qux, expected length of 1',173 }),174 factory.testResult({ id: 'spec3', status: TestStatus.Skipped, timeSpentMs: 45, name: 'quux should corge' }),175 ];176 const actualResult = await actDryRun({ specResults });177 assertions.expectCompleted(actualResult);178 expect(actualResult.tests).deep.eq(expectedTests);179 });180 it('should run karma with custom karma configuration', async () => {181 // Arrange182 projectStarterMock.start.resolves({ exitPromise: new Task<number>().promise });183 StrykerReporter.instance.karmaConfig = await karma.config.parseConfig(null, {}, { promiseConfig: true });184 StrykerReporter.instance.karmaConfig.hostname = 'www.localhost.com';185 StrykerReporter.instance.karmaConfig.port = 1337;186 StrykerReporter.instance.karmaConfig.listenAddress = 'www.localhost.com:1337';187 const parseConfigStub = sinon.stub(karma.config, 'parseConfig');188 const expectedRunConfig = { custom: 'config' };189 parseConfigStub.resolves(expectedRunConfig);190 const initPromise = sut.init();191 StrykerReporter.instance.onBrowsersReady();192 await initPromise;193 // Act194 await actDryRun({});195 // Assert196 expect(karmaRunStub).calledWith(expectedRunConfig, sinon.match.func);197 expect(parseConfigStub).calledWithExactly(null, { hostname: 'www.localhost.com', port: 1337, listenAddress: 'www.localhost.com:1337' });198 });199 it('should log when karma run is done', async () => {200 await actDryRun({});201 expect(testInjector.logger.debug).calledWith('karma run done with ', 0);202 });203 it('should clear run results between runs', async () => {204 const firstTestResult = createKarmaSpec({ id: 'spec1', suite: ['foo'], description: 'should bar', time: 42, success: true });205 const expectedTestResult = factory.testResult({ id: 'spec1', status: TestStatus.Success, timeSpentMs: 42, name: 'foo should bar' });206 const actualFirstResult = await actDryRun({ specResults: [firstTestResult] });207 const actualSecondResult = await actDryRun({});208 assertions.expectCompleted(actualFirstResult);209 assertions.expectCompleted(actualSecondResult);210 expect(actualFirstResult.tests).deep.eq([expectedTestResult]);211 expect(actualSecondResult.tests).lengthOf(0);212 });213 it('should configure the coverage analysis in the test hooks middleware', async () => {214 await actDryRun({ options: factory.dryRunOptions({ coverageAnalysis: 'all' }) });215 expect(testHooksMiddlewareMock.configureCoverageAnalysis).calledWithExactly('all');216 });217 it('should add coverage report when the reporter raises the "coverage_report" event', async () => {218 const expectedCoverageReport = factory.mutantCoverage({ static: { '1': 4 } });219 const actualResult = await actDryRun({ mutantCoverage: expectedCoverageReport });220 assertions.expectCompleted(actualResult);221 expect(actualResult.mutantCoverage).eq(expectedCoverageReport);222 });223 it('should add error when the reporter raises the "browser_error" event', async () => {224 const expectedError = 'Global variable undefined';225 const actualResult = await actDryRun({ runResults: createKarmaTestResults({ error: true }), browserError: [createBrowser(), expectedError] });226 assertions.expectErrored(actualResult);227 expect(actualResult.errorMessage).deep.eq(expectedError);228 });229 it('should report state Error when tests where ran and run completed in an error', async () => {230 const actualResult = await actDryRun({231 runResults: createKarmaTestResults({ error: true }),232 specResults: [createKarmaSpec()],233 browserError: [createBrowser(), 'some error'],234 });235 assertions.expectErrored(actualResult);236 });237 });238 describe('mutantRun', () => {239 let sut: KarmaTestRunner;240 function actMutantRun({241 specResults = [],242 runResults = createKarmaTestResults(),243 options = factory.mutantRunOptions(),244 mutantCoverage = factory.mutantCoverage(),245 hitCount = undefined,246 browserError = undefined,247 }: {248 specResults?: KarmaSpec[];249 runResults?: TestResults;250 options?: MutantRunOptions;251 hitCount?: number;252 mutantCoverage?: MutantCoverage;253 browserError?: [browser: Browser, error: any] | undefined;254 }) {255 const promise = sut.mutantRun(options);256 actRun({ specResults, runResults, mutantCoverage, hitCount, browserError });257 return promise;258 }259 beforeEach(() => {260 sut = createSut();261 karmaRunStub.callsArgOn(1, 0);262 });263 it('should configure the mutant run on the middleware', async () => {264 const options = factory.mutantRunOptions({ testFilter: ['foobar'] });265 await actMutantRun({ options });266 expect(testHooksMiddlewareMock.configureMutantRun).calledOnceWithExactly(options);267 });268 it('should correctly report a survived mutant', async () => {269 const result = await actMutantRun({ specResults: [createKarmaSpec({ success: true })] });270 assertions.expectSurvived(result);271 expect(result.nrOfTests).eq(1);272 });273 it('should correctly report a killed mutant', async () => {274 const result = await actMutantRun({ specResults: [createKarmaSpec({ success: true }), createKarmaSpec({ success: false })] });275 assertions.expectKilled(result);276 expect(result.nrOfTests).eq(2);277 });278 it('should report a timeout when the browser disconnects', async () => {279 arrangeLauncherMock();280 const onGoingRun = sut.mutantRun(factory.mutantRunOptions());281 StrykerReporter.instance.onRunStart();282 StrykerReporter.instance.onBrowserError(createBrowser({ id: '42', state: 'DISCONNECTED' }), 'disconnected');283 StrykerReporter.instance.onRunComplete(null, createKarmaTestResults({ disconnected: true }));284 StrykerReporter.instance.onBrowsersReady();285 const result = await onGoingRun;286 assertions.expectTimeout(result);287 expect(result.reason).eq('Browser disconnected during test execution. Karma error: disconnected');288 });289 it('should restart the browser and wait until it is restarted when it gets disconnected (issue #2989)', async () => {290 // Arrange291 const { launcher, karmaServer } = arrangeLauncherMock();292 // Act293 let runCompleted = false;294 const onGoingRun = sut.mutantRun(factory.mutantRunOptions()).then(() => (runCompleted = true));295 StrykerReporter.instance.onRunStart();296 StrykerReporter.instance.onBrowserError(createBrowser({ id: '42', state: 'DISCONNECTED' }), 'disconnected');297 // Assert298 expect(launcher.restart).calledWith('42');299 expect(karmaServer.get).calledWith('launcher');300 StrykerReporter.instance.onRunComplete(null, createKarmaTestResults({ disconnected: true }));301 await tick();302 expect(runCompleted).false;303 StrykerReporter.instance.onBrowsersReady();304 await onGoingRun;305 });306 it('should report a timeout when the hitLimit was reached', async () => {307 const result = await actMutantRun({308 options: factory.mutantRunOptions({ hitLimit: 9 }),309 specResults: [createKarmaSpec({ success: false })],310 hitCount: 10,311 });312 assertions.expectTimeout(result);313 expect(result.reason).contains('Hit limit reached (10/9)');314 });315 it('should reset the hitLimit between runs', async () => {316 const firstResult = await actMutantRun({317 options: factory.mutantRunOptions({ hitLimit: 9 }),318 specResults: [createKarmaSpec({ success: false })],319 hitCount: 10,320 });321 const secondResult = await actMutantRun({322 options: factory.mutantRunOptions({ hitLimit: undefined }),323 specResults: [createKarmaSpec({ success: false })],324 hitCount: 10,325 });326 assertions.expectTimeout(firstResult);327 assertions.expectKilled(secondResult);328 });329 });330 describe('dispose', () => {331 beforeEach(async () => {332 StrykerReporter.instance.karmaConfig = await karma.config.parseConfig(null, {}, { promiseConfig: true });333 });334 it('should not do anything if there is no karma server', async () => {335 const sut = createSut();336 await expect(sut.dispose()).not.rejected;337 });338 it('should stop the karma server', async () => {339 const karmaServerMock = sinon.createStubInstance(karma.Server);340 StrykerReporter.instance.karmaServer = karmaServerMock;341 const sut = createSut();342 await sut.dispose();343 expect(karmaServerMock.stop).called;344 });345 it('should await the exit promise provided at startup', async () => {346 // Arrange347 const sut = createSut();348 const karmaServerMock = sinon.createStubInstance(karma.Server);349 StrykerReporter.instance.karmaServer = karmaServerMock;350 const exitTask = new Task<number>();351 let disposeResolved = false;352 projectStarterMock.start.resolves({ exitPromise: exitTask.promise });353 const initPromise = sut.init();354 StrykerReporter.instance.onBrowsersReady();355 await initPromise;356 // Act357 const onGoingDisposal = sut.dispose().then(() => (disposeResolved = true));358 // Assert359 await tick();360 expect(disposeResolved).false;361 exitTask.resolve(1);362 await onGoingDisposal;363 });364 });365 function actRun({366 specResults,367 runResults,368 mutantCoverage,369 hitCount,370 browserError,371 }: {372 specResults: KarmaSpec[];373 runResults: TestResults;374 mutantCoverage: MutantCoverage;375 hitCount: number | undefined;376 browserError: [browser: Browser, error: any] | undefined;377 }) {378 StrykerReporter.instance.onRunStart();379 specResults.forEach((spec) => StrykerReporter.instance.onSpecComplete(null, spec));380 if (browserError) {381 StrykerReporter.instance.onBrowserError(...browserError);382 }383 StrykerReporter.instance.onBrowserComplete(null, { mutantCoverage, hitCount });384 StrykerReporter.instance.onRunComplete(null, runResults);385 }386});387function arrangeLauncherMock() {388 const karmaServerMock = sinon.createStubInstance(karma.Server);389 const launcherMock = sinon.createStubInstance(karma.launcher.Launcher);390 StrykerReporter.instance.karmaServer = karmaServerMock;391 karmaServerMock.get.returns(launcherMock);392 return { launcher: launcherMock, karmaServer: karmaServerMock };393}394function createKarmaSpec(overrides?: Partial<KarmaSpec>): KarmaSpec {395 return {396 description: 'baz',397 id: '1',398 log: [],399 skipped: false,400 success: true,401 suite: ['foo', 'bar'],402 time: 42,403 ...overrides,404 };405}406function createKarmaTestResults(overrides?: Partial<TestResults>): TestResults {407 return {408 disconnected: false,409 error: false,410 exitCode: 0,411 failed: 0,412 success: 0,413 ...overrides,414 };415}416function createBrowser(overrides?: Partial<Browser>): Browser {417 return {418 id: '123123',419 state: 'CONNECTED',420 ...overrides,421 };...

Full Screen

Full Screen

ChoiceBar.js

Source:ChoiceBar.js Github

copy

Full Screen

1import React, { useState } from 'react'2import ReactDOM from 'react-dom'3import ChoiceBarStyles from './ChoiceBarStyles.css'4import CardQuestion from "./CardQuestion.js"5import CardDatabase from "./CardDatabase.js"6import HoldbarBox from "./HoldbarBox.js"7import HoldbarBoxStyles from './HoldbarBoxStyles.css'8import SecondQuestionCharacter from './SecondQuestionCharacter.js'9import SecondQuestionCompany from './SecondQuestionCompany.js'10import SecondQuestionWriter from './SecondQuestionWriter.js'11import ThirdQuestionRun from './ThirdQuestionRun.js'12import ThirdQuestionRunStyles from './ThirdQuestionRunStyles.css'13import FourthSummary from './FourthSummary.js'14import Database from "./Database.js"15import RestartButton from "./RestartButton.js"16import Images from "./ImageDatabase.js"17class ChoiceBar extends React.Component {18 constructor(props) {19 super(props)20 this.state = {21 handleFirstQuestion: false,22 handleStartingInfo: true,23 handleCharacterQuestion: false,24 handleCompanyQuestion: false,25 handleWriterQuestion: false,26 handleRunQuestion: false,27 handleFourthSummary: false,28 handleRenderDatabase: false,29 characterChoice: false,30 characterData: "",31 companyChoice: false,32 companyMarvel: "",33 companyDC: "",34 companyImage: "",35 companyOther: "",36 companyData: "",37 writerChoice: false,38 writerData: "",39 classicRun: "",40 modernRun: "",41 ongoingRun: "",42 runData: "",43 randomChoice: false,44 };45 this.handleStartingInfo = this.restartAllQuestions.bind(this)46 this.handleFirstQuestion = this.handleFirstQuestion.bind(this)47 this.handleCharacterQuestion = this.handleCharacterQuestion.bind(this)48 this.handleWriterQuestion = this.handleWriterQuestion.bind(this)49 this.handleRenderDatabase = this.handleRenderDatabase.bind(this)50 this.characterChoice = this.characterChoice.bind(this)51 this.companyChoice = this.companyChoice.bind(this)52 this.writerChoice = this.writerChoice.bind(this)53 this.characterData = this.characterDataUpdate.bind(this)54 this.writerData = this.writerDataUpdate.bind(this)55 this.companyMarvel = this.companyMarvelChoice.bind(this)56 this.companyDC = this.companyDCChoice.bind(this)57 this.companyImage = this.companyImageChoice.bind(this)58 this.companyOther = this.companyOtherChoice.bind(this)59 this.classicRun = this.classicRunChoice.bind(this)60 this.modernRun = this.modernRunChoice.bind(this)61 this.ongoingRun = this.ongoingRunChoice.bind(this)62 };63 handleFirstQuestion() {64 console.log("Start Rendering First Question")65 this.setState({66 handleFirstQuestion: true,67 handleStartingInfo: false68 }, () => {console.log(this.state);69 });70 }71 handleCharacterQuestion() {72 console.log("Character Data Input Finished and moving to Run Question")73 this.setState({74 handleCharacterQuestion: false,75 handleRunQuestion: true76 }, () => {console.log(this.state);77 });78 }79 handleWriterQuestion() {80 console.log("Writer Data Input Finished and moving on")81 this.setState({82 writerChoice: false,83 handleFourthSummary: true84 }, () => {console.log(this.state);85 })86 }87 characterChoice() {88 console.log("Character Choice Acknowledged at Parent")89 this.setState({90 characterChoice: true,91 handleFirstQuestion: false,92 handleCharacterQuestion: true93 }, () => {console.log(this.state);94 });95 }96 companyChoice() {97 console.log("Company Choice Acknowledged at Parent")98 this.setState({99 companyChoice: true,100 handleFirstQuestion: false,101 handleCompanyQuestion: true102 }, () => {console.log(this.state);103 });104 }105 writerChoice() {106 console.log("Writer Choice Acknowledged at Parent")107 this.setState({108 writerChoice: true,109 handleFirstQuestion: false,110 handleWriterQuestion: true111 }, () => {console.log(this.state);112 });113 }114 characterDataUpdate(characterData) {115 console.log("Character Data update from SecondQuestionCharacter component")116 this.setState({117 characterData: characterData118 }, () => {console.log(this.state);119 });120 }121 writerDataUpdate(writerData) {122 console.log("Writer Data Update from SecondQuestionWriter component")123 this.setState({124 writerData: writerData125 }, () => {console.log(this.state);126 })127 }128 companyMarvelChoice() {129 console.log("Company Marvel Choice Acknowledged at Parent")130 this.setState({131 handleCompanyQuestion: false,132 handleRunQuestion: true,133 characterData: "DNF",134 companyMarvel: "Marvel",135 companyData: "Marvel",136 companyDC: false,137 companyImage: false,138 companyOther: false139 }, () => {console.log(this.state);140 })141 }142 companyDCChoice() {143 console.log("Company DC Choice Acknowledged at Parent")144 this.setState({145 handleCompanyQuestion: false,146 handleRunQuestion: true,147 characterData: "DNF",148 companyDC: "DC Comics",149 companyData: "DC Comics",150 companyMarvel: false,151 companyImage: false,152 companyOther: false153 }, () => {console.log(this.state);154 })155 }156 companyImageChoice() {157 console.log("Company Image Choice Acknowledged at Parent")158 this.setState({159 handleCompanyQuestion: false,160 handleRunQuestion: true,161 characterData: "DNF",162 companyData: "Image",163 companyImage: "Image",164 companyMarvel: false,165 companyDC: false,166 companyOther: false167 }, () => {console.log(this.state);168 })169 }170 companyOtherChoice() {171 console.log("Company Other Choice Acknowledged at Parent")172 this.setState({173 handleCompanyQuestion: false,174 handleRunQuestion: true,175 companyData: "Other",176 companyOther: "Other",177 characterData: "DNF",178 companyMarvel: false,179 companyDC: false,180 companyImage: false181 }, () => {console.log(this.state);182 })183 }184 classicRunChoice() {185 console.log("Classic Run Choice Acknowledged at Parent")186 this.setState({187 classicRun: "Classic",188 runData: "Classic",189 modernRun: false,190 ongoingRun: false,191 handleRunQuestion: false,192 handleFourthSummary: true193 }, () => {console.log(this.state);194 })195 }196 modernRunChoice() {197 console.log("Modern Run Choice Acknowledged at Parent")198 this.setState({199 modernRun: "Modern",200 runData: "Modern",201 classicRun: false,202 ongoingRun: false,203 handleRunQuestion: false,204 handleFourthSummary: true205 }, () => {console.log(this.state);206 })207 }208 ongoingRunChoice() {209 console.log("Ongoing Run Choice Acknowledged at Parent")210 this.setState({211 ongoingRun: "Ongoing",212 runData: "Ongoing",213 modernRun: false,214 classicRun: false,215 handleRunQuestion: false,216 handleFourthSummary: true217 }, () => {console.log(this.state);218 })219 }220 restartAllQuestions() {221 console.log("Reset All States")222 this.setState({223 handleFirstQuestion: false,224 handleStartingInfo: true,225 handleCharacterQuestion: false,226 handleCompanyQuestion: false,227 handleWriterQuestion: false,228 handleRunQuestion: false,229 handleFourthSummary: false,230 handleRenderDatabase: false,231 characterChoice: false,232 characterData: "",233 companyChoice: false,234 companyMarvel: "",235 companyDC: "",236 companyImage: "",237 companyOther: "",238 companyData: "",239 writerChoice: false,240 writerData: "",241 classicRun: "",242 modernRun: "",243 ongoingRun: "",244 runData: "",245 randomChoice: false,246 }, () => {console.log(this.state);247 })248 }249 handleRenderDatabase() {250 console.log("All filters done. Rendering Database")251 this.setState({252 handleRenderDatabase: true,253 handleFourthSummary: false254 }, () => {console.log(this.state);255 })256 }257 render() {258 return (259 <div>260 <center>261 <div>262 <h1> Comic Book Recommendation </h1>263 <div264 style={{265 display: !this.state.handleStartingInfo266 ? "none"267 : "block"268 }}269 >270 <h2> Want something to read? <br></br> </h2>271 <p class="ChoiceBarIntro"> Try something from Matthew's curated list </p>272 <button273 onClick={this.handleFirstQuestion}274 >275 Start!276 </button>277 <p> </p>278 </div>279 <div>280 {Database.map(Database =>281 <div>282 {this.state.handleRenderDatabase && this.state.characterData === Database.character[0] && this.state.runData === Database.run283 ? <div>284 <CardDatabase285 title={Database.title}286 writer={Database.writer[Database.writer.length - 1]}287 artist={Database.artist[0]}288 length={Database.length}289 synopsis={Database.synopsis}290 imageID={Database.imageID}291 />292 <br></br>293 </div>294 : null295 }296 </div>)}297 {Database.map(Database =>298 <div>299 {this.state.handleRenderDatabase && this.state.writerData === Database.writer[0]300 ? <div>301 <CardDatabase302 title={Database.title}303 writer={Database.writer[Database.writer.length - 1]}304 artist={Database.artist[0]}305 length={Database.length}306 synopsis={Database.synopsis}307 imageID={Database.imageID}308 />309 <br></br>310 </div>311 : null312 }313 </div>)}314 {Database.map(Database =>315 <div>316 {this.state.handleRenderDatabase && this.state.companyData === Database.company && this.state.runData === Database.run317 ? <div>318 <CardDatabase319 title={Database.title}320 writer={Database.writer[Database.writer.length - 1]}321 artist={Database.artist[0]}322 length={Database.length}323 synopsis={Database.synopsis}324 imageID={Database.imageID}325 />326 <br></br>327 </div>328 : null329 }330 </div>)}331 </div>332 <br></br>333 {this.state.handleFirstQuestion334 ? <FirstQuestionBox335 characterChoice = {this.characterChoice}336 companyChoice = {this.companyChoice}337 writerChoice = {this.writerChoice}338 />339 : null}340 {!this.state.handleFirstQuestion && this.state.handleCharacterQuestion341 ? <SecondQuestionCharacter342 handleCharacterQuestion = {this.handleCharacterQuestion}343 characterDataUpdate = {this.characterDataUpdate.bind(this)}344 />345 : null346 }347 {!this.state.handleFirstQuestion && this.state.handleCompanyQuestion348 ? <SecondQuestionCompany349 companyMarvelChoice = {this.companyMarvel}350 companyDCChoice = {this.companyDC}351 companyImageChoice = {this.companyImage}352 companyOtherChoice = {this.companyOther}353 />354 : null355 }356 {!this.state.handleFirstQuestion && this.state.writerChoice357 ? <SecondQuestionWriter358 handleWriterQuestion = {this.handleWriterQuestion}359 writerDataUpdate = {this.writerDataUpdate.bind(this)}360 />361 : null362 }363 {!this.state.handleFirstQuestion && !this.state.handleCompanyQuestion && !this.state.handleCharacterQuestion && this.state.handleRunQuestion364 ? <ThirdQuestionRun365 classicRunChoice = {this.classicRun}366 modernRunChoice = {this.modernRun}367 ongoingRunChoice = {this.ongoingRun}368 />369 : null370 }371 {this.state.handleFourthSummary372 ? <FourthSummary373 handleRenderDatabase = {this.handleRenderDatabase}374 />375 : null376 }377 {this.state.handleRenderDatabase378 ? <RestartButton379 restartAllQuestions = {this.restartAllQuestions.bind(this)}380 />381 : null382 }383 <br></br>384 </div>385 </center>386 </div>387 )388 }389}390class FirstQuestionBox extends React.Component {391 constructor() {392 super();393 this.state = {394 characterStatus: "false",395 companyStatus: "false",396 writerStatus: "false"397 };398 this.characterStatus = this.characterStatus.bind(this)399 this.companyStatus = this.companyStatus.bind(this)400 this.writerStatus = this.writerStatus.bind(this)401 }402 characterStatus() {403 console.log("Character Chosen Button")404 this.setState({405 characterStatus: true,406 companyStatus: false,407 writerStatus: false408 }, () => {console.log(this.state);409 });410 console.log(this.state)411 }412 companyStatus() {413 console.log("Company Chosen Button")414 this.setState({415 characterStatus: false,416 companyStatus: true,417 writerStatus: false418 }, () => {console.log(this.state);419 });420 console.log(this.state)421 }422 writerStatus() {423 console.log("Writer Chosen Button")424 this.setState({425 characterStatus: false,426 companyStatus: false,427 writerStatus: true428 }, () => {console.log(this.state);429 });430 console.log(this.state)431 }432 render() {433 return(434 <div>435 <div436 className="FirstQuestionBoxCharacterStyles"437 style={{438 display: this.state.characterStatus439 ? "block"440 : "none"441 }}442 >443 <CardQuestion444 title="Character"445 text="Do you want to search by character?"446 />447 <button onClick={this.props.characterChoice}> Choose By Character </button>448 </div>449 <div450 className="FirstQuestionBoxCompanyStyles"451 style={{452 display: this.state.companyStatus453 ? "block"454 : "none"455 }}456 >457 <CardQuestion458 title="Company"459 text="Do you want to search by company?"460 />461 <button onClick={this.props.companyChoice}> Choose By Company </button>462 </div>463 <div464 className="FirstQuestionBoxWriterStyles"465 style={{466 display: this.state.writerStatus467 ? "block"468 : "none"469 }}>470 <CardQuestion471 title="Writer"472 text="Do you want to search by writer?"473 />474 <button onClick={this.props.writerChoice}> Choose By Writer </button>475 </div>476 </div>477 )478 }479}...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var onGoingRun = require('stryker-parent').onGoingRun;2var onMutationTestReportReady = require('stryker-parent').onMutationTestReportReady;3var onAllMutantsTested = require('stryker-parent').onAllMutantsTested;4var onTestResult = require('stryker-parent').onTestResult;5var onAllMutantsTested = require('stryker-parent').onAllMutantsTested;6var onAllMutantsTested = require('stryker-parent').onAllMutantsTested;7var onAllMutantsTested = require('stryker-parent').onAllMutantsTested;8var onAllMutantsTested = require('stryker-parent').onAllMutantsTested;9var onAllMutantsTested = require('stryker-parent').onAllMutantsTested;10var onAllMutantsTested = require('stryker-parent').onAllMutantsTested;11var onAllMutantsTested = require('stryker-parent').onAllMutantsTested;12var onAllMutantsTested = require('stryker-parent').onAllMutantsTested;13var onAllMutantsTested = require('stryker-parent').onAllMutantsTested;14var onAllMutantsTested = require('stryker-parent').onAllMutantsTested;

Full Screen

Using AI Code Generation

copy

Full Screen

1var onGoingRun = require('stryker-parent').onGoingRun;2onGoingRun();3var onEndRun = require('stryker-parent').onEndRun;4onEndRun();5module.exports = {6 onGoingRun: function () {7 },8 onEndRun: function () {9 }10}11var onGoingRun = require('stryker-parent').onGoingRun;12onGoingRun();13var onEndRun = require('stryker-parent').onEndRun;14onEndRun();15module.exports = {16 onGoingRun: function () {17 },18 onEndRun: function () {19 }20}21var onGoingRun = require('stryker-parent').onGoingRun;22onGoingRun();23var onEndRun = require('stryker-parent').onEndRun;24onEndRun();25module.exports = {26 onGoingRun: function () {27 },28 onEndRun: function () {29 }30}31var onGoingRun = require('stryker-parent').onGoingRun;32onGoingRun();33var onEndRun = require('stryker-parent').onEndRun;34onEndRun();35module.exports = {36 onGoingRun: function () {37 },38 onEndRun: function () {39 }40}41var onGoingRun = require('stryker-parent').onGoingRun;42onGoingRun();43var onEndRun = require('stryker-parent').onEndRun;44onEndRun();45module.exports = {46 onGoingRun: function () {47 },48 onEndRun: function () {49 }50}51var onGoingRun = require('stryker-parent').onGoingRun;52onGoingRun();

Full Screen

Using AI Code Generation

copy

Full Screen

1var strykerParent = require('stryker-parent');2console.log(strykerParent.onGoingRun());3module.exports = {4 onGoingRun: function() {5 return true;6 }7};8var strykerParent = require('stryker-parent');9console.log(strykerParent.onGoingRun());10module.exports = {11 onGoingRun: function() {12 return true;13 }14};

Full Screen

Using AI Code Generation

copy

Full Screen

1const strykerParent = require('stryker-parent');2const strykerConfig = {3};4strykerParent.ongoingRun(strykerConfig);5const strykerParent = require('stryker-parent');6const strykerConfig = {7};8module.exports = strykerConfig;

Full Screen

Using AI Code Generation

copy

Full Screen

1const onGoingRun = require('stryker-parent').onGoingRun;2module.exports = function (config) {3 config.set({4 });5 onGoingRun(config);6};7module.exports = function (config) {8 config.set({9 });10 require('stryker-parent').onGoingRun(config);11};12const onGoingRun = require('stryker-parent').onGoingRun;13module.exports = function (config) {14 config.set({15 });16 onGoingRun(config);17};18const onGoingRun = require('stryker-parent').onGoingRun;19module.exports = function (config) {20 config.set({21 });22 onGoingRun(config);23};24const onGoingRun = require('stryker-parent').onGoingRun;25module.exports = function (config) {26 config.set({27 });28 onGoingRun(config);29};30const onGoingRun = require('stryker-parent').onGoingRun;31module.exports = function (config) {32 config.set({33 });34 onGoingRun(config);35};36const onGoingRun = require('stryker-parent').onGoingRun;37module.exports = function (config) {38 config.set({39 });40 onGoingRun(config);41};42const onGoingRun = require('stryker-parent').onGoingRun;43module.exports = function (config) {44 config.set({45 });46 onGoingRun(config);47};48const onGoingRun = require('stryker-parent').onGoingRun;49module.exports = function (config) {50 config.set({51 });52 onGoingRun(config);53};54const onGoingRun = require('stryker-parent').onGoingRun;55module.exports = function (config) {56 config.set({57 });58 onGoingRun(config);59};60const onGoingRun = require('stry

Full Screen

Using AI Code Generation

copy

Full Screen

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

Full Screen

Using AI Code Generation

copy

Full Screen

1const Parent = require('stryker-parent');2const parent = new Parent();3parent.onGoingRun();4parent.onAllTestRunEnd();5parent.onAllTestRunStart();6parent.onTestRunStart();7parent.onTestRunComplete();8parent.onTestStart();9parent.onTestComplete();10parent.onTestResult();11parent.onTestError();12parent.onTestTimeout();13parent.onAllMutantsMatchedWithTests();14parent.onMutantTested();15parent.onAllMutantsTested();16parent.onAllMutantsTested();17const Parent = require('stryker-parent');18const parent = new Parent();19parent.onTestResult();20parent.onTestError();21parent.onTestTimeout();22parent.onAllMutantsMatchedWithTests();23parent.onMutantTested();24parent.onAllMutantsTested();25parent.onAllMutantsTested();

Full Screen

Using AI Code Generation

copy

Full Screen

1var stryker = require('stryker-parent');2var onGoingRun = stryker.onGoingRun;3var options = {4};5var run = onGoingRun(options);6run.then(function(result){7 console.log(result);8});9run.start();10run.on('testResult', function(result){11 console.log(result);12});13run.on('error', function(error){14 console.log(error);15});16run.on('complete', function(){17 console.log('complete');18});19run.on('progress', function(progress){20 console.log(progress);21});22run.stop();23run.on('error', function(error){24 console.log(error);25});26run.on('complete', function(){27 console.log('complete');28});29run.on('progress', function(progress){30 console.log(progress);31});32run.restart();33run.on('error', function(error){34 console.log(error);35});36run.on('complete', function(){37 console.log('complete');38});39run.on('progress', function(progress){40 console.log(progress);41});42run.on('error', function(error){43 console.log(error);44});45run.on('complete', function(){46 console.log('complete');47});48run.on('progress', function(progress){49 console.log(progress);50});51run.restart();52run.on('error', function(error){53 console.log(error);54});55run.on('complete', function(){56 console.log('complete');57});58run.on('progress', function(progress){59 console.log(progress);60});61run.restart();62run.on('error', function(error){63 console.log(error);64});65run.on('complete', function(){66 console.log('complete');67});68run.on('progress', function(progress){69 console.log(progress);70});71run.restart();72run.on('error', function(error){73 console.log(error);74});75run.on('complete

Full Screen

Using AI Code Generation

copy

Full Screen

1var strykerParent = require('stryker-parent');2var stryker = require('stryker');3strykerParent.onGoingRun(function() {4 return stryker.run();5});6var stryker = require('stryker');7var strykerParent = require('stryker-parent');8strykerParent.onGoingRun(function() {9 return stryker.run();10});11strykerParent.onGoingRun(function() {12 return stryker.run();13});14var stryker = require('stryker');15var strykerParent = require('stryker-parent');16strykerParent.onGoingRun(function() {17 return stryker.run();18});19strykerParent.onGoingRun(function() {20 return stryker.run();21});22strykerParent.onGoingRun(function() {23 return stryker.run();24});25var stryker = require('stryker');26var strykerParent = require('stryker-parent');27strykerParent.onGoingRun(f

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