How to use createConfig method in stryker-parent

Best JavaScript code snippet using stryker-parent

create-window.ts

Source:create-window.ts Github

copy

Full Screen

1import path from 'path'2import { BrowserWindow, BrowserWindowConstructorOptions } from 'electron'3import { log } from '../log'4import routes from '@/src/auto-routes'5const { NODE_ENV, port, host } = process.env6/** 创建新窗口相关选项 */7export interface CreateWindowOptions {8 /** 路由启动参数 */9 params?: any10 /** URL 启动参数 */11 query?: any12 /** BrowserWindow 选项 */13 windowOptions?: BrowserWindowConstructorOptions14 /** 窗口启动参数 */15 createConfig?: CreateConfig16}17/** 已创建的窗口列表 */18export const windowList: Map<RouterKey, BrowserWindow> = new Map()19/**20 * 通过 routes 中的 key(name) 得到 url21 * @param key22 */23export function getWindowUrl(key: RouterKey, options: CreateWindowOptions = {}): string {24 let routePath = routes.get(key)?.path25 if (typeof routePath === 'string' && options.params) {26 routePath = routePath.replace(/\:([^\/]+)/g, (_, $1) => {27 return options.params[$1]28 })29 }30 const query = options.query ? $tools.toSearch(options.query) : ''31 if (NODE_ENV === 'development') {32 return `http://${host}:${port}#${routePath}${query}`33 } else {34 return `file://${path.join(__dirname, '../renderer/index.html')}#${routePath}${query}`35 }36}37/**38 * 创建一个新窗口39 * @param key40 * @param options41 */42export function createWindow(key: RouterKey, options: CreateWindowOptions = {}): Promise<BrowserWindow> {43 return new Promise((resolve) => {44 const routeConfig: RouteConfig | AnyObj = routes.get(key) || {}45 const windowOptions: BrowserWindowConstructorOptions = {46 ...$tools.DEFAULT_WINDOW_OPTIONS, // 默认新窗口选项47 ...routeConfig.windowOptions, // routes 中的配置的window选项48 ...options.windowOptions, // 调用方法时传入的选项49 }50 const createConfig: CreateConfig = {51 ...$tools.DEFAULT_CREATE_CONFIG,52 ...routeConfig.createConfig,53 ...options.createConfig,54 }55 let activeWin: BrowserWindow | boolean56 if (createConfig.single) {57 activeWin = activeWindow(key)58 if (activeWin) {59 resolve(activeWin)60 return activeWin61 }62 }63 const win = new BrowserWindow(windowOptions)64 const url = getWindowUrl(key, options)65 windowList.set(key, win)66 win.loadURL(url)67 if (createConfig.saveWindowBounds) {68 const lastBounds = $tools.settings.windowBounds.get(key)69 if (lastBounds) win.setBounds(lastBounds)70 }71 if (createConfig.hideMenus) win.setMenuBarVisibility(false)72 if (createConfig.created) createConfig.created(win)73 win.webContents.on('dom-ready', () => {74 win.webContents.send('dom-ready', createConfig)75 })76 win.webContents.on('did-finish-load', () => {77 if (createConfig.autoShow) {78 if (createConfig.delayToShow) {79 setTimeout(() => {80 win.show()81 }, createConfig.delayToShow)82 } else {83 win.show()84 }85 }86 resolve(win)87 })88 win.once('ready-to-show', () => {89 if (createConfig.openDevTools) win.webContents.openDevTools()90 })91 win.once('show', () => {92 log.info(`Window <${key}:${win.id}> url: ${url} opened.`)93 })94 win.on('close', () => {95 if (createConfig.saveWindowBounds && win) {96 $tools.settings.windowBounds.set(key, win.getBounds())97 }98 windowList.delete(key)99 log.info(`Window <${key}:${win.id}> closed.`)100 })101 })102}103/**104 * 激活一个已存在的窗口, 成功返回 BrowserWindow 失败返回 false105 * @param key106 */107export function activeWindow(key: RouterKey): BrowserWindow | false {108 const win: BrowserWindow | undefined = windowList.get(key)109 if (win) {110 win.show()111 return win112 } else {113 return false114 }...

Full Screen

Full Screen

config-test.js

Source:config-test.js Github

copy

Full Screen

1var Config = require('../../../lib/models/config');2var expect = require('chai').expect;3describe('Config', function() {4 function createConfig(projectName, configJson) {5 return new Config({6 project: { name: function(){ return projectName; } },7 rawConfig: configJson8 });9 }10 describe('manifestPrefix', function(){11 it('defaults to project name', function() {12 var config = createConfig('tomster', {});13 expect(config.get('manifestPrefix')).to.eq('tomster');14 });15 it('allows configuration', function() {16 var config = createConfig('tomster', { manifestPrefix: 'seldenator' });17 expect(config.get('manifestPrefix')).to.eq('seldenator');18 });19 });20 describe('buildEnv', function(){21 it('defaults to production', function() {22 var config = createConfig('tomster', {});23 expect(config.get('buildEnv')).to.eq('production');24 });25 it('allows configuration', function() {26 var config = createConfig('tomster', { buildEnv: 'chocula' });27 expect(config.get('buildEnv')).to.eq('chocula');28 });29 });30 describe('store.type', function(){31 it('defaults to redis', function() {32 var config = createConfig('tomster', {});33 expect(config.get('store.type')).to.eq('redis');34 });35 it('allows configuration', function() {36 var config = createConfig('tomster', { store: { type: 'cassandra' } });37 expect(config.get('store.type')).to.eq('cassandra');38 });39 });40 describe('store.manifestSize', function(){41 it('defaults to 10', function() {42 var config = createConfig('tomster', {});43 expect(config.get('store.manifestSize')).to.eq(10);44 });45 it('allows configuration', function() {46 var config = createConfig('tomster', { store: { manifestSize: 42 } });47 expect(config.get('store.manifestSize')).to.eq(42);48 });49 });50 describe('assets.type', function(){51 it('defaults to s3', function() {52 var config = createConfig('tomster', {});53 expect(config.get('assets.type')).to.eq('s3');54 });55 it('allows configuration', function() {56 var config = createConfig('tomster', { assets: { type: 'akamai' } });57 expect(config.get('assets.type')).to.eq('akamai');58 });59 });60 describe('assets.gzip', function(){61 it('defaults to true', function() {62 var config = createConfig('tomster', {});63 expect(config.get('assets.gzip')).to.eq(true);64 });65 it('allows configuration', function() {66 var config = createConfig('tomster', { assets: { gzip: false } });67 expect(config.get('assets.gzip')).to.eq(false);68 });69 });70 describe('assets.gzipExtensions', function(){71 it('defaults to js,css,svg', function() {72 var config = createConfig('tomster', {});73 expect(config.get('assets.gzipExtensions')).to.deep.equal(['js', 'css', 'svg']);74 });75 it('allows configuration', function() {76 var config = createConfig('tomster', { assets: { gzipExtensions: ['js', 'css'] } });77 expect(config.get('assets.gzipExtensions')).to.deep.equal(['js', 'css']);78 });79 });80 describe('tagging', function(){81 it('defaults to sha', function() {82 var config = createConfig('tomster', {});83 expect(config.get('tagging')).to.equal('sha');84 });85 it('allows configuration', function() {86 var config = createConfig('tomster', { tagging: 'yapp-custom' });87 expect(config.get('tagging')).to.equal('yapp-custom');88 });89 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var createConfig = require('stryker-parent').createConfig;2var config = createConfig();3config.set({4});5module.exports = config;6module.exports = require('./test');

Full Screen

Using AI Code Generation

copy

Full Screen

1const createConfig = require('stryker-parent').createConfig;2module.exports = function (config) {3 config.set(createConfig({4 karma: {5 }6 }));7}

Full Screen

Using AI Code Generation

copy

Full Screen

1const { createConfig } = require('stryker-parent');2module.exports = createConfig({3});4module.exports = require('./test.js');5module.exports = require('./test.js');6module.exports = require('./test.js');7module.exports = require('./test.js');8module.exports = require('./test.js');9module.exports = require('./test.js');10module.exports = require('./test.js');11module.exports = require('./test.js');12module.exports = require('./test.js');13module.exports = require('./test.js');14module.exports = require('./test.js');15module.exports = require('./test.js');16module.exports = require('./test.js');17module.exports = require('./test.js');18module.exports = require('./test.js');19module.exports = require('./test.js');20module.exports = require('./test.js');21module.exports = require('./test.js');22module.exports = require('./test.js');23module.exports = require('./test.js');24module.exports = require('./test.js');25module.exports = require('./test.js');26module.exports = require('./test.js');27module.exports = require('./test.js');28module.exports = require('./test.js');29module.exports = require('./test.js');30module.exports = require('./test.js');31module.exports = require('./test.js');32module.exports = require('./test.js');

Full Screen

Using AI Code Generation

copy

Full Screen

1var createConfig = require('stryker-parent').createConfig;2var config = createConfig({3});4module.exports = config;5module.exports = require('./test.js');6var Stryker = require('stryker');7var stryker = new Stryker();8stryker.runMutationTest();9var Stryker = require('stryker');10var stryker = new Stryker(options);

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