Wondering what’s next for npm?Check out our public roadmap! »

test-timebomb

1.0.0 • Public • Published

test-timebomb

💥 auto expire feature toggles in your code

example

import timebomb from 'test-timebomb';
 
// jest it up (optional - default will simply throw)
timebomb.fail = (test) => expect('💥').toEqual('feature ' + test.result.description + ' has expired')
 
// yeah thats a ms timestamp for when this test will never pass again
timebomb(1496327291228)(
  test('myFeature', () => {
    expect(feature()).toMatchSnapshot();
  })
)

output:

//output
FAIL  __tests__/feature.test.js
 ● Test suite failed to run

   expect(received).toEqual(expected)

   Expected value to equal:
     "feature myFeature has expired"
   Received:
     "💥"

default timebomb.fail simply throws:

FAIL  __tests__/feature.test.js
 ● Test suite failed to run

   💥feature expired💥

why does this exist?

There are many scenarios where code depends on time sensitive implementations. Maybe it's your Firebase or AWS account info, or some Signing Certificates. If your build breaks before any of these scenarios expire they force development to correct before an outage.

Another use case is for features that you know will be deprecated can loudly be set to be cleaned up in your codebase.

Install

npm i test-timebomb

DownloadsWeekly Downloads

2

Version

1.0.0

License

MIT

Last publish

Collaborators

  • avatar