@iobroker/legacy-testing 0.2.1 → 0.2.3

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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/setup.js +8 -7
package/README.md CHANGED
@@ -11,7 +11,7 @@ Legacy test modules for ioBroker
11
11
 
12
12
  ## Changelog
13
13
  <!-- ### **WORK IN PROGRESS** -->
14
- ### 0.2.1 (2023-05-07)
14
+ ### 0.2.3 (2023-05-07)
15
15
  * (bluefox) Added possibility to install additional adapters at start
16
16
  * (bluefox) Added setOfflineState/getOfflineState
17
17
 
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.2.1",
2
+ "version": "0.2.3",
3
3
  "name": "@iobroker/legacy-testing",
4
4
  "main": "setup.js",
5
5
  "files": [
package/setup.js CHANGED
@@ -432,7 +432,8 @@ function installJsController(preInstalledAdapters, cb) {
432
432
  });
433
433
  } else {
434
434
  // check if port 9000 is free, else admin adapter will be added to running instance
435
- const client = new require('net').Socket();
435
+ const { Socket } = require('net')
436
+ const client = new Socket();
436
437
  client.on('error', () => {});
437
438
  client.connect(9000, '127.0.0.1', () => {
438
439
  console.error('Cannot initiate the first run of test, because one instance of application is running on this PC. Stop it and repeat.');
@@ -573,8 +574,8 @@ function clearDB() {
573
574
  }
574
575
  }
575
576
 
576
- function setupController(cb) {
577
- installJsController(async isInitialized => {
577
+ function setupController(preInstalledAdapters, cb) {
578
+ installJsController(preInstalledAdapters, async isInitialized => {
578
579
  try {
579
580
  clearControllerLog();
580
581
  clearDB();
@@ -893,8 +894,8 @@ function stopController(cb) {
893
894
  }
894
895
 
895
896
  // Set up the adapter
896
- async function setAdapterConfig(common, native, instance, customAdapterName, customInstance) {
897
- const id = `system.adapter.${(adapterName || customAdapterName).split('.').pop()}.${customInstance === undefined ? instance || 0 : customInstance}`;
897
+ async function setAdapterConfig(common, native, instance, customAdapterName) {
898
+ const id = `system.adapter.${(adapterName || customAdapterName).split('.').pop()}.${instance || 0}`;
898
899
  if (fs.existsSync(`${rootDir}tmp/${appName}-data/objects.json`)) {
899
900
  const objects = JSON.parse(fs.readFileSync(`${rootDir}tmp/${appName}-data/objects.json`).toString());
900
901
  if (common) {
@@ -925,8 +926,8 @@ async function setAdapterConfig(common, native, instance, customAdapterName, cus
925
926
  }
926
927
 
927
928
  // Read config of the adapter
928
- async function getAdapterConfig(instance, customAdapterName, customInstance) {
929
- const id = `system.adapter.${(adapterName || customAdapterName).split('.').pop()}.${customInstance === undefined ? instance || 0 : customInstance}`;
929
+ async function getAdapterConfig(instance, customAdapterName) {
930
+ const id = `system.adapter.${(adapterName || customAdapterName).split('.').pop()}.${instance || 0}`;
930
931
  if (fs.existsSync(`${rootDir}tmp/${appName}-data/objects.json`)) {
931
932
  const objects = JSON.parse(fs.readFileSync(`${rootDir}tmp/${appName}-data/objects.json`).toString());
932
933
  return objects[id];