-
Notifications
You must be signed in to change notification settings - Fork 28
Upgrade to @iobroker/testing 5.1.1, remove redundant dependencies, and integrate template tests in main test suite #1166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
884e6d4
e284c42
dd0f309
727afaf
da67959
939d94f
ebf74cb
8a597b1
fccb4bd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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) | ||
Apollon77 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| 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. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,25 +37,14 @@ const templateFunction: TemplateFunction = async answers => { | |
| const devDependencyPromises = [ | ||
| ...([ | ||
| // testing and translations are always required | ||
| "@iobroker/testing", | ||
| "@iobroker/testing@^5.1.1", | ||
|
||
| "@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 | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.