Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This file provides guidance to AI agents when working with code in this reposito
## Commands

```bash
npm test # Run all tests (mocha)
npm test # Run all tests (node:test)
npm run lint # ESLint (flat config in eslint.config.js)
npm run build # Generate JSDoc documentation into build/
npm run docs # Build the docs and open them in the browser (macOS `open`)
Expand All @@ -16,7 +16,7 @@ The docs are a static site that works straight from disk, no server needed. Off

Run single test file:
```bash
npx mocha test/onOff.js
node --test test/onOff.js
```

## Architecture
Expand Down Expand Up @@ -68,10 +68,16 @@ inputClusters: [0x0006]

### Test Pattern

Tests run on `node:test`, so `describe`, `it` and `mock` are imported, not globals. A
callback-style test takes the test context first: `it('...', function(t, done) { ... })`.
With `function(done)` node:test sees a synchronous test, passes it immediately and never
runs the assertions.

Tests use mock nodes from `test/util/mockNode.js`:

**Single node with loopback** (command → same node's BoundCluster):
```javascript
const { describe, it } = require('node:test');
const { createMockNode } = require('./util');
const OnOffCluster = require('../lib/clusters/onOff');

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -339,5 +339,5 @@ The workflow commits updated types back to `develop` if changes are detected.
Great if you'd like to contribute to this project, a few things to take note of before submitting a PR:

- This project enforces ESLint, validate by running `npm run lint`.
- This project implements a basic test framework based on mocha, see [test](https://github.com/athombv/node-zigbee-clusters/blob/production/test) directory.
- This project implements a basic test framework based on node:test, see [test](https://github.com/athombv/node-zigbee-clusters/blob/production/test) directory.
- This project uses several [GitHub Action workflows](https://github.com/athombv/node-zigbee-clusters/blob/production/.github/workflows) (e.g. ESLint, running test and versioning/publishing).
8 changes: 0 additions & 8 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,4 @@ module.exports = defineConfig(
],
},
},
{
files: ['test/**/*.js'],
languageOptions: {
globals: {
...globals.mocha,
},
},
},
);
Loading
Loading