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.
Testee
✓ <!-- In HTML: -->
<script type="text/javascript" src="testee-client.js"></script>
<script type="text/javascript">
window.Testee = { baseURL: 'http://testee-server.com/' };
</script>
✗ import { Testee } from 'testee-client'
The library is primarily consumed as a global `window.Testee` object after being loaded via a <script> tag in a browser environment. Direct ESM/CJS imports are not the intended usage for its client-side functionality.
Testee.init
✓ <!-- After asynchronous test files are loaded and Testee is configured: -->
<script type="text/javascript">
if (window.Testee) {
window.Testee.init();
}
</script>
✗ Testee.init() // Called before testee-client.js is loaded or if Testee is not on window
This method is called to initialize the client adapters, especially crucial when test files are loaded asynchronously to prevent test frameworks from running prematurely. Ensure `window.Testee` exists before calling.
Testee.start
✓ Testee.start({
id: 'some-unique-run-id',
environment: navigator.userAgent,
runner: 'Mocha',
framework: 'mocha'
});
✗ const { start } = require('testee-client'); start(...)
Direct API calls like `Testee.start`, `Testee.suite`, `Testee.pass`, and `Testee.fail` are exposed globally for manual test flow reporting. These are typically used internally by framework adapters or for implementing custom test runners, and require `testee-client.js` to be loaded.
This quickstart demonstrates how to include `testee-client.js` in an HTML page, configure `window.Testee` options, and manually initialize it within a Mocha test setup that simulates asynchronous test loading. It includes basic manual reporting via the `Testee` API.
<!-- index.html -->
<!DOCTYPE html>
<html>
<head>
<title>Testee Client Quickstart</title>
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/mocha@10.0.0/mocha.min.css">
<script src="//cdn.jsdelivr.net/npm/mocha@10.0.0/mocha.min.js"></script>
<script type="text/javascript">
// Configure Testee client options before loading the script
window.Testee = {
baseURL: 'http://localhost:3030/testee-runner', // Replace with your Testee server URL
provider: { type: 'socket.io' } // Explicitly set for clarity, socket.io is often default
};
mocha.setup('bdd');
</script>
<!-- Load testee-client AFTER configuration -->
<script type="text/javascript" src="node_modules/testee-client/dist/testee-client.js"></script>
</head>
<body>
<div id="mocha"></div>
<script>
// Simulate asynchronous test loading and then run tests
// In a real application, 'tests.js' would contain your actual Mocha tests.
// Here, we're embedding a simple test.
Promise.resolve().then(() => {
describe('My application', () => {
it('should perform addition correctly', () => {
// Example of manual Testee API calls (normally handled by adapters)
if (typeof Testee !== 'undefined' && Testee.start) {
const runId = 'qs-run-id';
const suiteId = 'qs-suite-id';
const testId = 'qs-test-id';
Testee.start({ id: runId, environment: navigator.userAgent, runner: 'Mocha', framework: 'mocha' });
Testee.suite({ id: suiteId, title: 'Quickstart Arithmetic Suite', root: true, parent: runId });
Testee.test({ id: testId, title: '1 + 1 equals 2', parent: suiteId });
// Actual test assertion
if (1 + 1 === 2) {
Testee.pass({ id: testId, duration: 2 });
} else {
Testee.fail({ id: testId, err: { message: 'Unexpected result' } });
}
Testee.testEnd({ id: testId });
}
// Using a common assertion library (e.g., Chai) for actual test logic
// For this example, we'll just check directly.
if ((1 + 1) !== 2) {
throw new Error('1 + 1 should equal 2');
}
});
});
// After all test files are 'loaded', initialize Testee and run the framework
if (window.Testee) {
window.Testee.init();
}
mocha.run();
});
</script>
</body>
</html>
Errors
Common errors & fixes
Error: Cannot find module 'testee-client/dist/testee-client.js' (or similar file not found errors for dist/ files)
This error most commonly occurs when attempting to use `testee-client@0.5.2`, which was released without the necessary distribution files in its `dist/` folder, making the package effectively unusable.
fixEnsure you are using `testee-client@0.5.3` or a later version, as version 0.5.2 was a faulty release and is missing critical files.
process.cwd() returns an empty string or an unexpected path in StealJS/steal-tools environments
A specific conflict between the `steal-tools` process shim and `testee-client`'s internal shim in versions prior to 0.5.6 caused `process.cwd()` to return an incorrect or empty value, affecting tests relying on it.
fixUpgrade `testee-client` to version 0.5.6 or higher. This version includes a fix that rebuilds the distribution without the conflicting `steal-tools` process shim.
Uncaught ReferenceError: Testee is not defined
The `testee-client.js` script was not loaded in the browser, or `window.Testee` was accessed before the script had fully executed and populated the global object.
fixEnsure that the `<script src="path/to/testee-client.js"></script>` tag is correctly placed in your HTML and executed before any code that attempts to access `window.Testee` or call `window.Testee.init()`.
Audit
Dependencies
No dependency data recorded yet.