# testit-js-commons

> JavaScript commons for Test IT

Latest version **5.0.8** (published 2026-09-30) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install testit-js-commons
pnpm add testit-js-commons
yarn add testit-js-commons
bun add testit-js-commons
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

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

## Facts

| | |
|---|---|
| Version | 5.0.8 |
| Published | 2026-09-30 |
| First published | 2023-08-11 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Integration team |
| Maintainers | testit |

## Links

- npm: https://www.npmjs.com/package/testit-js-commons
- Repository: https://github.com/testit-tms/adapters-js
- Homepage: https://github.com/testit-tms/adapters-js#readme
- Issues: https://github.com/testit-tms/adapters-js/issues
- npm.io page: https://npm.io/package/testit-js-commons

## Recent versions

- 5.0.8 (latest) — 2026-09-30
- 5.0.6-TMS-5.8 — 2026-09-23
- 5.0.5-TMS-5.8 — 2026-09-16
- 5.0.7 — 2026-09-16
- 5.0.6 — 2026-08-31
- 5.0.4-TMS-5.8 — 2026-08-28
- 5.0.5 — 2026-08-28
- 5.0.4 — 2026-08-17
- 5.0.3-TMS-5.8 — 2026-08-12
- 5.0.3 — 2026-08-12
- 5.0.2-TMS-5.8 — 2026-08-12
- 5.0.2 — 2026-08-12
- 5.0.1-TMS-5.8 — 2026-08-06
- 5.0.1 — 2026-08-06
- 5.0.0-TMS-5.8 — 2026-07-22
- … 98 more at https://npm.io/package/testit-js-commons/versions

## README

# Test IT JavaScript Integrations
The repository contains new versions of adapters for JS test frameworks.

## Compatibility

| Test IT | Codecept        | Cucumber        | Jest            | Mocha           | Playwright      | TestCafe        | Cypress         |
|---------|-----------------|-----------------|-----------------|-----------------|-----------------|-----------------|-----------------|
| 3.5     | -               | 1.0             | -               | -               | -               | -               | -               |
| 4.0     | 1.1             | 1.1             | 1.1             | 1.1             | 2.0             | -               | -               |
| 4.5     | 2.1             | 2.1             | 2.1             | 2.1             | 2.1             | -               | -               |
| 5.0     | 2.2             | 2.2             | 2.2             | 2.2             | 2.2             | 2.2             | -               |
| 5.2     | 2.3             | 2.3             | 2.3             | 2.3             | 2.3             | 2.3             | -               |
| 5.3     | 3.2.1-TMS-5.3   | 3.2.1-TMS-5.3   | 3.2.1-TMS-5.3   | 3.2.1-TMS-5.3   | 3.2.1-TMS-5.3   | 3.2.1-TMS-5.3   | -               |
| 5.4     | 3.2.8-TMS-5.4   | 3.2.8-TMS-5.4   | 3.2.8-TMS-5.4   | 3.2.8-TMS-5.4   | 3.2.8-TMS-5.4   | 3.2.8-TMS-5.4   | -               |
| 5.5     | 3.4.3-TMS-5.5   | 3.4.3-TMS-5.5   | 3.4.3-TMS-5.5   | 3.4.3-TMS-5.5   | 3.4.3-TMS-5.5   | 3.4.3-TMS-5.5   | -               |
| 5.6     | 3.6.0-TMS-5.6   | 3.6.0-TMS-5.6   | 3.6.0-TMS-5.6   | 3.6.0-TMS-5.6   | 3.6.0-TMS-5.6   | 3.6.0-TMS-5.6   | -               |
| 5.7     | 3.7.9-TMS-5.7   | 3.7.9-TMS-5.7   | 3.7.9-TMS-5.7   | 3.7.9-TMS-5.7   | 3.7.9-TMS-5.7   | 3.7.9-TMS-5.7   | 3.7.9-TMS-5.7   |
| 5.8     | 4.2.0-TMS-5.8   | 4.2.0-TMS-5.8   | 4.2.0-TMS-5.8   | 4.2.0-TMS-5.8   | 4.2.0-TMS-5.8   | 4.2.0-TMS-5.8   | 4.2.0-TMS-5.8   |
| Cloud   | 3.7.0 +         | 3.7.0 +         | 3.7.0 +         | 3.7.0 +         | 3.7.0 +         | 3.7.0 +         | 3.7.7 +         |

1. For current versions, see the releases tab. 
2. Starting with 5.2, we have added a TMS postscript, which means that the utility is compatible with a specific enterprise version. 
3. If you are in doubt about which version to use, check with the support staff: support@testit.software or https://help.testit.software/help

Supported test frameworks :
 1. [Cucumber](https://github.com/testit-tms/adapters-js/tree/main/testit-adapter-cucumber)
 2. [Jest](https://github.com/testit-tms/adapters-js/tree/main/testit-adapter-jest)
 3. [Codecept](https://github.com/testit-tms/adapters-js/tree/main/testit-adapter-codecept)
 4. [Mocha](https://github.com/testit-tms/adapters-js/tree/main/testit-adapter-mocha)
 5. [Playwright](https://github.com/testit-tms/adapters-js/tree/main/testit-adapter-playwright)
 6. [TestCafe](https://github.com/testit-tms/adapters-js/tree/main/testcafe-reporter-testit)
 7. [Cypress](https://github.com/testit-tms/adapters-js/tree/main/testit-adapter-cypress)

## Autotest layer (test pyramid)

All adapters support an optional **layer** on the autotest card. Declare it in test code only (not via adapter config). TMS shows the layer with source **Run**.

| Adapter | Syntax |
|---------|--------|
| Jest | `testit.layer('API')` |
| Mocha | `this.layer = 'API'` |
| Playwright | `await testit.layer('API')` |
| Cypress | `tms.addLayer('API')` |
| Codecept | `{ layer: 'API' }` in scenario opts |
| Cucumber | `@Layer=API` on scenario |
| TestCafe | `layer: 'API'` in `test.meta({ ... })` |

Recommended constants: `TestLayers` from `testit-js-commons` (`E2E`, `UI`, `API`, `Contract`, `Integration`, `Component`, `Unit`). Any other non-empty string is accepted.

See [docs/tz-autotest-layer.md](docs/tz-autotest-layer.md) for the full contract.


## What's new in 4.0.0?

- New logic with a fix for test results loading
- Added sync-storage subprocess usage for worker synchronization on port **49152** by defailt.
- importRealtime=false is a default mode (previously true)
- minor fixes for jest and playwright adapters, common adapters logic

### How to run 4.0+ locally?

You can change nothing, it's full compatible with previous versions of adapters for local run on all OS.

### How to run in an isolated environment?

The adapter tries to download the correct sync-storage version from GitHub. If that is not possible, prepare the sync-storage binary yourself:

1. Find the sync-storage version for your adapter release: check out the release tag and look for the `VERSION` value in `syncstorage.runner.ts`. You can use our [script](https://github.com/testit-tms/adapters-js/blob/main/scripts/get_sync_storage_version.sh).

2. Download the correct binary for your OS and version from our [release page](https://github.com/testit-tms/sync-storage-public/releases).

3. Place the downloaded binary at `./build/.caches/syncstorage-v0.3.3-windows_amd64.exe` in your test project (the version in the filename is an example).

4. Run your tests as usual; the adapter will pick up and run the version specified in `VERSION` value.

### How to run 4.0+ with CI/CD?

For CI/CD pipelines, we recommend starting the sync-storage instance before the adapter and waiting for its completion within the same job.

It can be OK for `adapterMode=2` and automatic creation of new test-run + call for `curl -v http://127.0.0.1:49152/wait-completion || true` in the end.  

There is a guide how to do everything with `adapterMode` `1` or `0`:

You can see how we implement this [here.](https://github.com/testit-tms/adapters-js/tree/main/.github/workflows/test.yml#143) 

- to get the latest version of sync-storage, please use our [script](https://github.com/testit-tms/adapters-js/tree/main/scripts/curl_last_version.sh)

- To download a specific version of sync-storage, use our [script](https://github.com/testit-tms/adapters-js/tree/main/scripts/get_sync_storage.sh) and pass the desired version number as the first parameter. Sync-storage will be downloaded as `.caches/syncstorage-linux-amd64`

1. Create an empty test run using `testit-cli` or use an existing one, and save the `testRunId`.
1.1 (alternative) You can use `curl + jq` to create empty test run, there is an example for github actions:

```bash
mkdir -p "$(dirname "${{ env.TEMP_FILE }}")"
BASE_URL="${{ env.TMS_URL }}"
BASE_URL="${BASE_URL%/}"
BODY=$(jq -nc \
    --arg projectId "${{ env.TMS_PROJECT_ID }}" \
    --arg name "${{ env.TMS_TEST_RUN_NAME }}" \
    '{projectId: $projectId, name: $name}')

curl -sS -f -X POST "${BASE_URL}/api/v2/testRuns" \
    -H "accept: application/json" \
    -H "Content-Type: application/json" \
    -H "Authorization: PrivateToken ${{ env.TMS_PRIVATE_TOKEN }}" \
    -d "$BODY" \
    | jq -er '.id' > "${{ env.TEMP_FILE }}"

echo "TMS_TEST_RUN_ID=$(<${{ env.TEMP_FILE }})" >> $GITHUB_ENV
echo "TMS_TEST_RUN_ID=$(<${{ env.TEMP_FILE }})" >> .env
export TMS_TEST_RUN_ID=$(<${{ env.TEMP_FILE }})
```

2. Start **sync-storage** with the correct parameters as a background process (alternatives to nohup can be used). Stream the log output to the `service.log` file:
```bash
nohup .caches/syncstorage-linux-amd64 --testRunId ${{ env.TMS_TEST_RUN_ID }} --port 49152 \
    --baseURL ${{ env.TMS_URL }} --privateToken ${{ env.TMS_PRIVATE_TOKEN }}  > service.log 2>&1 & 
```
3. Start the adapter using adapterMode=1 or adapterMode=0 for the selected testRunId.
4. Wait for sync-storage to complete background jobs by calling:
```bash
curl -v http://127.0.0.1:49152/wait-completion?testRunId=${{ env.TMS_TEST_RUN_ID }} || true
```
5. You can read the sync-storage logs from the service.log file.


# 🚀 Warning
Since 3.0.0 version for Cucumber:
- If the externalId annotation is not specified, then its contents will be a hash of the Scenario name.

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