How to use the app-module-path.addPath function in app-module-path

To help you get started, we’ve selected a few app-module-path 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 laurent22 / joplin / Server / spec / testUtils.ts View on Github external
require('app-module-path').addPath(__dirname + '/..');

// Wrap an async test in a try/catch block so that done() is always called
// and display a proper error message instead of "unhandled promise error"
export const asyncTest = function(callback:Function) {
	return async function(done:Function) {
		try {
			await callback();
		} catch (error) {
			console.error(error);
		} finally {
			done();
		}
	};
};
github mzp / tumblotte / test / bootstrap.js View on Github external
// add src/ directory to require path
require('app-module-path').addPath(__dirname + '/../src/');

// setup chai-enzyme
var chai = require('chai');
chai.use(require('chai-enzyme')());
chai.use(require("chai-as-promised"));
github mui-org / material-ui / test / index.js View on Github external
// @flow weak

process.env.NODE_ENV = 'test';

require('babel-register');
require('app-module-path').addPath(`${__dirname}'./../`);
require('./cli');
github swaponline / swap.core / index.js View on Github external
// require('babel-core/register')

require('app-module-path/register') // on windows
require('app-module-path').addPath(__dirname + '/lib')

exports = module.exports = require('./lib')
github coralproject / talk / plugins.js View on Github external
const fs = require('fs');
const path = require('path');
const resolve = require('resolve');
const debug = require('debug')('talk:plugins');
const Joi = require('joi');
const amp = require('app-module-path');
const hjson = require('hjson');
const pkg = require('./package.json');

const PLUGINS_JSON = process.env.TALK_PLUGINS_JSON;

// Add the current path to the module root.
amp.addPath(__dirname);

let pluginsPath;
let plugins = {};

// Try to parse the plugins.json file, logging out an error if the plugins.json
// file isn't loaded, but continuing. Else, like a parsing error, throw it and
// crash the program.
try {
  let envPlugins = path.join(__dirname, 'plugins.env.js');
  let customPlugins = path.join(__dirname, 'plugins.json');
  let defaultPlugins = path.join(__dirname, 'plugins.default.json');

  if (PLUGINS_JSON && PLUGINS_JSON.length > 0) {
    debug('Now using TALK_PLUGINS_JSON environment variable for plugins');
    pluginsPath = envPlugins;
  } else if (fs.existsSync(customPlugins)) {
github HashBrownCMS / hashbrown-cms / hashbrown.js View on Github external
/**
 * @namespace HashBrown
 */

/**
 * @namespace HashBrown.Common
 */

const AppModulePath = require('app-module-path'); 
const Path = require('path');

// Set app root
global.APP_ROOT = Path.resolve(__dirname);

// Make sure we can require our source files conveniently
AppModulePath.addPath(__dirname);
AppModulePath.addPath(Path.resolve(__dirname, './src'));

// Use bluebird promise
global.Promise = require('bluebird');

Promise.onPossiblyUnhandledRejection((error, promise) => {
    throw error;
});

// Include main server module
require(APP_ROOT + '/src/Server');
github binary-com / binary-bot / newDesign / botPage / __tests__ / index.js View on Github external
require('app-module-path').addPath(__dirname + '/../../');
require('binary-common-utils/compatibility');


var BotPage = require('../index');
var expect = require('chai').expect;
var observer = require('binary-common-utils/observer');

describe('BotPage', function() {
	before(function(){
	});
	it('BotPage is initialized', function(){
		expect(true).to.be.ok;
	});
});
github AJFunk / nasa-sdk / tests / helper.js View on Github external
import {
  expect,
  assert,
} from 'chai';
import { addPath } from 'app-module-path';
import path from 'path';

global.expect = expect;
global.assert = assert;

addPath(path.resolve(__dirname, `../${process.env.TEST_PATH}`));
github mui-org / material-ui / test / index.js View on Github external
require('app-module-path').addPath(`${__dirname}'./../`);
import Minimist from 'minimist';
import Mocha from 'mocha';
import Glob from 'glob';
import './utils/dom';

const argv = Minimist(process.argv.slice(2), {
  alias: {
    m: 'module',
    g: 'grep',
  },
});

const types = argv._;
const globPatterns = {
  unit: `src/**/${argv.module ? argv.module : '*'}.spec.js`,
  //integration: `test/integration/**/${argv.module ? argv.module : '*'}.spec.js`,
github mui-org / material-ui / test / unit / index.js View on Github external
require('app-module-path').addPath(`${__dirname}'./../../`);
import Mocha from 'mocha';
import Glob from 'glob';

const argv = process.argv.slice(2);
const opts = {};

if (argv && argv.length > 0) {
  opts.grep = argv[0];
}

const mocha = new Mocha(opts);

Glob(`${__dirname}/**/*.spec.js`, {}, (err, files) => {
  files.forEach((file) => mocha.addFile(file));

  mocha.run((failures) => {

app-module-path

Simple module to add additional directories to the Node module search for top-level app modules

BSD-2-Clause
Latest version published 8 years ago

Package Health Score

71 / 100
Full package analysis

Popular app-module-path functions