Skip to content

Commit

Permalink
Merge pull request #400 from dreamit-de/399-incmutationtest
Browse files Browse the repository at this point in the history
399 Add incremental mutation tests and runs
  • Loading branch information
sgohlke authored Nov 12, 2024
2 parents 7fa999e + 3bd8654 commit 39e57e4
Show file tree
Hide file tree
Showing 7 changed files with 24,109 additions and 24 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ on: [push, workflow_dispatch]
jobs:
graphqlserver:
uses: dreamit-de/workflows/.github/workflows/nodejs-ci-libs.yml@main
with:
runMutationTests: true
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Stryker incremental mutation file
stryker-incremental.json
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dreamit/graphql-server",
"version": "4.11.0",
"version": "4.11.1",
"description": "A GraphQL server written in NodeJS/Typescript.",
"scripts": {
"build": "tsup-node",
Expand All @@ -10,6 +10,7 @@
"lint": "eslint src/*.ts src/**/*.ts tests/*.ts tests/**/*.ts",
"lintfix": "eslint --fix src/*.ts src/**/*.ts tests/*.ts tests/**/*.ts",
"mutationtest": "stryker run",
"mutationtestCI": "stryker run --incremental --incrementalFile stryker-incremental.json",
"prepack": "npm run build",
"test": "vitest run --coverage"
},
Expand Down
3 changes: 1 addition & 2 deletions src/error/DetermineGraphQLOrFetchError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ export function determineGraphQLOrFetchError(error: unknown): string {
error.message.includes('network timeout') ||
error.message.includes('invalid redirect URL') ||
error.message.includes(
'uri requested responds with a redirect' +
', redirect mode is set to error',
'uri requested responds with a redirect, redirect mode is set to error',
) ||
error.message.includes('maximum redirect reached') ||
error.message.includes('Cannot follow redirect') ||
Expand Down
4 changes: 1 addition & 3 deletions src/metrics/NoMetricsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import { MetricsClient } from '@dreamit/graphql-server-base'
* Metrics client that does not collect any metrics.
*/
export class NoMetricsClient implements MetricsClient {
constructor() {
this.initMetrics()
}
constructor() {}
initMetrics(): void {}
setAvailability(): void {}
increaseRequestThroughput(): void {}
Expand Down
21 changes: 3 additions & 18 deletions src/metrics/SimpleMetricsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ export class SimpleMetricsClient implements MetricsClient {
readonly requestThroughputMetricName: string
readonly availabilityMetricName: string
readonly errorsMetricName: string
graphQLServerAvailabilityGauge!: number
requestThroughput!: number
graphQLServerErrorCounter!: Map<string, number>
graphQLServerAvailabilityGauge = 0
requestThroughput = 0
graphQLServerErrorCounter: Map<string, number> = new Map<string, number>()

constructor(
requestThroughputMetricName = 'graphql_server_request_throughput',
Expand All @@ -36,24 +36,9 @@ export class SimpleMetricsClient implements MetricsClient {
}

initMetrics(): void {
this.createRequestThroughputCounter()
this.createServerAvailabilityGauge()
this.createServerErrorCounter()
this.initErrorCounterLabels()
}

createServerErrorCounter(): void {
this.graphQLServerErrorCounter = new Map<string, number>()
}

createServerAvailabilityGauge(): void {
this.graphQLServerAvailabilityGauge = 0
}

createRequestThroughputCounter(): void {
this.requestThroughput = 0
}

/**
* Initializes the error counter.
* When evaluating time series this can help
Expand Down
Loading

0 comments on commit 39e57e4

Please sign in to comment.