How to use expectedPluginPaths method in stryker-parent

Best JavaScript code snippet using stryker-parent

1-prepare-executor.spec.ts

Source:1-prepare-executor.spec.ts Github

copy

Full Screen

1import path from 'path';2import sinon from 'sinon';3import { JSONSchema7 } from 'json-schema';4import { Injector } from 'typed-inject';5import { expect } from 'chai';6import { testInjector, factory } from '@stryker-mutator/test-helpers';7import { PartialStrykerOptions, LogLevel } from '@stryker-mutator/api/core';8import { BaseContext } from '@stryker-mutator/api/plugin';9import { MutantInstrumenterContext, PrepareExecutor } from '../../../src/process/index.js';10import { coreTokens, PluginLoader, LoadedPlugins } from '../../../src/di/index.js';11import { LogConfigurator, LoggingClientContext } from '../../../src/logging/index.js';12import { Project, ProjectReader } from '../../../src/fs/index.js';13import { TemporaryDirectory } from '../../../src/utils/temporary-directory.js';14import { ConfigError } from '../../../src/errors.js';15import { ConfigReader, OptionsValidator, MetaSchemaBuilder } from '../../../src/config/index.js';16import { BroadcastReporter, reporterPluginsFileUrl } from '../../../src/reporters/index.js';17import { UnexpectedExitHandler } from '../../../src/unexpected-exit-handler.js';18import { FileSystemTestDouble } from '../../helpers/file-system-test-double.js';19interface AllContext extends MutantInstrumenterContext {20 [coreTokens.validationSchema]: unknown;21 [coreTokens.optionsValidator]: OptionsValidator;22 [coreTokens.pluginsByKind]: PluginLoader;23}24describe(PrepareExecutor.name, () => {25 let cliOptions: PartialStrykerOptions;26 let configReaderMock: sinon.SinonStubbedInstance<ConfigReader>;27 let pluginLoaderMock: sinon.SinonStubbedInstance<PluginLoader>;28 let metaSchemaBuilderMock: sinon.SinonStubbedInstance<MetaSchemaBuilder>;29 let configureMainProcessStub: sinon.SinonStub;30 let optionsValidatorMock: sinon.SinonStubbedInstance<OptionsValidator>;31 let configureLoggingServerStub: sinon.SinonStub;32 let injectorMock: sinon.SinonStubbedInstance<Injector<AllContext>>;33 let projectReaderMock: sinon.SinonStubbedInstance<ProjectReader>;34 let project: Project;35 let temporaryDirectoryMock: sinon.SinonStubbedInstance<TemporaryDirectory>;36 let loadedPlugins: LoadedPlugins;37 let sut: PrepareExecutor;38 beforeEach(() => {39 const fsTestDouble = new FileSystemTestDouble({ 'index.js': 'console.log("hello world");' });40 project = new Project(fsTestDouble, fsTestDouble.toFileDescriptions());41 cliOptions = {};42 configReaderMock = sinon.createStubInstance(ConfigReader);43 configReaderMock.readConfig.resolves(testInjector.options);44 metaSchemaBuilderMock = sinon.createStubInstance(MetaSchemaBuilder);45 configureMainProcessStub = sinon.stub(LogConfigurator, 'configureMainProcess');46 pluginLoaderMock = sinon.createStubInstance(PluginLoader);47 loadedPlugins = { pluginModulePaths: [], pluginsByKind: new Map(), schemaContributions: [] };48 pluginLoaderMock.load.resolves(loadedPlugins);49 temporaryDirectoryMock = sinon.createStubInstance(TemporaryDirectory);50 projectReaderMock = sinon.createStubInstance(ProjectReader);51 optionsValidatorMock = sinon.createStubInstance(OptionsValidator);52 configureLoggingServerStub = sinon.stub(LogConfigurator, 'configureLoggingServer');53 injectorMock = factory.injector() as unknown as sinon.SinonStubbedInstance<Injector<AllContext>>;54 injectorMock.resolve.withArgs(coreTokens.temporaryDirectory).returns(temporaryDirectoryMock);55 injectorMock.injectClass56 .withArgs(PluginLoader)57 .returns(pluginLoaderMock)58 .withArgs(OptionsValidator)59 .returns(optionsValidatorMock)60 .withArgs(MetaSchemaBuilder)61 .returns(metaSchemaBuilderMock)62 .withArgs(ConfigReader)63 .returns(configReaderMock)64 .withArgs(ProjectReader)65 .returns(projectReaderMock);66 projectReaderMock.read.resolves(project);67 sut = new PrepareExecutor(injectorMock as Injector<BaseContext>);68 });69 it('should provide the cliOptions to the config reader', async () => {70 await sut.execute(cliOptions);71 expect(configReaderMock.readConfig).calledWithExactly(cliOptions);72 });73 it('should load the plugins', async () => {74 // Arrange75 testInjector.options.appendPlugins = ['appended'];76 testInjector.options.plugins = ['@stryker-mutator/*', './my-custom-plugin.js'];77 // Act78 await sut.execute(cliOptions);79 // Assert80 sinon.assert.calledWithExactly(pluginLoaderMock.load, ['@stryker-mutator/*', './my-custom-plugin.js', reporterPluginsFileUrl, 'appended']);81 });82 it('should provided the loaded modules as pluginModulePaths', async () => {83 // Arrange84 const expectedPluginPaths = ['@stryker-mutator/core', path.resolve('./my-custom-plugin.js'), 'appended'];85 loadedPlugins.pluginModulePaths.push(...expectedPluginPaths);86 // Act87 await sut.execute(cliOptions);88 // Assert89 sinon.assert.calledWithExactly(injectorMock.provideValue, coreTokens.pluginModulePaths, expectedPluginPaths);90 });91 it('should validate final options with the meta schema', async () => {92 // Arrange93 const contributions = [{ some: 'schema contributions' }];94 const metaSchema: JSONSchema7 = { properties: { meta: { $comment: 'schema' } } };95 loadedPlugins.schemaContributions.push(...contributions);96 metaSchemaBuilderMock.buildMetaSchema.returns(metaSchema);97 // Act98 await sut.execute(cliOptions);99 // Assert100 sinon.assert.calledWithExactly(metaSchemaBuilderMock.buildMetaSchema, contributions);101 sinon.assert.calledWithExactly(injectorMock.provideValue, coreTokens.validationSchema, metaSchema);102 sinon.assert.calledWithExactly(optionsValidatorMock.validate, testInjector.options, true);103 });104 it('should configure logging for the main process', async () => {105 await sut.execute(cliOptions);106 expect(configureMainProcessStub).calledOnce;107 });108 it('should configure the logging server', async () => {109 const expectedLoggingContext: LoggingClientContext = {110 level: LogLevel.Fatal,111 port: 1337,112 };113 configureLoggingServerStub.resolves(expectedLoggingContext);114 testInjector.options.logLevel = LogLevel.Information;115 testInjector.options.fileLogLevel = LogLevel.Trace;116 testInjector.options.allowConsoleColors = true;117 await sut.execute(cliOptions);118 expect(configureLoggingServerStub).calledWithExactly(LogLevel.Information, LogLevel.Trace, true);119 expect(injectorMock.provideValue).calledWithExactly(coreTokens.loggingContext, expectedLoggingContext);120 });121 it('should resolve input files', async () => {122 await sut.execute(cliOptions);123 expect(projectReaderMock.read).called;124 expect(injectorMock.provideValue).calledWithExactly(coreTokens.project, project);125 });126 it('should provide the reporter the reporter', async () => {127 await sut.execute(cliOptions);128 sinon.assert.calledWithExactly(injectorMock.provideClass, coreTokens.reporter, BroadcastReporter);129 });130 it('should provide the UnexpectedExitRegister', async () => {131 await sut.execute(cliOptions);132 sinon.assert.calledWithExactly(injectorMock.provideClass, coreTokens.unexpectedExitRegistry, UnexpectedExitHandler);133 });134 it('should reject when logging server rejects', async () => {135 const expectedError = Error('expected error');136 configureLoggingServerStub.rejects(expectedError);137 await expect(sut.execute(cliOptions)).rejectedWith(expectedError);138 });139 it('should reject when input file globbing results in a rejection', async () => {140 const expectedError = Error('expected error');141 projectReaderMock.read.rejects(expectedError);142 await expect(sut.execute(cliOptions)).rejectedWith(expectedError);143 });144 it('should reject when no input files where found', async () => {145 projectReaderMock.read.resolves(new Project(new FileSystemTestDouble(), {}));146 await expect(sut.execute(cliOptions)).rejectedWith(ConfigError, 'No input files found');147 });148 it('should not create the temp directory when no input files where found', async () => {149 projectReaderMock.read.resolves(new Project(new FileSystemTestDouble(), {}));150 await expect(sut.execute(cliOptions)).rejected;151 expect(temporaryDirectoryMock.initialize).not.called;152 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const strykerParent = require('stryker-parent');2const expectedPluginPaths = strykerParent.expectedPluginPaths;3console.log(expectedPluginPaths);4const strykerParent = require('stryker-parent');5const expectedPluginPaths = strykerParent.expectedPluginPaths;6console.log(expectedPluginPaths);7I have fixed this and released a new version of stryker-parent (1.0.4). Can you verify that it works for you?

Full Screen

Using AI Code Generation

copy

Full Screen

1const { expectedPluginPaths } = require('stryker-parent');2console.log(expectedPluginPaths);3const expectedPluginPaths = require('./lib/pluginPaths');4module.exports = { expectedPluginPaths };5const path = require('path');6const expectedPluginPaths = [path.resolve(__dirname, 'plugins', 'stryker-plugin1')];7module.exports = expectedPluginPaths;8module.exports = { name: 'stryker-plugin1' };9module.exports = { name: 'stryker-plugin2' };10module.exports = { name: 'stryker-plugin3' };11module.exports = { name: 'stryker-plugin4' };12module.exports = { name: 'stryker-plugin5' };13module.exports = { name: 'stryker-plugin6' };14module.exports = { name: 'stryker-plugin7' };15module.exports = { name: 'stryker-plugin8' };

Full Screen

Using AI Code Generation

copy

Full Screen

1const expectedPluginPaths = require('stryker-parent').expectedPluginPaths;2console.log(expectedPluginPaths('stryker-mocha-runner', '1.0.0'));3const expectedPluginPaths = require('stryker').expectedPluginPaths;4console.log(expectedPluginPaths('stryker-mocha-runner', '1.0.0'));5const expectedPluginPaths = require('stryker-api').expectedPluginPaths;6console.log(expectedPluginPaths('stryker-mocha-runner', '1.0.0'));7const expectedPluginPaths = require('stryker-mocha-runner').expectedPluginPaths;8console.log(expectedPluginPaths('stryker-mocha-runner', '1.0.0'));9const expectedPluginPaths = require('stryker').expectedPluginPaths;10console.log(expectedPluginPaths('stryker-mocha-runner', '1.0.0'));11const expectedPluginPaths = require('stryker-mocha-runner').expectedPluginPaths;12console.log(expectedPluginPaths('stryker-mocha-runner', '1.0.0'));13const expectedPluginPaths = require('stryker-mocha-runner').expectedPluginPaths;

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