forked from robdsoule/postgresql-adapter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunner.js
98 lines (83 loc) · 2.84 KB
/
runner.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/**
* Run integration tests
*
* Uses the `waterline-adapter-tests` module to
* run mocha tests against the appropriate version
* of Waterline. Only the interfaces explicitly
* declared in this adapter's `package.json` file
* are tested. (e.g. `queryable`, `semantic`, etc.)
*/
/**
* Module dependencies
*/
var util = require('util');
var mocha = require('mocha');
var TestRunner = require('waterline-adapter-tests');
var Adapter = require('../../dist/adapter');
// Grab targeted interfaces from this adapter's `package.json` file:
var package = {},
interfaces = [],
features = [];
try {
package = require('../../package.json');
interfaces = package.waterlineAdapter.interfaces;
features = package.waterlineAdapter.features;
} catch (e) {
throw new Error(
'\n' +
'Could not read supported interfaces from `waterlineAdapter.interfaces`' + '\n' +
'in this adapter\'s `package.json` file ::' + '\n' +
util.inspect(e)
);
}
console.log('Testing `' + package.name + '`, a Sails/Waterline adapter.');
console.log('Running `waterline-adapter-tests` against ' + interfaces.length + ' interfaces...');
console.log('( ' + interfaces.join(', ') + ' )');
console.log();
console.log('Latest draft of Waterline adapter interface spec:');
console.log('http://links.sailsjs.org/docs/plugins/adapters/interfaces');
console.log();
/**
* Integration Test Runner
*
* Uses the `waterline-adapter-tests` module to
* run mocha tests against the specified interfaces
* of the currently-implemented Waterline adapter API.
*/
new TestRunner({
// Mocha opts
mocha: {
bail: false,
grep: /(case in)|(case se)|(greaterThanOrEqual key when searching strings)|(>= usage when searching strings)/,
invert: true
},
// Load the adapter module.
adapter: Adapter,
// Default connection config to use.
config: {
},
failOnError: true,
// The set of adapter interfaces to test against.
// (grabbed these from this adapter's package.json file above)
interfaces: interfaces,
// The set of adapter features to test against.
// (grabbed these from this adapter's package.json file above)
features: features,
// Most databases implement 'semantic' and 'queryable'.
//
// As of Sails/Waterline v0.10, the 'associations' interface
// is also available. If you don't implement 'associations',
// it will be polyfilled for you by Waterline core. The core
// implementation will always be used for cross-adapter / cross-connection
// joins.
//
// In future versions of Sails/Waterline, 'queryable' may be also
// be polyfilled by core.
//
// These polyfilled implementations can usually be further optimized at the
// adapter level, since most databases provide optimizations for internal
// operations.
//
// Full interface reference:
// https://github.com/balderdashy/sails-docs/blob/master/adapter-specification.md
});