You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

coverage

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

coverage - npm Package Compare versions

Comparing version

to
0.2.0

14

index.js

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

const c8BinPath = join(dirname(c8PackageJsonPath), c8PackageData.bin.c8);
const [nodePath] = process.argv;
const nodePath = process.execPath;
const optionArgs = process.argv.slice(2);

@@ -69,3 +69,13 @@ const {_: [command], reporter} = yargsParser(optionArgs);

optionArgs.splice(optionArgs.indexOf(command), 1, nodePath, entryPath);
optionArgs.splice(
optionArgs.indexOf(command),
1,
nodePath,
...ext === 'mjs' ? [
'--experimental-modules',
'--es-module-specifier-resolution=node',
'--no-warnings'
] : [],
entryPath
);
}

@@ -72,0 +82,0 @@

3

package.json
{
"name": "coverage",
"version": "0.1.5",
"version": "0.2.0",
"description": "A command-line tool to collect and report code coverage of a JavaScript program",

@@ -47,2 +47,3 @@ "author": "Shinnosuke Watanabe (https://github.com/shinnn)",

"lodash": "^4.17.11",
"rmfr": "^2.0.0",
"tape": "^4.10.1"

@@ -49,0 +50,0 @@ },

@@ -30,5 +30,6 @@ # coverage

This is a wrapper of [c8](https://github.com/bcoe/c8), different in the following points:
This is an opinionated wrapper of [c8](https://github.com/bcoe/c8), different in the following points:
* Runs both [`html` and `text` reporter](https://github.com/istanbuljs/nyc#running-reports) by default
* Automatically enables [ECMAScript module](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import) support for `.mjs` files
* The first argument can be a JavaScript file path instead of a command

@@ -53,9 +54,15 @@ * Built-in [Codecov](https://codecov.io) support

Execute a JavaScript file with Node.js or run a command, print code coverage to the stdout and write [HTML reports](https://istanbul.js.org/docs/advanced/alternative-reporters/#html) under the `./coverage` directory.
Execute the command, print code coverage to the stdout and write [HTML reports](https://istanbul.js.org/docs/advanced/alternative-reporters/#html) under the `./coverage` directory.
`<file|command>` can be either a JavaScript file path or a command. If a path is provided, the file is run with the `node` command.
```console
$ coverage /path/to/entry-point.js # ↑ is the same as ↓
$ coverage /path/to/entry-point.js # is the same as ↓
$ coverage node /path/to/entry-point.js
```
If the provided JavaScript path ends with `.mjs`, [ECMAScript module mode](https://nodejs.org/api/esm.html) is automatically [enabled](https://nodejs.org/api/esm.html#esm_enabling) and [`--es-module-specifier-resolution`](https://nodejs.org/api/esm.html#esm_customizing_esm_specifier_resolution_algorithm) is set to `node`.
#### Reporters
Users can override the default format of reports with `--reporter` option.

@@ -84,2 +91,4 @@

#### Codecov integration
When the execution exits with code `0` on a CI service or [GitHub Actions](https://github.com/features/actions), it automatically uploads the generated coverage to [Codecov](https://docs.codecov.io/docs). Whether `CODECOV_TOKEN` environment variable is required or not varies between [services](https://github.com/codecov/codecov-bash#ci-providers).

@@ -86,0 +95,0 @@