# tehanu-tenbo

> Runs test suites written with tehanu in a browser.

Latest version **0.2.1** (published 2024-05-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install tehanu-tenbo
pnpm add tehanu-tenbo
yarn add tehanu-tenbo
bun add tehanu-tenbo
```

Provides the command `tenbo`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2024-05-26 |
| First published | 2022-05-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=14.13 |
| Dependencies | 4 |
| Unpacked size | 11.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Ferdinand Prantl |
| Maintainers | prantlf |
| Keywords | testing, unit-testing, test-runner |

## Links

- npm: https://www.npmjs.com/package/tehanu-tenbo
- Repository: https://github.com/prantlf/tehanu
- Homepage: https://github.com/prantlf/tehanu/tree/master/packages/tenbo#readme
- Issues: https://github.com/prantlf/tehanu/issues
- npm.io page: https://npm.io/package/tehanu-tenbo

## Dependencies (4)

- [sirv](https://npm.io/package/sirv.md) ^2.0.4
- [polka](https://npm.io/package/polka.md) ^0.5.2
- [colorette](https://npm.io/package/colorette.md) ^2.0.20
- [tiny-glob](https://npm.io/package/tiny-glob.md) ^0.2.9

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads

## Recent versions

- 0.2.1 (latest) — 2024-05-26
- 0.2.0 — 2024-05-26
- 0.1.0 — 2022-06-05
- 0.0.1 — 2022-05-22

## README

# Test in Browser

[![NPM version](https://badge.fury.io/js/tehanu-tenbo.png)](http://badge.fury.io/js/tehanu-tenbo)

Runs test suites written with [tehanu] in a browser. Experimental.

## Synopsis

sum1.test.js:

```js
import test from './node_modules/tehanu/dist/suite.min.mjs?name=sum1'
import './node_modules/tehanu-repo-tape/dist/index.min.mjs'
import { equal } from './node_modules/tehanu-teas/dist/index.min.mjs'
import sum from './sum.js'

test('one number', () => equal(sum(1), 1))
```

sum2.test.js:

```js
import test from './node_modules/tehanu/dist/suite.min.mjs?name=sum2'
import './node_modules/tehanu-repo-tape/dist/index.min.mjs'
import { equal } from './node_modules/tehanu-teas/dist/index.min.mjs'
import sum from './sum.js'

test('two numbers', () => equal(sum(1, 2), 3))
```

Running `tenbo *.test.js` or `tenbo sum1.test.js sum2.test.js` allows executing some or all test suites.

## Installation

You can install the test runner using your favourite Node.js package manager. Make sure that you include `puppeteer` or `puppeteer-core`:

```
npm i -D tehanu-tenbo puppeteer
yarn add -D tehanu-tenbo puppeteer
pnpm i -D tehanu-tenbo puppeteer
```

## Usage

Run tests written with Tehanu:

    tenbo [option ...] [pattern ...]

### Options

    -o|--port <number>      port for the web server to listen to (default: 8012)
    -l|--launcher <module>  puppeteer module name (default: puppeteer)
    -e|--executable <path>  override path to the Chromium executable
    -t|--timeout <ms>       fail if no log or request occurs (default: 1000)
    -c|--cache <s>          enable browser cache (default: 5)
    -a|--[no-]headless      enable headless mode (default: true)
    -d|--[no-]disconnect    just disconnect from the browser at the end
    -v|--[no-]verbose       print more diagnostics on the console
    -V|--version            print version number and exit
    -h|--help               print usage instructions and exit

If no pattern is provided, `./**/*.js` will be used by default.

### Examples

    tenbo -l puppeteer-core
    tenbo -A -d test/*.js

## Alternative

The alternative to running tests in scripts, the tests can can be passed to the tool as one or more HTML pages.

    tenbo tests.html

tests.html:

```html
<html>
  <script type="module">
    import test from './node_modules/tehanu/dist/suite.min.mjs?name=sum1'
    import './node_modules/tehanu-repo-tape/dist/index.min.mjs'
    import { equal } from './node_modules/tehanu-teas/dist/index.min.mjs'
    import sum from './sum.js'

    test('one number', () => equal(sum(1), 1))
    test('two numbers', () => equal(sum(1, 2), 3))
  </script>
</html>
```

[tehanu]: https://www.npmjs.com/package/tehanu

---
_Source: https://npm.io/package/tehanu-tenbo · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
