chalk/test/no-color-support.js

25 lines
520 B
JavaScript
Raw Normal View History

2018-09-18 04:48:47 -04:00
import test from 'ava';
2021-04-16 15:23:29 +07:00
import chalk from '../source/index.js';
2018-09-18 04:48:47 -04:00
2021-04-16 15:23:29 +07:00
// TODO: Do this when ESM supports loader hooks
2018-09-18 04:48:47 -04:00
// Spoof supports-color
2021-04-16 15:23:29 +07:00
// require('./_supports-color')(__dirname, {
// stdout: {
// level: 0,
// hasBasic: false,
// has256: false,
// has16m: false
// },
// stderr: {
// level: 0,
// hasBasic: false,
// has256: false,
// has16m: false
// }
// });
2018-09-18 04:48:47 -04:00
test('colors can be forced by using chalk.level', t => {
chalk.level = 1;
2018-09-18 04:48:47 -04:00
t.is(chalk.green('hello'), '\u001B[32mhello\u001B[39m');
});