How to use the test-console.stdout.inspectSync function in test-console

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 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 cerner / f-twelve / test / unit / views / content / console / console.js View on Github external
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() {
github chiefy / metalsmith-express / test / test_log.js View on Github external
function testLogSync(...args) {
  const output = stdout.inspectSync(function() {
    metalsmithExpressLog(...args)
  })
  return output.pop()
}