Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

borp

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

borp - npm Package Compare versions

Comparing version 0.11.0 to 0.12.0

fixtures/ts-esm-check-coverage/src/math.ts

17

borp.js

@@ -13,2 +13,3 @@ #! /usr/bin/env node

import { Report } from 'c8'
import { checkCoverages } from 'c8/lib/commands/check-coverage.js'
import os from 'node:os'

@@ -43,3 +44,8 @@ import { execa } from 'execa'

multiple: true
}
},
'check-coverage': { type: 'boolean' },
lines: { type: 'string', default: '100' },
branches: { type: 'string', default: '100' },
functions: { type: 'string', default: '100' },
statements: { type: 'string', default: '100' }
},

@@ -141,2 +147,11 @@ allowPositionals: true

if (args.values['check-coverage']) {
await checkCoverages({
lines: parseInt(args.values.lines),
functions: parseInt(args.values.functions),
branches: parseInt(args.values.branches),
statements: parseInt(args.values.statements),
...args
}, report)
}
await report.run()

@@ -143,0 +158,0 @@ }

2

package.json
{
"name": "borp",
"version": "0.11.0",
"version": "0.12.0",
"type": "module",

@@ -5,0 +5,0 @@ "description": "node:test wrapper with TypeScript support",

@@ -18,2 +18,5 @@ # borp

borp --coverage
# with check coverage active
borp --coverage --check-coverage --lines 95
```

@@ -29,5 +32,5 @@

│   ├── lib
│   │   └── add.ts
│   │   └── math.ts
│   └── test
│   └── add.test.ts
│   └── math.test.ts
└── tsconfig.json

@@ -37,6 +40,6 @@

As an example, consider having a `src/lib/add.ts` file
As an example, consider having a `src/lib/math.ts` file
```typescript
export function add (x: number, y: number): number {
export function math (x: number, y: number): number {
return x + y

@@ -46,11 +49,11 @@ }

and a `src/test/add.test.ts` file:
and a `src/test/math.test.ts` file:
```typescript
import { test } from 'node:test'
import { add } from '../lib/add.js'
import { math } from '../lib/math.js'
import { strictEqual } from 'node:assert'
test('add', () => {
strictEqual(add(1, 2), 3)
test('math', () => {
strictEqual(math(1, 2), 3)
})

@@ -104,3 +107,8 @@ ```

* `--post-compile` or `-P`, the path to a file that will be executed after each typescript compilation.
* `--check-coverage`, enables c8 check coverage; default is false
### Check coverage options
* `--lines`, set the lines threshold when check coverage is active; default is 100
* `--functions`, set the functions threshold when check coverage is active; default is 100
* `--statements`, set the statements threshold when check coverage is active; default is 100
* `--branches`, set the branches threshold when check coverage is active; default is 100
## Reporters

@@ -107,0 +115,0 @@

import { test } from 'node:test'
import { match, doesNotMatch } from 'node:assert'
import { match, doesNotMatch, fail, equal, AssertionError } from 'node:assert'
import { execa } from 'execa'

@@ -38,1 +38,47 @@ import { join } from 'desm'

})
test('borp should return right error when check coverage is active with default thresholds', async (t) => {
try {
await execa('node', [
borp,
'--coverage',
'--check-coverage'
], {
cwd: join(import.meta.url, '..', 'fixtures', 'ts-esm-check-coverage')
})
fail('Should not complete borp without error')
} catch (e) {
if (e instanceof AssertionError) {
throw e
}
equal(e.exitCode, 1)
match(e.stderr, /ERROR: Coverage for lines \(75%\) does not meet global threshold \(100%\)/)
match(e.stderr, /ERROR: Coverage for functions \(50%\) does not meet global threshold \(100%\)/)
match(e.stderr, /ERROR: Coverage for statements \(75%\) does not meet global threshold \(100%\)/)
}
})
test('borp should return right error when check coverage is active with defined thresholds', async (t) => {
try {
await execa('node', [
borp,
'--coverage',
'--check-coverage',
'--lines=80',
'--functions=50',
'--statements=0',
'--branches=100'
], {
cwd: join(import.meta.url, '..', 'fixtures', 'ts-esm-check-coverage')
})
fail('Should not complete borp without error')
} catch (e) {
if (e instanceof AssertionError) {
throw e
}
equal(e.exitCode, 1)
match(e.stderr, /ERROR: Coverage for lines \(75%\) does not meet global threshold \(80%\)/)
}
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc