@iobroker/testing 4.0.0 → 4.1.0
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/README.md
CHANGED
|
@@ -43,6 +43,10 @@ tests.integration(path.join(__dirname, ".."), {
|
|
|
43
43
|
// By default, termination during startup is not allowed.
|
|
44
44
|
allowedExitCodes: [11],
|
|
45
45
|
|
|
46
|
+
// To test against a different version of JS-Controller, you can change the version or dist-tag here.
|
|
47
|
+
// Make sure to remove this setting when you're done testing.
|
|
48
|
+
controllerVersion: "latest", // or a specific version like "4.0.1"
|
|
49
|
+
|
|
46
50
|
// Define your own tests inside defineAdditionalTests
|
|
47
51
|
defineAdditionalTests({ suite }) {
|
|
48
52
|
// All tests (it, describe) must be grouped in one or more suites. Each suite sets up a fresh environment for the adapter tests.
|
|
@@ -7,6 +7,11 @@ export interface TestAdapterOptions {
|
|
|
7
7
|
loglevel?: ioBroker.LogLevel;
|
|
8
8
|
/** How long to wait before the adapter startup is considered successful */
|
|
9
9
|
waitBeforeStartupSuccess?: number;
|
|
10
|
+
/**
|
|
11
|
+
* Which JS-Controller version or dist-tag should be used for the tests. Default: dev
|
|
12
|
+
* This should only be changed during active development.
|
|
13
|
+
*/
|
|
14
|
+
controllerVersion?: string;
|
|
10
15
|
/** Allows you to define additional tests */
|
|
11
16
|
defineAdditionalTests?: (args: TestContext) => void;
|
|
12
17
|
}
|
|
@@ -58,7 +58,7 @@ function testAdapter(adapterDir, options = {}) {
|
|
|
58
58
|
// Installation happens in two steps:
|
|
59
59
|
// First we need to set up JS Controller, so the databases etc. can be created
|
|
60
60
|
// First we need to copy all files and execute an npm install
|
|
61
|
-
await controllerSetup.prepareTestDir();
|
|
61
|
+
await controllerSetup.prepareTestDir(options.controllerVersion);
|
|
62
62
|
// Only then we can install the adapter, because some (including VIS) try to access
|
|
63
63
|
// the databases if JS Controller is installed
|
|
64
64
|
await adapterSetup.installAdapterInTestDir();
|
|
@@ -8,7 +8,7 @@ export declare class ControllerSetup {
|
|
|
8
8
|
private testAdapterDir;
|
|
9
9
|
private testControllerDir;
|
|
10
10
|
private testDataDir;
|
|
11
|
-
prepareTestDir(): Promise<void>;
|
|
11
|
+
prepareTestDir(controllerVersion?: string): Promise<void>;
|
|
12
12
|
/**
|
|
13
13
|
* Tests if JS-Controller is already installed
|
|
14
14
|
* @param appName The branded name of "iobroker"
|
|
@@ -53,8 +53,8 @@ class ControllerSetup {
|
|
|
53
53
|
debug(` appName: ${this.appName}`);
|
|
54
54
|
debug(` adapterName: ${this.adapterName}`);
|
|
55
55
|
}
|
|
56
|
-
async prepareTestDir() {
|
|
57
|
-
debug(
|
|
56
|
+
async prepareTestDir(controllerVersion = "dev") {
|
|
57
|
+
debug(`Preparing the test directory. JS-Controller version: "${controllerVersion}"...`);
|
|
58
58
|
// Make sure the test dir exists
|
|
59
59
|
await (0, fs_extra_1.ensureDir)(this.testDir);
|
|
60
60
|
// Write the package.json
|
|
@@ -69,7 +69,7 @@ class ControllerSetup {
|
|
|
69
69
|
author: "",
|
|
70
70
|
license: "ISC",
|
|
71
71
|
dependencies: {
|
|
72
|
-
[`${this.appName}.js-controller`]:
|
|
72
|
+
[`${this.appName}.js-controller`]: controllerVersion,
|
|
73
73
|
},
|
|
74
74
|
description: "",
|
|
75
75
|
};
|