diff --git a/e2e/helpers.ts b/e2e/helpers.ts index 9a77db5ca4..810c2d3112 100644 --- a/e2e/helpers.ts +++ b/e2e/helpers.ts @@ -43,13 +43,15 @@ export async function expectMetricsResult(expectedMetricsResult: Partial) { const actualMetricsResult = await readMutationTestResult(); + const actualMetrics: Partial = {}; Object.entries(expectedMetrics).forEach(([key, value]) => { if (key === 'mutationScore' || key === 'mutationScoreBasedOnCoveredCode') { - expect(parseFloat(actualMetricsResult.metrics[key].toFixed(2))).eq(value); + actualMetrics[key] = parseFloat(actualMetricsResult.metrics[key].toFixed(2)); } else { - expect(actualMetricsResult.metrics).property(key, value); + actualMetrics[key as keyof Metrics] = value; } }); + expect(actualMetrics).deep.eq(expectedMetrics); } export function produceMetrics(metrics: Partial): Metrics { diff --git a/e2e/test/jest-with-ts/package.json b/e2e/test/jest-with-ts/package.json index 0d0c6b2fc1..e987db70fb 100644 --- a/e2e/test/jest-with-ts/package.json +++ b/e2e/test/jest-with-ts/package.json @@ -1,6 +1,6 @@ { "name": "jest-with-ts", - "description": "A test project for using stryker with jest and jest-ts preprocessor", + "description": "A test project for using stryker with jest and jest-ts preprocessor. Inspired by the stryker-dashboard source code.", "scripts": { "test": "stryker run", "posttest": "mocha --require ../../tasks/ts-node-register.js verify/verify.ts" diff --git a/e2e/test/jest-with-ts/src/data-access/mappers/TableStorageMapper.test.ts b/e2e/test/jest-with-ts/src/data-access/mappers/TableStorageMapper.test.ts index 097ff6eb2e..3b4a817030 100644 --- a/e2e/test/jest-with-ts/src/data-access/mappers/TableStorageMapper.test.ts +++ b/e2e/test/jest-with-ts/src/data-access/mappers/TableStorageMapper.test.ts @@ -9,9 +9,9 @@ import { OptimisticConcurrencyError } from '../errors'; jest.mock('../services/TableServiceAsPromised'); export class FooModel { - public partitionId: string; - public rowId: string; - public bar: number; + public partitionId!: string; + public rowId!: string; + public bar!: number; public static createPartitionKey(entity: Pick): string { return entity.partitionId; @@ -136,7 +136,7 @@ describe(TableStorageMapper.name, () => { TableServiceAsPromisedModuleMocked.insertEntityMock.mockResolvedValue({ ['.metadata']: { etag: 'next-etag' } }); const expected: FooModel = { bar: 42, partitionId: 'partId', rowId: 'rowId' }; const expectedResult: Result = { model: expected, etag: 'next-etag' }; - const result = await helper.sut.insert(expected); + const result: Result = await helper.sut.insert(expected); expect(result).toEqual(expectedResult); expect(TableServiceAsPromisedModuleMocked.insertEntityMock).toHaveBeenCalledWith(FooModel.tableName, createRawEntity(expected), {}); }); diff --git a/e2e/test/jest-with-ts/src/data-access/mappers/TableStorageMapper.ts b/e2e/test/jest-with-ts/src/data-access/mappers/TableStorageMapper.ts index d3cbd09686..2c0fa47f2a 100644 --- a/e2e/test/jest-with-ts/src/data-access/mappers/TableStorageMapper.ts +++ b/e2e/test/jest-with-ts/src/data-access/mappers/TableStorageMapper.ts @@ -67,7 +67,7 @@ export default class TableStorageMapper> { + public async insert(model: TModel) { const entity = this.toEntity(model); try { const result = await this.tableService.insertEntity(this.ModelClass.tableName, entity, {}); diff --git a/e2e/test/jest-with-ts/tsconfig.json b/e2e/test/jest-with-ts/tsconfig.json index ee7762d7d3..69ba96b8c4 100644 --- a/e2e/test/jest-with-ts/tsconfig.json +++ b/e2e/test/jest-with-ts/tsconfig.json @@ -8,6 +8,7 @@ "types": [ "jest" ], + "strict": true, "typeRoots": [ "./node_modules/@types" ], diff --git a/e2e/test/jest-with-ts/verify/verify.ts b/e2e/test/jest-with-ts/verify/verify.ts index 64890c0d5f..403ac5e614 100644 --- a/e2e/test/jest-with-ts/verify/verify.ts +++ b/e2e/test/jest-with-ts/verify/verify.ts @@ -7,7 +7,7 @@ describe('Verify stryker has ran correctly', () => { await expectMetrics({ ignored: 0, killed: 26, - mutationScore: 66.67, + mutationScore: 54.55, noCoverage: 0, survived: 13, timeout: 0,