chalk/test/constructor.js

15 lines
389 B
JavaScript
Raw Normal View History

2017-07-23 22:17:33 +02:00
import test from 'ava';
2021-04-16 15:23:29 +07:00
import chalk from '../source/index.js';
2017-07-23 22:17:33 +02:00
test('Chalk.constructor should throw an expected error', t => {
const expectedError = t.throws(() => {
chalk.constructor();
});
2017-07-23 22:17:33 +02:00
t.is(expectedError.message, '`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.');
2018-09-18 15:33:20 +07:00
t.throws(() => {
new chalk.constructor(); // eslint-disable-line no-new
});
2018-09-18 15:33:20 +07:00
});