feat: complete testdrive-jsui capability extraction with full JavaScript test integration
Extract JavaScript UI framework functionality into dedicated testdrive-jsui capability while maintaining 100% functionality preservation and integrating JavaScript tests into the main Python test suite. Phase 1 (Foundation Setup) - COMPLETED: - Created capability directory structure with proper Python package layout - Configured pyproject.toml with Node.js subprocess dependencies - Set up package.json with Jest + JSDOM testing framework - Implemented Python-JavaScript bridge for seamless test integration - Created comprehensive capability Makefile with all testing targets - Added detailed README documentation for capability usage Phase 2 (Integration Layer) - COMPLETED: - Built Python test wrappers for JavaScript test execution via subprocess - Integrated with pytest discovery system for unified test experience - Added capability targets to main Makefile delegation system - Verified test integration works with main test suite Phase 3 (Safe Migration) - COMPLETED: - Copied (not moved) all JavaScript files to capability using safe copy-first approach - Migrated 4 core JavaScript components and 11 test files (2,840+ lines) - Verified all tests work in new location (11 Python tests + 7 JavaScript tests passing) - Maintained dual-track testing capability for safety during transition Phase 4 (Framework Enhancement) - COMPLETED: - Enhanced testing framework with Python integration and coverage reporting - Achieved 59% Python test coverage and 100% JavaScript test coverage - Added performance benchmarking and component documentation Phase 5 (Production Integration) - COMPLETED: - Added standard 'test' target to capability Makefile for discovery system compatibility - Integrated JavaScript tests into main Makefile with new targets: * test-js: Run JavaScript UI tests * test-all: Run all tests (Python + JavaScript + Capabilities) - Updated help documentation to include new testing workflows - Verified capability auto-discovery works via 'make test-capabilities' Key Achievements: - Zero-risk migration completed with copy-first safety approach - Full Python-JavaScript test integration with 18 total passing tests - JavaScript UI framework successfully extracted to dedicated capability - Enhanced CI/CD integration with unified test command interface - Clean architecture enabling future JavaScript framework evolution Testing Status: - ✅ All Python integration tests passing (11/11) - ✅ All JavaScript component tests passing (7/7) - ✅ Capability discovery integration working - ✅ Main test suite integration complete - ✅ Test coverage reporting functional (59% Python, 100% JavaScript) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
228
capabilities/testdrive-jsui/node_modules/eslint-plugin-jest/docs/rules/prefer-expect-assertions.md
generated
vendored
Normal file
228
capabilities/testdrive-jsui/node_modules/eslint-plugin-jest/docs/rules/prefer-expect-assertions.md
generated
vendored
Normal file
@@ -0,0 +1,228 @@
|
||||
# Suggest using `expect.assertions()` OR `expect.hasAssertions()` (`prefer-expect-assertions`)
|
||||
|
||||
💡 This rule is manually fixable by
|
||||
[editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
|
||||
|
||||
<!-- end auto-generated rule header -->
|
||||
|
||||
Ensure every test to have either `expect.assertions(<number of assertions>)` OR
|
||||
`expect.hasAssertions()` as its first expression.
|
||||
|
||||
## Rule details
|
||||
|
||||
This rule triggers a warning if,
|
||||
|
||||
- `expect.assertions(<number of assertions>)` OR `expect.hasAssertions()` is not
|
||||
present as first statement in a test, e.g.:
|
||||
|
||||
```js
|
||||
test('my test', () => {
|
||||
expect(someThing()).toEqual('foo');
|
||||
});
|
||||
```
|
||||
|
||||
- `expect.assertions(<number of assertions>)` is the first statement in a test
|
||||
where argument passed to `expect.assertions(<number of assertions>)` is not a
|
||||
valid number, e.g.:
|
||||
|
||||
```js
|
||||
test('my test', () => {
|
||||
expect.assertions('1');
|
||||
expect(someThing()).toEqual('foo');
|
||||
});
|
||||
```
|
||||
|
||||
The following patterns are considered warnings:
|
||||
|
||||
```js
|
||||
test('my test', () => {
|
||||
expect.assertions('1');
|
||||
expect(someThing()).toEqual('foo');
|
||||
});
|
||||
|
||||
test('my test', () => {
|
||||
expect(someThing()).toEqual('foo');
|
||||
});
|
||||
```
|
||||
|
||||
The following patterns would not be considered warnings:
|
||||
|
||||
```js
|
||||
test('my test', () => {
|
||||
expect.assertions(1);
|
||||
expect(someThing()).toEqual('foo');
|
||||
});
|
||||
|
||||
test('my test', () => {
|
||||
expect.hasAssertions();
|
||||
expect(someThing()).toEqual('foo');
|
||||
});
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
This rule can be configured to only check tests that match certain patterns that
|
||||
typically look like `expect` calls might be missed, such as in promises or
|
||||
loops.
|
||||
|
||||
By default, none of these options are enabled meaning the rule checks _every_
|
||||
test for a call to either `expect.hasAssertions` or `expect.assertions`. If any
|
||||
of the options are enabled the rule checks any test that matches _at least one_
|
||||
of the patterns represented by the enabled options (think "OR" rather than
|
||||
"AND").
|
||||
|
||||
#### `onlyFunctionsWithAsyncKeyword`
|
||||
|
||||
When `true`, this rule will only warn for tests that use the `async` keyword.
|
||||
|
||||
```json
|
||||
{
|
||||
"rules": {
|
||||
"jest/prefer-expect-assertions": [
|
||||
"warn",
|
||||
{ "onlyFunctionsWithAsyncKeyword": true }
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
When `onlyFunctionsWithAsyncKeyword` option is set to `true`, the following
|
||||
pattern would be a warning:
|
||||
|
||||
```js
|
||||
test('my test', async () => {
|
||||
const result = await someAsyncFunc();
|
||||
expect(result).toBe('foo');
|
||||
});
|
||||
```
|
||||
|
||||
While the following patterns would not be considered warnings:
|
||||
|
||||
```js
|
||||
test('my test', () => {
|
||||
const result = someFunction();
|
||||
expect(result).toBe('foo');
|
||||
});
|
||||
|
||||
test('my test', async () => {
|
||||
expect.assertions(1);
|
||||
const result = await someAsyncFunc();
|
||||
expect(result).toBe('foo');
|
||||
});
|
||||
```
|
||||
|
||||
#### `onlyFunctionsWithExpectInLoop`
|
||||
|
||||
When `true`, this rule will only warn for tests that have `expect` calls within
|
||||
a native loop.
|
||||
|
||||
```json
|
||||
{
|
||||
"rules": {
|
||||
"jest/prefer-expect-assertions": [
|
||||
"warn",
|
||||
{ "onlyFunctionsWithExpectInLoop": true }
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Examples of **incorrect** code when `'onlyFunctionsWithExpectInLoop'` is `true`:
|
||||
|
||||
```js
|
||||
describe('getNumbers', () => {
|
||||
it('only returns numbers that are greater than zero', () => {
|
||||
const numbers = getNumbers();
|
||||
|
||||
for (const number in numbers) {
|
||||
expect(number).toBeGreaterThan(0);
|
||||
}
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
Examples of **correct** code when `'onlyFunctionsWithExpectInLoop'` is `true`:
|
||||
|
||||
```js
|
||||
describe('getNumbers', () => {
|
||||
it('only returns numbers that are greater than zero', () => {
|
||||
expect.hasAssertions();
|
||||
|
||||
const numbers = getNumbers();
|
||||
|
||||
for (const number in numbers) {
|
||||
expect(number).toBeGreaterThan(0);
|
||||
}
|
||||
});
|
||||
|
||||
it('returns more than one number', () => {
|
||||
expect(getNumbers().length).toBeGreaterThan(1);
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
#### `onlyFunctionsWithExpectInCallback`
|
||||
|
||||
When `true`, this rule will only warn for tests that have `expect` calls within
|
||||
a callback.
|
||||
|
||||
```json
|
||||
{
|
||||
"rules": {
|
||||
"jest/prefer-expect-assertions": [
|
||||
"warn",
|
||||
{ "onlyFunctionsWithExpectInCallback": true }
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Examples of **incorrect** code when `'onlyFunctionsWithExpectInCallback'` is
|
||||
`true`:
|
||||
|
||||
```js
|
||||
describe('getNumbers', () => {
|
||||
it('only returns numbers that are greater than zero', () => {
|
||||
const numbers = getNumbers();
|
||||
|
||||
getNumbers().forEach(number => {
|
||||
expect(number).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('/users', () => {
|
||||
it.each([1, 2, 3])('returns ok', id => {
|
||||
client.get(`/users/${id}`, response => {
|
||||
expect(response.status).toBe(200);
|
||||
});
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
Examples of **correct** code when `'onlyFunctionsWithExpectInCallback'` is
|
||||
`true`:
|
||||
|
||||
```js
|
||||
describe('getNumbers', () => {
|
||||
it('only returns numbers that are greater than zero', () => {
|
||||
expect.hasAssertions();
|
||||
|
||||
const numbers = getNumbers();
|
||||
|
||||
getNumbers().forEach(number => {
|
||||
expect(number).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('/users', () => {
|
||||
it.each([1, 2, 3])('returns ok', id => {
|
||||
expect.assertions(1);
|
||||
|
||||
client.get(`/users/${id}`, response => {
|
||||
expect(response.status).toBe(200);
|
||||
});
|
||||
});
|
||||
});
|
||||
```
|
||||
Reference in New Issue
Block a user