How to use test-console - 10 common examples

To help you get started, we’ve selected a few test-console examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github skleeschulte / babel-plugin-transform-semantic-ui-react-imports / test / index.js View on Github external
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
                    );
github skleeschulte / babel-plugin-transform-semantic-ui-react-imports / test / index.js View on Github external
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'] }]
                        ]
                    });
github duyluonglc / lucid-mongo / test / acceptance / commands.spec.js View on Github external
/*
|--------------------------------------------------------------------------
| 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')
  })
github DefinitelyTyped / DefinitelyTyped / types / test-console / test-console-tests.ts View on Github external
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
github DefinitelyTyped / DefinitelyTyped / types / test-console / test-console-tests.ts View on Github external
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({}, () => {});
github jaridmargolin / inspect-process / test / index.js View on Github external
'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')

/* -----------------------------------------------------------------------------
github DefinitelyTyped / DefinitelyTyped / types / test-console / test-console-tests.ts View on Github external
// $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
github DefinitelyTyped / DefinitelyTyped / types / test-console / test-console-tests.ts View on Github external
// $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);
github chiefy / metalsmith-express / test / test_server.js View on Github external
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() {
github DefinitelyTyped / DefinitelyTyped / types / test-console / test-console-tests.ts View on Github external
// $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