Skip to content

Commit

Permalink
chore: ignore coverage of browser related stuff (#1819)
Browse files Browse the repository at this point in the history
* chore: ignore coverage of browser related stuff

* fix: ignore type

* fix: add missing lcov report
  • Loading branch information
robertsLando authored Mar 15, 2024
1 parent 64ee449 commit 78e9213
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
21 changes: 21 additions & 0 deletions nyc.config.js
Original file line number Diff line number Diff line change
@@ -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,
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions src/lib/connect/ws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 })
Expand Down

0 comments on commit 78e9213

Please sign in to comment.