Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should warn about colliding babel-plugin-lodash usage', function() {
// test with full plugin name
var output1 = stdout.inspectSync(function() {
babel.transformSync('import all from "semantic-ui-react";', {
plugins: [
path.resolve(__dirname, '../index.js'),
['babel-plugin-lodash', { 'id': ['semantic-ui-react'] }]
]
});
});
// test with short plugin name
var output2 = stdout.inspectSync(function() {
babel.transformSync('import all from "semantic-ui-react";', {
plugins: [
path.resolve(__dirname, '../index.js'),
['lodash', { 'id': ['semantic-ui-react'] }]
]
});
});
var isOutputOk = function(output) {
return (
output.length > 0 &&
output[0].indexOf('[babel-plugin-transform-semantic-ui-react-imports]') > -1 &&
output[0].indexOf('WARNING') > -1 &&
output[0].indexOf('You are converting semantic-ui-react imports with this plugin and with ' +
'babel-plugin-lodash.') > -1
);
it('should warn about colliding babel-plugin-lodash usage', function() {
// test with full plugin name
var output1 = stdout.inspectSync(function() {
babel.transformSync('import all from "semantic-ui-react";', {
plugins: [
path.resolve(__dirname, '../index.js'),
['babel-plugin-lodash', { 'id': ['semantic-ui-react'] }]
]
});
});
// test with short plugin name
var output2 = stdout.inspectSync(function() {
babel.transformSync('import all from "semantic-ui-react";', {
plugins: [
path.resolve(__dirname, '../index.js'),
['lodash', { 'id': ['semantic-ui-react'] }]
]
});
import { stdout, stderr } from 'test-console';
// $ExpectType Inspector
stdout.inspect();
// $ExpectType Inspector
stdout.inspect({isTTY: true});
// $ExpectError
stdout.inspectSync();
// $ExpectError
stdout.inspectSync({});
// $ExpectType ReadonlyArray || Output
stdout.inspectSync({isTTY: false}, (output) => output);
// $ExpectType Restore
stdout.ignore();
// $ExpectType Restore
stdout.ignore({isTTY: false});
// $ExpectError
stdout.ignoreSync();
// $ExpectType void
stdout.ignoreSync(() => {});
// $ExpectError
stdout.ignoreSync({}, (output) => output);
// $ExpectType void
stdout.ignoreSync({}, () => {});
it('should output the input and the evaluated object reference', function() {
window.testString = 'value';
stdout.inspectSync((output) => {
this.console.exec('window.testString');
assert.deepStrictEqual(output, [
'window.testString\n',
`${window.testString}\n`
]);
});
});
it('should not assign variables', function() {
function testLogSync(...args) {
const output = stdout.inspectSync(function() {
metalsmithExpressLog(...args)
})
return output.pop()
}