How to use actAssertValid method in stryker-parent

Best JavaScript code snippet using stryker-parent

options-validator.spec.ts

Source:options-validator.spec.ts Github

copy

Full Screen

...81 };82 expect(options).deep.eq(expectedOptions);83 });84 it('should validate the default options', () => {85 actAssertValid();86 });87 });88 describe('files', () => {89 it('should log a deprecation warning when "files" are set', () => {90 testInjector.options.files = ['src/**/*.js', '!src/index.js'];91 sut.validate(testInjector.options);92 expect(testInjector.logger.warn).calledWith(93 'DEPRECATED. Use of "files" is deprecated, please use "ignorePatterns" instead (or remove "files" altogether will probably work as well). For now, rewriting them as ["**","!src/**/*.js","src/index.js"]. See https://stryker-mutator.io/docs/stryker-js/configuration/#ignorepatterns-string'94 );95 });96 it(`should rewrite them to "${propertyPath<StrykerOptions>('ignorePatterns')}"`, () => {97 testInjector.options.files = ['src/**/*.js', '!src/index.js'];98 sut.validate(testInjector.options);99 expect(testInjector.options.ignorePatterns).deep.eq(['**', '!src/**/*.js', 'src/index.js']);100 });101 it(`should not clear existing "${propertyPath<StrykerOptions>('ignorePatterns')}" when rewritting "files"`, () => {102 testInjector.options.files = ['src/**/*.js'];103 testInjector.options.ignorePatterns = ['src/index.js'];104 sut.validate(testInjector.options);105 expect(testInjector.options.ignorePatterns).deep.eq(['**', '!src/**/*.js', 'src/index.js']);106 });107 });108 describe('thresholds', () => {109 it('should be invalid with thresholds < 0 or > 100', () => {110 testInjector.options.thresholds.high = -1;111 testInjector.options.thresholds.low = 101;112 actValidationErrors('Config option "thresholds.high" must be >= 0, was -1.', 'Config option "thresholds.low" must be <= 100, was 101.');113 });114 it('should be invalid with thresholds.high null', () => {115 // @ts-expect-error invalid setting116 testInjector.options.thresholds.high = null;117 actValidationErrors('Config option "thresholds.high" has the wrong type. It should be a number, but was a null.');118 });119 it('should not allow high < low', () => {120 testInjector.options.thresholds.high = 20;121 testInjector.options.thresholds.low = 21;122 actValidationErrors('Config option "thresholds.high" should be higher than "thresholds.low".');123 });124 });125 it('should be invalid with invalid logLevel', () => {126 // @ts-expect-error invalid setting127 testInjector.options.logLevel = 'thisTestPasses';128 actValidationErrors(129 'Config option "logLevel" should be one of the allowed values ("off", "fatal", "error", "warn", "info", "debug", "trace"), but was "thisTestPasses".'130 );131 });132 it('should be invalid with non-numeric timeoutMS', () => {133 breakConfig('timeoutMS', 'break');134 actValidationErrors('Config option "timeoutMS" has the wrong type. It should be a number, but was a string.');135 });136 it('should be invalid with non-numeric timeoutFactor', () => {137 breakConfig('timeoutFactor', 'break');138 actValidationErrors('Config option "timeoutFactor" has the wrong type. It should be a number, but was a string.');139 });140 it('should be invalid with non-numeric dryRunTimeout', () => {141 breakConfig('dryRunTimeoutMinutes', 'break');142 actValidationErrors('Config option "dryRunTimeoutMinutes" has the wrong type. It should be a number, but was a string.');143 });144 it('should be invalid with negative numeric dryRunTimeout', () => {145 breakConfig('dryRunTimeoutMinutes', -1);146 actValidationErrors('Config option "dryRunTimeoutMinutes" must be >= 0, was -1.');147 });148 it('should report a deprecation warning and set disableBail for jest.enableBail', () => {149 testInjector.options.jest = { enableBail: false };150 sut.validate(testInjector.options);151 expect(testInjector.logger.warn).calledWith(152 'DEPRECATED. Use of "jest.enableBail" inside deprecated, please use "disableBail" instead. See https://stryker-mutator.io/docs/stryker-js/configuration#disablebail-boolean'153 );154 expect(testInjector.options.disableBail).true;155 });156 describe('plugins', () => {157 it('should be invalid with non-array plugins', () => {158 breakConfig('plugins', '@stryker-mutator/typescript');159 actValidationErrors('Config option "plugins" has the wrong type. It should be a array, but was a string.');160 });161 it('should be invalid with non-string array elements', () => {162 breakConfig('plugins', ['stryker-jest', 0]);163 actValidationErrors('Config option "plugins[1]" has the wrong type. It should be a string, but was a number.');164 });165 });166 describe('appendPlugins', () => {167 it('should be invalid with non-array plugins', () => {168 breakConfig('appendPlugins', '@stryker-mutator/typescript');169 actValidationErrors('Config option "appendPlugins" has the wrong type. It should be a array, but was a string.');170 });171 it('should be invalid with non-string array elements', () => {172 breakConfig('appendPlugins', ['stryker-jest', 0]);173 actValidationErrors('Config option "appendPlugins[1]" has the wrong type. It should be a string, but was a number.');174 });175 });176 describe('mutator', () => {177 it('should be invalid with non-string mutator', () => {178 // @ts-expect-error invalid setting179 testInjector.options.mutator = 1;180 actValidationErrors('Config option "mutator" has the wrong type. It should be a object, but was a number.');181 });182 it('should report a deprecation warning for "mutator.name"', () => {183 testInjector.options.mutator = {184 // @ts-expect-error invalid setting185 name: 'javascript',186 };187 sut.validate(testInjector.options);188 expect(testInjector.logger.warn).calledWith(189 'DEPRECATED. Use of "mutator.name" is no longer needed. You can remove "mutator.name" from your configuration. Stryker now supports mutating of JavaScript and friend files out of the box.'190 );191 });192 it('should report a deprecation warning for mutator as a string', () => {193 // @ts-expect-error invalid setting194 testInjector.options.mutator = 'javascript';195 sut.validate(testInjector.options);196 expect(testInjector.logger.warn).calledWith(197 'DEPRECATED. Use of "mutator" as string is no longer needed. You can remove it from your configuration. Stryker now supports mutating of JavaScript and friend files out of the box.'198 );199 });200 it('should accept mutationRange without a glob pattern', () => {201 testInjector.options.mutate = ['src/index.ts:1:0-2:0'];202 actAssertValid();203 });204 it('should not accept mutationRange for line < 1 (lines are 1 based)', () => {205 testInjector.options.mutate = ['src/app.ts:5:0-6:0', 'src/index.ts:0:0-2:0'];206 actValidationErrors('Config option "mutate[1]" is invalid. Mutation range "0:0-2:0" is invalid, line 0 does not exist (lines start at 1).');207 });208 it('should not accept mutationRange for start > end', () => {209 testInjector.options.mutate = ['src/index.ts:6-5'];210 actValidationErrors(211 'Config option "mutate[0]" is invalid. Mutation range "6-5" is invalid. The "from" line number (6) should be less then the "to" line number (5).'212 );213 });214 it('should not accept mutationRange with a glob pattern', () => {215 testInjector.options.mutate = ['src/index.*.ts:1:0-2:0'];216 actValidationErrors(217 'Config option "mutate[0]" is invalid. Cannot combine a glob expression with a mutation range in "src/index.*.ts:1:0-2:0".'218 );219 });220 it('should not accept mutationRange (with no column numbers) with a glob pattern', () => {221 testInjector.options.mutate = ['src/index.*.ts:1-2'];222 actValidationErrors('Config option "mutate[0]" is invalid. Cannot combine a glob expression with a mutation range in "src/index.*.ts:1-2".');223 });224 });225 describe('testFramework', () => {226 it('should report a deprecation warning', () => {227 testInjector.options.testFramework = '';228 sut.validate(testInjector.options);229 expect(testInjector.logger.warn).calledWith(230 'DEPRECATED. Use of "testFramework" is no longer needed. You can remove it from your configuration. Your test runner plugin now handles its own test framework integration.'231 );232 });233 });234 describe('reporters', () => {235 it('should be invalid with non-array reporters', () => {236 breakConfig('reporters', '@stryker-mutator/typescript');237 actValidationErrors('Config option "reporters" has the wrong type. It should be a array, but was a string.');238 });239 it('should be invalid with non-string array elements', () => {240 breakConfig('reporters', ['stryker-jest', 0]);241 actValidationErrors('Config option "reporters[1]" has the wrong type. It should be a string, but was a number.');242 });243 });244 describe('dashboard', () => {245 it('should be invalid for non-string project', () => {246 breakConfig('dashboard', { project: 23 });247 actValidationErrors('Config option "dashboard.project" has the wrong type. It should be a string, but was a number.');248 });249 it('should be invalid for non-string module', () => {250 breakConfig('dashboard', { module: 23 });251 actValidationErrors('Config option "dashboard.module" has the wrong type. It should be a string, but was a number.');252 });253 it('should be invalid for non-string version', () => {254 breakConfig('dashboard', { version: 23 });255 actValidationErrors('Config option "dashboard.version" has the wrong type. It should be a string, but was a number.');256 });257 it('should be invalid for non-string baseUrl', () => {258 breakConfig('dashboard', { baseUrl: 23 });259 actValidationErrors('Config option "dashboard.baseUrl" has the wrong type. It should be a string, but was a number.');260 });261 it('should be invalid for a wrong reportType', () => {262 breakConfig('dashboard', { reportType: 'empty' });263 actValidationErrors('Config option "dashboard.reportType" should be one of the allowed values ("full", "mutationScore"), but was "empty".');264 });265 });266 describe('maxConcurrentTestRunners', () => {267 it('should report a deprecation warning', () => {268 testInjector.options.maxConcurrentTestRunners = 8;269 sut.validate(testInjector.options);270 expect(testInjector.logger.warn).calledWith('DEPRECATED. Use of "maxConcurrentTestRunners" is deprecated. Please use "concurrency" instead.');271 });272 it('should not configure "concurrency" if "maxConcurrentTestRunners" is >= cpus-1', () => {273 testInjector.options.maxConcurrentTestRunners = 2;274 sinon.stub(os, 'cpus').returns([createCpuInfo(), createCpuInfo(), createCpuInfo()]);275 sut.validate(testInjector.options);276 expect(testInjector.options.concurrency).undefined;277 });278 it('should configure "concurrency" if "maxConcurrentTestRunners" is set with a lower value', () => {279 testInjector.options.maxConcurrentTestRunners = 1;280 sinon.stub(os, 'cpus').returns([createCpuInfo(), createCpuInfo(), createCpuInfo()]);281 sut.validate(testInjector.options);282 expect(testInjector.options.concurrency).eq(1);283 });284 });285 it('should be invalid with non-numeric maxTestRunnerReuse', () => {286 breakConfig('maxTestRunnerReuse', 'break');287 actValidationErrors('Config option "maxTestRunnerReuse" has the wrong type. It should be a number, but was a string.');288 });289 it('should warn when testRunnerNodeArgs are combined with the "command" test runner', () => {290 testInjector.options.testRunnerNodeArgs = ['--inspect-brk'];291 testInjector.options.testRunner = 'command';292 sut.validate(testInjector.options);293 expect(testInjector.logger.warn).calledWith(294 'Using "testRunnerNodeArgs" together with the "command" test runner is not supported, these arguments will be ignored. You can add your custom arguments by setting the "commandRunner.command" option.'295 );296 });297 describe('transpilers', () => {298 it('should report a deprecation warning', () => {299 testInjector.options.transpilers = ['stryker-jest'];300 sut.validate(testInjector.options);301 expect(testInjector.logger.warn).calledWith(302 'DEPRECATED. Support for "transpilers" is removed. You can now configure your own "buildCommand". For example, npm run build.'303 );304 });305 });306 it('should be invalid with invalid coverageAnalysis', () => {307 breakConfig('coverageAnalysis', 'invalid');308 actValidationErrors('Config option "coverageAnalysis" should be one of the allowed values ("off", "all", "perTest"), but was "invalid".');309 });310 function actValidationErrors(...expectedErrors: string[]) {311 expect(() => sut.validate(testInjector.options)).throws();312 for (const error of expectedErrors) {313 expect(testInjector.logger.error).calledWith(error);314 }315 expect(testInjector.logger.error).callCount(expectedErrors.length);316 }317 function actAssertValid() {318 sut.validate(testInjector.options);319 expect(testInjector.logger.fatal).not.called;320 expect(testInjector.logger.error).not.called;321 expect(testInjector.logger.warn).not.called;322 }323 function breakConfig(key: keyof StrykerOptions, value: any): void {324 const original = testInjector.options[key];325 if (typeof original === 'object' && !Array.isArray(original)) {326 testInjector.options[key] = { ...original, ...value };327 } else {328 testInjector.options[key] = value;329 }330 }331});...

Full Screen

Full Screen

JsonValidator.spec.ts

Source:JsonValidator.spec.ts Github

copy

Full Screen

...18 // eslint-disable-next-line @typescript-eslint/no-var-requires19 const report: unknown = require(`../../../testResources/${testResourceFileName}.json`);20 return schemaValidator.validate(SCHEMA_NAME, report);21 }22 function actAssertValid(testResourceFileName: string) {23 const valid = validate(testResourceFileName);24 expect(valid, schemaValidator.errorsText(schemaValidator.errors)).true;25 }26 function actAssertInvalid(testResourceFileName: string, ...expectedErrors: string[]) {27 const valid = validate(testResourceFileName);28 expect(valid).false;29 for (const expectedError of expectedErrors) {30 expect(schemaValidator.errorsText()).contain(expectedError);31 }32 }33 it('should validate a report that strictly complies to the schema', () => {34 actAssertValid('strict-report');35 });36 it('should validate a report that loosely complies to the schema', () => {37 actAssertValid('additional-properties-report');38 });39 it('should invalidate a report where "schemaVersion" is missing', () => {40 actAssertInvalid('missing-version-report', "must have required property 'schemaVersion'");41 });42 it('should invalidate a report where thresholds are invalid', () => {43 actAssertInvalid('thresholds/threshold-too-high-report', 'thresholds/high must be <= 100');44 actAssertInvalid('thresholds/threshold-too-low-report', 'thresholds/low must be >= 0');45 });46 it('should invalidate a report when mutant location is missing', () => {47 actAssertInvalid('missing-mutant-location-report', "files/test.js/mutants/0/location must have required property 'end'");48 });49 it('should invalidate a report when a test name is missing', () => {50 actAssertInvalid('missing-test-name', "data/testFiles/test~1foo.spec.js/tests/0 must have required property 'name'");51 });52 it('should invalidate a report when the framework/name is missing', () => {53 actAssertInvalid('missing-framework-name', "framework must have required property 'name'");54 });55 it('should invalidate a report when the tests in testFiles are missing', () => {56 actAssertInvalid('missing-tests', "data/testFiles/test~1foo.spec.js must have required property 'tests'");57 });58 it('should invalidate a report when system/ci is missing', () => {59 actAssertInvalid('missing-system-ci', "data/system must have required property 'ci'");60 });61 it('should invalidate a report when system/cpu/logicalCores is missing', () => {62 actAssertInvalid('missing-system-cpu-logical-cores', "data/system/cpu must have required property 'logicalCores'");63 });64 it('should invalidate a report when system/os/platform is missing', () => {65 actAssertInvalid('missing-system-os-platform', "data/system/os must have required property 'platform'");66 });67 it('should invalidate a report when system/ram/total is missing', () => {68 actAssertInvalid('missing-system-ram-total', "data/system/ram must have required property 'total'");69 });70 it('should invalidate a report when system/os/platform is missing', () => {71 actAssertInvalid('missing-system-os-platform', "data/system/os must have required property 'platform'");72 });73 it('should invalidate a report when performance/* is missing', () => {74 actAssertInvalid(75 'missing-performance-fields',76 "data/performance must have required property 'setup'",77 "data/performance must have required property 'initialRun'",78 "data/performance must have required property 'mutation'"79 );80 });81 it('should validate a report when the replacement is missing', () => {82 actAssertValid('missing-replacement-report');83 });84 it('should validate a report when testFiles is missing', () => {85 actAssertValid('missing-test-files');86 });87 it('should validate a report when end is missing in test location', () => {88 actAssertValid('missing-end-location');89 });90 it('should validate a report when imageUrl is a data URL', () => {91 actAssertValid('data-url');92 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var actAssertValid = require('stryker-parent').actAssertValid;2actAssertValid('test');3var actAssertValid = require('stryker-parent').actAssertValid;4actAssertValid('test');5var actAssertValid = require('stryker-parent').actAssertValid;6actAssertValid('test', 'This is a custom error message');7var actAssertValid = require('stryker-parent').actAssertValid;8actAssertValid('test', 'This is a custom error message');9var actAssertValid = require('stryker-parent').actAssertValid;10actAssertValid('test', 'This is a custom error message');11var actAssertValid = require('stryker-parent').actAssertValid;12actAssertValid('test', 'This is a custom error message');13var actAssertValid = require('stryker-parent').actAssertValid;14actAssertValid('test', 'This is a custom error message');15var actAssertValid = require('stryker-parent').actAssertValid;16actAssertValid('test', 'This is a custom error message');

Full Screen

Using AI Code Generation

copy

Full Screen

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

Full Screen

Using AI Code Generation

copy

Full Screen

1var assert = require('assert');2var stryker = require('stryker-parent');3var strykerAssert = new stryker.assert.Assertion();4var result = strykerAssert.actAssertValid('test', 'test');5assert.equal(result, true);6var assert = require('assert');7var stryker = require('stryker-parent');8var strykerAssert = new stryker.assert.Assertion();9var result = strykerAssert.actAssertValid('test', 'test');10assert.equal(result, true);11var assert = require('assert');12var stryker = require('stryker-parent');13var strykerAssert = new stryker.assert.Assertion();14var result = strykerAssert.actAssertValid('test', 'test');15assert.equal(result, true);16var assert = require('assert');17var stryker = require('stryker-parent');18var strykerAssert = new stryker.assert.Assertion();19var result = strykerAssert.actAssertValid('test', 'test');20assert.equal(result, true);21var assert = require('assert');22var stryker = require('stryker-parent');23var strykerAssert = new stryker.assert.Assertion();24var result = strykerAssert.actAssertValid('test', 'test');25assert.equal(result, true);26var assert = require('assert');27var stryker = require('stryker-parent');28var strykerAssert = new stryker.assert.Assertion();29var result = strykerAssert.actAssertValid('test', 'test');30assert.equal(result, true);31var assert = require('assert');32var stryker = require('stryker-parent');33var strykerAssert = new stryker.assert.Assertion();34var result = strykerAssert.actAssertValid('test', 'test');35assert.equal(result, true);

Full Screen

Using AI Code Generation

copy

Full Screen

1var assert = require('assert');2var stryker = require('stryker-parent');3var actAssertValid = stryker.actAssertValid;4actAssertValid('test', 'test');5assert.equal(true, true);6var assert = require('assert');7var stryker = require('stryker-parent');8var actAssertValid = stryker.actAssertValid;9actAssertValid('test', 'test');10assert.equal(true, true);11var assert = require('assert');12var stryker = require('stryker-parent');13var actAssertValid = stryker.actAssertValid;14actAssertValid('test', 'test');15assert.equal(true, true);16var assert = require('assert');17var stryker = require('stryker-parent');18var actAssertValid = stryker.actAssertValid;19actAssertValid('test', 'test');20assert.equal(true, true);21var assert = require('assert');22var stryker = require('stryker-parent');23var actAssertValid = stryker.actAssertValid;24actAssertValid('test', 'test');25assert.equal(true, true);26var assert = require('assert');27var stryker = require('stryker-parent');28var actAssertValid = stryker.actAssertValid;29actAssertValid('test', 'test');30assert.equal(true, true);31var assert = require('assert');32var stryker = require('stryker-parent');33var actAssertValid = stryker.actAssertValid;34actAssertValid('test', 'test');35assert.equal(true, true);36var assert = require('assert');37var stryker = require('stryker-parent');38var actAssertValid = stryker.actAssertValid;39actAssertValid('test', 'test');40assert.equal(true, true

Full Screen

Using AI Code Generation

copy

Full Screen

1const strykerParent = require('stryker-parent');2const assert = require('assert');3const assertValid = strykerParent.actAssertValid;4const expected = {5 address: {6 }7};8const actual = {9 address: {10 }11};12assertValid(expected, actual);

Full Screen

Using AI Code Generation

copy

Full Screen

1try {2 var actAssert = require('stryker-parent').actAssertValid;3 actAssert('test.js', 'test', 'test', 'test');4} catch (e) {5 console.log('actAssertValid method not found');6}7try {8 var actAssert = require('stryker-parent').actAssertValid;9 actAssert('test.js', 'test', 'test', 'test');10} catch (e) {11 console.log('actAssertValid method not found');12}13try {14 var actAssert = require('stryker-parent').actAssertValid;15 actAssert('test.js', 'test', 'test', 'test');16} catch (e) {17 console.log('actAssertValid method not found');18}19try {20 var actAssert = require('stryker-parent').actAssertValid;21 actAssert('test.js', 'test', 'test', 'test');22} catch (e) {23 console.log('actAssertValid method not found');24}25try {26 var actAssert = require('stryker-parent').actAssertValid;27 actAssert('test.js', 'test', 'test', 'test');28} catch (e) {29 console.log('actAssertValid method not found');30}31try {32 var actAssert = require('stryker-parent').actAssertValid;33 actAssert('test.js', 'test', 'test', 'test');34} catch (e) {35 console.log('actAssertValid method not found');36}37try {38 var actAssert = require('stryker-parent').actAssertValid;39 actAssert('test.js', 'test', 'test', 'test');40} catch (e) {41 console.log('actAssertValid method not found');42}43try {

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