Best JavaScript code snippet using stryker-parent
configurationTests.ts
Source:configurationTests.ts
1/*2 * Copyright 2016 Palantir Technologies, Inc.3 *4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 *8 * http://www.apache.org/licenses/LICENSE-2.09 *10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */16import { assert } from "chai";17import * as fs from "fs";18import * as path from "path";19import {20 convertRuleOptions,21 extendConfigurationFile,22 findConfigurationPath,23 IConfigurationFile,24 loadConfigurationFromPath,25 parseConfigFile,26 RawConfigFile,27} from "../src/configuration";28import { IOptions, RuleSeverity } from "./../src/language/rule/rule";29import { createTempFile } from "./utils";30describe("Configuration", () => {31 describe("parseConfigFile", () => {32 it("parses empty config", () => {33 const rawConfig = {34 };35 const expected = getEmptyConfig();36 assertConfigEquals(parseConfigFile(rawConfig), expected);37 });38 it("arrayifies `extends`", () => {39 const rawConfig = {40 extends: "a",41 };42 const expected = getEmptyConfig();43 expected.extends = ["a"];44 assertConfigEquals(parseConfigFile(rawConfig), expected);45 });46 it("parses different ways of storing options", () => {47 const rawConfig: RawConfigFile = {48 rules: {49 a: true,50 b: [true],51 c: false,52 d: [false],53 e: [true, 1],54 f: [false, 2, 3],55 g: { severity: "off"},56 h: { severity: "warn"},57 i: { severity: "warning"},58 j: { severity: "error"},59 k: { severity: "none" },60 l: { options: 1 },61 m: { options: [2] },62 n: { options: [{ no: false }] },63 o: { severity: "warn", options: 1 },64 p: null,65 q: {},66 r: "garbage" as any,67 s: { junk: 1 } as any,68 },69 };70 const expected = getEmptyConfig();71 expected.rules.set("a", { ruleArguments: [], ruleSeverity: "error" });72 expected.rules.set("b", { ruleArguments: [], ruleSeverity: "error" });73 expected.rules.set("c", { ruleArguments: [], ruleSeverity: "off" });74 expected.rules.set("d", { ruleArguments: [], ruleSeverity: "off" });75 expected.rules.set("e", { ruleArguments: [1], ruleSeverity: "error" });76 expected.rules.set("f", { ruleArguments: [2, 3], ruleSeverity: "off" });77 expected.rules.set("g", { ruleArguments: undefined, ruleSeverity: "off" });78 expected.rules.set("h", { ruleArguments: undefined, ruleSeverity: "warning" });79 expected.rules.set("i", { ruleArguments: undefined, ruleSeverity: "warning" });80 expected.rules.set("j", { ruleArguments: undefined, ruleSeverity: "error" });81 expected.rules.set("k", { ruleArguments: undefined, ruleSeverity: "off" });82 expected.rules.set("l", { ruleArguments: [1], ruleSeverity: "error" });83 expected.rules.set("m", { ruleArguments: [2], ruleSeverity: "error" });84 expected.rules.set("n", { ruleArguments: [{ no: false }], ruleSeverity: "error" });85 expected.rules.set("o", { ruleArguments: [1], ruleSeverity: "warning" });86 expected.rules.set("p", { ruleArguments: [], ruleSeverity: "off" });87 expected.rules.set("q", { ruleArguments: undefined, ruleSeverity: "error" });88 expected.rules.set("r", { ruleArguments: undefined, ruleSeverity: "error" });89 expected.rules.set("s", { ruleArguments: undefined, ruleSeverity: "error" });90 assertConfigEquals(parseConfigFile(rawConfig), expected);91 });92 it("fills in default values", () => {93 const initial = getEmptyConfig();94 initial.rules.set("s", { ruleArguments: undefined, ruleSeverity: undefined });95 assert.deepEqual<IOptions>(convertRuleOptions(initial.rules)[0], {96 disabledIntervals: [],97 ruleArguments: [],98 ruleName: "s",99 ruleSeverity: "error",100 });101 });102 it("resolves exclude pattern relative to the configuration file", () => {103 const config: RawConfigFile = {104 linterOptions: {105 exclude: ["foo.ts", "**/*.d.ts"],106 },107 };108 assert.deepEqual(109 parseConfigFile(config, "/path").linterOptions,110 {111 exclude: [path.resolve("/path", "foo.ts"), path.resolve("/path", "**/*.d.ts")],112 },113 );114 });115 it("parses jsRules when jsRules is a config", () => {116 const rawConfig: RawConfigFile = {117 jsRules: {118 a: true,119 },120 };121 const expected = getEmptyConfig();122 expected.jsRules.set("a", { ruleArguments: [], ruleSeverity: "error" });123 assertConfigEquals(parseConfigFile(rawConfig), expected);124 });125 it("copies valid rules to jsRules when jsRules is a boolean", () => {126 let rawConfig: RawConfigFile = {127 jsRules: true,128 rules: {},129 };130 const expected = getEmptyConfig();131 assertConfigEquals(parseConfigFile(rawConfig), expected);132 rawConfig = {133 jsRules: true,134 rules: {135 eofline: true,136 },137 };138 let {rules, jsRules} = parseConfigFile(rawConfig);139 assert.deepEqual(demap(rules), demap(jsRules));140 rawConfig = {141 jsRules: true,142 rules: {143 eofline: true,144 typedef: true,145 },146 };147 ({rules, jsRules} = parseConfigFile(rawConfig));148 assert(jsRules.has("eofline"));149 assert(!jsRules.has("typedef"));150 rules.delete("typedef");151 assert.deepEqual(demap(rules), demap(jsRules));152 });153 });154 describe("defaultSeverity", () => {155 it("uses defaultSeverity if severity is default", () => {156 const rawConfig: RawConfigFile = {157 defaultSeverity: "warning",158 rules: {159 a: { severity: "error" },160 b: { severity: "warning" },161 c: { severity: "off" },162 d: { severity: "default" },163 },164 };165 const expected = getEmptyConfig();166 expected.rules.set("a", { ruleArguments: undefined, ruleSeverity: "error" });167 expected.rules.set("b", { ruleArguments: undefined, ruleSeverity: "warning" });168 expected.rules.set("c", { ruleArguments: undefined, ruleSeverity: "off" });169 expected.rules.set("d", { ruleArguments: undefined, ruleSeverity: "warning" });170 assertConfigEquals(parseConfigFile(rawConfig), expected);171 });172 });173 describe("extendConfigurationFile", () => {174 const EMPTY_CONFIG = getEmptyConfig();175 it("verifies that empty extending empty is empty", () => {176 assertConfigEquals(extendConfigurationFile(EMPTY_CONFIG, EMPTY_CONFIG), EMPTY_CONFIG);177 });178 it("extends empty with non-empty", () => {179 const config = getEmptyConfig();180 config.jsRules.set("row", { ruleArguments: ["oar", "column"], ruleSeverity: "error" });181 config.rules.set("foo", { ruleArguments: ["bar"], ruleSeverity: "off" });182 config.rulesDirectory = ["foo"];183 config.linterOptions = { exclude: ["foo"] };184 assertConfigEquals(extendConfigurationFile(EMPTY_CONFIG, config), config);185 });186 it("extends empty, with undefined ruleSeverity or ruleArguments", () => {187 const config = getEmptyConfig();188 config.jsRules.set("row", { ruleArguments: ["oar", "column"] });189 config.rules.set("foo", { ruleSeverity: "off" });190 config.linterOptions = { };191 assertConfigEquals(extendConfigurationFile(EMPTY_CONFIG, config), config);192 });193 it ("unions values", () => {194 const baseConfig = getEmptyConfig();195 baseConfig.rules.set("foo", { ruleArguments: ["bar"], ruleSeverity: "off" });196 baseConfig.jsRules.set("row", { ruleArguments: ["oar", "column"] });197 baseConfig.rulesDirectory = ["foo"];198 const extendingConfig = getEmptyConfig();199 extendingConfig.rules.set("flow", { ruleArguments: ["river"] });200 extendingConfig.jsRules.set("good", { ruleArguments: ["does"], ruleSeverity: "warning" });201 extendingConfig.rulesDirectory = ["baz"];202 const expectedConfig = getEmptyConfig();203 expectedConfig.rules.set("foo", { ruleArguments: ["bar"], ruleSeverity: "off" });204 expectedConfig.rules.set("flow", { ruleArguments: ["river"] });205 expectedConfig.jsRules.set("row", { ruleArguments: ["oar", "column"] });206 expectedConfig.jsRules.set("good", { ruleArguments: ["does"], ruleSeverity: "warning" });207 expectedConfig.rulesDirectory = ["foo", "baz"];208 const actualConfig = extendConfigurationFile(baseConfig, extendingConfig);209 assertConfigEquals(actualConfig, expectedConfig);210 });211 it ("overrides values", () => {212 const baseConfig = getEmptyConfig();213 baseConfig.rules.set("foo", { ruleArguments: ["bar"], ruleSeverity: "off" });214 baseConfig.jsRules.set("row", { ruleArguments: ["oar", "column"] });215 baseConfig.rulesDirectory = ["foo"];216 const extendingConfig = getEmptyConfig();217 extendingConfig.rules.set("foo", { ruleSeverity: "warning" });218 extendingConfig.jsRules.set("row", { ruleArguments: ["skid"] });219 extendingConfig.rulesDirectory = ["foo"];220 const expectedConfig = getEmptyConfig();221 expectedConfig.rules.set("foo", { ruleArguments: ["bar"], ruleSeverity: "warning" });222 expectedConfig.jsRules.set("row", { ruleArguments: ["skid"] });223 expectedConfig.rulesDirectory = ["foo"];224 const actualConfig = extendConfigurationFile(baseConfig, extendingConfig);225 assertConfigEquals(actualConfig, expectedConfig);226 });227 it("replaces exclude option", () => {228 const baseConfig = getEmptyConfig();229 baseConfig.linterOptions = {230 exclude: ["src"],231 };232 const extendingConfig = getEmptyConfig();233 extendingConfig.linterOptions = {234 exclude: [235 "lib",236 "bin",237 ],238 };239 const expectedConfig = getEmptyConfig();240 expectedConfig.linterOptions = {241 exclude: [242 "lib",243 "bin",244 ],245 };246 const actualConfig = extendConfigurationFile(baseConfig, extendingConfig);247 assertConfigEquals(actualConfig, expectedConfig);248 });249 it("empty linter options does not replace exclude", () => {250 const baseConfig = getEmptyConfig();251 baseConfig.linterOptions = {252 exclude: ["src"],253 };254 const extendingConfig = getEmptyConfig();255 extendingConfig.linterOptions = {};256 const expectedConfig = getEmptyConfig();257 expectedConfig.linterOptions = {258 exclude: ["src"],259 };260 const actualConfig = extendConfigurationFile(baseConfig, extendingConfig);261 assertConfigEquals(actualConfig, expectedConfig);262 });263 it("overrides defaultSeverity of base configs", () => {264 const config = loadConfigurationFromPath("./test/config/tslint-extends-default-severity.json");265 assert.equal<RuleSeverity | undefined>(266 config.rules.get("default-severity-unspecified")!.ruleSeverity,267 "warning",268 "should apply defaultSeverity to base config with no defaultSeverity");269 assert.equal<RuleSeverity | undefined>(270 config.rules.get("default-severity-error")!.ruleSeverity,271 "warning",272 "should override defaultSeverity defined in base config");273 assert.equal<RuleSeverity | undefined>(274 config.rules.get("default-severity-warning")!.ruleSeverity,275 "warning",276 "should apply defaultSeverity to extending config");277 });278 it("inherits defaultSeverity from base config if not specified", () => {279 const config = loadConfigurationFromPath("./test/config/tslint-extends-default-severity-only-in-extended.json");280 assert.equal<RuleSeverity | undefined>(281 config.rules.get("default-severity-unspecified")!.ruleSeverity,282 "warning",283 "should apply defaultSeverity to base config with no defaultSeverity");284 assert.equal<RuleSeverity | undefined>(285 config.rules.get("default-severity-error")!.ruleSeverity,286 "warning",287 "should override defaultSeverity defined in base config");288 assert.equal<RuleSeverity | undefined>(289 config.rules.get("default-severity-warning")!.ruleSeverity,290 "warning",291 "should apply defaultSeverity to extending config");292 assert.equal<RuleSeverity | undefined>(293 config.rules.get("default-severity-only-in-extended")!.ruleSeverity,294 "warning",295 "should inherit defaultSeverity from base configs");296 });297 it("applies defaultSeverity to preceding base configs", () => {298 const config = loadConfigurationFromPath("./test/config/tslint-extends-default-severity-precedence.json");299 assert.equal<RuleSeverity | undefined>(300 config.rules.get("default-severity-unspecified")!.ruleSeverity,301 "off",302 "should apply defaultSeverity to base config with no defaultSeverity");303 assert.equal<RuleSeverity | undefined>(304 config.rules.get("default-severity-error")!.ruleSeverity,305 "off",306 "should override defaultSeverity defined in preceding base config");307 assert.equal<RuleSeverity | undefined>(308 config.rules.get("default-severity-warning")!.ruleSeverity,309 "off",310 "should override defaultSeverity defined in preceding base config");311 assert.equal<RuleSeverity | undefined>(312 config.rules.get("default-severity-off")!.ruleSeverity,313 "off",314 "should not override last declared defaultSeverity");315 });316 });317 describe("findConfigurationPath", () => {318 it("finds the closest tslint.json", () => {319 assert.strictEqual(320 findConfigurationPath(null, "./test/files/config-findup/contains-config"),321 path.resolve("test/files/config-findup/contains-config/tslint.json"),322 );323 assert.strictEqual(324 findConfigurationPath(null, "./test/files/config-findup/no-config"),325 path.resolve("./test/files/config-findup/tslint.json"),326 );327 assert.strictEqual(328 findConfigurationPath(null, "./test/files/config-findup"),329 path.resolve("./test/files/config-findup/tslint.json"),330 );331 // gulp-tslint uses a path including the filename332 assert.strictEqual(333 findConfigurationPath(null, "./test/files/config-findup/somefilename.ts"),334 path.resolve("./test/files/config-findup/tslint.json"),335 );336 });337 it("prefers json over yaml over yml configuration files", () => {338 assert.strictEqual(339 findConfigurationPath(null, "./test/files/config-findup/yaml-config"),340 path.resolve("test/files/config-findup/yaml-config/tslint.json"),341 );342 assert.strictEqual(343 findConfigurationPath(null, "./test/files/config-findup/yml-config"),344 path.resolve("test/files/config-findup/yml-config/tslint.yaml"),345 );346 });347 });348 describe("loadConfigurationFromPath", () => {349 it("extends with relative path", () => {350 const config = loadConfigurationFromPath("./test/config/tslint-extends-relative.json");351 assert.isArray(config.rulesDirectory);352 assert.equal<RuleSeverity | undefined>(353 "error",354 config.rules.get("no-fail")!.ruleSeverity,355 "should pick up 'no-fail' in base config");356 assert.equal<RuleSeverity | undefined>(357 "off",358 config.rules.get("always-fail")!.ruleSeverity,359 "should set 'always-fail' in top config");360 assert.equal<RuleSeverity | undefined>("error", config.jsRules.get("no-fail")!.ruleSeverity);361 assert.equal<RuleSeverity | undefined>("off", config.jsRules.get("always-fail")!.ruleSeverity);362 });363 it("extends with package", () => {364 const config = loadConfigurationFromPath("./test/config/tslint-extends-package.json");365 const expectedConfig = getEmptyConfig();366 expectedConfig.rules.set("rule-one", { ruleSeverity: "error" });367 expectedConfig.rules.set("rule-two", { ruleSeverity: "off" });368 expectedConfig.rules.set("rule-three", { ruleSeverity: "error" });369 assertConfigEquals(config.jsRules, expectedConfig.rules);370 assertConfigEquals(config.rules, expectedConfig.rules);371 });372 it("extends with package - boolean configuration", () => {373 const config = loadConfigurationFromPath("./test/config/tslint-extends-package-boolean.json");374 const expectedConfig = getEmptyConfig();375 expectedConfig.rules.set("rule-one", { ruleSeverity: "error" });376 expectedConfig.rules.set("rule-two", { ruleSeverity: "error" });377 expectedConfig.rules.set("rule-three", { ruleSeverity: "off" });378 assertConfigEquals(config.jsRules, expectedConfig.rules);379 assertConfigEquals(config.rules, expectedConfig.rules);380 });381 it("extends only severity or only arguments", () => {382 const config = loadConfigurationFromPath("./test/config/tslint-extends-package-partial.json");383 const expectedConfig = getEmptyConfig();384 expectedConfig.rules.set("always-fail", { ruleSeverity: "error", ruleArguments: [2] });385 expectedConfig.jsRules.set("always-fail", { ruleSeverity: "warning", ruleArguments: [1] });386 assertConfigEquals(config.jsRules, expectedConfig.jsRules);387 assertConfigEquals(config.rules, expectedConfig.rules);388 });389 it("extends with package without customization", () => {390 const config = loadConfigurationFromPath("./test/config/tslint-extends-package-no-mod.json");391 const expectedConfig = getEmptyConfig();392 expectedConfig.rules.set("rule-one", { ruleSeverity: "error" });393 expectedConfig.rules.set("rule-two", { ruleSeverity: "off" });394 assertConfigEquals(config.jsRules, expectedConfig.rules);395 assertConfigEquals(config.rules, expectedConfig.rules);396 });397 it("extends with builtin", () => {398 const config = loadConfigurationFromPath("./test/config/tslint-extends-builtin.json");399 assert.isUndefined(config.jsRules.get("no-var-keyword"));400 assert.equal<RuleSeverity | undefined>("off", config.jsRules.get("no-eval")!.ruleSeverity);401 assert.equal<RuleSeverity | undefined>("error", config.rules.get("no-var-keyword")!.ruleSeverity);402 assert.equal<RuleSeverity | undefined>("off", config.rules.get("no-eval")!.ruleSeverity);403 });404 it("resolve rule directory from package", () => {405 const config = loadConfigurationFromPath("./test/config/tslint-custom-rules-with-package.json");406 assert.deepEqual(config.rulesDirectory, [path.join(process.cwd(), "test/config/node_modules/tslint-test-custom-rules/rules")]);407 });408 it("resolve rule directory from package fallback", () => {409 const config = loadConfigurationFromPath("./test/config/tslint-custom-rules-with-package-fallback.json");410 assert.deepEqual(config.rulesDirectory, [path.join(process.cwd(), "test/config/relative-rules-directory")]);411 });412 describe("with config not relative to tslint", () => {413 let tmpfile: string | undefined;414 beforeEach(() => {415 tmpfile = createTempFile("json");416 });417 afterEach(() => {418 if (tmpfile !== undefined) {419 fs.unlinkSync(tmpfile);420 }421 });422 it("extends with package installed relative to tslint", () => {423 fs.writeFileSync(tmpfile!, JSON.stringify({ extends: "tslint-test-config-non-relative" }));424 const config = loadConfigurationFromPath(tmpfile!);425 const expectedConfig = getEmptyConfig();426 expectedConfig.rules.set("class-name", { ruleSeverity: "error" });427 assertConfigEquals(config.rules, expectedConfig.rules);428 });429 });430 it("extends with package two levels (and relative path in rulesDirectory)", () => {431 const config = loadConfigurationFromPath("./test/config/tslint-extends-package-two-levels.json");432 assert.lengthOf(config.rulesDirectory, 2);433 assert.isTrue(fs.existsSync(config.rulesDirectory[0]));434 assert.isTrue(fs.existsSync(config.rulesDirectory[1]));435 const expectedConfig = getEmptyConfig();436 expectedConfig.rules.set("always-fail", { ruleSeverity: "off" });437 expectedConfig.rules.set("rule-one", { ruleSeverity: "error" });438 expectedConfig.rules.set("rule-two", { ruleSeverity: "error" });439 expectedConfig.rules.set("rule-four", { ruleSeverity: "error" });440 assertConfigEquals(config.jsRules, expectedConfig.rules);441 assertConfigEquals(config.rules, expectedConfig.rules);442 });443 it("extends with array", () => {444 const config = loadConfigurationFromPath("./test/config/tslint-extends-package-array.json");445 const expectedConfig = getEmptyConfig();446 expectedConfig.rules.set("always-fail", { ruleSeverity: "off" });447 expectedConfig.rules.set("no-fail", { ruleSeverity: "error" });448 expectedConfig.rules.set("rule-one", { ruleSeverity: "error" });449 expectedConfig.rules.set("rule-two", { ruleSeverity: "error" });450 assertConfigEquals(config.jsRules, expectedConfig.rules);451 assertConfigEquals(config.rules, expectedConfig.rules);452 });453 it("can load .json files with comments", () => {454 const config = loadConfigurationFromPath("./test/config/tslint-with-comments.json");455 const expectedConfig = getEmptyConfig();456 expectedConfig.rules.set("rule-two", { ruleSeverity: "error" });457 expectedConfig.rules.set("rule-three", { ruleSeverity: "error", ruleArguments: ["//not a comment"] });458 expectedConfig.rules.set("rule-four", { ruleSeverity: "error", ruleArguments: ["/*also not a comment*/"] });459 assertConfigEquals(config.rules, expectedConfig.rules);460 assertConfigEquals(config.jsRules, expectedConfig.rules);461 });462 it("can load .json files with BOM", () => {463 assert.doesNotThrow(() => loadConfigurationFromPath("./test/config/tslint-with-bom.json"));464 });465 it("can load .yaml files with comments", () => {466 const config = loadConfigurationFromPath("./test/config/tslint-with-comments.yaml");467 const expectedConfig = getEmptyConfig();468 expectedConfig.rules.set("rule-two", { ruleSeverity: "error" });469 expectedConfig.rules.set("rule-three", { ruleSeverity: "error", ruleArguments: ["#not a comment"] });470 assertConfigEquals(config.rules, expectedConfig.rules);471 assertConfigEquals(config.jsRules, expectedConfig.rules);472 });473 it("can load a built-in configuration", () => {474 const config = loadConfigurationFromPath("tslint:recommended");475 assert.strictEqual<RuleSeverity | undefined>("error", config.jsRules.get("no-eval")!.ruleSeverity);476 assert.strictEqual<RuleSeverity | undefined>("error", config.rules.get("no-eval")!.ruleSeverity);477 });478 it("throws on an invalid built-in configuration path", () => {479 assert.throws(() => {480 loadConfigurationFromPath("tslint:doesnotexist");481 });482 });483 });484});485function getEmptyConfig(): IConfigurationFile {486 return {487 extends: [],488 jsRules: new Map<string, Partial<IOptions>>(),489 linterOptions: {},490 rules: new Map<string, Partial<IOptions>>(),491 rulesDirectory: [],492 };493}494function demap<T>(map: Map<string, T>) {495 if (map == undefined) {496 return map;497 }498 const output: { [key: string]: T } = {};499 map.forEach((value, key) => {500 output[key] = value;501 });502 return output;503}504// this is needed since `assertConfigEquals` doesn't go into Map object505function assertConfigEquals(actual: any, expected: any) {506 assert.deepEqual(actual, expected);507 // tslint:disable no-unsafe-any strict-boolean-expressions508 if (actual && (actual.jsRules || actual.rules)) {509 assert.deepEqual(demap(actual.jsRules), demap(expected.jsRules));510 assert.deepEqual(demap(actual.rules), demap(expected.rules));511 }512 // tslint:enable no-unsafe-any...
config.spec.ts
Source:config.spec.ts
1/**2 * Tests config file3 * 4 * @group unit/file/config5 */6import { ComparableVersion } from '../commons/ComparableVersion'7import { DEFAULT_CONFIG_OPTIONS } from '../commons/constants'8import type { IChromeConfigWrapper, IStoreConfigWrapper, IExportConfigWrapper } from '../interfaces/interfaces'9import type { OS } from '../interfaces/os.interfaces'10import { Logger, logger } from '../log/logger'11import { createChromeFullConfig, createChromeOptions, createImportConfig, createExportConfig, createChromeSingleConfig } from '../test/test.utils'12import { readConfig } from './config'13/* eslint-disable-next-line @typescript-eslint/no-var-requires */14const program = require('commander')15jest.mock('commander')16jest.mock('../log/logger')17describe('config', () => {18 let programMock: jest.MaybeMockedDeep<typeof program>19 let loggerMock: jest.MaybeMockedDeep<Logger>20 describe('readConfig', () => {21 beforeEach(() => {22 loggerMock = jest.mocked(logger, true)23 loggerMock.warn.mockClear()24 programMock = jest.mocked(program, true)25 programMock.version.mockClear()26 programMock.option.mockClear()27 programMock.parse.mockClear()28 programMock.opts.mockClear()29 programMock.version.mockReturnValue(programMock)30 programMock.option.mockReturnValue(programMock)31 })32 it('should pass the args to program.parse()', () => {33 programMock.opts.mockReturnValue(createChromeOptions())34 readConfig(['-a -b -c -d'], 'linux')35 expect(programMock.parse).toBeCalledTimes(1)36 expect(programMock.parse).toBeCalledTimes(1)37 })38 describe('loadChrome', () => {39 it('should set min version', () => {40 programMock.opts.mockReturnValue(createChromeOptions({41 min: '20',42 }))43 44 const config = readConfig([''], 'linux')45 46 const expectedConfig: IChromeConfigWrapper = {47 action: 'loadChrome',48 config: createChromeFullConfig({49 min: new ComparableVersion({50 branch: 0,51 major: 20,52 minor: 0,53 patch: 0,54 }),55 results: Infinity,56 })57 }58 59 expect(config).toEqual(expectedConfig)60 })61 it('should set max version', () => {62 programMock.opts.mockReturnValue(createChromeOptions({63 max: '30.0.1234.33',64 }))65 66 const config = readConfig([''], 'linux')67 68 const expectedConfig: IChromeConfigWrapper = {69 action: 'loadChrome',70 config: createChromeFullConfig({71 max: new ComparableVersion({72 branch: 1234,73 major: 30,74 minor: 0,75 patch: 33,76 }),77 })78 }79 80 expect(config).toEqual(expectedConfig)81 })82 83 it('should set decrease on fail', () => {84 programMock.opts.mockReturnValue(createChromeOptions({85 decreaseOnFail: true,86 }))87 88 const config = readConfig([''], 'linux')89 90 const expectedConfig: IChromeConfigWrapper = {91 action: 'loadChrome',92 config: createChromeFullConfig({93 onFail: 'decrease',94 })95 }96 97 expect(config).toEqual(expectedConfig)98 })99 it('should set increase on fail', () => {100 programMock.opts.mockReturnValue({101 ...DEFAULT_CONFIG_OPTIONS,102 increaseOnFail: true,103 })104 105 const config = readConfig([''], 'linux')106 107 const expectedConfig: IChromeConfigWrapper = {108 action: 'loadChrome',109 config: createChromeFullConfig({110 onFail: 'increase',111 })112 }113 114 expect(config).toEqual(expectedConfig)115 })116 117 it('should set autoUnzip', () => {118 programMock.opts.mockReturnValue(createChromeOptions({119 unzip: true,120 }))121 122 const config = readConfig([''], 'linux')123 124 const expectedConfig: IChromeConfigWrapper = {125 action: 'loadChrome',126 config: createChromeFullConfig({127 autoUnzip: true,128 })129 }130 131 expect(config).toEqual(expectedConfig)132 })133 134 it('should set results', () => {135 programMock.opts.mockReturnValue(createChromeOptions({136 maxResults: '24',137 }))138 139 const config = readConfig([''], 'linux')140 141 const expectedConfig: IChromeConfigWrapper = {142 action: 'loadChrome',143 config: createChromeFullConfig({144 results: 24,145 })146 }147 148 expect(config).toEqual(expectedConfig)149 })150 151 it('should set no-download', () => {152 programMock.opts.mockReturnValue(createChromeOptions({153 download: false,154 }))155 156 const config = readConfig([''], 'linux')157 158 const expectedConfig: IChromeConfigWrapper = {159 action: 'loadChrome',160 config: createChromeFullConfig({161 download: false,162 })163 }164 165 expect(config).toEqual(expectedConfig)166 })167 168 it('should set hide negative hits', () => {169 programMock.opts.mockReturnValue(createChromeOptions({170 hideNegativeHits: true,171 }))172 173 const config = readConfig([''], 'linux')174 175 const expectedConfig: IChromeConfigWrapper = {176 action: 'loadChrome',177 config: createChromeFullConfig({178 hideNegativeHits: true,179 })180 }181 182 expect(config).toEqual(expectedConfig)183 })184 185 it('should warn on non-interactive without decrease-on-fail set', () => {186 programMock.opts.mockReturnValue(createChromeOptions({187 nonInteractive: true188 }))189 190 const config = readConfig([''], 'linux')191 192 const expectedConfig: IChromeConfigWrapper = {193 action: 'loadChrome',194 config: createChromeFullConfig({195 interactive: false,196 })197 }198 199 expect(loggerMock.warn).toBeCalledTimes(1)200 expect(loggerMock.warn).toHaveBeenCalledWith('Setting "--non-interactive" has no effect, when "--decrease-on-fail" is not set!')201 202 expect(config).toEqual(expectedConfig)203 })204 205 it('should set non-interactive without warning', () => {206 programMock.opts.mockReturnValue(createChromeOptions({207 nonInteractive: true,208 decreaseOnFail: true,209 }))210 211 const config = readConfig([''], 'linux')212 213 const expectedConfig: IChromeConfigWrapper = {214 action: 'loadChrome',215 config: createChromeFullConfig({216 interactive: false,217 onFail: 'decrease',218 })219 }220 221 expect(loggerMock.warn).toBeCalledTimes(0)222 expect(config).toEqual(expectedConfig)223 })224 it('should enable debug logging on --debug', () => {225 programMock.opts.mockReturnValue(createChromeOptions({226 debug: true,227 }))228 229 const config = readConfig([''], 'linux')230 231 const expectedConfig: IChromeConfigWrapper = {232 action: 'loadChrome',233 config: createChromeFullConfig({234 debug: true,235 })236 }237 238 expect(config).toEqual(expectedConfig)239 })240 describe('arch/os', () => {241 it('should do nothing on arch without os', () => {242 programMock.opts.mockReturnValue(createChromeOptions({243 arch: 'x86'244 }))245 246 const config = readConfig([''], 'linux')247 248 const expectedConfig: IChromeConfigWrapper = {249 action: 'loadChrome',250 config: createChromeFullConfig({251 arch: 'x64'252 })253 }254 255 expect(loggerMock.warn).toBeCalledTimes(1)256 expect(loggerMock.warn).toHaveBeenLastCalledWith('Setting "--arch" has no effect, when "--os" is not set!')257 258 expect(config).toEqual(expectedConfig)259 })260 261 it('should set the arch with os also set', () => {262 programMock.opts.mockReturnValue(createChromeOptions({263 arch: 'x86',264 os: 'linux',265 }))266 267 const config = readConfig([''], 'linux')268 269 const expectedConfig: IChromeConfigWrapper = {270 action: 'loadChrome',271 config: createChromeFullConfig({272 arch: 'x86',273 os: 'linux',274 })275 }276 277 expect(loggerMock.warn).toBeCalledTimes(0)278 expect(config).toEqual(expectedConfig)279 })280 281 it('should set os windows', () => {282 programMock.opts.mockReturnValue(createChromeOptions({283 os: 'win'284 }))285 286 const config = readConfig([''], 'linux')287 288 const expectedConfig: IChromeConfigWrapper = {289 action: 'loadChrome',290 config: createChromeFullConfig({291 os: 'win'292 })293 }294 295 expect(config).toEqual(expectedConfig)296 })297 298 it('should set os windows with node.js string', () => {299 programMock.opts.mockReturnValue(createChromeOptions({300 os: 'win32'301 }))302 303 const config = readConfig([''], 'linux')304 305 const expectedConfig: IChromeConfigWrapper = {306 action: 'loadChrome',307 config: createChromeFullConfig({308 os: 'win'309 })310 }311 312 expect(config).toEqual(expectedConfig)313 })314 315 it('should set os mac', () => {316 programMock.opts.mockReturnValue(createChromeOptions({317 os: 'mac'318 }))319 320 const config = readConfig([''], 'linux')321 322 const expectedConfig: IChromeConfigWrapper = {323 action: 'loadChrome',324 config: createChromeFullConfig({325 os: 'mac'326 })327 }328 329 expect(config).toEqual(expectedConfig)330 })331 332 it('should set os mac with node.js string', () => {333 programMock.opts.mockReturnValue(createChromeOptions({334 os: 'darwin'335 }))336 337 const config = readConfig([''], 'linux')338 339 const expectedConfig: IChromeConfigWrapper = {340 action: 'loadChrome',341 config: createChromeFullConfig({342 os: 'mac'343 })344 }345 346 expect(config).toEqual(expectedConfig)347 })348 349 // TODO: this should be changed350 it('should fallback to x86 on unknown arch', () => {351 programMock.opts.mockReturnValue(createChromeOptions({352 arch: 'foo',353 os: 'linux',354 }))355 356 const config = readConfig([''], 'linux')357 358 const expectedConfig: IChromeConfigWrapper = {359 action: 'loadChrome',360 config: createChromeFullConfig({361 os: 'linux',362 arch: 'x86',363 })364 }365 366 expect(config).toEqual(expectedConfig)367 })368 369 it('should throw an error on unknown os', () => {370 programMock.opts.mockReturnValue(createChromeOptions({371 os: 'foo' as unknown as OS372 }))373 374 expect(() => {375 readConfig([''], 'linux')376 }).toThrow(new Error('unknown OS: foo'))377 })378 })379 describe('single', () => {380 it('should set config single mode', () => {381 programMock.opts.mockReturnValue(createChromeOptions({382 arch: 'x64',383 os: 'win',384 download: true,385 single: '10.11.12.13',386 }))387 388 const config = readConfig([''], 'linux')389 390 const expectedConfig: IChromeConfigWrapper = {391 action: 'loadChrome',392 config: createChromeSingleConfig({393 arch: 'x64',394 os: 'win',395 download: true,396 single: new ComparableVersion(10, 11, 12, 13),397 })398 }399 400 expect(loggerMock.warn).toBeCalledTimes(0)401 expect(config).toEqual(expectedConfig)402 })403 })404 })405 describe('importStore', () => {406 it('should set importStore', () => {407 programMock.opts.mockReturnValue(createChromeOptions({408 importStore: 'some-url',409 }))410 411 const config = readConfig([''], 'linux')412 413 const expectedConfig: IStoreConfigWrapper = {414 action: 'importStore',415 config: createImportConfig()416 }417 418 expect(config).toEqual(expectedConfig)419 })420 })421 describe('exportStore', () => {422 it('should set exportStore without path', () => {423 programMock.opts.mockReturnValue(createChromeOptions({424 exportStore: true425 }))426 427 const config = readConfig([''], 'linux')428 429 const expectedConfig: IExportConfigWrapper = {430 action: 'exportStore',431 config: createExportConfig({ path: undefined })432 }433 434 expect(config).toEqual(expectedConfig)435 })436 437 it('should set exportStore with path', () => {438 programMock.opts.mockReturnValue(createChromeOptions({439 exportStore: 'some-path'440 }))441 442 const config = readConfig([''], 'linux')443 444 const expectedConfig: IExportConfigWrapper = {445 action: 'exportStore',446 config: createExportConfig({447 path: 'some-path',448 })449 }450 451 expect(config).toEqual(expectedConfig)452 })453 })454 })...
folderIcons.spec.ts
Source:folderIcons.spec.ts
1import * as assert from 'assert';2import merge from 'lodash.merge';3import {4 getDefaultIconOptions,5 loadFolderIconDefinitions,6} from '../../../icons/index';7import {8 FolderTheme,9 IconConfiguration,10 IconPack,11} from '../../../models/index';12describe('folder icons', () => {13 let folderIcons: FolderTheme[];14 let expectedConfig: IconConfiguration;15 before(() => {16 folderIcons = [17 {18 name: 'specific',19 defaultIcon: { name: 'folder' },20 rootFolder: { name: 'folder-root' },21 icons: [22 { name: 'folder-src', folderNames: ['src', 'source'] },23 {24 name: 'folder-angular',25 folderNames: ['angular', 'ng'],26 enabledFor: [IconPack.Angular, IconPack.Ngrx],27 },28 ],29 },30 {31 name: 'blue',32 defaultIcon: { name: 'folder-blue' },33 icons: [{ name: 'folder-blue-src', folderNames: ['src', 'source'] }],34 },35 { name: 'classic', defaultIcon: { name: 'folder' } },36 { name: 'none', defaultIcon: { name: '' } },37 ];38 });39 beforeEach(() => {40 expectedConfig = merge({}, new IconConfiguration(), {41 options: getDefaultIconOptions(),42 });43 });44 it('should configure icon definitions', () => {45 const options = getDefaultIconOptions();46 const iconConfig = merge({}, new IconConfiguration(), { options });47 const iconDefinitions = loadFolderIconDefinitions(48 folderIcons,49 iconConfig,50 options51 );52 expectedConfig.iconDefinitions = {53 folder: {54 iconPath: './../icons/folder.svg',55 },56 'folder-open': {57 iconPath: './../icons/folder-open.svg',58 },59 'folder-root': {60 iconPath: './../icons/folder-root.svg',61 },62 'folder-root-open': {63 iconPath: './../icons/folder-root-open.svg',64 },65 'folder-src': {66 iconPath: './../icons/folder-src.svg',67 },68 'folder-src-open': {69 iconPath: './../icons/folder-src-open.svg',70 },71 'folder-angular': {72 iconPath: './../icons/folder-angular.svg',73 },74 'folder-angular-open': {75 iconPath: './../icons/folder-angular-open.svg',76 },77 };78 expectedConfig.folder = 'folder';79 expectedConfig.folderExpanded = 'folder-open';80 expectedConfig.rootFolder = 'folder-root';81 expectedConfig.rootFolderExpanded = 'folder-root-open';82 expectedConfig.folderNames = {83 src: 'folder-src',84 source: 'folder-src',85 angular: 'folder-angular',86 ng: 'folder-angular',87 };88 expectedConfig.folderNamesExpanded = {89 src: 'folder-src-open',90 source: 'folder-src-open',91 angular: 'folder-angular-open',92 ng: 'folder-angular-open',93 };94 expectedConfig.hidesExplorerArrows = false;95 assert.deepStrictEqual(iconDefinitions, expectedConfig);96 });97 it('should deactivate folder icons', () => {98 const options = getDefaultIconOptions();99 options.folders.theme = 'none';100 const iconConfig = merge({}, new IconConfiguration(), { options });101 const iconDefinitions = loadFolderIconDefinitions(102 folderIcons,103 iconConfig,104 options105 );106 expectedConfig.iconDefinitions = {};107 expectedConfig.folderNames = {};108 expectedConfig.folderNamesExpanded = {};109 expectedConfig.hidesExplorerArrows = false;110 expectedConfig.options!.folders!.theme = 'none';111 assert.deepStrictEqual(iconDefinitions, expectedConfig);112 });113 it('should enable folder theme', () => {114 const options = getDefaultIconOptions();115 options.folders.theme = 'blue';116 const iconConfig = merge({}, new IconConfiguration(), { options });117 const iconDefinitions = loadFolderIconDefinitions(118 folderIcons,119 iconConfig,120 options121 );122 expectedConfig.iconDefinitions = {123 'folder-blue': {124 iconPath: './../icons/folder-blue.svg',125 },126 'folder-blue-open': {127 iconPath: './../icons/folder-blue-open.svg',128 },129 'folder-blue-src': {130 iconPath: './../icons/folder-blue-src.svg',131 },132 'folder-blue-src-open': {133 iconPath: './../icons/folder-blue-src-open.svg',134 },135 };136 expectedConfig.folder = 'folder-blue';137 expectedConfig.folderExpanded = 'folder-blue-open';138 expectedConfig.rootFolder = 'folder-blue';139 expectedConfig.rootFolderExpanded = 'folder-blue-open';140 expectedConfig.folderNames = {141 src: 'folder-blue-src',142 source: 'folder-blue-src',143 };144 expectedConfig.folderNamesExpanded = {145 src: 'folder-blue-src-open',146 source: 'folder-blue-src-open',147 };148 expectedConfig.hidesExplorerArrows = false;149 expectedConfig.options!.folders!.theme = 'blue';150 assert.deepStrictEqual(iconDefinitions, expectedConfig);151 });152 it('should configure custom icon associations', () => {153 const options = getDefaultIconOptions();154 options.folders.associations = {155 sample: 'src',156 };157 const iconConfig = merge({}, new IconConfiguration(), { options });158 const iconDefinitions = loadFolderIconDefinitions(159 folderIcons,160 iconConfig,161 options162 );163 expectedConfig.iconDefinitions = {164 folder: {165 iconPath: './../icons/folder.svg',166 },167 'folder-open': {168 iconPath: './../icons/folder-open.svg',169 },170 'folder-root': {171 iconPath: './../icons/folder-root.svg',172 },173 'folder-root-open': {174 iconPath: './../icons/folder-root-open.svg',175 },176 'folder-src': {177 iconPath: './../icons/folder-src.svg',178 },179 'folder-src-open': {180 iconPath: './../icons/folder-src-open.svg',181 },182 'folder-angular': {183 iconPath: './../icons/folder-angular.svg',184 },185 'folder-angular-open': {186 iconPath: './../icons/folder-angular-open.svg',187 },188 };189 expectedConfig.folder = 'folder';190 expectedConfig.folderExpanded = 'folder-open';191 expectedConfig.rootFolder = 'folder-root';192 expectedConfig.rootFolderExpanded = 'folder-root-open';193 expectedConfig.folderNames = {194 src: 'folder-src',195 source: 'folder-src',196 angular: 'folder-angular',197 ng: 'folder-angular',198 sample: 'folder-src',199 };200 expectedConfig.folderNamesExpanded = {201 src: 'folder-src-open',202 source: 'folder-src-open',203 angular: 'folder-angular-open',204 ng: 'folder-angular-open',205 sample: 'folder-src-open',206 };207 expectedConfig.hidesExplorerArrows = false;208 expectedConfig.options!.folders!.associations = {209 sample: 'src',210 };211 assert.deepStrictEqual(iconDefinitions, expectedConfig);212 });213 it('should disable icon packs', () => {214 const options = getDefaultIconOptions();215 options.activeIconPack = '';216 const iconConfig = merge({}, new IconConfiguration(), { options });217 const iconDefinitions = loadFolderIconDefinitions(218 folderIcons,219 iconConfig,220 options221 );222 expectedConfig.iconDefinitions = {223 folder: {224 iconPath: './../icons/folder.svg',225 },226 'folder-open': {227 iconPath: './../icons/folder-open.svg',228 },229 'folder-root': {230 iconPath: './../icons/folder-root.svg',231 },232 'folder-root-open': {233 iconPath: './../icons/folder-root-open.svg',234 },235 'folder-src': {236 iconPath: './../icons/folder-src.svg',237 },238 'folder-src-open': {239 iconPath: './../icons/folder-src-open.svg',240 },241 };242 expectedConfig.folder = 'folder';243 expectedConfig.folderExpanded = 'folder-open';244 expectedConfig.rootFolder = 'folder-root';245 expectedConfig.rootFolderExpanded = 'folder-root-open';246 expectedConfig.folderNames = {247 src: 'folder-src',248 source: 'folder-src',249 };250 expectedConfig.folderNamesExpanded = {251 src: 'folder-src-open',252 source: 'folder-src-open',253 };254 expectedConfig.hidesExplorerArrows = false;255 // disable default icon pack by using empty string256 expectedConfig.options!.activeIconPack = '';257 assert.deepStrictEqual(iconDefinitions, expectedConfig);258 });259 it('should configure folder icons for light and high contrast', () => {260 const options = getDefaultIconOptions();261 const lightHighContrastFolderIcons: FolderTheme[] = [262 {263 name: 'specific',264 defaultIcon: { name: 'folder', light: true, highContrast: true },265 rootFolder: { name: 'folder-root', light: true, highContrast: true },266 icons: [267 {268 name: 'folder-src',269 folderNames: ['src', 'source'],270 light: true,271 highContrast: true,272 },273 ],274 },275 ];276 const iconConfig = merge({}, new IconConfiguration(), { options });277 const iconDefinitions = loadFolderIconDefinitions(278 lightHighContrastFolderIcons,279 iconConfig,280 options281 );282 /* eslint-disable camelcase */283 expectedConfig.iconDefinitions = {284 folder: {285 iconPath: './../icons/folder.svg',286 },287 'folder-open': {288 iconPath: './../icons/folder-open.svg',289 },290 folder_light: {291 iconPath: './../icons/folder_light.svg',292 },293 'folder-open_light': {294 iconPath: './../icons/folder-open_light.svg',295 },296 folder_highContrast: {297 iconPath: './../icons/folder_highContrast.svg',298 },299 'folder-open_highContrast': {300 iconPath: './../icons/folder-open_highContrast.svg',301 },302 'folder-root': {303 iconPath: './../icons/folder-root.svg',304 },305 'folder-root-open': {306 iconPath: './../icons/folder-root-open.svg',307 },308 'folder-root_light': {309 iconPath: './../icons/folder-root_light.svg',310 },311 'folder-root-open_light': {312 iconPath: './../icons/folder-root-open_light.svg',313 },314 'folder-root_highContrast': {315 iconPath: './../icons/folder-root_highContrast.svg',316 },317 'folder-root-open_highContrast': {318 iconPath: './../icons/folder-root-open_highContrast.svg',319 },320 'folder-src': {321 iconPath: './../icons/folder-src.svg',322 },323 'folder-src-open': {324 iconPath: './../icons/folder-src-open.svg',325 },326 'folder-src_light': {327 iconPath: './../icons/folder-src_light.svg',328 },329 'folder-src-open_light': {330 iconPath: './../icons/folder-src-open_light.svg',331 },332 'folder-src_highContrast': {333 iconPath: './../icons/folder-src_highContrast.svg',334 },335 'folder-src-open_highContrast': {336 iconPath: './../icons/folder-src-open_highContrast.svg',337 },338 };339 expectedConfig.folder = 'folder';340 expectedConfig.folderExpanded = 'folder-open';341 expectedConfig.rootFolder = 'folder-root';342 expectedConfig.rootFolderExpanded = 'folder-root-open';343 expectedConfig.folderNames = {344 src: 'folder-src',345 source: 'folder-src',346 };347 expectedConfig.folderNamesExpanded = {348 src: 'folder-src-open',349 source: 'folder-src-open',350 };351 expectedConfig.light = {352 fileExtensions: {},353 fileNames: {},354 folder: 'folder_light',355 folderExpanded: 'folder-open_light',356 rootFolder: 'folder-root_light',357 rootFolderExpanded: 'folder-root-open_light',358 folderNames: {359 src: 'folder-src_light',360 source: 'folder-src_light',361 },362 folderNamesExpanded: {363 src: 'folder-src-open_light',364 source: 'folder-src-open_light',365 },366 };367 expectedConfig.highContrast = {368 fileExtensions: {},369 fileNames: {},370 folder: 'folder_highContrast',371 folderExpanded: 'folder-open_highContrast',372 rootFolder: 'folder-root_highContrast',373 rootFolderExpanded: 'folder-root-open_highContrast',374 folderNames: {375 src: 'folder-src_highContrast',376 source: 'folder-src_highContrast',377 },378 folderNamesExpanded: {379 src: 'folder-src-open_highContrast',380 source: 'folder-src-open_highContrast',381 },382 };383 expectedConfig.hidesExplorerArrows = false;384 /* eslint-enable camelcase */385 assert.deepStrictEqual(iconDefinitions, expectedConfig);386 });387 it('should hide explorer arrows', () => {388 const options = getDefaultIconOptions();389 options.hidesExplorerArrows = true;390 const iconConfig = merge({}, new IconConfiguration(), { options });391 const iconDefinitions = loadFolderIconDefinitions(392 folderIcons,393 iconConfig,394 options395 );396 assert.deepStrictEqual(iconDefinitions.hidesExplorerArrows, true);397 });...
Using AI Code Generation
1const expectedConfig = require('stryker-parent/expectedConfig');2const strykerConfig = expectedConfig('stryker.conf.js');3const expectedConfig = require('stryker-parent/expectedConfig');4const strykerConfig = expectedConfig('stryker.conf.js');5const expectedConfig = require('stryker-parent/expectedConfig');6const strykerConfig = expectedConfig('stryker.conf.js');7const expectedConfig = require('stryker-parent/expectedConfig');8const strykerConfig = expectedConfig('stryker.conf.js');9const expectedConfig = require('stryker-parent/expectedConfig');10const strykerConfig = expectedConfig('stryker.conf.js');11const expectedConfig = require('stryker-parent/expectedConfig');12const strykerConfig = expectedConfig('stryker.conf.js');13const expectedConfig = require('stryker-parent/expectedConfig');14const strykerConfig = expectedConfig('stryker.conf.js');15const expectedConfig = require('stryker-parent/expectedConfig');16const strykerConfig = expectedConfig('stryker.conf.js');17const expectedConfig = require('stryker-parent/expectedConfig');18const strykerConfig = expectedConfig('stryker.conf.js');19const expectedConfig = require('stryker-parent/expectedConfig');20const strykerConfig = expectedConfig('stryker.conf.js');21const expectedConfig = require('stryker-parent/expectedConfig');22const strykerConfig = expectedConfig('stryker.conf.js');23const expectedConfig = require('stryker-parent/expectedConfig');24const strykerConfig = expectedConfig('stryker.conf.js');25const expectedConfig = require('stryker-parent/expectedConfig');
Using AI Code Generation
1const expectedConfig = require('stryker-parent').expectedConfig;2const config = expectedConfig('stryker-javascript-mutator');3module.exports = function(config) {4 config.set({5 karma: {6 },7 });8};9const expectedConfig = require('stryker-parent').expectedConfig;10const config = expectedConfig('stryker-javascript-mutator');11module.exports = function(config) {12config.set({13karma: {14},15});16};
Using AI Code Generation
1const { expectedConfig } = require('stryker-parent');2const config = expectedConfig();3const { expectedConfig } = require('stryker');4const config = expectedConfig();5const { expectedConfig } = require('stryker-parent');6const config = expectedConfig();7const { expectedConfig } = require('stryker');8const config = expectedConfig();9const { expectedConfig } = require('stryker-parent');10const config = expectedConfig();11const { expectedConfig } = require('stryker');12const config = expectedConfig();13const { expectedConfig } = require('stryker-parent');14const config = expectedConfig();15const { expectedConfig } = require('stryker');16const config = expectedConfig();17const { expectedConfig } = require('stryker-parent');18const config = expectedConfig();19const { expectedConfig } = require('stryker');20const config = expectedConfig();21const { expectedConfig } = require('stryker-parent');22const config = expectedConfig();23const { expectedConfig } = require('stryker');24const config = expectedConfig();25const { expectedConfig } = require('stryker-parent');26const config = expectedConfig();27const { expectedConfig } = require('stryker');28const config = expectedConfig();29const { expectedConfig } = require('stryker-parent');30const config = expectedConfig();31const { expectedConfig } = require
Using AI Code Generation
1var config = require('stryker-parent').expectedConfig;2module.exports = config({3});4module.exports = function (config) {5 config.set({6 { pattern: 'src/**/*.js', mutated: true, included: false },7 { pattern: 'test/**/*.js', mutated: false, included: false }8 });9};10module.exports = function (config) {11 config.set({12 { pattern: 'src/**/*.js', mutated: true, included: false },13 { pattern: 'test/**/*.js', mutated: false, included: false }14 });15};16module.exports = function (config) {17 config.set({18 { pattern: 'src/**/*.js', mutated: true, included: false },19 { pattern: 'test/**/*.js', mutated: false, included: false }20 });21};22module.exports = function (config) {23 config.set({24 { pattern: 'src/**/*.js', mutated: true, included: false },25 { pattern: 'test/**/*.js', mutated: false, included: false }26 });27};28module.exports = function (config) {29 config.set({30 { pattern: 'src/**/*.js', mutated: true, included: false },31 { pattern: '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!!