An open API service indexing awesome lists of open source software.

https://github.com/arlac77/browser-ava

run ava test in the browser
https://github.com/arlac77/browser-ava

ava

Last synced: 23 days ago
JSON representation

run ava test in the browser

Awesome Lists containing this project

README

          

[![npm](https://img.shields.io/npm/v/browser-ava.svg)](https://www.npmjs.com/package/browser-ava)
[![License](https://img.shields.io/badge/License-0BSD-blue.svg)](https://spdx.org/licenses/0BSD.html)
[![bundlejs](https://deno.bundlejs.com/?q=browser-ava\&badge=detailed)](https://bundlejs.com/?q=browser-ava)
[![downloads](http://img.shields.io/npm/dm/browser-ava.svg?style=flat-square)](https://npmjs.org/package/browser-ava)
[![GitHub Issues](https://img.shields.io/github/issues/arlac77/browser-ava.svg?style=flat-square)](https://github.com/arlac77/browser-ava/issues)
[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Farlac77%2Fbrowser-ava%2Fbadge\&style=flat)](https://actions-badge.atrox.dev/arlac77/browser-ava/goto)
[![Styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
[![Known Vulnerabilities](https://snyk.io/test/github/arlac77/browser-ava/badge.svg)](https://snyk.io/test/github/arlac77/browser-ava)

# browser-ava

Run ava tests in the browser

## What it does

If your code does not depend on any node api (process, fs, ...) then this runner allows to run your ava test inside the browser.

### Running your tests

```console
browser-ava --webkit --chromium --firefox tests/*.mjs
```

![Scrrenshot](docs/screenshot.png)

## limitations

* only supports ESM

# API

### Table of Contents

* [pluralize](#pluralize)
* [Parameters](#parameters)
* [utf8EncodingOptions](#utf8encodingoptions)
* [importsConditionOrder](#importsconditionorder)
* [exportsConditionOrder](#exportsconditionorder)
* [resolveExports](#resolveexports)
* [Parameters](#parameters-1)
* [resolveImport](#resolveimport)
* [Parameters](#parameters-2)

## pluralize

Pluralize subjects

### Parameters

* `word` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** subject to be pluralized
* `number` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** if > 1 pluralize otherwize keep subject alone

Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** pluralized subject if number > 1

## utf8EncodingOptions

Type: BufferEncoding

## importsConditionOrder

* **See**: {

Order in which imports are searched

## exportsConditionOrder

* **See**: {

Order in which exports are searched

## resolveExports

Find module inside a package.

### Parameters

* `parts` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>**
* `pkg` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** decoded package.json content

Returns **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))** module file name relative to package

## resolveImport

Maps import url from node to browser view.

### Parameters

* `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** module to resolve
* `base` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** where to start resolving

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))>** resolved import url