to get engine and console when referred to. This will resolve the issue with usage of ql-unit within ql.io-engine tests #22

Merged
merged 1 commit into from Feb 28, 2012
Jump to file or symbol
Failed to load files and symbols.
+15 −6
Split
View
@@ -25,10 +25,19 @@ var fs = require("fs"),
exports.init = function (opt) {
// init the engine
- var engine = (opt || {}).engine || new (require("ql.io-engine"))(opt);
+ var engine = (opt || {}).engine;
- // init the console
- var c = (opt || {}).console || new (require('ql.io-console'))(_.extend(opt, {'enable console':false, connection:'close'}));
+ function getEngine(){
+ engine = engine || new (require("ql.io-engine"))(opt);
+ return engine;
+ }
+
+ var c = (opt || {}).console;
+
+ function getConsole() {
+ c = c || new (require('ql.io-console'))(_.extend(opt, {'enable console':false, connection:'close'}));
+ return c;
+ }
var port = (opt || {}).port || 8080;
@@ -146,7 +155,7 @@ exports.init = function (opt) {
tester.setup(function (ctx) {
if (aMeta.script) {
- engine.exec(aMeta.script, function (err, result) {
+ getEngine().exec(aMeta.script, function (err, result) {

This comment has been minimized.

Show comment Hide comment
@s3u

s3u Feb 28, 2012

Owner

We should to engine.execute from engine.exec

@s3u

s3u Feb 28, 2012

Owner

We should to engine.execute from engine.exec

This comment has been minimized.

Show comment Hide comment
@shimonchayim

shimonchayim Feb 29, 2012

Owner

Creating issue for that. @mtipnis likely to resolve that and is currently finishing the work for cooked tests execution.

@shimonchayim

shimonchayim Feb 29, 2012

Owner

Creating issue for that. @mtipnis likely to resolve that and is currently finishing the work for cooked tests execution.

try {
tester.test(test, err, result, ctx);
}
@@ -160,7 +169,7 @@ exports.init = function (opt) {
});
}
else if (aMeta.request) {
- c.app.listen(port, function () {
+ getConsole().app.listen(port, function () {
var options = {
host:'localhost',
port:port,
View
@@ -1,7 +1,7 @@
{
"author": "ql.io",
"name": "ql-unit",
- "version": "0.1.2",
+ "version": "0.1.4",
"repository": {
"type": "git",
"url": "https://github.com/ql-io/ql-unit"