Skip to content

Commit fc37341

Browse files
authored
test: add coverage (#2)
1 parent aa5672b commit fc37341

File tree

6 files changed

+42
-27
lines changed

6 files changed

+42
-27
lines changed

.github/workflows/nodejs.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
Job:
11+
name: Node.js
12+
uses: node-modules/github-actions/.github/workflows/node-test.yml@master
13+
with:
14+
os: 'ubuntu-latest'
15+
version: '14, 16, 18, 20, 22'
16+
secrets:
17+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/test.yml

-17
This file was deleted.

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules/
22
npm-debug.log
3+
coverage

README.md

+18-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
1-
# IP
2-
3-
[![](https://badge.fury.io/js/@eggjs/ip.svg)](https://www.npmjs.com/package/@eggjs/ip)
1+
# @eggjs/ip
2+
3+
[![NPM version][npm-image]][npm-url]
4+
[![Node.js CI](https://github.com/eggjs/node-ip/actions/workflows/nodejs.yml/badge.svg)](https://github.com/eggjs/node-ip/actions/workflows/nodejs.yml)
5+
[![Test coverage][codecov-image]][codecov-url]
6+
[![Known Vulnerabilities][snyk-image]][snyk-url]
7+
[![npm download][download-image]][download-url]
8+
9+
[npm-image]: https://img.shields.io/npm/v/@eggjs/ip.svg?style=flat-square
10+
[npm-url]: https://npmjs.org/package/@eggjs/ip
11+
[codecov-image]: https://codecov.io/gh/eggjs/node-ip/branch/master/graph/badge.svg
12+
[codecov-url]: https://codecov.io/gh/eggjs/node-ip
13+
[snyk-image]: https://snyk.io/test/npm/@eggjs/ip/badge.svg?style=flat-square
14+
[snyk-url]: https://snyk.io/test/npm/@eggjs/ip
15+
[download-image]: https://img.shields.io/npm/dm/@eggjs/ip.svg?style=flat-square
16+
[download-url]: https://npmjs.org/package/@eggjs/ip
417

518
IP address utilities for node.js
619

@@ -11,15 +24,15 @@ Security fix fork, merge https://github.com/indutny/node-ip/pull/144
1124
### npm
1225

1326
```shell
14-
npm install ip
27+
npm install @eggjs/ip
1528
```
1629

1730
## Usage
1831

1932
Get your ip address, compare ip addresses, validate ip addresses, etc.
2033

2134
```js
22-
var ip = require('ip');
35+
var ip = require('@eggjs/ip');
2336

2437
ip.address() // my ip address
2538
ip.isEqual('::1', '::0:1'); // true

package.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@
1919
],
2020
"main": "lib/ip",
2121
"devDependencies": {
22-
"eslint": "^8.15.0",
23-
"mocha": "^10.0.0"
22+
"egg-bin": "^6.10.0",
23+
"eslint": "^8.15.0"
2424
},
2525
"scripts": {
26-
"lint": "eslint lib/*.js test/*.js",
27-
"test": "npm run lint && mocha --reporter spec test/*-test.js",
28-
"fix": "npm run lint -- --fix"
26+
"lint": "eslint lib test",
27+
"test": "npm run lint && egg-bin test --ts false",
28+
"fix": "npm run lint -- --fix",
29+
"ci": "npm run lint && egg-bin cov --ts false"
2930
},
3031
"license": "MIT"
3132
}

test/api-test.js test/api.test.js

File renamed without changes.

0 commit comments

Comments
 (0)