<commit_before># `gpii.testem`

This library provides a [Fluid component](http://docs.fluidproject.org/infusion/development/UnderstandingInfusionComponents.html)
and static functions that assist in using [Testem](https://github.com/testem/testem).

# Key Features

1. Provides a mechanism to collect client-side code coverage data and combine that with browser coverage.
2. Provides the ability to launch and wait for server-side components to start up before each test run.
3. Provides the ability to safely shut down server-side test fixtures after each test run.
4. Provides cleanup mechanisms to remove temporary browser content after each test run.

# Requirements

In order to use the code coverage features of this grade, you'll need to have
[Istanbul](https://github.com/gotwarlost/istanbul) installed and available in your path.

# Usage instructions

To use this grade from Testem, install this package as a development dependency using a command like
`npm install --save-dev gpii-testem` or `yarn add --dev gpii-testem`.

Once you've done that, you will need to create a javascript configuration file, which will allow you to make use of the
[dynamic configuration options available via the `testem.js` file](https://github.com/testem/testem/blob/master/examples/dynamic_config/testem.js).

The most basic example of a file might look something like:

```
var fluid = require("infusion");
fluid.require("%gpii-testem");

var my  = fluid.registerNamespace("my");
fluid.defaults("my.testem.grade", {
    gradeNames: ["gpii.testem"],
    testPages:  ["tests/my-awesome-test.html"]
});

module.exports = my.testem.grade().getTestemOptions();
```

To make use of the code coverage support provided by gpii.testem, you must load the "coverage sender" in your HTML
fixtures, for example, using the markup below:

```
<script type="text/javascript" src="/coverage/client/coverageSender.js"></script>
```

The "coverage sender" needs to be loaded after Testem, but before your tests.  See [the coverage docs](docs/coverage.md)
for details.   Like Infusion itself, the "coverage sender" requires jQuery.

Once you have created your configuration javascript file, you can launch Testem with your configuration using a command
like the following:

`testem --file path/to/your-testem-config.js`

If you save your configuration to the file name `testem.js` in your package root, you can launch testem using a command
like `testem` or `testem ci`.

# More Information

For more information, check out the documentation links below:

* [The `gpii.testem` Component](docs/testem-component.md)
* [The Testem Lifecycle](docs/testem-lifecycle.md)
* [Code Coverage](docs/coverage.md)

# Running the Tests in this Package

You can run the tests using a command like `npm test` or `yarn test`.  You are not required to have Testem installed
globally to run the tests.<commit_msg>GPII-2296: Updated docs to prefer “local” copies of Testem and to point out the bug with versions of Testem higher than 1.13.0<commit_after># `gpii.testem`

This library provides a [Fluid component](http://docs.fluidproject.org/infusion/development/UnderstandingInfusionComponents.html)
and static functions that assist in using [Testem](https://github.com/testem/testem).

# Key Features

1. Provides a mechanism to collect client-side code coverage data and combine that with browser coverage.
2. Provides the ability to launch and wait for server-side components to start up before each test run.
3. Provides the ability to safely shut down server-side test fixtures after each test run.
4. Provides cleanup mechanisms to remove temporary browser content after each test run.

# Requirements

In order to use the code coverage features of this grade, you'll need to have
[Istanbul](https://github.com/gotwarlost/istanbul) installed and available in your path.

# Usage instructions

To use this grade from Testem, install this package as a development dependency using a command like
`npm install --save-dev gpii-testem` or `yarn add --dev gpii-testem`.  Note:  There is currently
[a bug in newer versions of Testem](https://github.com/testem/testem/issues/1075), if you use anything higher than
version 1.13.0, you may experience hangs when attempting to quit testem from the console.

Once you have Testem installed, you will need to create a javascript configuration file, which will allow you to make use of the
[dynamic configuration options available via the `testem.js` file](https://github.com/testem/testem/blob/master/examples/dynamic_config/testem.js).

The most basic example of a file might look something like:

```
var fluid = require("infusion");
fluid.require("%gpii-testem");

var my  = fluid.registerNamespace("my");
fluid.defaults("my.testem.grade", {
    gradeNames: ["gpii.testem"],
    testPages:  ["tests/my-awesome-test.html"]
});

module.exports = my.testem.grade().getTestemOptions();
```

To make use of the code coverage support provided by gpii.testem, you must load the "coverage sender" in your HTML
fixtures, for example, using the markup below:

```
<script type="text/javascript" src="/coverage/client/coverageSender.js"></script>
```

The "coverage sender" needs to be loaded after Testem, but before your tests.  See [the coverage docs](docs/coverage.md)
for details.   Like Infusion itself, the "coverage sender" requires jQuery.

Once you have created your configuration javascript file, you can launch Testem with your configuration using a command
like the following:

`node node_modules/testem/testem.js --file path/to/your-testem-config.js`

If you save your configuration to the file name `testem.js` in your package root, you can launch Testem using a command
like `node node_modules/testem/testem.js` or `node node_modules/testem/testem.js ci`.

# More Information

For more information, check out the documentation links below:

* [The `gpii.testem` Component](docs/testem-component.md)
* [The Testem Lifecycle](docs/testem-lifecycle.md)
* [Code Coverage](docs/coverage.md)

# Running the Tests in this Package

You can run the tests using a command like `npm test` or `yarn test`.  You are not required to have Testem installed
globally to run the tests.
{'fraction_non_alphanumeric': 0.08911211924821776, 'fraction_numerical': 0.0038885288399222295, 'mean_word_length': 4.731662024141133, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 7, 'lorem ipsum': 0, 'www.': 0, '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': '580282', 'n_tokens_mistral': 1773, 'n_tokens_neox': 1713, 'n_words': 745}