How to use the rc.test function in rc

To help you get started, we’ve selected a few rc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github strongloop / loopback-connector-oracle / test / init / init.js View on Github external
// Copyright IBM Corp. 2013,2018. All Rights Reserved.
// Node module: loopback-connector-oracle
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

'use strict';

const juggler = require('loopback-datasource-juggler');
let DataSource = juggler.DataSource;

const config = require('rc')('loopback', {test: {oracle: {}}}).test.oracle;
config.maxConn = 64;

let db;

global.getDataSource = global.getSchema = function() {
  if (db) {
    return db;
  }
  db = new DataSource(require('../../'), config);
  db.log = function(a) {
    // console.log(a);
  };
  return db;
};

global.resetDataSourceClass = function(ctor) {
github strongloop / loopback-connector-mysql / test / init.js View on Github external
// Copyright IBM Corp. 2013,2018. All Rights Reserved.
// Node module: loopback-connector-mysql
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

'use strict';

module.exports = require('should');
const juggler = require('loopback-datasource-juggler');
let DataSource = juggler.DataSource;

var config = require('rc')('loopback', {test: {mysql: {}}}).test.mysql;
global.getConfig = function(options) {
  var dbConf = {
    host: process.env.MYSQL_HOST || config.host || 'localhost',
    port: process.env.MYSQL_PORT || config.port || 3306,
    database: process.env.MYSQL_DATABASE || 'myapp_test',
    username: process.env.MYSQL_USER || config.username,
    password: process.env.MYSQL_PASSWORD || config.password,
    createDatabase: true,
  };

  if (options) {
    for (var el in options) {
      dbConf[el] = options[el];
    }
  }
  return dbConf;
github strongloop / loopback-connector-cassandra / test / init.js View on Github external
// Copyright IBM Corp. 2015,2019. All Rights Reserved.
// Node module: loopback-connector-cassandra
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

var DataSource = require('loopback-datasource-juggler').DataSource;

var config = require('rc')('loopback', {test: {cassandra: {
  host: process.env.CASSANDRA_HOST || 'localhost',
  port: process.env.CASSANDRA_PORT || 9042,
  keyspace: process.env.CASSANDRA_KEYSPACE || 'test',
  replication: process.env.CASSANDRA_REPLICATION || {
    class: 'SimpleStrategy', 
    replication_factor: 3,
  }
}}}).test.cassandra;

global.getDataSource = global.getSchema = function() {
  var db = new DataSource(require('../'), config);
  return db;
};

global.connectorCapabilities = {
  ilike: false,
github strongloop / loopback-connector-mssql / test / init.js View on Github external
// Copyright IBM Corp. 2014,2018. All Rights Reserved.
// Node module: loopback-connector-mssql
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

'use strict';
module.exports = require('should');

const juggler = require('loopback-datasource-juggler');
let DataSource = juggler.DataSource;

let config = {};
try {
  config = require('rc')('loopback', {test: {mssql: {}}}).test.mssql;
} catch (err) {
  config = {
    user: 'demo',
    password: 'L00pBack',
    host: 'localhost',
    database: 'demo',
    supportsOffSetFetch: Math.random() > 0.5,
  };
}

global.getConfig = function(options) {
  const dbConf = {
    host: process.env.MSSQL_HOST || config.host || config.hostname || config.server || 'localhost',
    port: process.env.MSSQL_PORT || config.port || 1433,
    database: process.env.MSSQL_DATABASE || config.database || 'test',
    user: process.env.MSSQL_USER || config.user || config.username,

rc

hardwired configuration loader

(BSD-2-Clause OR MIT OR Apach…
Latest version published 7 years ago

Package Health Score

70 / 100
Full package analysis