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'] }]
]
});
/*
|--------------------------------------------------------------------------
| COMMANDS
|--------------------------------------------------------------------------
|
| Ace commands tests are written in this file.
|
*/
/* global describe, it, after, before */
const chai = require('chai')
const expect = chai.expect
const fold = require('adonis-fold')
const Ioc = fold.Ioc
const stdout = require('test-console').stdout
const setup = require('./setup')
require('co-mocha')
describe('Commands', function () {
before(function * () {
yield setup.loadProviders()
setup.registerCommands()
const LucidMongo = Ioc.use('Adonis/Src/LucidMongo')
class User extends LucidMongo {}
Ioc.bind('App/Model/User', function () {
return User
})
this.database = Ioc.use('Adonis/Src/Database')
})
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
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({}, () => {});
'use strict'
/* -----------------------------------------------------------------------------
* dependencies
* -------------------------------------------------------------------------- */
// core
const spawn = require('child_process').spawn
const path = require('path')
const net = require('net')
// 3rd party
const _ = require('lodash/fp')
const assert = require('chai').assert
const stdout = require('test-console').stdout
const stderr = require('test-console').stderr
// lib
const inspect = require('../lib/index')
/* -----------------------------------------------------------------------------
* reusable
* -------------------------------------------------------------------------- */
const executablePath = path.resolve(__dirname, '..', 'bin', 'inspect.js')
const fixturesPath = path.resolve(__dirname, 'fixtures')
const successPath = path.resolve(fixturesPath, 'success')
const errorPath = path.resolve(fixturesPath, 'error')
const exceptionPath = path.resolve(fixturesPath, 'exception')
/* -----------------------------------------------------------------------------
// $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({}, () => {});
// $ExpectType Inspector
stderr.inspect();
// $ExpectType Inspector
stderr.inspect({isTTY: true});
// $ExpectError
stderr.inspectSync();
// $ExpectError
stderr.inspectSync({});
// $ExpectType ReadonlyArray || Output
stderr.inspectSync({isTTY: false}, (output) => output);
// $ExpectType Restore
stderr.ignore();
// $ExpectType Restore
stderr.ignore({isTTY: false});
// $ExpectError
// $ExpectError
stdout.ignoreSync();
// $ExpectType void
stdout.ignoreSync(() => {});
// $ExpectError
stdout.ignoreSync({}, (output) => output);
// $ExpectType void
stdout.ignoreSync({}, () => {});
// $ExpectType Inspector
stderr.inspect();
// $ExpectType Inspector
stderr.inspect({isTTY: true});
// $ExpectError
stderr.inspectSync();
// $ExpectError
stderr.inspectSync({});
// $ExpectType ReadonlyArray || Output
stderr.inspectSync({isTTY: false}, (output) => output);
// $ExpectType Restore
stderr.ignore();
// $ExpectType Restore
stderr.ignore({isTTY: false});
// $ExpectError
stderr.ignoreSync();
// $ExpectType void
stderr.ignoreSync(() => {});
// $ExpectError
stderr.ignoreSync({}, (output) => output);
before(function startServer() {
// The server itself is not externally accessible;
// this function just returns a plain object containing
// `start()` and `stop()` controls.
let suppressOutput = stdout.ignore()
serverController = metalsmithExpressServer({'document_root': '.'})
serverController.start( suppressOutput )
})
after(function stopServer() {
// $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({}, () => {});
// $ExpectType Inspector
stderr.inspect();
// $ExpectType Inspector
stderr.inspect({isTTY: true});
// $ExpectError