baset-core
Advanced tools
Comparing version 0.9.0 to 0.10.0
@@ -6,2 +6,18 @@ # Change Log | ||
<a name="0.10.0"></a> | ||
# [0.10.0](https://github.com/Igmat/baset/compare/v0.9.1...v0.10.0) (2018-03-07) | ||
### Bug Fixes | ||
* **core:** don't dispose env because it happens to early ([ef3b5fa](https://github.com/Igmat/baset/commit/ef3b5fa)) | ||
### Features | ||
* **core:** abstract environment api ([f37f42f](https://github.com/Igmat/baset/commit/f37f42f)) | ||
<a name="0.9.0"></a> | ||
@@ -8,0 +24,0 @@ # [0.9.0](https://github.com/Igmat/baset/compare/v0.8.0...v0.9.0) (2018-03-03) |
@@ -1,5 +0,8 @@ | ||
export declare abstract class AbstractEnvironmet { | ||
import { IDictionary } from './utils'; | ||
export declare abstract class AbstractEnvironment { | ||
options: any; | ||
constructor(options: any); | ||
abstract getContextImport(sandbox: IDictionary<any>): string; | ||
abstract dispose(): void; | ||
} | ||
export declare type IEnvironmentConstructor = new (options: any) => AbstractEnvironmet; | ||
export declare type IEnvironmentConstructor = new (options: any) => AbstractEnvironment; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
class AbstractEnvironmet { | ||
class AbstractEnvironment { | ||
constructor(options) { | ||
@@ -8,3 +8,3 @@ this.options = options; | ||
} | ||
exports.AbstractEnvironmet = AbstractEnvironmet; | ||
exports.AbstractEnvironment = AbstractEnvironment; | ||
//# sourceMappingURL=abstractEnvironment.js.map |
@@ -6,5 +6,5 @@ import * as dataTypes from './dataTypes'; | ||
export { AbstractResolver } from './abstractResolver'; | ||
export { AbstractEnvironmet } from './abstractEnvironment'; | ||
export { AbstractEnvironment } from './abstractEnvironment'; | ||
export { circularReference, ITestGroupOptions } from './testGroup'; | ||
export { Tester } from './tester'; | ||
export { utils, dataTypes }; |
@@ -21,3 +21,3 @@ "use strict"; | ||
var abstractEnvironment_1 = require("./abstractEnvironment"); | ||
exports.AbstractEnvironmet = abstractEnvironment_1.AbstractEnvironmet; | ||
exports.AbstractEnvironment = abstractEnvironment_1.AbstractEnvironment; | ||
var testGroup_1 = require("./testGroup"); | ||
@@ -24,0 +24,0 @@ exports.circularReference = testGroup_1.circularReference; |
@@ -14,2 +14,3 @@ import { IDictionary } from './utils'; | ||
private baseliner; | ||
private environment?; | ||
private references; | ||
@@ -19,3 +20,2 @@ private pattern; | ||
private resolvers; | ||
private allImports; | ||
private indexOfResolver; | ||
@@ -22,0 +22,0 @@ constructor(pattern: string | RegExp, options: ITestGroupOptions, pluginsOptions: IDictionary<any>); |
@@ -23,3 +23,2 @@ "use strict"; | ||
this.pluginsOptions = pluginsOptions; | ||
// private environemt: AbstractEnvironmet; | ||
this.references = new WeakMap(); | ||
@@ -31,2 +30,7 @@ this.match = (filePath) => this.pattern.test(filePath); | ||
const sandbox = {}; | ||
const envImport = this.environment && this.environment.getContextImport(sandbox); | ||
const imports = [ | ||
envImport, | ||
...this.options.imports, | ||
].filter((importName) => !!importName); | ||
const context = new baset_vm_1.NodeVM({ | ||
@@ -37,3 +41,3 @@ require: { | ||
external: true, | ||
import: this.allImports, | ||
import: imports, | ||
}, | ||
@@ -58,5 +62,9 @@ sandbox: { basetSandbox: sandbox }, | ||
: new Promise(resolve => resolve('')); | ||
const output = yield this.baseliner.compare(testsResults, baselineValue); | ||
// FIXME: find out why next disposal happens before result are calculated | ||
// after test proccess termination server is stopped, so it's not an issue now | ||
// this.environment && this.environment.dispose(); | ||
return { | ||
path: baselinePath, | ||
output: yield this.baseliner.compare(testsResults, baselineValue), | ||
output, | ||
}; | ||
@@ -137,2 +145,6 @@ }); | ||
}); | ||
if (options.environment) { | ||
const environment = require(path_1.default.resolve(options.environment)).default; | ||
this.environment = new environment(pluginsOptions[options.environment] || pluginsOptions[path_1.default.basename(options.environment)]); | ||
} | ||
const resolveMatchers = this.resolvers | ||
@@ -145,6 +157,2 @@ .map((resolver, index) => (toMatch, context, sandbox) => __awaiter(this, void 0, void 0, function* () { return resolver.match(toMatch, context, sandbox); })); | ||
}); | ||
this.allImports = [ | ||
options.environment, | ||
...options.imports, | ||
].filter((importName) => !!importName); | ||
} | ||
@@ -151,0 +159,0 @@ } |
{ | ||
"name": "baset-core", | ||
"version": "0.9.0", | ||
"version": "0.10.0", | ||
"description": "Core library for BaseT project.", | ||
@@ -32,3 +32,3 @@ "keywords": [ | ||
"@types/node": "^9.3.0", | ||
"baset": "^0.9.0", | ||
"baset": "^0.10.0", | ||
"doctoc": "^1.3.0", | ||
@@ -35,0 +35,0 @@ "tslint": "^5.9.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39349
443
5