How to use the jasmine-core.boot function in jasmine-core

To help you get started, we’ve selected a few jasmine-core 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 angular / angular / tools / testing / init_node_spec.ts View on Github external
import 'zone.js/dist/long-stack-trace-zone.js';
import 'zone.js/dist/proxy.js';
import 'zone.js/dist/sync-test.js';
import 'zone.js/dist/async-test.js';
import 'zone.js/dist/fake-async-test.js';
import 'zone.js/dist/task-tracking.js';
import 'reflect-metadata/Reflect';

// We must first initialize jasmine-core before calling
// requiring `zone.js/dist/jasmine-patch.js` which patches
// jasmine ENV with code which understands ProxyZone.
// jasmine_node_test under Bazel will check if `jasmineCore.boot(jasmineCore)`
// has been called and re-use the env if it has.
// See https://github.com/bazelbuild/rules_nodejs/pull/539
const jasmineCore: any = require('jasmine-core');
jasmineCore.boot(jasmineCore);
import 'zone.js/dist/jasmine-patch.js';

(global as any).isNode = true;
(global as any).isBrowser = false;

import '@angular/compiler'; // For JIT mode. Must be in front of any other @angular/* imports.
// Init TestBed
import {TestBed} from '@angular/core/testing';
import {ServerTestingModule, platformServerTesting} from '@angular/platform-server/testing/src/server';
import {DominoAdapter} from '@angular/platform-server/src/domino_adapter';
import {createDocument} from 'domino';

TestBed.initTestEnvironment(ServerTestingModule, platformServerTesting());
DominoAdapter.makeCurrent();
(global as any).document =
    (DominoAdapter as any).defaultDoc || ((DominoAdapter as any).defaultDoc = createDocument());
github angular / flex-layout / test / angular-test-init-node-spec.ts View on Github external
*/

import 'zone.js/dist/zone-node.js';
import 'zone.js/dist/long-stack-trace-zone.js';
import 'zone.js/dist/proxy.js';
import 'zone.js/dist/sync-test.js';
import 'zone.js/dist/async-test.js';
import 'zone.js/dist/fake-async-test.js';
import 'zone.js/dist/task-tracking.js';
import 'reflect-metadata/Reflect';

// This hack is needed to get jasmine, node and zone working inside bazel.
// 1) we load `jasmine-core` which contains the ENV: it, describe etc...
const jasmineCore: any = require('jasmine-core');
// 2) We create an instance of `jasmine` ENV.
const patchedJasmine = jasmineCore.boot(jasmineCore);
// 3) Save the `jasmine` into global so that `zone.js/dist/jasmine-patch.js` can get a hold of it to
// patch it.
(global as any)['jasmine'] = patchedJasmine;
// 4) Change the `jasmine-core` to make sure that all subsequent jasmine's have the same ENV,
// otherwise the patch will not work.
//    This is needed since Bazel creates a new instance of jasmine and it's ENV and we want to make
//    sure it gets the same one.
jasmineCore.boot = function() {
  return patchedJasmine;
};
// 5) Patch jasmine ENV with code which understands ProxyZone.
import 'zone.js/dist/jasmine-patch.js';
// 6) Save the patched `jasmineCore` into global so that
// `@build_bazel_rules_nodejs//internal/jasmine_node_test/jasmine_runner.js` can get a hold of it
(global as any)['jasmineCore'] = jasmineCore;
github nodekit-io / nodekit-darwin / test / lib-test / lib / jasmineRunner.js View on Github external
function Jasmine(container, options) {
    
    options = options || {};
    var jasmineCore = require('jasmine-core');
   
    this.jasmine = jasmineCore.boot(jasmineCore);
    this.projectBaseDir = options.projectBaseDir || path.dirname(module.parent.filename);
    this.specFiles = [];
    this.env = this.jasmine.getEnv();
    this.reportersCount = 0;
    this.container = container;
    this.jasmine.DEFAULT_TIMEOUT_INTERVAL = 2000;
}
github onury / grunt-jasmine-nodejs / tasks / lib / jasmine.runner.js View on Github external
function JasmineRunner(options) {
        options = options || {};
        this.jasmine = jasmineCore.boot(jasmineCore);
        this.env = this.jasmine.getEnv();
        this.env.throwOnExpectationFailure(Boolean(options.stopOnFailure));
        this.env.randomizeTests(Boolean(options.random));
        this.env.seed(Boolean(options.seed));
        if (typeof options.defaultTimeout === 'number' && options.defaultTimeout >= 0) {
            this.jasmine.DEFAULT_TIMEOUT_INTERVAL = options.defaultTimeout;
        }
        this._reporters = [];
    }
github bazelbuild / rules_nodejs / packages / jasmine / index.js View on Github external
function boot() {
  jasmineCore.boot(jasmineCore);
}
exports.boot = boot;