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

baddsert

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

baddsert - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

2

package.json
{
"name": "baddsert",
"version": "0.1.1",
"version": "0.1.2",
"description": "Baseline Acceptance Driven Development for JavaScript",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -9,4 +9,41 @@ # baddsert

`// TODO: Real docs`
### Use
Further reading: https://medium.com/@tinganho/baseline-acceptance-driven-development-f39f7010a04#.d1fdg36x0
baddsert replaces your old assert library. Write your tests as usual, using baddsert as the assert. Step one is to init the whole shebang:
```typescript
import {baddsert} from 'baddsert';
let docTests = baddsert('docTests');
```
You'll need to init once per file. Try and make it descriptive of that particular test battery.
Now that everything's all init-ifyed, let's use baddsert:
```typescript
it('runs a superfluous demo test', () => {
let result = hammertime(`can't touch this`);
docTests('I am a steg-o-sarus', result);
});
```
The first param describes this particular assertion - what are you testing?
The second is the thing you want asserted.
And now, the magic happens. When you run your tests, baddsert will take the result from the first test and save it under the `badd-baseline` directory (in this case, as the file `docTests`). Future runs will throw if the value passed in is not `deepStrictEqual` to the original one.
When you inevitably change something that makes the tests fail (because your function is correctly returning a new value) run `baddsert` in the same dir as your `badd-baseline` directory. This will run through all of your asserts, letting you replace the old data with the data that was passed in during the failing test.
```
--- Checking docTests ---
I am a steg-o-sarus: AGH THEY DON'T MATCH DOOOOOOOM
Stored result: result
Latest: NEW SWEET DATAS
Should I replace this? [y/n] :
```
Easy as pie.
Further reading: https://medium.com/@tinganho/baseline-acceptance-driven-development-f39f7010a04#.d1fdg36x0

Sorry, the diff of this file is not supported yet

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