@iobroker/legacy-testing 1.0.9 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +8 -2
- package/package.json +3 -3
- package/setup.js +44 -3
- package/tests/testPackageFiles.js +4 -3
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2022-
|
|
3
|
+
Copyright (c) 2022-2024 bluefox <dogafox@gmail.com>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -14,6 +14,12 @@ Set process.env.JS_CONTROLLER_VERSION to version e.g. `5.0.5-alpha.0-20230617-46
|
|
|
14
14
|
|
|
15
15
|
## Changelog
|
|
16
16
|
<!-- ### **WORK IN PROGRESS** -->
|
|
17
|
+
### 1.0.11 (2024-04-14)
|
|
18
|
+
* (bluefox) Added support for the once mode
|
|
19
|
+
|
|
20
|
+
### 1.0.10 (2024-04-10)
|
|
21
|
+
* (bluefox) Added support for vis-2 testing
|
|
22
|
+
|
|
17
23
|
### 1.0.9 (2023-12-19)
|
|
18
24
|
* (foxriver76) create folder on initialization
|
|
19
25
|
|
|
@@ -24,7 +30,7 @@ Set process.env.JS_CONTROLLER_VERSION to version e.g. `5.0.5-alpha.0-20230617-46
|
|
|
24
30
|
* (foxriver76) allow re-initialization after config change
|
|
25
31
|
|
|
26
32
|
### 1.0.6 (2023-12-19)
|
|
27
|
-
* (foxriver76) allow
|
|
33
|
+
* (foxriver76) allow specifying the `rootDir`
|
|
28
34
|
|
|
29
35
|
### 1.0.5 (2023-12-15)
|
|
30
36
|
* (bluefox) Added support for vis-1 testing
|
|
@@ -63,7 +69,7 @@ Set process.env.JS_CONTROLLER_VERSION to version e.g. `5.0.5-alpha.0-20230617-46
|
|
|
63
69
|
## License
|
|
64
70
|
MIT License
|
|
65
71
|
|
|
66
|
-
Copyright (c) 2022-
|
|
72
|
+
Copyright (c) 2022-2024 bluefox <dogafox@gmail.com>
|
|
67
73
|
|
|
68
74
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
69
75
|
of this software and associated documentation files (the "Software"), to deal
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.0.
|
|
2
|
+
"version": "1.0.11",
|
|
3
3
|
"name": "@iobroker/legacy-testing",
|
|
4
4
|
"main": "setup.js",
|
|
5
5
|
"files": [
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"email": "dogafox@gmail.com"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"mocha": "^10.
|
|
30
|
-
"chai": "^4.
|
|
29
|
+
"mocha": "^10.4.0",
|
|
30
|
+
"chai": "^4.4.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@alcalzone/release-script": "^3.7.0",
|
package/setup.js
CHANGED
|
@@ -459,6 +459,22 @@ async function installJsController(preInstalledAdapters, cb) {
|
|
|
459
459
|
await storeOriginalFiles();
|
|
460
460
|
cb && cb(true);
|
|
461
461
|
} else {
|
|
462
|
+
if (preInstalledAdapters) {
|
|
463
|
+
for (let p = 0; p < preInstalledAdapters.length; p++) {
|
|
464
|
+
// if not installed
|
|
465
|
+
const parts = preInstalledAdapters[p].split('@');
|
|
466
|
+
const name = parts[0];
|
|
467
|
+
const version = parts[1];
|
|
468
|
+
if (!fs.existsSync(`${rootDir}tmp/node_modules/${name}`)) {
|
|
469
|
+
await installAdapterAsync(preInstalledAdapters[p]);
|
|
470
|
+
} else {
|
|
471
|
+
const pack = require(`${rootDir}tmp/node_modules/${name}/package.json`);
|
|
472
|
+
if (pack.version !== version) {
|
|
473
|
+
await installAdapterAsync(preInstalledAdapters[p]);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
462
478
|
setTimeout(() => {
|
|
463
479
|
console.log('installJsController: js-controller installed');
|
|
464
480
|
cb && cb(false);
|
|
@@ -560,8 +576,9 @@ function clearDB() {
|
|
|
560
576
|
* @param {LegacyTestingOptions} options specify attributes which should be overridden
|
|
561
577
|
*/
|
|
562
578
|
function setOptions(options) {
|
|
563
|
-
if (options.rootDir) {
|
|
579
|
+
if (options.rootDir && fs.existsSync(options.rootDir) && rootDir !== options.rootDir) {
|
|
564
580
|
rootDir = options.rootDir
|
|
581
|
+
initialize();
|
|
565
582
|
}
|
|
566
583
|
}
|
|
567
584
|
|
|
@@ -694,6 +711,27 @@ function startCustomAdapter(adapterName, adapterInstance) {
|
|
|
694
711
|
stdio: [0, 1, 2, 'ipc'],
|
|
695
712
|
});
|
|
696
713
|
}
|
|
714
|
+
pids[id].on('exit', (code, signal) => {
|
|
715
|
+
if (pids[id]) {
|
|
716
|
+
console.log(`child process terminated 1 due to receipt of signal ${signal}`);
|
|
717
|
+
let resolve = pids[id].customResolve;
|
|
718
|
+
if (resolve) {
|
|
719
|
+
delete pids[id].customResolve;
|
|
720
|
+
}
|
|
721
|
+
pids[id] = null;
|
|
722
|
+
resolve && resolve();
|
|
723
|
+
}
|
|
724
|
+
});
|
|
725
|
+
pids[id].on('close', () => {
|
|
726
|
+
if (pids[id]) {
|
|
727
|
+
let resolve = pids[id].customResolve;
|
|
728
|
+
if (resolve) {
|
|
729
|
+
delete pids[id].customResolve;
|
|
730
|
+
}
|
|
731
|
+
pids[id] = null;
|
|
732
|
+
resolve && resolve();
|
|
733
|
+
}
|
|
734
|
+
});
|
|
697
735
|
} catch (error) {
|
|
698
736
|
console.error(JSON.stringify(error));
|
|
699
737
|
}
|
|
@@ -836,16 +874,19 @@ function stopCustomAdapter(adapterName, adapterInstance) {
|
|
|
836
874
|
} else {
|
|
837
875
|
adaptersStarted[id] = false;
|
|
838
876
|
return new Promise(resolve => {
|
|
877
|
+
pids[id].customResolve = resolve;
|
|
839
878
|
pids[id].on('exit', (code, signal) => {
|
|
840
879
|
if (pids[id]) {
|
|
841
|
-
console.log(`child process terminated due to receipt of signal ${signal}`);
|
|
880
|
+
console.log(`child process terminated 3 due to receipt of signal ${signal}`);
|
|
881
|
+
delete pids[id].customResolve;
|
|
842
882
|
pids[id] = null;
|
|
843
883
|
resolve();
|
|
844
884
|
}
|
|
845
885
|
});
|
|
846
886
|
|
|
847
|
-
pids[id].on('close', (
|
|
887
|
+
pids[id].on('close', () => {
|
|
848
888
|
if (pids[id]) {
|
|
889
|
+
delete pids[id].customResolve;
|
|
849
890
|
pids[id] = null;
|
|
850
891
|
resolve();
|
|
851
892
|
}
|
|
@@ -8,7 +8,8 @@ const expect = require('chai').expect;
|
|
|
8
8
|
const fs = require('fs');
|
|
9
9
|
|
|
10
10
|
// node_modules/@iobroker/legacy-testing/tests/testPackageFiles.js
|
|
11
|
-
const adapterDir = `${__dirname}/../../../../`;
|
|
11
|
+
const adapterDir = process.env.IOBROKER_ROOT_DIR || `${__dirname}/../../../../`;
|
|
12
|
+
const alternativeAdapterDir = `${__dirname}/../../../../`;
|
|
12
13
|
|
|
13
14
|
describe('Test package.json and io-package.json', () => {
|
|
14
15
|
it('Test package files', done => {
|
|
@@ -52,7 +53,7 @@ describe('Test package.json and io-package.json', () => {
|
|
|
52
53
|
console.log();
|
|
53
54
|
}
|
|
54
55
|
|
|
55
|
-
expect(fs.existsSync(`${adapterDir}/README.md`), 'ERROR: README.md needs to exist! Please create one with description, detail information and changelog. English is mandatory.').to.be.true;
|
|
56
|
+
expect(fs.existsSync(`${adapterDir}/README.md`) || fs.existsSync(`${alternativeAdapterDir}/README.md`), 'ERROR: README.md needs to exist! Please create one with description, detail information and changelog. English is mandatory.').to.be.true;
|
|
56
57
|
|
|
57
58
|
if (!ioPackage.common.titleLang || typeof ioPackage.common.titleLang !== 'object') {
|
|
58
59
|
console.log('WARNING: titleLang is not existing in io-package.json. Please add');
|
|
@@ -85,7 +86,7 @@ describe('Test package.json and io-package.json', () => {
|
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
const licenseFileExists = fs.existsSync(`${adapterDir}/LICENSE`);
|
|
88
|
-
const fileContentReadme = fs.readFileSync(`${adapterDir}/README.md`, 'utf8');
|
|
89
|
+
const fileContentReadme = fs.existsSync(`${alternativeAdapterDir}/README.md`) ? fs.readFileSync(`${alternativeAdapterDir}/README.md`, 'utf8') : fs.readFileSync(`${adapterDir}/README.md`, 'utf8');
|
|
89
90
|
|
|
90
91
|
if (!fileContentReadme.includes('## Changelog')) {
|
|
91
92
|
console.log('Warning: The README.md should have a section ## Changelog');
|