Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Helper function for adding jasmine functionlaity to global.
// tslint:disable-next-line: no-any
function extend(destination: any, source: any) {
for (const property in source) {
destination[property] = source[property];
}
return destination;
}
const jasmine = jasmineRequire.core(jasmineRequire);
// @ts-ignore
global.jasmine = jasmine;
const env: jasmine.Env = jasmine.getEnv();
const jasmineInterface = jasmineRequire.interface(jasmine, env);
extend(global, jasmineInterface);
//@ts-ignore
env.configure({ random: false });
// Custom reporter to collect the test results
const reactReporter: jasmine.CustomReporter = {
jasmineStarted: suiteInfo => {
// The console.warn below seems necessary in order for the spy on
// console.warn defined in one of the tests to run corrently.
console.warn('starting tests');
//@ts-ignore
console.reportErrorsAsExceptions = false;
this.setState({
testsStarted: true,
totalTests: suiteInfo.totalSpecsDefined,
/*jshint node:true, browser:false */
var jasmineRequire = require('jasmine-core/lib/jasmine-core/jasmine.js');
var JasmineConsoleReporter = require('jasmine-console-reporter');
// Init
var jasmine = jasmineRequire.core(jasmineRequire);
var jasmineEnv = jasmine.getEnv();
// Export interface
var jasmineInterface = jasmineRequire.interface(jasmine, jasmineEnv);
global.jasmine = jasmine;
global.jasmineRequire = jasmineRequire;
for (var property in jasmineInterface) {
if (jasmineInterface.hasOwnProperty(property)) {
global[property] = jasmineInterface[property];
}
}
// Default reporter
jasmineEnv.addReporter(jasmineInterface.jsApiReporter);
// Html reporter
var consoleReporter = new JasmineConsoleReporter({
colors: 1,
cleanStack: 1,
verbosity: 4,
/*jshint node:true, browser:false */
var jasmineRequire = require('jasmine-core/lib/jasmine-core/jasmine.js');
var JasmineConsoleReporter = require('jasmine-console-reporter');
var Montage = require('../montage');
var PATH = require("path");
global.XMLHttpRequest = require('xhr2');
// Init
var jasmine = jasmineRequire.core(jasmineRequire);
var jasmineEnv = jasmine.getEnv();
// Export interface
var jasmineInterface = jasmineRequire.interface(jasmine, jasmineEnv);
global.jasmine = jasmine;
global.jasmineRequire = jasmineRequire;
for (var property in jasmineInterface) {
if (jasmineInterface.hasOwnProperty(property)) {
global[property] = jasmineInterface[property];
}
}
// Default reporter
jasmineEnv.addReporter(jasmineInterface.jsApiReporter);
// Html reporter
var consoleReporter = new JasmineConsoleReporter({
colors: 1,
cleanStack: 1,
verbosity: 4,
/*jshint node:true, browser:false */
var jasmineRequire = require('jasmine-core/lib/jasmine-core/jasmine.js');
var JasmineConsoleReporter = require('jasmine-console-reporter');
var Montage = require('montage');
var PATH = require("path");
// Init
var jasmine = jasmineRequire.core(jasmineRequire);
var jasmineEnv = jasmine.getEnv();
// Export interface
var jasmineInterface = jasmineRequire.interface(jasmine, jasmineEnv);
global.jasmine = jasmine;
global.jasmineRequire = jasmineRequire;
for (var property in jasmineInterface) {
if (jasmineInterface.hasOwnProperty(property)) {
global[property] = jasmineInterface[property];
}
}
// Default reporter
jasmineEnv.addReporter(jasmineInterface.jsApiReporter);
// Html reporter
var consoleReporter = new JasmineConsoleReporter({
colors: 1,
cleanStack: 1,
verbosity: 4,
/*jshint node:true, browser:false */
var jasmineRequire = require('jasmine-core/lib/jasmine-core/jasmine.js');
var JasmineConsoleReporter = require('jasmine-console-reporter');
// Init
var jasmine = jasmineRequire.core(jasmineRequire);
var jasmineEnv = jasmine.getEnv();
// Export interface
var jasmineInterface = jasmineRequire.interface(jasmine, jasmineEnv);
global.jasmine = jasmine;
global.jasmineRequire = jasmineRequire;
for (var property in jasmineInterface) {
if (jasmineInterface.hasOwnProperty(property)) {
global[property] = jasmineInterface[property];
}
}
// Default reporter
jasmineEnv.addReporter(jasmineInterface.jsApiReporter);
// Html reporter
var consoleReporter = new JasmineConsoleReporter({
colors: 1,
cleanStack: 1,
verbosity: 4,
function initJasmine(context) {
context.setTimeout = function(fn, delay, params) { fn.apply(this, params); };
context.setInterval = function(fn, delay, params) { print('si');print(fn.toString());};
context.clearInterval = function(fn, delay, params) { print('ci');print(fn.toString());};
context.clearTimeout = function(fn, delay, params) { };
var jasmine = jasmineRequire.core(jasmineRequire);
var env = jasmine.getEnv();
var jI = jasmineRequire.interface(jasmine, env);
extend(context, jI);
var CoRep = jasmineRequire_console.ConsoleReporter();
env.addReporter(new CoRep({print: context.console.log, showColors: true}));
env.specFilter = function(spec) {
//print(spec.getFullName());
//for (var property in spec) print(property);
return true;
};
function extend(destination, source) {
for (var property in source) destination[property] = source[property];
return destination;
}
return env;