How to use record-stdstreams - 3 common examples

To help you get started, we’ve selected a few record-stdstreams 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 thenativeweb / flaschenpost / test / integration / MorganPluginTests.ts View on Github external
test('passes writes to stream on to a flaschenpost.', async (): Promise => {
      const stop = record(false);
      const morganPlugin = new MorganPlugin('info');

      morganPlugin.write('some log message');

      const { stdout } = stop();
      const lines = stripAnsi(stdout).split('\n');

      assert.that(lines[0]).is.equalTo('some log message (info)');
    });
  });
github thenativeweb / flaschenpost / test / integration / flaschenpostTests.ts View on Github external
test('logs in a human readable format up to info level.', async (): Promise => {
      const stop = record(false);
      const logger = flaschenpostInstance.getLogger();

      logger.info('Info message');
      logger.debug('Debug message');

      const { stdout } = stop();
      const lines = stripAnsi(stdout).split('\n');

      assert.that(lines).is.containing('Info message (info)');
      assert.that(lines).is.not.containing('Debug message (debug)');
    });
  });
github thenativeweb / flaschenpost / test / unit / flaschenpostTests.ts View on Github external
test('debug filtering by module.', async (): Promise => {
    const originalConfiguration = flaschenpost.getConfiguration();
    const stop = record(false);

    flaschenpost.configure(
      originalConfiguration.
        withApplication({
          name: 'some-module',
          version: 'irrelevant'
        }).
        withDebugModuleFilter([ 'not-some-module' ]).
        withHighestEnabledLogLevel('debug')
    );

    const logger = flaschenpost.getLogger();

    logger.debug('Some debug.');

    const { stdout } = stop();

record-stdstreams

record-stdstreams captures process.stdout and process.stderr.

MIT
Latest version published 2 years ago

Package Health Score

46 / 100
Full package analysis

Popular record-stdstreams functions