<commit_before># dotest

One dev dependency for your [Node.js](https://nodejs.org) package to run ESLint,
your test.js, coverage and report to Coveralls.io when running on Travis CI.

[![npm](https://img.shields.io/npm/v/dotest.svg?maxAge=3600)](https://www.npmjs.com/package/dotest?activeTab=versions)
[![Build Status](https://github.com/fvdm/nodejs-dotest/actions/workflows/node.js.yml/badge.svg?branch=master)](https://github.com/fvdm/nodejs-dotest/actions/workflows/node.js.yml)
[![Coverage Status](https://coveralls.io/repos/github/fvdm/nodejs-dotest/badge.svg?branch=master)](https://coveralls.io/github/fvdm/nodejs-dotest?branch=master)

* It runs ESLint with your package's `.eslintrc` config
* Finally it runs your `test.js` with `nyc` for coverage
* When it detects Travis CI it will also submit the coverage report to [Coveralls.io](https://coveralls.io)
* In case it runs in a Github action the warning, fail and error lines are highlighted.

- [Changelog](https://github.com/fvdm/nodejs-dotest/blob/master/CHANGELOG.md)


## Example

**test.js**

```js
// Load test runner and your app
const doTest = require ('dotest');
const app = require ('./');

// Check app interface
doTest.add ('App interface', test => {
  test()
    .isFunction ('fail', 'methodOne', app.methodOne)
    .isObject ('fail', 'sub', app.sub)
    .isFunction ('fail', 'sub.methodTwo', app.sub.methodTwo)
    .done()
  ;
});

// Check method response
doTest.add ('App methodOne', test => {
  app.methodOne ((err, data) => {
    test (err)
      .isObject ('fail', 'Callback data', data)
      .isArray ('fail', 'data.music', data.music)
      .isNotEmpty ('warn', 'data.music', data.music)
      .done()
    ;
  });
});

// Check promise
doTest.add ('Promise good', async test => {
  let error;
  let data;

  try {
    data = await myPromise();
  }
  catch (err) {
    error = err;
  }

  test (error)
    .isObject ('fail', 'data', data);
    .done()
  ;
});

// Run the tests
doTest.run ();
```

**package.json**

Full test including ESLint, test.js, coverage report and Coveralls.io submit.

```json
"scripts": {
  "test": "dotest"
}
```

Or just run your `test.js`

```json
"scripts": {
  "test": "node test.js"
}
```


Just run `npm test`


## Installation

This is usually intended for CI builds, so best to make sure it's in your dev dependencies ;)

`npm i dotest --save-dev`


## Configuration

The script takes these env variables. They override the code settings.
<commit_msg>Docs: Minor tweaks<commit_after># dotest

One dev dependency for your [Node.js](https://nodejs.org) package to run ESLint,
your test.js, coverage and report to Coveralls.io when running on Travis CI.

[![npm](https://img.shields.io/npm/v/dotest.svg?maxAge=3600)](https://www.npmjs.com/package/dotest?activeTab=versions)
[![Build Status](https://github.com/fvdm/nodejs-dotest/actions/workflows/node.js.yml/badge.svg?branch=master)](https://github.com/fvdm/nodejs-dotest/actions/workflows/node.js.yml)
[![Coverage Status](https://coveralls.io/repos/github/fvdm/nodejs-dotest/badge.svg?branch=master)](https://coveralls.io/github/fvdm/nodejs-dotest?branch=master)

* It runs ESLint with your package's `.eslintrc` config
* Finally it runs your `test.js` with `nyc` for coverage
* When it detects Travis CI it will also submit the coverage report to [Coveralls.io](https://coveralls.io)
* In case it runs in a Github action the warning, fail and error lines are highlighted.

- [Changelog](https://github.com/fvdm/nodejs-dotest/blob/master/CHANGELOG.md)


## Example

**test.js**

```js
// Load test runner and your app
const doTest = require ('dotest');
const app = require ('./');

// Check app interface
doTest.add ('App interface', test => {
  test()
    .isFunction ('fail', 'methodOne', app.methodOne)
    .isObject ('fail', 'sub', app.sub)
    .isFunction ('fail', 'sub.methodTwo', app.sub.methodTwo)
    .done()
  ;
});

// Check method response
doTest.add ('App methodOne', test => {
  app.methodOne ((err, data) => {
    test (err)
      .isObject ('fail', 'Callback data', data)
      .isArray ('fail', 'data.music', data.music)
      .isNotEmpty ('warn', 'data.music', data.music)
      .done()
    ;
  });
});

// Check promise
doTest.add ('Promise good', async test => {
  let error;
  let data;

  try {
    data = await myPromise();
  }
  catch (err) {
    error = err;
  }

  test (error)
    .isObject ('fail', 'data', data);
    .done()
  ;
});

// Run the tests
doTest.run ();
```

**package.json**

Full test including ESLint, test.js, coverage report and Coveralls.io submit.

```json
"scripts": {
  "test": "dotest"
}
```

Or just run your `test.js`

```json
"scripts": {
  "test": "node test.js"
}
```


Just run `npm test`


## Installation

This is usually intended for CI builds,
so best to make sure it's in your `devDependencies`

```sh
npm i dotest --save-dev
```


## Configuration

The script takes these env variables. They override the code settings.

{'fraction_non_alphanumeric': 0.16622904463744698, 'fraction_numerical': 0.0016158351848111492, 'mean_word_length': 3.684957426679281, 'pattern_counts': {'":': 8, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 18, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '153906', 'n_tokens_mistral': 1771, 'n_tokens_neox': 1678, 'n_words': 468}