Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

acquit-ignore

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

acquit-ignore

Acquit plugin for removing lines of code from output

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

acquit-ignore

Acquit plugin for removing lines of code from output

Build Status Coverage Status

acquit-ignore

It removes code between delimiters

By default, acquit-ignore will attach a transform to acquit that removes any code in a block that's between '// acquit:ignore:start' and '// acquit:ignore:end'.

    
    var acquit = require('acquit');
    require('acquit-ignore')();

    var contents = [
      'describe(\'test\', function() {',
      '  it(\'works\', function(done) {',
      '    var x = 1;',
      '    // acquit:ignore:start',
      '    assert.equal(x, 1);',
      '    // acquit:ignore:end',
      '',
      '    setTimeout(function() {',
      '      assert.equal(x, 2);',
      '      // acquit:ignore:start',
      '      done();',
      '      // acquit:ignore:end',
      '    }, 0);',
      '    ++x;',
      '  });',
      '});'
    ].join('\n');

    var blocks = acquit.parse(contents);
    assert.equal(blocks.length, 1);
    assert.equal(blocks[0].blocks[0].contents, 'works');

    var expectedCode = [
      '',
      '    var x = 1;',
      '',
      '    setTimeout(function() {',
      '      assert.equal(x, 2);',
      '    }, 0);',
      '    ++x;',
      '  '
    ].join('\n');

    assert.equal(blocks[0].blocks[0].code, expectedCode);
  
It supports custom delimiters

Don't like 'acquit:ignore:start' and 'acquit:ignore:end'? Set your own by setting the 'start' and 'end' options.

    
    var acquit = require('acquit');
    require('acquit-ignore')({
      start: '// bacon',
      end: '// eggs'
    });

    var contents = [
      'describe(\'test\', function() {',
      '  it(\'works\', function(done) {',
      '    var x = 1;',
      '    // acquit:ignore:start',
      '    assert.equal(x, 1);',
      '    // acquit:ignore:end',
      '',
      '    setTimeout(function() {',
      '      assert.equal(x, 2);',
      '      // bacon',
      '      done();',
      '      // eggs',
      '    }, 0);',
      '    ++x;',
      '  });',
      '});'
    ].join('\n');

    var blocks = acquit.parse(contents);
    assert.equal(blocks.length, 1);
    assert.equal(blocks[0].blocks[0].contents, 'works');

    var expectedCode = [
      '',
      '    var x = 1;',
      '    // acquit:ignore:start',
      '    assert.equal(x, 1);',
      '    // acquit:ignore:end',
      '',
      '    setTimeout(function() {',
      '      assert.equal(x, 2);',
      '    }, 0);',
      '    ++x;',
      '  '
    ].join('\n');

    assert.equal(blocks[0].blocks[0].code, expectedCode);
  
It can accept an acquit instance

By default, acquit-ignore attaches itself to the acquit singleton. However, you can also attach it to an acquit instance.

    
    var instance = require('acquit')();
    require('acquit-ignore')(instance, {
      start: '// bacon',
      end: '// eggs'
    });

    var contents = [
      'describe(\'test\', function() {',
      '  it(\'works\', function(done) {',
      '    var x = 1;',
      '    // bacon',
      '    assert.equal(x, 1);',
      '    // eggs',
      '',
      '    setTimeout(function() {',
      '      assert.equal(x, 2);',
      '      // bacon',
      '      done();',
      '      // eggs',
      '    }, 0);',
      '    ++x;',
      '  });',
      '});'
    ].join('\n');

    var blocks = instance.parse(contents);
    assert.equal(blocks.length, 1);
    assert.equal(blocks[0].blocks[0].contents, 'works');

    var expectedCode = [
      '',
      '    var x = 1;',
      '',
      '    setTimeout(function() {',
      '      assert.equal(x, 2);',
      '    }, 0);',
      '    ++x;',
      '  '
    ].join('\n');

    assert.equal(blocks[0].blocks[0].code, expectedCode);
  

FAQs

Package last updated on 04 Sep 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc