Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
global.jasmine = runner.jasmine;
require('zone.js/dist/jasmine-patch.js');
// Override console.warn, otherwise we log too much to the console
// This is because of the `runtimeChecks` warning when no runtime config is provided
console.warn = () => {};
const { getTestBed } = require('@angular/core/testing');
const {
ServerTestingModule,
platformServerTesting,
} = require('@angular/platform-server/testing');
getTestBed().initTestEnvironment(ServerTestingModule, platformServerTesting());
runner.loadConfig({
spec_dir: 'modules',
spec_files: ['**/*.spec.ts'],
});
runner.execute();
// or bad things happen when users of this package try to use MockNgRedux etc. This bit of code
// gets the unit test process to alias `import '@angular-redux/store'` to `import `../src` during
// our unit test execution.
const tsconfigPaths = require('tsconfig-paths');
tsconfigPaths.register({
baseUrl: '.',
paths: { '@angular-redux/store': [''] },
});
const { getTestBed } = require('@angular/core/testing');
const {
ServerTestingModule,
platformServerTesting,
} = require('@angular/platform-server/testing');
getTestBed().initTestEnvironment(ServerTestingModule, platformServerTesting());
runner.loadConfig({
spec_dir: '.',
spec_files: ['**/*.spec.ts'],
});
runner.execute();
};
// 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;
(global as any).isNode = true;
(global as any).isBrowser = false;
// Init TestBed
import {TestBed} from '@angular/core/testing';
import {ServerTestingModule, platformServerTesting} from '@angular/platform-server/testing';
import {patchTestBedToDestroyFixturesAfterEveryTest} from './patch-testbed';
const testBed = TestBed.initTestEnvironment(ServerTestingModule, platformServerTesting());
patchTestBedToDestroyFixturesAfterEveryTest(testBed);
});
require('reflect-metadata');
require('zone.js/dist/zone-node');
require('zone.js/dist/async-test');
require('zone.js/dist/sync-test');
require('zone.js/dist/fake-async-test');
require('zone.js/dist/proxy');
const { getTestBed } = require('@angular/core/testing');
const { platformServerTesting, ServerTestingModule } = require('@angular/platform-server/testing');
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
ServerTestingModule,
platformServerTesting()
);
jasmine.execute();
import { TestBed } from '@angular/core/testing';
import {
ServerTestingModule,
platformServerTesting,
} from '@angular/platform-server/testing';
const originalConfigureTestingModule = TestBed.configureTestingModule;
TestBed.configureTestingModule = function() {
TestBed.resetTestingModule();
return originalConfigureTestingModule.apply(null, arguments as any);
};
TestBed.initTestEnvironment(ServerTestingModule, platformServerTesting());
protected async bootstrap(rootModule: any) {
getTestBed().initTestEnvironment(rootModule, platformServerTesting());
}
}
obs.updateQuery((prev) => {
const allHeroes = [...prev.allHeroes, result.addedHero];
return { ...prev, allHeroes: allHeroes };
});
});
}
private pushNewHero() {
client['networkInterface'].fireResult(1);
}
}
getTestBed().initTestEnvironment(
ServerTestingModule,
platformServerTesting(),
);
getTestBed().configureTestingModule({
declarations: [ HeroesComponent ],
providers: [
{ provide: ComponentFixtureAutoDetect, useValue: true },
APOLLO_PROVIDERS,
provideClientMap(() => client),
],
});
const fixture = TestBed.createComponent(HeroesComponent);
function getHTML(): string {
return clearHTML(ɵgetDOM().getInnerHTML(fixture.nativeElement).trim());
}
register({baseUrl, paths});
require('zone.js/dist/zone-node.js');
require('zone.js/dist/long-stack-trace-zone.js');
require('zone.js/dist/proxy.js');
require('zone.js/dist/sync-test.js');
require('zone.js/dist/async-test.js');
require('zone.js/dist/fake-async-test.js');
require('zone.js/dist/task-tracking.js');
require('reflect-metadata/Reflect');
const jasmine = new (require('jasmine'))({projectBaseDir: projectDir});
require('zone.js/dist/jasmine-patch.js');
const {TestBed} = require('@angular/core/testing');
const {ServerTestingModule, platformServerTesting} = require('@angular/platform-server/testing');
let testBed = TestBed.initTestEnvironment(
ServerTestingModule,
platformServerTesting()
);
patchTestBed(testBed);
jasmine.loadConfigFile('test/jasmine-ssr.json');
jasmine.execute();
done();
});
import 'reflect-metadata';
import {platformServerTesting, ServerTestingModule} from '@angular/platform-server/testing';
import { TestBed } from '@angular/core/testing';
TestBed.initTestEnvironment(ServerTestingModule, platformServerTesting());
console.log('initialised test env');