Skip to content
Merged
5 changes: 3 additions & 2 deletions .copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,10 @@ When making a PR to this repository, ensure the following points are addressed:
- **Project builds**: Ensure the project builds successfully with `npm run build`
- **Tests included**: Add tests for your change. This includes negative tests (i.e. inputs that need to fail) as well as baseline tests (i.e. how should the directory structure look like?).
- **Test suite passes**: Run the test suite with `npm test` and ensure all tests pass
- **Template creation test**: Ensure the template creation test (`.github/test_template_creation.sh`) passes as part of the main test suite
- **Baseline changes**: If there are baseline changes, review them and make a separate commit for them with the comment "accept baselines" if they are desired changes
- **Template creation updates**: If you added a required option, also add it to the template creation (`.github/create_templates.ts`)
- **Migration documentation**: Add a detailed migration description to `docs/updates` explaining what the user needs to do when manually updating an existing project
- **CHANGELOG.md updated**: Add your changes to CHANGELOG.md (referencing the migration description and this PR or the issue you fixed)
- **Migration documentation** (**REQUIRED**): Always add a detailed migration description to `docs/updates` with filename format `YYYYMMDD_description.md` explaining what the user needs to do when manually updating an existing project. Even for minor changes, provide guidance on what users should check or update.
- **CHANGELOG.md updated** (**REQUIRED**): Always add your changes to CHANGELOG.md under the `__WORK IN PROGRESS__` section, referencing the migration description file and this PR or the issue you fixed

These requirements help maintain code quality, ensure proper testing coverage, and provide clear documentation for users upgrading existing projects.
Empty file modified .github/test_template_creation.sh
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
(at the beginning of a new line)
-->
## __WORK IN PROGRESS__
* (copilot) Upgrade to @iobroker/testing 5.1.1, remove redundant dependencies, and include template tests in main test suite (#1165) · [Migration guide](docs/updates/20250831_iobroker_testing_51.md)
* (copilot) Update TypeScript to 5.9.2 and typescript-eslint to 7.x for both creator and generated templates (#1158) · [Migration guide](docs/updates/20250831_typescript_59_update.md)
* (copilot) Add Node.js 24 as a supported version (#1145) · [Migration guide](docs/updates/20250831_node24_support.md)
* (copilot) Replace deprecated `setStateAsync` with `setState` in adapter templates (#1148, [Migration guide](./docs/updates/20250831_setstate_sync.md))
Expand Down
77 changes: 77 additions & 0 deletions docs/updates/20250831_iobroker_testing_51.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Upgrade to @iobroker/testing 5.1.1 and remove redundant dependencies

@iobroker/testing version 5.1.1 now includes many test dependencies that were previously required to be manually added to adapter projects. This update allows you to clean up your `package.json` file by removing redundant dependencies.

## Update @iobroker/testing version

Update the @iobroker/testing version in your `package.json` devDependencies:

```diff
"devDependencies": {
- "@iobroker/testing": "^4.1.3",
+ "@iobroker/testing": "^5.1.1",
// ... other dependencies
},
```

## Remove redundant test dependencies

The following dependencies can now be removed from your `package.json` devDependencies since they are included in `@iobroker/testing` 5.1.1:

### Runtime test dependencies:
```diff
"devDependencies": {
- "chai": "^4.5.0",
- "chai-as-promised": "^7.1.2",
- "mocha": "^11.7.1",
- "sinon": "^19.0.5",
- "sinon-chai": "^3.7.0",
- "proxyquire": "^2.1.3",
// ... other dependencies
},
```

### Type definitions:
```diff
"devDependencies": {
- "@types/chai": "^4.3.20",
- "@types/chai-as-promised": "^8.0.2",
- "@types/mocha": "^10.0.10",
- "@types/sinon": "^17.0.4",
- "@types/sinon-chai": "^3.2.12",
- "@types/proxyquire": "^1.3.31",
// ... other dependencies
},
```

## Test script updates (optional)

If you want to include template creation testing in your main test suite (for consistency with CI), you can add a `test:templates` script to your `package.json`:

```diff
"scripts": {
"test": "npm run test:js && npm run test:integration",
+ "test:templates": "mocha test/testAdapterCreation.js --timeout 60000",
// ... other scripts
},
```

Then update your main test script to include it:

```diff
"scripts": {
- "test": "npm run test:js && npm run test:integration",
+ "test": "npm run test:js && npm run test:integration && npm run test:templates",
// ... other scripts
},
```

## After the changes

After making these changes:

1. Delete your `node_modules` folder and `package-lock.json` file
2. Run `npm install` to reinstall dependencies with the updated versions
3. Run `npm test` to verify everything still works correctly

All testing functionality remains unchanged as the dependencies are now provided by `@iobroker/testing` 5.1.1.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@
"watch": "tsc -p tsconfig.build.json --watch",
"test:ts": "mocha src/**/*.test.ts",
"test:baselines": "mocha test/create-adapter.test.ts",
"test:templates": "bash .github/test_template_creation.sh",
"pretest": "npm run linkTemplates",
"test": "npm run test:ts && npm run test:baselines",
"test": "npm run test:ts && npm run test:baselines && npm run test:templates",
"test:watch": "mocha src/**/*.test.ts --watch",
"lint:ts": "eslint {src,test,.github,maintenance}/**/*.ts",
"lint": "npm run lint:ts",
Expand Down
17 changes: 3 additions & 14 deletions templates/package.json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,14 @@ const templateFunction: TemplateFunction = async answers => {
const devDependencyPromises = [
...([
// testing and translations are always required
"@iobroker/testing",
"@iobroker/testing@^5.1.1",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot No need to specify the exact version here, this should automatically be resolved to the latest available which is ok

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the exact version specification from @iobroker/testing dependency. It now automatically resolves to the latest available version. Commit 8a597b1.

"@iobroker/adapter-dev",
]),
...(isAdapter ? [
// support adapter testing by default
"chai@4", // v5 is ESM and incompatible with chai-as-promised
"chai-as-promised@7",
`mocha`,
`sinon`,
"sinon-chai@3",
"proxyquire",
// Testing dependencies are now included in @iobroker/testing 5.1.x
] : []),
...(isAdapter && useTypeChecking ? [
"@types/chai@4",
"@types/chai-as-promised@7",
"@types/mocha",
"@types/sinon",
"@types/sinon-chai@3",
"@types/proxyquire",
// Type definitions for testing dependencies are now included in @iobroker/testing 5.1.x
// Recommended tsconfig for the minimum supported Node.js version
`@tsconfig/node${minNodeVersion}`,
// and NodeJS typings
Expand Down
10 changes: 2 additions & 8 deletions test/baselines/ReleaseScript_JS/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,8 @@
"@alcalzone/release-script-plugin-license": "^3.7.0",
"@alcalzone/release-script-plugin-manual-review": "^3.7.0",
"@iobroker/adapter-dev": "^1.4.0",
"@iobroker/testing": "^5.1.0",
"chai-as-promised": "^7.1.2",
"chai": "^4.5.0",
"eslint": "^8.57.1",
"mocha": "^11.7.1",
"proxyquire": "^2.1.3",
"sinon": "^21.0.0",
"sinon-chai": "^3.7.0"
"@iobroker/testing": "^5.1.1",
"eslint": "^8.57.1"
},
"main": "main.js",
"files": [
Expand Down
14 changes: 1 addition & 13 deletions test/baselines/ReleaseScript_TS/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,13 @@
"@alcalzone/release-script-plugin-license": "^3.7.0",
"@alcalzone/release-script-plugin-manual-review": "^3.7.0",
"@iobroker/adapter-dev": "^1.4.0",
"@iobroker/testing": "^5.1.0",
"@iobroker/testing": "^5.1.1",
"@tsconfig/node20": "^20.1.6",
"@types/chai-as-promised": "^7.1.8",
"@types/chai": "^4.3.20",
"@types/mocha": "^10.0.10",
"@types/node": "^20.19.11",
"@types/proxyquire": "^1.3.31",
"@types/sinon": "^17.0.4",
"@types/sinon-chai": "^3.2.12",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"chai-as-promised": "^7.1.2",
"chai": "^4.5.0",
"eslint": "^8.57.1",
"mocha": "^11.7.1",
"proxyquire": "^2.1.3",
"rimraf": "^6.0.1",
"sinon": "^21.0.0",
"sinon-chai": "^3.7.0",
"source-map-support": "^0.5.21",
"ts-node": "^10.9.2",
"typescript": "~5.9.2"
Expand Down
14 changes: 1 addition & 13 deletions test/baselines/TS_Prettier/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,16 @@
},
"devDependencies": {
"@iobroker/adapter-dev": "^1.4.0",
"@iobroker/testing": "^5.1.0",
"@iobroker/testing": "^5.1.1",
"@tsconfig/node20": "^20.1.6",
"@types/chai-as-promised": "^7.1.8",
"@types/chai": "^4.3.20",
"@types/mocha": "^10.0.10",
"@types/node": "^20.19.11",
"@types/proxyquire": "^1.3.31",
"@types/sinon": "^17.0.4",
"@types/sinon-chai": "^3.2.12",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"chai-as-promised": "^7.1.2",
"chai": "^4.5.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-prettier": "^5.5.4",
"eslint": "^8.57.1",
"mocha": "^11.7.1",
"prettier": "^3.6.2",
"proxyquire": "^2.1.3",
"rimraf": "^6.0.1",
"sinon": "^21.0.0",
"sinon-chai": "^3.7.0",
"source-map-support": "^0.5.21",
"ts-node": "^10.9.2",
"typescript": "~5.9.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,10 @@
},
"devDependencies": {
"@iobroker/adapter-dev": "^1.4.0",
"@iobroker/testing": "^5.1.0",
"@iobroker/testing": "^5.1.1",
"@tsconfig/node20": "^20.1.6",
"@types/chai-as-promised": "^7.1.8",
"@types/chai": "^4.3.20",
"@types/mocha": "^10.0.10",
"@types/node": "^20.19.11",
"@types/proxyquire": "^1.3.31",
"@types/sinon": "^17.0.4",
"@types/sinon-chai": "^3.2.12",
"chai-as-promised": "^7.1.2",
"chai": "^4.5.0",
"eslint": "^8.57.1",
"mocha": "^11.7.1",
"proxyquire": "^2.1.3",
"sinon": "^21.0.0",
"sinon-chai": "^3.7.0",
"typescript": "~5.9.2"
},
"main": "main.js",
Expand Down
10 changes: 2 additions & 8 deletions test/baselines/adapter_JS_React/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,12 @@
"devDependencies": {
"@iobroker/adapter-dev": "^1.4.0",
"@iobroker/adapter-react": "2.0.22",
"@iobroker/testing": "^5.1.0",
"@iobroker/testing": "^5.1.1",
"@material-ui/core": "^4.12.4",
"chai-as-promised": "^7.1.2",
"chai": "^4.5.0",
"eslint-plugin-react": "^7.37.5",
"eslint": "^8.57.1",
"mocha": "^11.7.1",
"proxyquire": "^2.1.3",
"react-dom": "^17.0.2",
"react": "^17.0.2",
"sinon": "^21.0.0",
"sinon-chai": "^3.7.0"
"react": "^17.0.2"
},
"main": "main.js",
"files": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,13 @@
},
"devDependencies": {
"@iobroker/adapter-dev": "^1.4.0",
"@iobroker/testing": "^5.1.0",
"@iobroker/testing": "^5.1.1",
"@tsconfig/node20": "^20.1.6",
"@types/chai-as-promised": "^7.1.8",
"@types/chai": "^4.3.20",
"@types/mocha": "^10.0.10",
"@types/node": "^20.19.11",
"@types/proxyquire": "^1.3.31",
"@types/sinon": "^17.0.4",
"@types/sinon-chai": "^3.2.12",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"chai-as-promised": "^7.1.2",
"chai": "^4.5.0",
"eslint": "^8.57.1",
"mocha": "^11.7.1",
"proxyquire": "^2.1.3",
"rimraf": "^6.0.1",
"sinon": "^21.0.0",
"sinon-chai": "^3.7.0",
"source-map-support": "^0.5.21",
"ts-node": "^10.9.2",
"typescript": "~5.9.2"
Expand Down
14 changes: 1 addition & 13 deletions test/baselines/adapter_TS_React/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,19 @@
"devDependencies": {
"@iobroker/adapter-dev": "^1.4.0",
"@iobroker/adapter-react": "2.0.22",
"@iobroker/testing": "^5.1.0",
"@iobroker/testing": "^5.1.1",
"@material-ui/core": "^4.12.4",
"@tsconfig/node20": "^20.1.6",
"@types/chai-as-promised": "^7.1.8",
"@types/chai": "^4.3.20",
"@types/mocha": "^10.0.10",
"@types/node": "^20.19.11",
"@types/proxyquire": "^1.3.31",
"@types/react-dom": "^17.0.26",
"@types/react": "^17.0.88",
"@types/sinon": "^17.0.4",
"@types/sinon-chai": "^3.2.12",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"chai-as-promised": "^7.1.2",
"chai": "^4.5.0",
"eslint-plugin-react": "^7.37.5",
"eslint": "^8.57.1",
"mocha": "^11.7.1",
"proxyquire": "^2.1.3",
"react-dom": "^17.0.2",
"react": "^17.0.2",
"rimraf": "^6.0.1",
"sinon": "^21.0.0",
"sinon-chai": "^3.7.0",
"source-map-support": "^0.5.21",
"ts-node": "^10.9.2",
"typescript": "~5.9.2"
Expand Down
14 changes: 1 addition & 13 deletions test/baselines/contributors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,13 @@
},
"devDependencies": {
"@iobroker/adapter-dev": "^1.4.0",
"@iobroker/testing": "^5.1.0",
"@iobroker/testing": "^5.1.1",
"@tsconfig/node20": "^20.1.6",
"@types/chai-as-promised": "^7.1.8",
"@types/chai": "^4.3.20",
"@types/mocha": "^10.0.10",
"@types/node": "^20.19.11",
"@types/proxyquire": "^1.3.31",
"@types/sinon": "^17.0.4",
"@types/sinon-chai": "^3.2.12",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"chai-as-promised": "^7.1.2",
"chai": "^4.5.0",
"eslint": "^8.57.1",
"mocha": "^11.7.1",
"proxyquire": "^2.1.3",
"rimraf": "^6.0.1",
"sinon": "^21.0.0",
"sinon-chai": "^3.7.0",
"source-map-support": "^0.5.21",
"ts-node": "^10.9.2",
"typescript": "~5.9.2"
Expand Down
14 changes: 1 addition & 13 deletions test/baselines/git_SSH/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,13 @@
},
"devDependencies": {
"@iobroker/adapter-dev": "^1.4.0",
"@iobroker/testing": "^5.1.0",
"@iobroker/testing": "^5.1.1",
"@tsconfig/node20": "^20.1.6",
"@types/chai-as-promised": "^7.1.8",
"@types/chai": "^4.3.20",
"@types/mocha": "^10.0.10",
"@types/node": "^20.19.11",
"@types/proxyquire": "^1.3.31",
"@types/sinon": "^17.0.4",
"@types/sinon-chai": "^3.2.12",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"chai-as-promised": "^7.1.2",
"chai": "^4.5.0",
"eslint": "^8.57.1",
"mocha": "^11.7.1",
"proxyquire": "^2.1.3",
"rimraf": "^6.0.1",
"sinon": "^21.0.0",
"sinon-chai": "^3.7.0",
"source-map-support": "^0.5.21",
"ts-node": "^10.9.2",
"typescript": "~5.9.2"
Expand Down
Loading