@iobroker/testing
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -10,2 +10,5 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
@@ -19,2 +22,5 @@ if (mod && mod.__esModule) return mod; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
// Add debug logging for tests | ||
const debug_1 = __importDefault(require("debug")); | ||
const debug = debug_1.default("testing:unit:adapterTools"); | ||
// tslint:disable:unified-signatures | ||
@@ -51,2 +57,3 @@ const fs_extra_1 = require("fs-extra"); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
debug(`locating adapter main file in ${adapterDir}...`); | ||
const ioPackage = loadIoPackage(adapterDir); | ||
@@ -58,8 +65,12 @@ // First look for the file defined in io-package.json or use "main.js" as a fallback | ||
let ret = path.join(adapterDir, mainFile); | ||
if (yield fs_extra_1.pathExists(ret)) | ||
if (yield fs_extra_1.pathExists(ret)) { | ||
debug(` => found ${mainFile}`); | ||
return ret; | ||
} | ||
// If both don't exist, JS-Controller uses <adapter name>.js as another fallback | ||
ret = path.join(adapterDir, ioPackage.name + ".js"); | ||
if (yield fs_extra_1.pathExists(ret)) | ||
if (yield fs_extra_1.pathExists(ret)) { | ||
debug(` => found ${mainFile}`); | ||
return ret; | ||
} | ||
throw new Error(`The adapter main file was not found in ${adapterDir}`); | ||
@@ -66,0 +77,0 @@ }); |
@@ -10,2 +10,5 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
@@ -18,6 +21,6 @@ if (mod && mod.__esModule) return mod; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
// Add debug logging for tests | ||
const debug_1 = __importDefault(require("debug")); | ||
const debug = debug_1.default("testing:integration:AdapterSetup"); | ||
const fs_extra_1 = require("fs-extra"); | ||
@@ -28,5 +31,2 @@ const path = __importStar(require("path")); | ||
const tools_1 = require("./tools"); | ||
// Add debug logging for tests | ||
const debug_1 = __importDefault(require("debug")); | ||
const debug = debug_1.default("testing:integration:AdapterSetup"); | ||
class AdapterSetup { | ||
@@ -71,3 +71,3 @@ constructor(adapterDir, testDir, dbConnection) { | ||
const tarballPath = path.resolve(this.adapterDir, tarballName); | ||
yield fs_extra_1.copy(tarballPath, path.resolve(this.testDir, tarballName)); | ||
yield fs_extra_1.copy(tarballPath, path.resolve(this.testDir, Date.now() + "-" + tarballName)); | ||
yield fs_extra_1.unlink(tarballPath); | ||
@@ -74,0 +74,0 @@ // Complete the package.json, so npm can do it's magic |
{ | ||
"name": "@iobroker/testing", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Shared utilities for adapter and module testing in ioBroker", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
133199
2801