0.15.2 • Published 4 months ago

best-behavior v0.15.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

best-behavior

Best-Behavior is a domain-specific language and command line tool for writing executable documentation and validating that your software conforms to it. It utilizes Vite and Playwright to allow you to write tests that exercise your Javascript code in Node or a real web browser with no config necessary.

Getting Started

Best-Behavior works best with Typescript.

Best-Behavior uses Vite and Playwright. These are all peer dependencies of best-behavior; install them explicitly to control their versions.

In addition, best-behavior requires a matcher library. We recommend installing great-expectations for this purpose.

$ npm install --save-dev best-behavior great-expectations vite playwright

Writing a Behavior

Let's write a simple behavior.

import { behavior, example, effect } from "best-behavior"
import { expect, is, stringContaining } from "great-expectations"

export default behavior("My first behavior", [

  example()
    .description("My first example")
    .script({
      observe: [
        effect("it works", () => {
          expect("funny", is(stringContaining("fun")))
        })
      ]
    })

])

Each of your test files should be structured like the example here, with a default export of a Behavior.

Validating the Behavior

To validate this behavior, use the best cli and provide a glob that matches the file. So suppose you save the file as ./behaviors/fun.behavior.ts, you could run the file, like so:

$ best --behaviors './behaviors/**/*.behavior.ts'

Learn More!

Check out the documentation..

0.15.2

4 months ago

0.15.1

5 months ago

0.15.0

5 months ago

0.13.0

6 months ago

0.14.0

6 months ago

0.12.0

8 months ago

0.12.1

8 months ago

0.11.0

8 months ago

0.11.1

8 months ago

0.10.0

8 months ago

0.9.0

10 months ago

0.8.1

10 months ago

0.8.0

10 months ago

0.7.2

11 months ago

0.7.1

11 months ago

0.7.3

11 months ago

0.7.0

11 months ago

0.6.4

1 year ago

0.6.3

1 year ago

0.6.2

2 years ago

0.6.1

2 years ago

0.5.0

2 years ago

0.4.1

2 years ago

0.6.0

2 years ago

0.4.2

2 years ago

0.4.0

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago