Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
TestitApiClient
✓ import * as TestitApiClient from 'testit-api-client';
✗ const TestitApiClient = require('testit-api-client');
While the quickstart uses `require`, ESM imports are generally preferred in modern Node.js and browser environments. The package provides both CJS and ESM exports. For TypeScript, use `import * as TestitApiClient from 'testit-api-client'`.
ApiClient
✓ import { ApiClient } from 'testit-api-client';
✗ import ApiClient from 'testit-api-client';
The main `ApiClient` class is a named export. It's often accessed via `TestitApiClient.ApiClient` in CJS contexts, but direct named import is cleaner in ESM/TypeScript.
ProjectsApi
✓ import { ProjectsApi } from 'testit-api-client';
✗ import { ApiProjects } from 'testit-api-client';
Specific API endpoints (e.g., `ProjectsApi`, `AttachmentsApi`, `AutoTestsApi`) are exposed as named exports. Ensure you use the exact class name as provided by the client.
Demonstrates how to initialize the API client, authenticate with a Bearer or PrivateToken, and fetch all projects from a specified Test IT TMS instance. Uses environment variables for sensitive data.
var TestitApiClient = require('testit-api-client');
// Initialize the default API client instance
var defaultClient = TestitApiClient.ApiClient.instance;
// Set the base path for your Test IT TMS instance
defaultClient.basePath = process.env.TESTIT_BASE_PATH || 'https://team-xxx.testit.software'; // Replace with your actual TMS URL
// Configure authentication using a Bearer token or PrivateToken
var auth = defaultClient.authentications['Bearer or PrivateToken'];
auth.apiKeyPrefix = process.env.TESTIT_API_KEY_PREFIX || "PrivateToken"; // Typically 'PrivateToken' or 'Bearer'
auth.apiKey = process.env.TESTIT_API_KEY || "xxxxxx"; // Your actual API key
// Async function to fetch projects
async function getProjects() {
// Create an instance of the Projects API
var api = new TestitApiClient.ProjectsApi();
try {
// Call the method to get all projects
var res = await api.getAllProjects();
console.log("Successfully fetched projects:", res);
} catch (e) {
console.error("Error fetching projects:", e);
}
}
// Execute the function
getProjects();
Debug
Known issues
gotchaThe `testit-api-client` package has strict compatibility requirements with specific versions of the Test IT TMS server. Using a client version incompatible with your TMS server version can lead to unexpected errors or missing functionality.fixAlways consult the compatibility table in the package's README or the official documentation to ensure your client version matches your Test IT TMS server version. For versions 5.2 and above, pay attention to the `TMS-X.Y` suffix in the client's version number.
affects: All versions
breakingMajor version updates (e.g., from 6.x to 7.x) for `testit-api-client` often introduce breaking changes due to underlying API updates in Test IT TMS. This may require code modifications and potentially regeneration of API models.fixReview the full changelog for any major version upgrade. After updating, run `npm run fix` as recommended in the README for 'new version generation' to update API models and ensure compatibility.
affects: >=7.0.0
gotchaAuthentication requires setting both `defaultClient.basePath` to your Test IT TMS URL and correctly configuring the `auth.apiKeyPrefix` (e.g., 'PrivateToken' or 'Bearer') and `auth.apiKey`.fixDouble-check that `defaultClient.basePath` points to your exact Test IT TMS instance URL, and that `auth.apiKeyPrefix` and `auth.apiKey` are correctly set according to your API token type and value.
affects: All versions
gotchaStarting with version 7.2.0, significant updates for Test IT Cloud support were introduced. Older client versions may not be fully compatible or optimized for the latest Test IT Cloud environments.fixIf working with Test IT Cloud, ensure you are using `testit-api-client` version 7.2.4 or newer, as indicated in the compatibility table, to leverage the latest cloud features and fixes.
affects: >=7.2.0 (for cloud)
gotchaA fix for TypeScript usage was specifically released in version 7.2.6. Users on older versions might encounter type definition issues or incorrect type inference when using TypeScript.fixUpgrade to `testit-api-client` version 7.2.6 or later to benefit from improved TypeScript support and resolve any type-related compilation errors.
affects: <7.2.6
Errors
Common errors & fixes
Error: Request failed with status code 401
Incorrect or missing API key, wrong API key prefix, or incorrect base URL for the Test IT TMS instance.
fixVerify that `defaultClient.basePath` is set to the correct Test IT TMS URL, and `auth.apiKeyPrefix` (e.g., 'PrivateToken') and `auth.apiKey` are accurately configured with a valid token.
TypeError: TestitApiClient.ApiClient is not a constructor
Attempting to use `TestitApiClient.ApiClient` as a constructor directly in a CommonJS context without properly accessing the `instance` property, or an incorrect ESM import for the `ApiClient` class.
fixFor CommonJS, use `TestitApiClient.ApiClient.instance` to get the pre-configured singleton. For ESM/TypeScript, use `import { ApiClient } from 'testit-api-client';` then `ApiClient.instance;` or `new ApiClient();` depending on the use case. The example uses `TestitApiClient.ApiClient.instance`. Client version X.Y.Z is not compatible with Test IT TMS server version A.B.C
Mismatch between the installed `testit-api-client` version and the Test IT TMS server version you are connecting to.
fixRefer to the compatibility table in the `testit-api-client` README and adjust your package version (upgrade or downgrade) to match your Test IT TMS server version. For TMS versions >= 5.2, check the `TMS-X.Y` suffix.
Property 'someMethod' does not exist on type 'SomeApi'.
TypeScript compilation error indicating that an API method is not recognized, often due to outdated type definitions, an older client version, or changes in the Test IT TMS API.
fixEnsure you are using `testit-api-client` version 7.2.6 or newer (for general TypeScript fixes). If the method is new, update to the latest client version compatible with your TMS. If it's an older method, check if it was deprecated in your TMS version. Running `npm run fix` might also regenerate models.
Audit
Dependencies
No dependency data recorded yet.