a8bd44a6ec
There was some nasty global-ish variable reference updating happening when the native module 'initializes' after its require with `require('pg').native` This fixes the issue by making sure both `require('pg')` and `require('pg').native` each initialize their own context in isolation and no weird global-ish references are used & subsequently stomped on.
28 lines
642 B
JavaScript
28 lines
642 B
JavaScript
var helper = require(__dirname + '/../test-helper');
|
|
|
|
//native bindings are only installed for native tests
|
|
if(!helper.args.native) {
|
|
return;
|
|
}
|
|
|
|
var assert = require('assert')
|
|
var pg = require('../../../lib')
|
|
var native = require('../../../lib').native
|
|
|
|
var JsClient = require('../../../lib/client')
|
|
var NativeClient = require('../../../lib/native')
|
|
|
|
assert(pg.Client === JsClient);
|
|
assert(native.Client === NativeClient);
|
|
|
|
pg.connect(function(err, client, done) {
|
|
assert(client instanceof JsClient);
|
|
client.end();
|
|
|
|
native.connect(function(err, client, done) {
|
|
assert(client instanceof NativeClient);
|
|
client.end();
|
|
});
|
|
});
|
|
|