semantic-release/test/get-logger.test.js
Matt Travi 9eab1adb9d
feat(esm): convert to esm (#2569)
for #2543

BREAKING CHANGE: semantic-release is now ESM-only. since it is used through its own executable, the impact on consuming projects should be minimal

BREAKING CHANGE: references to plugin files in configs need to include the file extension because of executing in an ESM context
2022-11-11 09:24:06 -06:00

18 lines
523 B
JavaScript

import test from 'ava';
import {spy} from 'sinon';
import getLogger from '../lib/get-logger.js';
test('Expose "error", "success" and "log" functions', (t) => {
const stdout = spy();
const stderr = spy();
const logger = getLogger({stdout: {write: stdout}, stderr: {write: stderr}});
logger.log('test log');
logger.success('test success');
logger.error('test error');
t.regex(stdout.args[0][0], /.*test log/);
t.regex(stdout.args[1][0], /.*test success/);
t.regex(stderr.args[0][0], /.*test error/);
});