Skip to content

Commit

Permalink
replace istanbul ignores with c8
Browse files Browse the repository at this point in the history
  • Loading branch information
XY-Wang committed Nov 26, 2024
1 parent c0ecc8b commit 19957f6
Show file tree
Hide file tree
Showing 17 changed files with 16 additions and 19 deletions.
1 change: 0 additions & 1 deletion packages/server/src/cli/args.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* istanbul ignore file */
import { InvalidArgumentError, Option } from 'commander'

import { FastifyCorsOptions } from '@fastify/cors'
Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/environment.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* istanbul ignore next */
/* c8 ignore next */
export const environment = process.env.NODE_ENV || 'development'

const NON_PROD = ['test', 'development']
Expand Down
1 change: 0 additions & 1 deletion packages/server/src/errors.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* istanbul ignore file */
import { FastifyReply } from 'fastify'
import { ZodError } from 'zod'

Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async function startServer(this: Command) {
},
)

/* istanbul ignore next */
/* c8 ignore next */
closeWithGrace(
{
delay: opts.grace,
Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export async function createServer(opts: ServerOptions) {
logger,
})

/* istanbul ignore next */
/* c8 ignore next */
process.once('SIGUSR2', async function () {
await server.close()
// Controlled shutdown for Nodemon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class Queries {
return await this.#locationHandler.queryAssetByLocation(args.criteria)
}

/* c8 ignore next */
throw new ValidationError('Unknown query type')
}

Expand Down
4 changes: 2 additions & 2 deletions packages/server/src/services/agents/xcm/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,12 +325,12 @@ export class XcmAgent implements Agent, Subscribable {
})
}
} catch (error) {
/* istanbul ignore next */
/* c8 ignore next */
// Clean up subscriptions.
subs.forEach(({ sub }) => {
sub.unsubscribe()
})
/* istanbul ignore next */
/* c8 ignore next */
throw error
}

Expand Down
4 changes: 2 additions & 2 deletions packages/server/src/services/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,13 @@ const configPlugin: FastifyPluginAsync<ConfigServerOptions> = async (fastify, op
const config = $ServiceConfiguration.parse(toml.parse(fs.readFileSync(configPath, 'utf-8')))
fastify.decorate('localConfig', config)
} catch (err) {
/* istanbul ignore next */
/* c8 ignore next */
if (err instanceof z.ZodError) {
fastify.log.error(err.issues)
} else {
fastify.log.error(err)
}
/* istanbul ignore next */
/* c8 ignore next */
throw new Error('Error while loading configuration.')
}
}
Expand Down
1 change: 0 additions & 1 deletion packages/server/src/services/ingress/producer/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* istanbul ignore file */
import EventEmitter from 'node:events'

import { Subscription as RxSubscription } from 'rxjs'
Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/services/ingress/server/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async function startServer(this: Command) {
},
)

/* istanbul ignore next */
/* c8 ignore next */
closeWithGrace(
{
delay: opts.grace,
Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/services/ingress/server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export async function createIngressServer(opts: ServerOptions) {

server.setErrorHandler(errorHandler)

/* istanbul ignore next */
/* c8 ignore next */
process.once('SIGUSR2', function () {
server.close().then(() => {
// Controlled shutdown for Nodemon
Expand Down
1 change: 0 additions & 1 deletion packages/server/src/services/ingress/watcher/fetchers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* istanbul ignore file */
import { HexString, NetworkURN } from '@/lib.js'
import { ApiClient } from '@/services/networking/client/index.js'

Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/services/networking/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ declare module 'fastify' {
}

const connectorPlugin: FastifyPluginAsync = async (fastify) => {
/* istanbul ignore next */
/* c8 ignore next */
if (fastify.localConfig === undefined) {
return
}
Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/services/persistence/kysely/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ declare module 'fastify' {
type KyselyOptions = DatabaseOptions & KyselyServerOptions

const kyselyPlugin: FastifyPluginAsync<KyselyOptions> = async (fastify, { data }) => {
/* istanbul ignore next */
/* c8 ignore next */
const filename = data && data.length > 0 ? path.join(data, '/db.sqlite') : ':memory:'

fastify.log.info('[kysely] open sqlite database at %s', filename)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export default class WebsocketProtocol extends (EventEmitter as new () => Teleme
socket.on('message', (data: Buffer) => {
setImmediate(async () => {
if (resolvedId) {
/* istanbul ignore next */
/* c8 ignore next */
this.#safeWrite(socket, resolvedId)
} else {
const parsed = $EphemeralSubscription.safeParse(data.toString())
Expand Down
4 changes: 2 additions & 2 deletions packages/server/src/services/subscriptions/api/ws/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export async function SubscriptionWebSocketsApi(fastify: FastifyInstance) {
},
)

/* istanbul ignore next */
/* c8 ignore next */
fastify.get<{
Querystring: NodQuerystring
Params: SubscriptionPathParams
Expand All @@ -56,7 +56,7 @@ export async function SubscriptionWebSocketsApi(fastify: FastifyInstance) {
},
)

/* istanbul ignore next */
/* c8 ignore next */
fastify.get<{
Querystring: NodQuerystring
}>(
Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/services/telemetry/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const telemetryPlugin: FastifyPluginAsync<TelemetryOptions> = async (fastify, op

fastify.addHook('onResponse', createReplyHook())

/* istanbul ignore next */
/* c8 ignore next */
fastify.get(
'/metrics',
{
Expand Down

0 comments on commit 19957f6

Please sign in to comment.