Skip to content

Commit

Permalink
ignore unneccessary files in test coverage
Browse files Browse the repository at this point in the history
we would like to only check files that we've added (e.g. not included in the moj typescript template) and not check files that are just configuration.
  • Loading branch information
Harriethw committed May 18, 2023
1 parent b0a5a7e commit f82ff5b
Show file tree
Hide file tree
Showing 18 changed files with 35 additions and 1 deletion.
2 changes: 2 additions & 0 deletions server/app.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* istanbul ignore file */

import express from 'express'

import path from 'path'
Expand Down
2 changes: 2 additions & 0 deletions server/applicationVersion.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// eslint-disable import/no-unresolved,global-require
/* istanbul ignore file */

import fs from 'fs'

const packageData = JSON.parse(fs.readFileSync('./package.json').toString())
Expand Down
2 changes: 2 additions & 0 deletions server/config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* istanbul ignore file */

const production = process.env.NODE_ENV === 'production'

function get<T>(name: string, fallback: T, options = { requireInProduction: false }): T | string {
Expand Down
2 changes: 2 additions & 0 deletions server/data/healthCheck.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* istanbul ignore file */

import superagent from 'superagent'
import Agent, { HttpsAgent } from 'agentkeepalive'
import logger from '../../logger'
Expand Down
2 changes: 2 additions & 0 deletions server/data/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Do appinsights first as it does some magic instrumentation work, i.e. it affects other 'require's
* In particular, applicationinsights automatically collects bunyan logs
*/
/* istanbul ignore file */

import { initialiseAppInsights, buildAppInsightsClient } from '../utils/azureAppInsights'

initialiseAppInsights()
Expand Down
2 changes: 2 additions & 0 deletions server/data/redisClient.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* istanbul ignore file */

import { createClient } from 'redis'

import logger from '../../logger'
Expand Down
2 changes: 2 additions & 0 deletions server/data/restClient.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* istanbul ignore file */

import superagent from 'superagent'
import Agent, { HttpsAgent } from 'agentkeepalive'
import { Readable } from 'stream'
Expand Down
2 changes: 2 additions & 0 deletions server/data/restClientMetricsMiddleware.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* istanbul ignore file */

import { Socket } from 'net'
import promClient from 'prom-client'
import { Response, SuperAgentRequest } from 'superagent'
Expand Down
2 changes: 2 additions & 0 deletions server/data/tokenStore.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* istanbul ignore file */

import type { RedisClient } from './redisClient'

import logger from '../../logger'
Expand Down
2 changes: 2 additions & 0 deletions server/data/tokenVerification.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* istanbul ignore file */

import superagent from 'superagent'
import type { Request } from 'express'
import getSanitisedError from '../sanitisedError'
Expand Down
2 changes: 2 additions & 0 deletions server/errorHandler.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* istanbul ignore file */

import type { Request, Response, NextFunction } from 'express'
import type { HTTPError } from 'superagent'
import logger from '../logger'
Expand Down
2 changes: 2 additions & 0 deletions server/monitoring/metricsApp.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* istanbul ignore file */

import express from 'express'
import promBundle from 'express-prom-bundle'

Expand Down
2 changes: 2 additions & 0 deletions server/routes/testutils/appSetup.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* istanbul ignore file */

import express, { Express } from 'express'
import cookieSession from 'cookie-session'
import createError from 'http-errors'
Expand Down
2 changes: 2 additions & 0 deletions server/sanitisedError.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* istanbul ignore file */

import type { ResponseError } from 'superagent'

interface SanitisedError {
Expand Down
2 changes: 2 additions & 0 deletions server/services/healthCheck.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* istanbul ignore file */

import promClient from 'prom-client'
import { serviceCheckFactory } from '../data/healthCheck'
import config from '../config'
Expand Down
2 changes: 2 additions & 0 deletions server/utils/azureAppInsights.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* istanbul ignore file */

import { setup, defaultClient, TelemetryClient, DistributedTracingModes } from 'applicationinsights'
import applicationVersion from '../applicationVersion'

Expand Down
2 changes: 2 additions & 0 deletions server/utils/nunjucksSetup.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/* eslint-disable no-param-reassign */
/* istanbul ignore file */

import nunjucks from 'nunjucks'
import express from 'express'
import * as pathModule from 'path'
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
"@approved-premises/ui": ["server/@types/ui/index.d.ts"]
}
},
"exclude": ["node_modules", "assets/**/*.js", "integration_tests", "dist", "cypress.config.ts"],
"exclude": ["node_modules", "assets/**/*.js", "integration_tests", "dist", "cypress.config.ts", "coverage/**"],
"include": ["**/*.js", "**/*.ts"]
}

0 comments on commit f82ff5b

Please sign in to comment.