From 78e921320ddb2bce1691e8fcb12346d34f49e829 Mon Sep 17 00:00:00 2001 From: Daniel Lando Date: Fri, 15 Mar 2024 12:04:09 +0100 Subject: [PATCH] chore: ignore coverage of browser related stuff (#1819) * chore: ignore coverage of browser related stuff * fix: ignore type * fix: add missing lcov report --- nyc.config.js | 21 +++++++++++++++++++++ package.json | 2 +- src/lib/connect/ws.ts | 2 ++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 nyc.config.js diff --git a/nyc.config.js b/nyc.config.js new file mode 100644 index 000000000..cdc8932ce --- /dev/null +++ b/nyc.config.js @@ -0,0 +1,21 @@ + +module.exports = { + include: [ + 'src/**', + ], + exclude: [ + 'src/bin/*', + 'src/lib/BufferedDuplex.ts', + 'src/connect/wx.ts', + 'src/connect/ali.ts', + ], + reporter: [ + 'text', + 'lcov', + ], + branches: 80, + functions: 89, + lines: 86, + statements: 86, + 'check-coverage': true, +} \ No newline at end of file diff --git a/package.json b/package.json index ac95f4a29..a97bc7016 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "build:browser": "node esbuild.js", "build": "npm run build:ts && npm run build:browser", "prepare": "npm run build", - "unit-test:node": "node_modules/.bin/nyc --reporter=lcov --reporter=text node -r esbuild-register test/runTests.ts", + "unit-test:node": "node_modules/.bin/nyc node -r esbuild-register test/runTests.ts", "unit-test:browser": "wtr", "test:node": "npm run unit-test:node && codecov", "test:browser": "npm run build && npm run unit-test:browser", diff --git a/src/lib/connect/ws.ts b/src/lib/connect/ws.ts index f44c3ddd8..f98ec481e 100644 --- a/src/lib/connect/ws.ts +++ b/src/lib/connect/ws.ts @@ -120,6 +120,7 @@ function createWebSocket( return socket } +/* istanbul ignore next */ function createBrowserWebSocket(client: MqttClient, opts: IClientOptions) { const websocketSubProtocol = opts.protocolId === 'MQIsdp' && opts.protocolVersion === 3 @@ -154,6 +155,7 @@ const streamBuilder: StreamBuilder = (client, opts) => { return webSocketStream } +/* istanbul ignore next */ const browserStreamBuilder: StreamBuilder = (client, opts) => { debug('browserStreamBuilder') let stream: BufferedDuplex | (Transform & { socket?: WebSocket })