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
|
|
|
|
2019-03-12 12:53:03 +00:00
|
|
|
test('Chalk.constructor should throw an expected error', t => {
|
|
|
|
|
const expectedError = t.throws(() => {
|
|
|
|
|
chalk.constructor();
|
|
|
|
|
});
|
2017-07-23 22:17:33 +02:00
|
|
|
|
2019-03-12 12:53:03 +00:00
|
|
|
t.is(expectedError.message, '`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.');
|
2018-09-18 15:33:20 +07:00
|
|
|
|
|
|
|
|
t.throws(() => {
|
2019-03-12 12:53:03 +00:00
|
|
|
new chalk.constructor(); // eslint-disable-line no-new
|
|
|
|
|
});
|
2018-09-18 15:33:20 +07:00
|
|
|
});
|