chalk/test/constructor.js

16 lines
386 B
JavaScript
Raw Normal View History

2017-07-23 22:17:33 +02:00
import test from 'ava';
2019-07-12 13:51:07 +07:00
const chalk = require('../source');
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
});