spoof supports-color
This commit is contained in:
parent
18f2e7c122
commit
608242a4fc
1 changed files with 11 additions and 1 deletions
12
test.js
12
test.js
|
|
@ -2,11 +2,21 @@
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const importFresh = require('import-fresh');
|
const importFresh = require('import-fresh');
|
||||||
const resolveFrom = require('resolve-from');
|
const resolveFrom = require('resolve-from');
|
||||||
|
|
||||||
|
// Spoof supports-color
|
||||||
|
require.cache[resolveFrom(__dirname, 'supports-color')] = {
|
||||||
|
exports: {
|
||||||
|
level: 3,
|
||||||
|
hasBasic: true,
|
||||||
|
has256: true,
|
||||||
|
has16m: true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const chalk = require('.');
|
const chalk = require('.');
|
||||||
|
|
||||||
console.log('host TERM=', process.env.TERM || '[none]');
|
console.log('host TERM=', process.env.TERM || '[none]');
|
||||||
console.log('host platform=', process.platform || '[unknown]');
|
console.log('host platform=', process.platform || '[unknown]');
|
||||||
console.log('host support=', chalk.supportsColor);
|
|
||||||
|
|
||||||
describe('chalk', () => {
|
describe('chalk', () => {
|
||||||
it('should style string', () => {
|
it('should style string', () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue