loopback-datasource-juggler/test/operation-hooks.suite/index.js

25 lines
830 B
JavaScript
Raw Normal View History

// Copyright IBM Corp. 2016,2019. All Rights Reserved.
2019-05-08 15:45:37 +00:00
// Node module: loopback-datasource-juggler
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT
2016-08-22 19:55:22 +00:00
'use strict';
2018-12-07 14:54:29 +00:00
const debug = require('debug')('test');
const fs = require('fs');
const path = require('path');
module.exports = function(dataSource, should, connectorCapabilities) {
2018-12-07 14:54:29 +00:00
let operations = fs.readdirSync(__dirname);
operations = operations.filter(function(it) {
return it !== path.basename(__filename) &&
!!require.extensions[path.extname(it).toLowerCase()];
});
2018-12-07 14:54:29 +00:00
for (const ix in operations) {
const name = operations[ix];
const fullPath = require.resolve('./' + name);
debug('Loading test suite %s (%s)', name, fullPath);
require(fullPath).apply(this, arguments);
}
};