Best JavaScript code snippet using stryker-parent
monaco.contribution.ts
Source:monaco.contribution.ts
1import { Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di';2import {3 PreferenceService,4 JsonSchemaContribution,5 ISchemaStore,6 PreferenceScope,7 IJSONSchemaRegistry,8 Disposable,9 CommandRegistry,10 IMimeService,11 CorePreferences,12 ClientAppContribution,13 CommandContribution,14 ContributionProvider,15 Domain,16 MonacoService,17 MonacoContribution,18 ServiceNames,19 KeybindingContribution,20 KeybindingRegistry,21 IOpenerService,22 MonacoOverrideServiceRegistry,23} from '@opensumi/ide-core-browser';24import {25 IMenuRegistry,26 MenuContribution,27 MenuId,28 IMenuItem,29 ISubmenuItem,30} from '@opensumi/ide-core-browser/lib/menu/next';31import { URI, ILogger } from '@opensumi/ide-core-common';32import { IIconService, IThemeService } from '@opensumi/ide-theme';33import { IconService } from '@opensumi/ide-theme/lib/browser/icon.service';34import {35 ISemanticTokenRegistry,36 parseClassifierString,37 TokenStyle,38} from '@opensumi/ide-theme/lib/common/semantic-tokens-registry';39import { SimpleKeybinding } from '@opensumi/monaco-editor-core/esm/vs/base/common/keybindings';40import { registerEditorContribution } from '@opensumi/monaco-editor-core/esm/vs/editor/browser/editorExtensions';41import { AbstractCodeEditorService } from '@opensumi/monaco-editor-core/esm/vs/editor/browser/services/abstractCodeEditorService';42import { OpenerService } from '@opensumi/monaco-editor-core/esm/vs/editor/browser/services/openerService';43import { IEditorContribution } from '@opensumi/monaco-editor-core/esm/vs/editor/common/editorCommon';44import { EditorContextKeys } from '@opensumi/monaco-editor-core/esm/vs/editor/common/editorContextKeys';45import {46 FormattingConflicts,47 IFormattingEditProviderSelector,48} from '@opensumi/monaco-editor-core/esm/vs/editor/contrib/format/browser/format';49import { StandaloneCommandService } from '@opensumi/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices';50import { StandaloneServices } from '@opensumi/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices';51import { IStandaloneThemeService } from '@opensumi/monaco-editor-core/esm/vs/editor/standalone/common/standaloneTheme';52import * as monacoActions from '@opensumi/monaco-editor-core/esm/vs/platform/actions/common/actions';53import {54 ContextKeyExpr,55 ContextKeyExprType,56} from '@opensumi/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey';57import { IInstantiationService } from '@opensumi/monaco-editor-core/esm/vs/platform/instantiation/common/instantiation';58import * as monacoKeybindings from '@opensumi/monaco-editor-core/esm/vs/platform/keybinding/common/keybindingsRegistry';59import {60 EditorExtensionsRegistry,61 ICommandServiceToken,62 IMonacoActionRegistry,63 IMonacoCommandService,64 IMonacoCommandsRegistry,65} from './contrib/command';66import { ITextmateTokenizer, ITextmateTokenizerService } from './contrib/tokenizer';67import { ICodeEditor } from './monaco-api/editor';68import { languageFeaturesService } from './monaco-api/languages';69import { MonacoMenus } from './monaco-menu';70import { MonacoSnippetSuggestProvider } from './monaco-snippet-suggest-provider';71import { MonacoResolvedKeybinding } from './monaco.resolved-keybinding';72@Domain(ClientAppContribution, CommandContribution, MenuContribution, KeybindingContribution)73export class MonacoClientContribution74 implements ClientAppContribution, CommandContribution, MenuContribution, KeybindingContribution75{76 @Autowired()77 monacoService: MonacoService;78 @Autowired(MonacoContribution)79 monacoContributionProvider: ContributionProvider<MonacoContribution>;80 @Autowired(JsonSchemaContribution)81 schemaContributionProvider: ContributionProvider<JsonSchemaContribution>;82 @Autowired(ICommandServiceToken)83 monacoCommandService: IMonacoCommandService;84 @Autowired(IMonacoCommandsRegistry)85 monacoCommandRegistry: IMonacoCommandsRegistry;86 @Autowired(IMonacoActionRegistry)87 monacoActionRegistry: IMonacoActionRegistry;88 @Autowired(ITextmateTokenizer)89 private textmateService!: ITextmateTokenizerService;90 @Autowired(IThemeService)91 themeService: IThemeService;92 @Autowired(IIconService)93 private iconService: IconService;94 @Autowired(PreferenceService)95 preferenceService: PreferenceService;96 @Autowired(ISchemaStore)97 schemaStore: ISchemaStore;98 @Autowired(IJSONSchemaRegistry)99 jsonContributionRegistry: IJSONSchemaRegistry;100 @Autowired(INJECTOR_TOKEN)101 injector: Injector;102 @Autowired(CorePreferences)103 corePreferences: CorePreferences;104 @Autowired(IMimeService)105 mimeService: IMimeService;106 @Autowired(ISemanticTokenRegistry)107 protected readonly semanticTokenRegistry: ISemanticTokenRegistry;108 @Autowired(MonacoSnippetSuggestProvider)109 protected readonly snippetSuggestProvider: MonacoSnippetSuggestProvider;110 @Autowired(IOpenerService)111 private readonly openerService: IOpenerService;112 @Autowired(ILogger)113 private readonly logger: ILogger;114 @Autowired(MonacoOverrideServiceRegistry)115 private readonly overrideServicesRegistry: MonacoOverrideServiceRegistry;116 get editorExtensionsRegistry(): typeof EditorExtensionsRegistry {117 return EditorExtensionsRegistry;118 }119 async initialize() {120 // 注å monaco 模ååæç override services121 // ç±äºåå²åå ï¼è¿é¨åå®ç°å¨ monaco 模åï¼åéè¦è¿ç§»å° editor 模å122 this.registerOverrideServices();123 // æ§è¡ææ MonacoContribution124 for (const contrib of this.monacoContributionProvider.getContributions()) {125 // æ§è¡ææ MonacoContribution ç registerOverrideService æ¹æ³ï¼ç¨æ¥æ³¨å overrideService126 if (contrib.registerOverrideService) {127 contrib.registerOverrideService(this.overrideServicesRegistry);128 }129 // 注å Monaco å
ç½®çæ ¼å¼åéæ©å¨ï¼è§¦å Select æä½æ¶ä½¿ç¨ OpenSumi èªå·±å®ç°çéæ©å¨130 if (contrib.registerMonacoDefaultFormattingSelector) {131 contrib.registerMonacoDefaultFormattingSelector(this.registryDefaultFormattingSelector);132 }133 // 注å/è¦çä¸äº monaco å
ç½®ç EditorExtensionContributionï¼ä¾å¦ ContextMenu134 if (contrib.registerEditorExtensionContribution) {135 contrib.registerEditorExtensionContribution(136 (id: string, contribCtor: new (editor: ICodeEditor, ...services: any) => IEditorContribution) => {137 const existContrib = this.editorExtensionsRegistry.getSomeEditorContributions([id]);138 if (existContrib.length === 0) {139 registerEditorContribution(id, contribCtor);140 } else {141 existContrib[0].ctor = contribCtor;142 }143 },144 );145 }146 }147 // æ§è¡ææ SchemaContribution148 for (const contribution of this.schemaContributionProvider.getContributions()) {149 contribution.registerSchema(this.jsonContributionRegistry);150 }151 // çå¬ Schema æ¹åçäºä»¶152 this.setSchemaPreferenceListener(this.schemaStore);153 // çå¬ preferences æ´æ°äºä»¶ï¼åæ¥æ´æ° mime154 this.setPreferencesChangeListener();155 // ä¿®æ¹ä¸äº Monaco å
ç½® Services çè¡ä¸º156 this.patchMonacoInternalServices();157 // 注å/æ¦æª Monaco å
ç½®çèå158 this.patchMonacoInternalMenus();159 // æ´æ° Mime160 this.mimeService.updateMime();161 // å¨ç¼è¾å¨å
¨é¨æ¢å¤ååå§å textmateService162 this.initTextmateService();163 }164 onDidStart() {165 languageFeaturesService.completionProvider.register(166 this.snippetSuggestProvider.registeredLanguageIds,167 this.snippetSuggestProvider,168 );169 }170 private registerOverrideServices() {171 const codeEditorService = this.overrideServicesRegistry.getRegisteredService<AbstractCodeEditorService>(172 ServiceNames.CODE_EDITOR_SERVICE,173 );174 // Monaco CommandService175 const standaloneCommandService = new StandaloneCommandService(StandaloneServices.get(IInstantiationService));176 // ç» monacoCommandService 设置å§æï¼æ§è¡ monaco å½ä»¤ä½¿ç¨ standaloneCommandService æ§è¡177 this.monacoCommandService.setDelegate(standaloneCommandService);178 // æ¿æ¢ monaco å
é¨ç commandService179 this.overrideServicesRegistry.registerOverrideService(ServiceNames.COMMAND_SERVICE, this.monacoCommandService);180 // Monaco OpenerService181 const monacoOpenerService = new OpenerService(codeEditorService!, this.monacoCommandService);182 monacoOpenerService.registerOpener({183 open: (uri) => this.interceptOpen(new URI(uri.toString())),184 });185 this.overrideServicesRegistry.registerOverrideService(ServiceNames.OPENER_SERVICE, monacoOpenerService);186 }187 private patchMonacoInternalServices() {188 this.patchMonacoThemeService();189 const codeEditorService = this.overrideServicesRegistry.getRegisteredService(ServiceNames.CODE_EDITOR_SERVICE);190 // æ¿æ¢ StaticServices ä¸æè½½ç codeEditorService å®ä¾191 // FIXME: å¦ä½æ¿æ¢æ StandaloneServices.get(ICodeEditorService)192 (StandaloneServices as unknown as any).codeEditorService = {193 get: () => codeEditorService,194 };195 }196 private patchMonacoInternalMenus() {197 const menuRegistry = this.injector.get(IMenuRegistry) as IMenuRegistry;198 const monacoMenuRegistry = monacoActions.MenuRegistry;199 // editor/context200 monacoMenuRegistry.getMenuItems(monacoActions.MenuId.EditorContext).forEach((item) => {201 const menuItem = transformMonacoMenuItem(item);202 /**203 * monaco ä¸ editor/context æ¯ä¸ä¸ªæ°åæ举å¼204 * opensumi ä¸æ¯ä¸ä¸ª å符串205 * è¿éåäºä¸å±ä»£çè½¬æ¢ (ä¸æ¹ä¹æ代ç注å)206 */207 menuRegistry.registerMenuItem(MenuId.EditorContext as unknown as string, menuItem);208 });209 // editor/context submenu contextPeek210 monacoMenuRegistry.getMenuItems(monacoActions.MenuId.EditorContextPeek).forEach((item) => {211 const menuItem = transformMonacoMenuItem(item);212 menuRegistry.registerMenuItem(monacoActions.MenuId.EditorContextPeek as unknown as string, menuItem);213 });214 const originalAppendItem = monacoMenuRegistry.appendMenuItem;215 monacoMenuRegistry.appendMenuItem = (menuId, item) => {216 const disposer = new Disposable();217 disposer.addDispose(originalAppendItem.apply(monacoMenuRegistry, [menuId, item]));218 /**219 * monaco ä¸ editor/context æ¯ä¸ä¸ªæ°åæ举å¼220 * opensumi ä¸æ¯ä¸ä¸ª å符串221 * è¿éåäºä¸å±ä»£ç注å222 */223 if (menuId === monacoActions.MenuId.EditorContext) {224 disposer.addDispose(menuRegistry.registerMenuItem(MenuId.EditorContext, transformMonacoMenuItem(item)));225 } else {226 disposer.addDispose(menuRegistry.registerMenuItem(menuId as unknown as string, transformMonacoMenuItem(item)));227 }228 return disposer;229 };230 }231 private initTextmateService() {232 this.textmateService.init();233 this.textmateService.initialized = true;234 }235 private registryDefaultFormattingSelector(selector: IFormattingEditProviderSelector) {236 (FormattingConflicts as unknown as any)._selectors.unshift(selector);237 }238 protected setPreferencesChangeListener() {239 this.corePreferences.onPreferenceChanged((e) => {240 if (e.preferenceName === 'files.associations') {241 this.mimeService.updateMime();242 }243 });244 }245 protected setSchemaPreferenceListener(registry: ISchemaStore) {246 this.schemaStore.onSchemasChanged(() => {247 const configs = registry.getConfigurations();248 this.preferenceService.set('json.schemas', configs, PreferenceScope.Default);249 });250 }251 private patchMonacoThemeService() {252 const standaloneThemeService = StandaloneServices.get(IStandaloneThemeService);253 const originalGetColorTheme: typeof standaloneThemeService.getColorTheme =254 standaloneThemeService.getColorTheme.bind(standaloneThemeService);255 const patchedGetTokenStyleMetadataFlag = '__patched_getTokenStyleMetadata';256 standaloneThemeService.getColorTheme = () => {257 const theme = originalGetColorTheme();258 if (!(patchedGetTokenStyleMetadataFlag in theme)) {259 Object.defineProperty(theme, patchedGetTokenStyleMetadataFlag, {260 enumerable: false,261 configurable: false,262 writable: false,263 value: true,264 });265 // è¿é patch ä¸ä¸ª getTokenStyleMetadata åå æ¯ monaco å
é¨è·å SemanticTokens æ¶åªèµ°å
é¨ç StandaloneThemeService266 // 注åå¨ themeService ç SemanticTokens 没æ被åæ¥è¿å»ï¼æ以å¨è¿éåä¸æ¬¡å¤çï¼è·å TokenStyle æ¶åºäºå¤é¨ç themeService æ¥è®¡ç®æ ·å¼267 theme.getTokenStyleMetadata = (268 typeWithLanguage: string,269 modifiers: string[],270 defaultLanguage: string,271 useDefault = true,272 definitions: any = {},273 ) => {274 const { type, language } = parseClassifierString(typeWithLanguage, defaultLanguage);275 const style: TokenStyle | undefined = theme['themeData'].getTokenStyle(276 type,277 modifiers,278 language,279 useDefault,280 definitions,281 );282 if (!style) {283 return undefined;284 }285 return {286 foreground: theme['themeData'].getTokenColorIndex().get(style.foreground),287 bold: style.bold,288 underline: style.underline,289 italic: style.italic,290 strikethrough: undefined,291 };292 };293 }294 return theme;295 };296 standaloneThemeService.getFileIconTheme = () => this.iconService.currentTheme;297 }298 registerCommands(commands: CommandRegistry) {299 // 注å monaco ææç action300 this.monacoActionRegistry.registerMonacoActions();301 }302 registerMenus(menuRegistry: IMenuRegistry) {303 // 注å Monaco çéæ©å½ä»¤304 for (const group of MonacoMenus.SELECTION_GROUPS) {305 group.actions.forEach((action, index) => {306 const commandId = this.monacoCommandRegistry.validate(action);307 if (commandId) {308 menuRegistry.registerMenuItem(MenuId.MenubarSelectionMenu, {309 command: commandId,310 group: group.id,311 order: index,312 });313 }314 });315 }316 }317 registerKeybindings(keybindings: KeybindingRegistry): void {318 const monacoKeybindingsRegistry = monacoKeybindings.KeybindingsRegistry;319 const editorFocus = EditorContextKeys.focus;320 const defaultItems = monacoKeybindingsRegistry.getDefaultKeybindings();321 // å° Monaco ç Keybinding åæ¥å° ide ä¸322 for (const item of defaultItems) {323 const command = this.monacoCommandRegistry.validate(item.command);324 if (command) {325 const raw = item.keybinding;326 // monaco keybindingRegistryä¸ååºçkeybinding缺å°äºeditorFocusçwhen,327 // å½åå¼å¤©çkeybinding注åæ¶éè¦å ä¸ textInputFocus ï¼é¿å
ç¦ç¹ä¸å¨ç¼è¾å¨æ¶ååºå°328 let when = item.when;329 if (!when) {330 when = editorFocus;331 } else {332 // when ä¸æ²¡æ editorFocus æ¶åå追å 333 if (!when.keys().includes('editorFocus')) {334 // å½å
¶å
é¨ä¸º or æ¶ï¼é¿å
åºç° a && (b || c) æ¥é335 // å æ¤æ¹æ (a && b) || (a && c) è¿æ ·ä¸ä¼æ¥é336 // serialize ä¹åçç»æ类似 a && b || a && c337 // monaco-editor contextkey ç计ç®è§åä¸ && ä¼å
级é«äº ||338 if (when.type === ContextKeyExprType.Or) {339 const exprs = when.expr;340 when = ContextKeyExpr.or(...exprs.map((expr) => ContextKeyExpr.and(expr, editorFocus)));341 } else {342 when = ContextKeyExpr.and(when, editorFocus);343 }344 }345 }346 const keybindingStr = raw347 .map((key) => {348 if (key instanceof SimpleKeybinding) {349 return key350 .toChord()351 .parts.map((part) => MonacoResolvedKeybinding.keyCode(part))352 .join(' ');353 } else {354 // ç®å monaco å
ç key 没æ ScanCodeBinding çæ
åµï¼ææ¶æ²¡æå¤ç355 // eslint-disable-next-line no-console356 console.warn('No handler ScanCodeBinding:', key);357 }358 return '';359 })360 .join(' ');361 // monacoå
ä¼å
级计ç®æ¶ä¸ºåä¼å
级ç¸å ï¼ç¬¬ä¸ä¼å
级æé * 100362 const keybinding = {363 command,364 args: item.commandArgs,365 keybinding: keybindingStr,366 when,367 priority: (item.weight1 ? item.weight1 * 100 : 0) + (item.weight2 || 0),368 };369 keybindings.registerKeybinding(keybinding);370 }371 }372 }373 protected async interceptOpen(uri: URI) {374 try {375 await this.openerService.open(uri);376 return true;377 } catch (e) {378 this.logger.error(e);379 return false;380 }381 }382}383function transformMonacoMenuItem(item: monacoActions.IMenuItem | monacoActions.ISubmenuItem): IMenuItem | ISubmenuItem {384 if (monacoActions.isIMenuItem(item)) {385 return {386 command: {387 id: item.command.id,388 label: typeof item.command.title === 'string' ? item.command.title : item.command.title.value,389 },390 group: item.group,391 when: item.when,392 order: item.order,393 };394 }395 return {396 submenu: item.submenu as unknown as string,397 label: typeof item.title === 'string' ? item.title : item.title.value,398 when: item.when,399 group: item.group,400 order: item.order,401 };...
plugin-loader.ts
Source:plugin-loader.ts
1import path from 'path';2import fs from 'fs';3import { fileURLToPath, pathToFileURL, URL } from 'url';4import { Logger } from '@stryker-mutator/api/logging';5import { tokens, commonTokens, Plugin, PluginKind } from '@stryker-mutator/api/plugin';6import { notEmpty, propertyPath } from '@stryker-mutator/util';7import { fileUtils } from '../utils/file-utils.js';8import { defaultOptions } from '../config/options-validator.js';9const IGNORED_PACKAGES = ['core', 'api', 'util', 'instrumenter'];10interface PluginModule {11 strykerPlugins: Array<Plugin<PluginKind>>;12}13interface SchemaValidationContribution {14 strykerValidationSchema: Record<string, unknown>;15}16/**17 * Represents a collection of loaded plugins and metadata18 */19export interface LoadedPlugins {20 /**21 * The JSON schema contributions loaded22 */23 schemaContributions: Array<Record<string, unknown>>;24 /**25 * The actual Stryker plugins loaded, sorted by type26 */27 pluginsByKind: Map<PluginKind, Array<Plugin<PluginKind>>>;28 /**29 * The import specifiers or full URL paths to the actual plugins30 */31 pluginModulePaths: string[];32}33/**34 * Can resolve modules and pull them into memory35 */36export class PluginLoader {37 public static inject = tokens(commonTokens.logger);38 constructor(private readonly log: Logger) {}39 /**40 * Loads plugins based on configured plugin descriptors.41 * A plugin descriptor can be:42 * * A full url: "file:///home/nicojs/github/my-plugin.js"43 * * An absolute file path: "/home/nicojs/github/my-plugin.js"44 * * A relative path: "./my-plugin.js"45 * * A bare import expression: "@stryker-mutator/karma-runner"46 * * A simple glob expression (only wild cards are supported): "@stryker-mutator/*"47 */48 public async load(pluginDescriptors: readonly string[]): Promise<LoadedPlugins> {49 const pluginModules = await this.resolvePluginModules(pluginDescriptors);50 const loadedPluginModules = (51 await Promise.all(52 pluginModules.map(async (moduleName) => {53 const plugin = await this.loadPlugin(moduleName);54 return {55 ...plugin,56 moduleName,57 };58 })59 )60 ).filter(notEmpty);61 const result: LoadedPlugins = { schemaContributions: [], pluginsByKind: new Map<PluginKind, Array<Plugin<PluginKind>>>(), pluginModulePaths: [] };62 loadedPluginModules.forEach(({ plugins, schemaContribution, moduleName }) => {63 if (plugins) {64 result.pluginModulePaths.push(moduleName);65 plugins.forEach((plugin) => {66 const pluginsForKind = result.pluginsByKind.get(plugin.kind);67 if (pluginsForKind) {68 pluginsForKind.push(plugin);69 } else {70 result.pluginsByKind.set(plugin.kind, [plugin]);71 }72 });73 }74 if (schemaContribution) {75 result.schemaContributions.push(schemaContribution);76 }77 });78 return result;79 }80 private async resolvePluginModules(pluginDescriptors: readonly string[]): Promise<string[]> {81 return (82 await Promise.all(83 pluginDescriptors.map(async (pluginExpression) => {84 if (pluginExpression.includes('*')) {85 return await this.globPluginModules(pluginExpression);86 } else if (path.isAbsolute(pluginExpression) || pluginExpression.startsWith('.')) {87 return pathToFileURL(path.resolve(pluginExpression)).toString();88 } else {89 // Bare plugin expression like "@stryker-mutator/mocha-runner" (or file URL)90 return pluginExpression;91 }92 })93 )94 )95 .filter(notEmpty)96 .flat();97 }98 private async globPluginModules(pluginExpression: string) {99 const { org, pkg } = parsePluginExpression(pluginExpression);100 const pluginDirectory = path.resolve(fileURLToPath(new URL('../../../../../', import.meta.url)), org);101 const regexp = new RegExp('^' + pkg.replace('*', '.*'));102 this.log.debug('Loading %s from %s', pluginExpression, pluginDirectory);103 const plugins = (await fs.promises.readdir(pluginDirectory))104 .filter((pluginName) => !IGNORED_PACKAGES.includes(pluginName) && regexp.test(pluginName))105 .map((pluginName) => `${org.length ? `${org}/` : ''}${pluginName}`);106 if (plugins.length === 0 && !defaultOptions.plugins.includes(pluginExpression)) {107 this.log.warn('Expression "%s" not resulted in plugins to load.', pluginExpression);108 }109 plugins.forEach((plugin) => this.log.debug('Loading plugin "%s" (matched with expression %s)', plugin, pluginExpression));110 return plugins;111 }112 private async loadPlugin(113 descriptor: string114 ): Promise<{ plugins: Array<Plugin<PluginKind>> | undefined; schemaContribution: Record<string, unknown> | undefined } | undefined> {115 this.log.debug('Loading plugin %s', descriptor);116 try {117 const module = await fileUtils.importModule(descriptor);118 const plugins = isPluginModule(module) ? module.strykerPlugins : undefined;119 const schemaContribution = hasValidationSchemaContribution(module) ? module.strykerValidationSchema : undefined;120 if (plugins || schemaContribution) {121 return {122 plugins,123 schemaContribution,124 };125 } else {126 this.log.warn(127 'Module "%s" did not contribute a StrykerJS plugin. It didn\'t export a "%s" or "%s".',128 descriptor,129 propertyPath<PluginModule>()('strykerPlugins'),130 propertyPath<SchemaValidationContribution>()('strykerValidationSchema')131 );132 }133 } catch (e: any) {134 if (e.code === 'ERR_MODULE_NOT_FOUND' && e.message.indexOf(descriptor) !== -1) {135 this.log.warn('Cannot find plugin "%s".\n Did you forget to install it ?', descriptor);136 } else {137 this.log.warn('Error during loading "%s" plugin:\n %s', descriptor, e.message);138 }139 }140 return;141 }142}143/**144 * Distills organization name from a package expression.145 * @example146 * '@stryker-mutator/core' => { org: '@stryker-mutator', 'core' }147 * 'glob' => { org: '', 'glob' }148 */149function parsePluginExpression(pluginExpression: string) {150 const parts = pluginExpression.split('/');151 if (parts.length > 1) {152 return {153 org: parts.slice(0, parts.length - 1).join('/'),154 pkg: parts[parts.length - 1],155 };156 } else {157 return {158 org: '',159 pkg: parts[0],160 };161 }162}163function isPluginModule(module: unknown): module is PluginModule {164 const pluginModule = module as Partial<PluginModule>;165 return Array.isArray(pluginModule.strykerPlugins);166}167function hasValidationSchemaContribution(module: unknown): module is SchemaValidationContribution {168 const pluginModule = module as Partial<SchemaValidationContribution>;169 return typeof pluginModule.strykerValidationSchema === 'object';...
Using AI Code Generation
1const schemaContribution = require('stryker-parent').schemaContribution;2const schemaContribution = require('stryker-parent').schemaContribution;3const schemaContribution = require('stryker-parent').schemaContribution;4const schemaContribution = require('stryker-parent').schemaContribution;5const schemaContribution = require('stryker-parent').schemaContribution;6const schemaContribution = require('stryker-parent').schemaContribution;7const schemaContribution = require('stryker-parent').schemaContribution;8const schemaContribution = require('stryker-parent').schemaContribution;9const schemaContribution = require('stryker-parent').schemaContribution;10const schemaContribution = require('stryker-parent').schemaContribution;11const schemaContribution = require('stryker-parent').schemaContribution;12const schemaContribution = require('stryker-parent').schemaContribution;13const schemaContribution = require('stryker-parent').schemaContribution;14const schemaContribution = require('stryker-parent').schemaContribution;15const schemaContribution = require('stryker-parent').schemaContribution;
Using AI Code Generation
1const schemaContribution = require('stryker-parent').schemaContribution;2const schema = {3 properties: {4 someOption: {5 }6 }7};8module.exports = schemaContribution(schema);9module.exports = function(config) {10 config.set({11 });12};
Using AI Code Generation
1const { schemaContribution } = require('stryker-parent');2module.exports = schemaContribution({3 properties: {4 logLevel: {5 }6 }7});
Using AI Code Generation
1var strykerParent = require('stryker-parent');2var strykerSchema = strykerParent.schemaContribution;3var schema = strykerSchema({4});5var schema = require('./test.js');6module.exports = function(config) {7 config.set({8 });9};10var strykerParent = require('stryker-parent');11var strykerSchema = strykerParent.schemaContribution;12var schema = strykerSchema({13 karma: {14 config: {15 properties: {16 }17 }18 }19});20var strykerParent = require('stryker-parent');21var strykerSchema = strykerParent.schemaContribution;22var schema = strykerSchema({23 karma: {24 config: {25 properties: {26 }27 }28 }29});30var strykerParent = require('stryker-parent');31var strykerSchema = strykerParent.schemaContribution;32var schema = strykerSchema({33 karma: {34 config: {35 properties: {36 }37 }
Using AI Code Generation
1var schemaContribution = require('stryker-parent/schemaContribution');2var schema = require('stryker-api/schema/stryker-core.json');3schemaContribution(schema);4console.log(JSON.stringify(schema));5{6 "properties": {7 "plugins": {8 "items": {9 }10 },11 "reporters": {12 "items": {13 }14 },15 "testRunner": {16 },17 "logLevel": {18 },19 "timeoutMS": {20 },21 "timeoutFactor": {22 },23 "maxConcurrentTestRunners": {24 },25 "mutate": {26 "items": {27 }28 },29 "files": {30 "items": {31 }32 },33 "excludedMutations": {34 "items": {35 }36 },37 "symlinkNodeModules": {38 },39 "coverageAnalysis": {40 },41 "thresholds": {42 "properties": {43 "high": {44 },45 "low": {46 }47 }48 }49 },50}
Using AI Code Generation
1stryker-parent.schemaContribution('stryker-stryker-parent', 'test', 'test', 'test', 'test', 'test', 'test')2stryker-parent.schemaContribution('stryker-stryker-parent', 'test', 'test', 'test', 'test', 'test', 'test')3stryker-parent.schemaContribution('stryker-stryker-parent', 'test', 'test', 'test', 'test', 'test', 'test')4stryker-parent.schemaContribution('stryker-stryker-parent', 'test', 'test', 'test', 'test', 'test', 'test')5stryker-parent.schemaContribution('stryker-stryker-parent', 'test', 'test', 'test', 'test', 'test', 'test')6stryker-parent.schemaContribution('stryker-stryker-parent', 'test', 'test', 'test', 'test', 'test', 'test')7stryker-parent.schemaContribution('stryker-stryker-parent', 'test', 'test', 'test', 'test', 'test', 'test')8stryker-parent.schemaContribution('stryker-stryker-parent', 'test', 'test', 'test', 'test', 'test', 'test')9stryker-parent.schemaContribution('stryker-stryker-parent', 'test', 'test', 'test', 'test', 'test', 'test')10stryker-parent.schemaContribution('stryker-stryker-parent', 'test', 'test', 'test', 'test', 'test', 'test
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!