Update test dependencies
Signed-off-by: Richie Bendall <richiebendall@gmail.com>
This commit is contained in:
parent
445092f9af
commit
5be1773244
11 changed files with 59 additions and 56 deletions
|
|
@ -3,7 +3,9 @@ const chalk = require('..');
|
||||||
|
|
||||||
const ignoreChars = /[^!-~]/g;
|
const ignoreChars = /[^!-~]/g;
|
||||||
|
|
||||||
const delay = milliseconds => new Promise(resolve => setTimeout(resolve, milliseconds));
|
const delay = milliseconds => new Promise(resolve => {
|
||||||
|
setTimeout(resolve, milliseconds);
|
||||||
|
});
|
||||||
|
|
||||||
function rainbow(string, offset) {
|
function rainbow(string, offset) {
|
||||||
if (!string || string.length === 0) {
|
if (!string || string.length === 0) {
|
||||||
|
|
|
||||||
32
index.d.ts
vendored
32
index.d.ts
vendored
|
|
@ -181,7 +181,7 @@ declare namespace chalk {
|
||||||
chalk.hex('#DEADED');
|
chalk.hex('#DEADED');
|
||||||
```
|
```
|
||||||
*/
|
*/
|
||||||
hex(color: string): Chalk;
|
hex: (color: string) => Chalk;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Use keyword color value to set text color.
|
Use keyword color value to set text color.
|
||||||
|
|
@ -195,27 +195,27 @@ declare namespace chalk {
|
||||||
chalk.keyword('orange');
|
chalk.keyword('orange');
|
||||||
```
|
```
|
||||||
*/
|
*/
|
||||||
keyword(color: string): Chalk;
|
keyword: (color: string) => Chalk;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Use RGB values to set text color.
|
Use RGB values to set text color.
|
||||||
*/
|
*/
|
||||||
rgb(red: number, green: number, blue: number): Chalk;
|
rgb: (red: number, green: number, blue: number) => Chalk;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Use HSL values to set text color.
|
Use HSL values to set text color.
|
||||||
*/
|
*/
|
||||||
hsl(hue: number, saturation: number, lightness: number): Chalk;
|
hsl: (hue: number, saturation: number, lightness: number) => Chalk;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Use HSV values to set text color.
|
Use HSV values to set text color.
|
||||||
*/
|
*/
|
||||||
hsv(hue: number, saturation: number, value: number): Chalk;
|
hsv: (hue: number, saturation: number, value: number) => Chalk;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Use HWB values to set text color.
|
Use HWB values to set text color.
|
||||||
*/
|
*/
|
||||||
hwb(hue: number, whiteness: number, blackness: number): Chalk;
|
hwb: (hue: number, whiteness: number, blackness: number) => Chalk;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set text color.
|
Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set text color.
|
||||||
|
|
@ -223,12 +223,12 @@ declare namespace chalk {
|
||||||
30 <= code && code < 38 || 90 <= code && code < 98
|
30 <= code && code < 38 || 90 <= code && code < 98
|
||||||
For example, 31 for red, 91 for redBright.
|
For example, 31 for red, 91 for redBright.
|
||||||
*/
|
*/
|
||||||
ansi(code: number): Chalk;
|
ansi: (code: number) => Chalk;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color.
|
Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color.
|
||||||
*/
|
*/
|
||||||
ansi256(index: number): Chalk;
|
ansi256: (index: number) => Chalk;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Use HEX value to set background color.
|
Use HEX value to set background color.
|
||||||
|
|
@ -242,7 +242,7 @@ declare namespace chalk {
|
||||||
chalk.bgHex('#DEADED');
|
chalk.bgHex('#DEADED');
|
||||||
```
|
```
|
||||||
*/
|
*/
|
||||||
bgHex(color: string): Chalk;
|
bgHex: (color: string) => Chalk;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Use keyword color value to set background color.
|
Use keyword color value to set background color.
|
||||||
|
|
@ -256,27 +256,27 @@ declare namespace chalk {
|
||||||
chalk.bgKeyword('orange');
|
chalk.bgKeyword('orange');
|
||||||
```
|
```
|
||||||
*/
|
*/
|
||||||
bgKeyword(color: string): Chalk;
|
bgKeyword: (color: string) => Chalk;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Use RGB values to set background color.
|
Use RGB values to set background color.
|
||||||
*/
|
*/
|
||||||
bgRgb(red: number, green: number, blue: number): Chalk;
|
bgRgb: (red: number, green: number, blue: number) => Chalk;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Use HSL values to set background color.
|
Use HSL values to set background color.
|
||||||
*/
|
*/
|
||||||
bgHsl(hue: number, saturation: number, lightness: number): Chalk;
|
bgHsl: (hue: number, saturation: number, lightness: number) => Chalk;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Use HSV values to set background color.
|
Use HSV values to set background color.
|
||||||
*/
|
*/
|
||||||
bgHsv(hue: number, saturation: number, value: number): Chalk;
|
bgHsv: (hue: number, saturation: number, value: number) => Chalk;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Use HWB values to set background color.
|
Use HWB values to set background color.
|
||||||
*/
|
*/
|
||||||
bgHwb(hue: number, whiteness: number, blackness: number): Chalk;
|
bgHwb: (hue: number, whiteness: number, blackness: number) => Chalk;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set background color.
|
Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set background color.
|
||||||
|
|
@ -285,12 +285,12 @@ declare namespace chalk {
|
||||||
For example, 31 for red, 91 for redBright.
|
For example, 31 for red, 91 for redBright.
|
||||||
Use the foreground code, not the background code (for example, not 41, nor 101).
|
Use the foreground code, not the background code (for example, not 41, nor 101).
|
||||||
*/
|
*/
|
||||||
bgAnsi(code: number): Chalk;
|
bgAnsi: (code: number) => Chalk;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set background color.
|
Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set background color.
|
||||||
*/
|
*/
|
||||||
bgAnsi256(index: number): Chalk;
|
bgAnsi256: (index: number) => Chalk;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Modifier: Resets the current color chain.
|
Modifier: Resets the current color chain.
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import {expectType, expectError} from 'tsd';
|
import {expectType, expectAssignable, expectError} from 'tsd';
|
||||||
import chalk = require('.');
|
import chalk = require('.');
|
||||||
|
|
||||||
// - Helpers -
|
// - Helpers -
|
||||||
|
|
@ -13,7 +13,7 @@ if (chalk.supportsColor) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// - stderr -
|
// - stderr -
|
||||||
expectType<chalk.Chalk>(chalk.stderr);
|
expectAssignable<chalk.Chalk>(chalk.stderr);
|
||||||
expectType<chalk.ColorSupport | false>(chalk.stderr.supportsColor);
|
expectType<chalk.ColorSupport | false>(chalk.stderr.supportsColor);
|
||||||
if (chalk.stderr.supportsColor) {
|
if (chalk.stderr.supportsColor) {
|
||||||
expectType<boolean>(chalk.stderr.supportsColor.hasBasic);
|
expectType<boolean>(chalk.stderr.supportsColor.hasBasic);
|
||||||
|
|
@ -41,22 +41,22 @@ expectType<string>(chalk`Hello {bold.red ${name}}`);
|
||||||
expectType<string>(chalk`Works with numbers {bold.red ${1}}`);
|
expectType<string>(chalk`Works with numbers {bold.red ${1}}`);
|
||||||
|
|
||||||
// -- Color methods --
|
// -- Color methods --
|
||||||
expectType<colorReturn>(chalk.hex('#DEADED'));
|
expectAssignable<colorReturn>(chalk.hex('#DEADED'));
|
||||||
expectType<colorReturn>(chalk.keyword('orange'));
|
expectAssignable<colorReturn>(chalk.keyword('orange'));
|
||||||
expectType<colorReturn>(chalk.rgb(0, 0, 0));
|
expectAssignable<colorReturn>(chalk.rgb(0, 0, 0));
|
||||||
expectType<colorReturn>(chalk.hsl(0, 0, 0));
|
expectAssignable<colorReturn>(chalk.hsl(0, 0, 0));
|
||||||
expectType<colorReturn>(chalk.hsv(0, 0, 0));
|
expectAssignable<colorReturn>(chalk.hsv(0, 0, 0));
|
||||||
expectType<colorReturn>(chalk.hwb(0, 0, 0));
|
expectAssignable<colorReturn>(chalk.hwb(0, 0, 0));
|
||||||
expectType<colorReturn>(chalk.ansi(30));
|
expectAssignable<colorReturn>(chalk.ansi(30));
|
||||||
expectType<colorReturn>(chalk.ansi256(0));
|
expectAssignable<colorReturn>(chalk.ansi256(0));
|
||||||
expectType<colorReturn>(chalk.bgHex('#DEADED'));
|
expectAssignable<colorReturn>(chalk.bgHex('#DEADED'));
|
||||||
expectType<colorReturn>(chalk.bgKeyword('orange'));
|
expectAssignable<colorReturn>(chalk.bgKeyword('orange'));
|
||||||
expectType<colorReturn>(chalk.bgRgb(0, 0, 0));
|
expectAssignable<colorReturn>(chalk.bgRgb(0, 0, 0));
|
||||||
expectType<colorReturn>(chalk.bgHsl(0, 0, 0));
|
expectAssignable<colorReturn>(chalk.bgHsl(0, 0, 0));
|
||||||
expectType<colorReturn>(chalk.bgHsv(0, 0, 0));
|
expectAssignable<colorReturn>(chalk.bgHsv(0, 0, 0));
|
||||||
expectType<colorReturn>(chalk.bgHwb(0, 0, 0));
|
expectAssignable<colorReturn>(chalk.bgHwb(0, 0, 0));
|
||||||
expectType<colorReturn>(chalk.bgAnsi(30));
|
expectAssignable<colorReturn>(chalk.bgAnsi(30));
|
||||||
expectType<colorReturn>(chalk.bgAnsi256(0));
|
expectAssignable<colorReturn>(chalk.bgAnsi256(0));
|
||||||
|
|
||||||
// -- Modifiers --
|
// -- Modifiers --
|
||||||
expectType<string>(chalk.reset('foo'));
|
expectType<string>(chalk.reset('foo'));
|
||||||
|
|
@ -158,5 +158,5 @@ expectType<string>(chalk.red.bgGreen.bold`Hello {italic.blue ${name}}`);
|
||||||
expectType<string>(chalk.strikethrough.cyanBright.bgBlack`Works with {reset {bold numbers}} {bold.red ${1}}`);
|
expectType<string>(chalk.strikethrough.cyanBright.bgBlack`Works with {reset {bold numbers}} {bold.red ${1}}`);
|
||||||
|
|
||||||
// -- Color types ==
|
// -- Color types ==
|
||||||
expectType<typeof chalk.Color>('red');
|
expectAssignable<typeof chalk.Color>('red');
|
||||||
expectError<typeof chalk.Color>('hotpink');
|
expectError<typeof chalk.Color>('hotpink');
|
||||||
|
|
|
||||||
17
package.json
17
package.json
|
|
@ -45,15 +45,15 @@
|
||||||
"supports-color": "^7.1.0"
|
"supports-color": "^7.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"ava": "^2.4.0",
|
"ava": "^3.13.0",
|
||||||
"coveralls": "^3.0.7",
|
"coveralls": "^3.1.0",
|
||||||
"execa": "^4.0.0",
|
"execa": "^4.0.3",
|
||||||
"import-fresh": "^3.1.0",
|
"import-fresh": "^3.2.1",
|
||||||
"matcha": "^0.7.0",
|
"matcha": "^0.7.0",
|
||||||
"nyc": "^15.0.0",
|
"nyc": "^15.1.0",
|
||||||
"resolve-from": "^5.0.0",
|
"resolve-from": "^5.0.0",
|
||||||
"tsd": "^0.7.4",
|
"tsd": "^0.13.1",
|
||||||
"xo": "^0.28.2"
|
"xo": "^0.33.1"
|
||||||
},
|
},
|
||||||
"xo": {
|
"xo": {
|
||||||
"rules": {
|
"rules": {
|
||||||
|
|
@ -62,7 +62,8 @@
|
||||||
"@typescript-eslint/member-ordering": "off",
|
"@typescript-eslint/member-ordering": "off",
|
||||||
"no-redeclare": "off",
|
"no-redeclare": "off",
|
||||||
"unicorn/string-content": "off",
|
"unicorn/string-content": "off",
|
||||||
"unicorn/better-regex": "off"
|
"unicorn/better-regex": "off",
|
||||||
|
"unicorn/prefer-number-properties": "off"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import test from 'ava';
|
const test = require('ava');
|
||||||
|
|
||||||
// Spoof supports-color
|
// Spoof supports-color
|
||||||
require('./_supports-color')(__dirname);
|
require('./_supports-color')(__dirname);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import test from 'ava';
|
const test = require('ava');
|
||||||
|
|
||||||
const chalk = require('../source');
|
const chalk = require('../source');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import test from 'ava';
|
const test = require('ava');
|
||||||
|
|
||||||
// Spoof supports-color
|
// Spoof supports-color
|
||||||
require('./_supports-color')(__dirname);
|
require('./_supports-color')(__dirname);
|
||||||
|
|
@ -17,10 +17,10 @@ test('the `level` option should be a number from 0 to 3', t => {
|
||||||
/* eslint-disable no-new */
|
/* eslint-disable no-new */
|
||||||
t.throws(() => {
|
t.throws(() => {
|
||||||
new chalk.Instance({level: 10});
|
new chalk.Instance({level: 10});
|
||||||
}, /should be an integer from 0 to 3/);
|
}, {message: /should be an integer from 0 to 3/});
|
||||||
|
|
||||||
t.throws(() => {
|
t.throws(() => {
|
||||||
new chalk.Instance({level: -1});
|
new chalk.Instance({level: -1});
|
||||||
}, /should be an integer from 0 to 3/);
|
}, {message: /should be an integer from 0 to 3/});
|
||||||
/* eslint-enable no-new */
|
/* eslint-enable no-new */
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import path from 'path';
|
const path = require('path');
|
||||||
import test from 'ava';
|
const test = require('ava');
|
||||||
import execa from 'execa';
|
const execa = require('execa');
|
||||||
|
|
||||||
// Spoof supports-color
|
// Spoof supports-color
|
||||||
require('./_supports-color')(__dirname);
|
require('./_supports-color')(__dirname);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import test from 'ava';
|
const test = require('ava');
|
||||||
|
|
||||||
// Spoof supports-color
|
// Spoof supports-color
|
||||||
require('./_supports-color')(__dirname, {
|
require('./_supports-color')(__dirname, {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/* eslint-disable unicorn/no-hex-escape */
|
/* eslint-disable unicorn/no-hex-escape */
|
||||||
import test from 'ava';
|
const test = require('ava');
|
||||||
|
|
||||||
// Spoof supports-color
|
// Spoof supports-color
|
||||||
require('./_supports-color')(__dirname);
|
require('./_supports-color')(__dirname);
|
||||||
|
|
@ -179,7 +179,7 @@ test('throws if an extra unescaped } is found', t => {
|
||||||
|
|
||||||
test('should not parse upper-case escapes', t => {
|
test('should not parse upper-case escapes', t => {
|
||||||
const instance = new chalk.Instance({level: 0});
|
const instance = new chalk.Instance({level: 0});
|
||||||
t.is(instance`\N\n\T\t\X07\x07\U000A\u000A\U000a\u000a`, 'N\nT\tX07\x07U000A\u000AU000a\u000A');
|
t.is(instance`\N\n\T\t\X07\x07\U000A\u000A\U000a\u000A`, 'N\nT\tX07\x07U000A\u000AU000a\u000A');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should properly handle undefined template interpolated values', t => {
|
test('should properly handle undefined template interpolated values', t => {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import test from 'ava';
|
const test = require('ava');
|
||||||
|
|
||||||
// Spoof supports-color
|
// Spoof supports-color
|
||||||
require('./_supports-color')(__dirname);
|
require('./_supports-color')(__dirname);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue