7281dcefc6
WIP #785 Initial router commit WIP #785 Added the log manager api WIP #785 Added some comments for needed updates WIP #785 Fixed typo in export WIP #785 Added basic fn-ality to JobLogsClient WIP #785 Added tests for the log router WIP #785 uri encode project, branch. Updated viz to use the log-storage WIP #785 Fixed updating on stdout update WIP #785 Filtered out stdout update msgs from the notification widget WIP #785 Added stdout save on canceled WIP #785 Added tests for the joblogsclient WIP #785 Moved job logs client to src/common WIP #785 Added forking support to api WIP #785 Added fork support for the job log client WIP #785 Fixed flashing on canceled job WIP #785 Fixed minor code climate issues WIP #785 Create test-tmp on npm test
55 linhas
1.5 KiB
JavaScript
55 linhas
1.5 KiB
JavaScript
// This is used by the test/plugins tests
|
|
/*jshint node:true*/
|
|
/**
|
|
* @author pmeijer / https://github.com/pmeijer
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
var testFixture = require('webgme/test/_globals'),
|
|
path = require('path'),
|
|
fs = require('fs'),
|
|
exists = require('exists-file'),
|
|
WEBGME_CONFIG_PATH = '../config';
|
|
|
|
// This flag will make sure the config.test.js is being used
|
|
// process.env.NODE_ENV = 'test'; // This is set by the require above, overwrite it here.
|
|
|
|
var WebGME = testFixture.WebGME,
|
|
gmeConfig = require(WEBGME_CONFIG_PATH),
|
|
getGmeConfig = function getGmeConfig() {
|
|
// makes sure that for each request it returns with a unique object and tests will not interfere
|
|
if (!gmeConfig) {
|
|
// if some tests are deleting or unloading the config
|
|
gmeConfig = require(WEBGME_CONFIG_PATH);
|
|
}
|
|
return JSON.parse(JSON.stringify(gmeConfig));
|
|
};
|
|
|
|
WebGME.addToRequireJsPaths(gmeConfig);
|
|
|
|
// Add the requirejs text plugin
|
|
testFixture.requirejs.config({
|
|
paths: {
|
|
text: 'client/lib/require/require-text/text'
|
|
}
|
|
});
|
|
testFixture.getGmeConfig = getGmeConfig;
|
|
|
|
testFixture.DF_SEED_DIR = testFixture.path.join(__dirname, '..', 'src', 'seeds');
|
|
|
|
testFixture.mkdir = function(dir) {
|
|
var dirs = path.resolve(dir).split(path.sep),
|
|
shortDir,
|
|
i = 1;
|
|
|
|
while (i++ < dirs.length) {
|
|
shortDir = dirs.slice(0,i).join(path.sep);
|
|
if (!exists.sync(shortDir)) {
|
|
fs.mkdirSync(shortDir);
|
|
}
|
|
}
|
|
};
|
|
|
|
module.exports = testFixture;
|