Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// jshint node: true
var testrunner = require('qunit');
var tests = [
{
code: {
path: '../index.js',
namespace: 'EmberNewRelic',
},
tests: 'index-test.js',
},
];
testrunner.run(tests, function(error, report) {
if (error) {
console.error('error:', error);
process.exitCode = 2;
}
if (report.failed > 0) {
process.exitCode = 1;
}
});
// Simple script runner used to test Node.JS.
if (process.env.CLOUDMINE_APPID && process.env.CLOUDMINE_APIKEY) {
var qunit = require('qunit');
var config = {
deps: [ "./tests/init.js", "./tests/util.js", "./tests/config.js" ],
code: {path: "./js/cloudmine.js", namespace: "cloudmine"},
tests: "./tests/tests.js"
};
qunit.run(config);
} else {
console.log("Cannot run tests without specifying an application id and api key.");
console.log("Please export the following variables in your shell:");
console.log(" CLOUDMINE_APPID: This should be the application id to test under");
console.log(" CLOUDMINE_APIKEY: This should be the api key to test under");
console.log("\nUnit tests may leave behind stale users and data.");
console.log("It is not recommended to run unit tests on a production application.");
}
};
var callback = function (err, report) {
if (err) {
util.log(util.inspect(err));
} else {
util.log(util.inspect(report));
if (report.failed > 0) {
process.exit(1);
}
}
};
// one code and tests file
testrunner.run({
code : 'lib/main.js',
tests : [
'tests/payments_test.js',
'tests/preauthorizations_test.js',
'tests/transactions_test.js',
'tests/clients_test.js',
'tests/offers_test.js',
'tests/subscriptions_test.js',
'tests/webhooks_test.js',
'tests/refunds_test.js'
]
}, callback);
"./test/IssueReports/IssueReport16.js",
"./test/IssueReports/IssueReport19.js",
"./test/IssueReports/IssueReport21.js",
"./test/IssueReports/IssueReport25.js",
"./test/IssueReports/IssueReport29.js"
]
};
/**
* Platform-independent bootstrap.
*/
if (typeof (window) === 'undefined') {
// Are we running on CLI / NodeJS ?
var qunit = require("qunit");
qunit.run(testsuite);
} else {
// We're running a browser.
// change to src version
testsuite.code = [
'src/Config.js',
'src/Compatibility.js',
'src/PrototypeBuilder.js',
'src/ClassBuilder.js',
'src/InterfaceBuilder.js',
'src/EnumBuilder.js',
'src/Reflection.js',
'src/joii.js',
"https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.2/require.min.js" // need requireJS for one of the issue reports
];
errors: true,
// log tests overview
tests: false,
// log summary
summary: false,
// log global summary (all files)
globalSummary: true,
// log currently testing code file
testing: false
};
testrunner.run({
deps: {path: 'multi/shared/errors', namespace: 'errors'},
code: 'multi/shared/errors.js',
tests: 'tests/shared/errors.js',
log: log
}, null);
testrunner.run({
deps: {path: 'multi/shared/SyncedObject', namespace: 'SyncedObject'},
code: 'multi/shared/SyncedObject.js',
tests: 'tests/shared/SyncedObject.js',
log: log
}, null);
testrunner.run({
deps: {path: 'multi/shared/PubSub', namespace: 'PubSub'},
code: 'multi/shared/PubSub.js',
// log global summary (all files)
globalSummary: true,
// log currently testing code file
testing: false
};
testrunner.run({
deps: {path: 'multi/server', namespace: 'multiModule'},
code: 'multi/server/index.js',
tests: 'tests/server/multi.js',
log: log
}, null);
testrunner.run({
deps: {path: 'multi/server/session', namespace: 'sessionModule'},
code: 'multi/server/session.js',
tests: 'tests/server/session.js',
log: log
}, null);
code: './api/extractor/keywords.js',
tests: './api/extractor/test/keywords.js'
})
tests.push({
code: {
path: './api/yahoo/contentAnalysis.js'
},
tests: './api/yahoo/test/contentAnalysis.js'
})
qunit.setup({
coverage: true
})
qunit.run(tests, function(err) {
if (err) console.log(err.stack)
process.exit(err || qunit.log.stats().failed > 0 ? 1 : 0)
})
testrunner.setup({
coverage: true,
maxBlockDuration: 10000
});
testrunner.run({
code: "lib/IdArray.js",
tests: "test/0A_IdArray.js"
}, onTest);
testrunner.run({
code: "lib/Spec.js",
tests: "test/01_Spec.js"
}, onTest);
testrunner.run({
code: "lib/Syncable.js",
tests: "test/02_EventRelay.js"
}, onTest);
testrunner.run({
code: "lib/Pipe.js",
tests: "test/03_OnOff.js"
}, onTest);
testrunner.run({
code: "lib/Text.js",
tests: "test/04_Text.js"
}, onTest);
testrunner.run({
code: "lib/LongSpec.js",