Fix code coverage

This commit is contained in:
Sindre Sorhus 2021-11-26 16:50:15 +07:00
parent 04fdbd6d8d
commit 7a6893551d
4 changed files with 24 additions and 8 deletions

View file

@ -10,6 +10,7 @@ jobs:
fail-fast: false
matrix:
node-version:
- 16
- 14
- 12
steps:
@ -19,3 +20,7 @@ jobs:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
- uses: codecov/codecov-action@v2
if: matrix.node-version == 16
with:
fail_ci_if_error: true

View file

@ -14,11 +14,12 @@
"default": "./source/vendor/supports-color/browser.js"
}
},
"types": "./source/index.d.ts",
"engines": {
"node": "^12.17.0 || ^14.13 || >=16.0.0"
},
"scripts": {
"test": "xo && nyc ava && tsd",
"test": "xo && c8 ava && tsd",
"bench": "matcha benchmark.js"
},
"files": [
@ -48,23 +49,29 @@
"text"
],
"devDependencies": {
"@types/node": "^16.11.10",
"ava": "^3.15.0",
"c8": "^7.10.0",
"color-convert": "^2.0.1",
"coveralls": "^3.1.1",
"execa": "^6.0.0",
"log-update": "^5.0.0",
"matcha": "^0.7.0",
"nyc": "^15.1.0",
"tsd": "^0.19.0",
"typescript": "^4.5.2",
"xo": "^0.47.0",
"yoctodelay": "^2.0.0"
},
"types": "./source/index.d.ts",
"xo": {
"rules": {
"unicorn/prefer-string-slice": "off",
"unicorn/better-regex": "off"
"unicorn/prefer-string-slice": "off"
}
},
"c8": {
"reporter": [
"text",
"lcov"
],
"exclude": [
"source/vendor"
]
}
}

View file

@ -9,7 +9,7 @@
> Terminal string styling done right
[![Coverage Status](https://coveralls.io/repos/github/chalk/chalk/badge.svg?branch=main)](https://coveralls.io/github/chalk/chalk?branch=main)
[![Coverage Status](https://codecov.io/gh/chalk/chalk/branch/main/graph/badge.svg)](https://codecov.io/gh/chalk/chalk)
[![npm dependents](https://badgen.net/npm/dependents/chalk)](https://www.npmjs.com/package/chalk?activeTab=dependents) [![Downloads](https://badgen.net/npm/dt/chalk)](https://www.npmjs.com/package/chalk)
[![run on repl.it](https://repl.it/badge/github/chalk/chalk)](https://repl.it/github/chalk/chalk)
[![Support Chalk on DEV](https://badge.devprotocol.xyz/0x44d871aebF0126Bf646753E2C976Aa7e68A66c15/descriptive)](https://stakes.social/0x44d871aebF0126Bf646753E2C976Aa7e68A66c15)
@ -72,6 +72,7 @@
- Expressive API
- Highly performant
- No dependencies
- Ability to nest styles
- [256/Truecolor color support](#256-and-truecolor-color-support)
- Auto-detects color support
@ -86,6 +87,8 @@
npm install chalk
```
**IMPORTANT:** Chalk 5 is ESM. If you want to use Chalk with TypeScript or a build tool, you will probably want to use Chalk 4 for now. [Read more.](https://github.com/chalk/chalk/releases/tag/v5.0.0)
## Usage
```js

View file

@ -1,3 +1,4 @@
// TODO: When targeting Node.js 16, use `String.prototype.replaceAll`.
export function stringReplaceAll(string, substring, replacer) {
let index = string.indexOf(substring);
if (index === -1) {