Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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();
}
};
};
// 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"));
// @flow weak
process.env.NODE_ENV = 'test';
require('babel-register');
require('app-module-path').addPath(`${__dirname}'./../`);
require('./cli');
// require('babel-core/register')
require('app-module-path/register') // on windows
require('app-module-path').addPath(__dirname + '/lib')
exports = module.exports = require('./lib')
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)) {
/**
* @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');
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;
});
});
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}`));
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`,
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) => {