{"name":"borp","version":"0.7.0","keywords":[],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","_id":"borp@0.7.0","maintainers":[{"name":"matteo.collina","email":"hello@matteocollina.com"}],"homepage":"https://github.com/mcollina/borp#readme","bugs":{"url":"https://github.com/mcollina/borp/issues"},"bin":{"borp":"borp.js"},"dist":{"shasum":"54a0a2902a8d02cc9f574e023d97643bbaf74c1e","tarball":"http://registry-npm.ywwl.com/borp/download/borp-0.7.0.tgz","fileCount":39,"integrity":"sha512-QM3jm8Y/QjoijVsEbYhWcaLTnqlkltf6CSSndSXErq9acg6dlqOUTnAf33WeZviMpcoikBASX263WMvgh2Fc5w==","signatures":[{"sig":"MEUCIQDYf+48mkjmwq078i/8n0WPSr/aVj6zRSzWm9mDMeXx0wIgCijtfpBySakEk1t2Wxc1xfKkrYNzTzKFBAlwujyFw/w=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":36386,"size":9043,"noattachment":false,"key":"/borp/-/borp-0.7.0.tgz"},"main":"borp.js","type":"module","gitHead":"c7c99c1c70afcbd13f903b678fbbec7c821e72fc","scripts":{"lint":"standard | snazzy","test":"npm run clean ; npm run lint && npm run unit","unit":"node borp.js --ignore \"fixtures/**/*\" --coverage --coverage-exclude \"fixtures/**/*\" --coverage-exclude \"test/**/*\"","clean":"rm -rf fixtures/*/dist .test-*"},"_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"repository":{"url":"git+https://github.com/mcollina/borp.git","type":"git"},"_npmVersion":"10.2.3","description":"node:test wrapper with TypeScript support","directories":{},"_nodeVersion":"18.19.0","dependencies":{"c8":"^9.0.0","glob":"^10.3.10","execa":"^8.0.1","find-up":"^7.0.0"},"_hasShrinkwrap":false,"devDependencies":{"desm":"^1.3.0","snazzy":"^9.0.0","standard":"^17.1.0","typescript":"^5.3.2","@types/node":"^20.10.0","@matteo.collina/tspl":"^0.1.0"},"_npmOperationalInternal":{"tmp":"tmp/borp_0.7.0_1706706915355_0.16494300149636487","host":"s3://npm-registry-packages"},"readme":"# borp\n\nBorp is a TypeScript-aware test runner for `node:test` with built-in code coverage support via [c8](https://npm.im/c8).\n\nBorp uses Node.js native [type stripping](https://nodejs.org/api/typescript.html) to run TypeScript files directly without compilation. No build step required!\n\nBorp is self-hosted, i.e. Borp runs its own tests.\n\n## Requirements\n\n- Node.js >= 22.6.0 (22.19.0+ or 24.x+ recommended for best TypeScript support)\n\n## Install\n\n```bash\nnpm i borp --save-dev\n```\n\n## Usage\n\n```bash\n# Run all tests\nborp\n\n# With code coverage\nborp --coverage\n\n# With coverage threshold checking\nborp --coverage --check-coverage --lines 95\n\n# With a node_modules located reporter\nborp --reporter foo\n\n# With a node_modules located reporter writing to stderr\nborp --reporter foo:stderr\n\n# With a local custom reporter\nborp --reporter ./lib/some-reporter.mjs\n\n# Matching all test.js files except ones in nested node_modules directories\nborp 'test/**/*.test.js' '!test/**/node_modules/**/*.test.js'\n```\n\nBorp will automatically run all test files matching `*.test.{js|ts|mts|cts}`.\n\n## TypeScript Support\n\nBorp uses Node.js native type stripping to run TypeScript files directly. No compilation step is required!\n\n### Example project setup\n\n```\n.\n├── src\n│   ├── lib\n│   │   └── math.ts\n│   └── test\n│       └── math.test.ts\n└── package.json\n```\n\nAs an example, consider having a `src/lib/math.ts` file:\n\n```typescript\nexport function math (x: number, y: number): number {\n  return x + y\n}\n```\n\nand a `src/test/math.test.ts` file:\n\n```typescript\nimport { test } from 'node:test'\nimport { math } from '../lib/math.ts'\nimport { strictEqual } from 'node:assert'\n\ntest('math', () => {\n  strictEqual(math(1, 2), 3)\n})\n```\n\nNote: Use `.ts` extensions in your imports, not `.js`!\n\n### TypeScript Constraints\n\nType stripping has some limitations compared to full TypeScript compilation. Your code must follow these rules:\n\n- **Use type-only imports**: Use `import type { Foo }` or `import { type Foo }` for type imports\n- **No enums**: Use const objects with `as const` instead\n- **No namespaces**: Use regular modules instead\n- **No parameter properties**: Explicitly declare class properties in the constructor body\n- **File extensions**: Import `.ts` files with `.ts` extension\n\nSee the [Node.js TypeScript documentation](https://nodejs.org/api/typescript.html) for full details.\n\n### Optional tsconfig.json\n\nA `tsconfig.json` is not required for borp to work, but you can include one for IDE support and type checking:\n\n```json\n{\n  \"compilerOptions\": {\n    \"target\": \"ES2022\",\n    \"module\": \"NodeNext\",\n    \"moduleResolution\": \"NodeNext\",\n    \"strict\": true,\n    \"noEmit\": true,\n    \"allowImportingTsExtensions\": true,\n    \"verbatimModuleSyntax\": true,\n    \"isolatedModules\": true,\n    \"skipLibCheck\": true\n  }\n}\n```\n\nKey options:\n- `noEmit: true` - No compilation output needed\n- `allowImportingTsExtensions: true` - Allow `.ts` imports\n- `verbatimModuleSyntax: true` - Enforce type-only imports\n\n## Options\n\n* `--concurrency` or `-c`, to set the number of concurrent tests. Defaults to the number of available CPUs minus one.\n* `--coverage` or `-C`, enables code coverage\n* `--only` or `-o`, only run `node:test` with the `only` option set\n* `--watch` or `-w`, re-run tests on file changes using Node.js native watch mode\n* `--timeout` or `-t`, timeouts the tests after a given time; default is 30000 ms\n* `--no-timeout`, disables the timeout\n* `--coverage-exclude` or `-X`, a list of comma-separated patterns to exclude from the coverage report. All tests files are ignored by default.\n* `--ignore` or `-i`, ignore a glob pattern, and not look for tests there\n* `--expose-gc`, exposes the gc() function to tests\n* `--pattern` or `-p`, run tests matching the given glob pattern\n* `--reporter` or `-r`, set up a reporter, use a colon to set a file destination. Reporter may either be a module name resolvable by standard `node_modules` resolution, or a path to a script relative to the process working directory (must be an ESM script). Default: `spec`.\n* `--check-coverage`, enables c8 check coverage; default is false\n* `--coverage-html`, generates c8 html report; default is false\n\n### Check coverage options\n\n* `--lines`, set the lines threshold when check coverage is active; default is 100\n* `--functions`, set the functions threshold when check coverage is active; default is 100\n* `--statements`, set the statements threshold when check coverage is active; default is 100\n* `--branches`, set the branches threshold when check coverage is active; default is 100\n\n## Reporters\n\nHere are the available reporters:\n\n* `gh`: emits `::error` workflow commands for GitHub Actions to show inlined errors. Enabled by default when running on GHA.\n* `tap`: outputs the test results in the TAP format.\n* `spec`: outputs the test results in a human-readable format.\n* `dot`: outputs the test results in a compact format, where each passing test is represented by a ., and each failing test is represented by a X.\n* `junit`: outputs test results in a jUnit XML format\n\n## Config File Support\n\nA limited set of options may be specified via a configuration file. The configuration file is expected to be in the process's working directory, and named either `.borp.yaml` or `.borp.yml`; it may also be specified by defining the environment variable `BORP_CONF_FILE` and setting it to the full path to some yaml file.\n\nThe current supported options are:\n\n+ `coverage` (object): A hash of options relating to test coverage. By defining this configuration object, coverage reporting will be enabled.\n  - `check-coverage` (boolean): Set to `true` to enable coverage checking. Omit to disable coverage checking.\n  - `coverage-html` (boolean): Set to `true` to generate an HTML coverage report.\n  - `branches` (number): Define the percentage of acceptable coverage for branches. Default: 100.\n  - `functions` (number): Define the percentage of acceptable coverage for functions. Default: 100.\n  - `lines` (number): Define the percentage of acceptable coverage for lines. Default: 100.\n  - `statements` (number): Define the percentage of acceptable coverage for statements. Default: 100.\n+ `files` (string[]): An array of test files to include. Globs are supported. Note: any glob that starts with a `!` (bang character) will be treated as an ignore glob, e.g. `'!test/**/node_modules/**/*'` will ignore all files in nested `node_modules` directories that would otherwise be matched.\n+ `reporters` (string[]): An array of reporters to use. May be relative path strings, or module name strings.\n\n### Example\n\n```yaml\ncoverage:\n  check-coverage: true\n  branches: 99\n  functions: 98\n  lines: 97\n  statements: 96\n\nfiles:\n  - 'test/one.test.js'\n  - 'test/foo/*.test.js'\n\nreporters:\n  - './test/lib/my-reporter.js'\n  - spec\n  - '@reporters/silent'\n```\n\n## Migration from borp < 1.0\n\nIf you're upgrading from an older version of borp, here are the key changes:\n\n1. **No compilation step**: Tests run directly from source files\n2. **Import extensions**: Change `.js` to `.ts` in your TypeScript imports\n3. **No outDir**: Remove `outDir` from tsconfig or set to your source directory\n4. **Removed options**: `--no-typescript` and `--post-compile` are removed\n5. **Type constraints**: See TypeScript Constraints section above\n\n## License\n\nMIT\n","publish_time":1706706915523,"_cnpm_publish_time":1706706915523,"dist-tags":{"latest":"1.0.1"}}