build(platform-browser): exclude node incompatible tests from :test target. (#21053)

PR Close #21053
This commit is contained in:
Misko Hevery 2017-12-17 22:18:50 -08:00 committed by Igor Minar
parent 6b81d1c9b9
commit 533a010b28
10 changed files with 15 additions and 5 deletions

View File

@ -14,7 +14,8 @@ import {DomRendererFactory2} from '@angular/platform-browser/src/dom/dom_rendere
import {InjectableAnimationEngine} from '../../animations/src/providers';
import {el} from '../../testing/src/browser_util';
{
(function() {
if (isNode) return;
describe('AnimationRenderer', () => {
let element: any;
beforeEach(() => {
@ -307,7 +308,7 @@ import {el} from '../../testing/src/browser_util';
expect(renderer.log).toEqual(['begin', 'end']);
});
});
}
})();
@Injectable()
class MockAnimationEngine extends InjectableAnimationEngine {

View File

@ -17,6 +17,7 @@ import {el} from '../../testing/src/browser_util';
{
describe('BrowserAnimationBuilder', () => {
if (isNode) return;
let element: any;
beforeEach(() => {
element = el('<div></div>');

View File

@ -132,6 +132,7 @@ function bootstrap(
lightDom: any /** TODO #9100 */;
describe('bootstrap factory method', () => {
if (isNode) return;
let compilerConsole: DummyConsole;
beforeEachProviders(() => { return [Log]; });

View File

@ -12,6 +12,7 @@ import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
{
describe('cookies', () => {
if (isNode) return;
it('sets cookie values', () => {
getDOM().setCookie('my test cookie', 'my test value');
getDOM().setCookie('my other cookie', 'my test value 2');

View File

@ -12,6 +12,7 @@ import {SpyComponentRef, callNgProfilerTimeChangeDetection} from './spies';
{
describe('profiler', () => {
if (isNode) return;
beforeEach(() => { enableDebugTools((<any>new SpyComponentRef())); });
afterEach(() => { disableDebugTools(); });

View File

@ -14,6 +14,7 @@ import {NAMESPACE_URIS} from '../../src/dom/dom_renderer';
{
describe('DefaultDomRendererV2', () => {
if (isNode) return;
let renderer: Renderer2;
beforeEach(() => {

View File

@ -13,7 +13,8 @@ import {DomEventsPlugin} from '@angular/platform-browser/src/dom/events/dom_even
import {EventManager, EventManagerPlugin} from '@angular/platform-browser/src/dom/events/event_manager';
import {el} from '../../../testing/src/browser_util';
{
(function() {
if (isNode) return;
let domEventPlugin: DomEventsPlugin;
let doc: any;
let zone: NgZone;
@ -319,7 +320,7 @@ import {el} from '../../../testing/src/browser_util';
expect(receivedEvent).toBe(null);
});
});
}
})();
/** @internal */
class FakeEventManagerPlugin extends EventManagerPlugin {

View File

@ -10,6 +10,7 @@ import {HammerGestureConfig, HammerGesturesPlugin} from '@angular/platform-brows
{
describe('HammerGesturesPlugin', () => {
if (isNode) return;
it('should implement addGlobalEventListener', () => {
const plugin = new HammerGesturesPlugin(document, new HammerGestureConfig());

View File

@ -11,6 +11,7 @@ import {KeyEventsPlugin} from '@angular/platform-browser/src/dom/events/key_even
{
describe('KeyEventsPlugin', () => {
if (isNode) return;
it('should ignore unrecognized events', () => {
expect(KeyEventsPlugin.parseEventName('keydown')).toEqual(null);

View File

@ -96,7 +96,8 @@ export class SwTestHarness implements ServiceWorkerGlobalScope, Adapter, Context
} as any;
static envIsSupported(): boolean {
return (typeof URL === 'function') || (typeof require === 'function' && typeof require('url')['parse'] === 'function');
return (typeof URL === 'function') ||
(typeof require === 'function' && typeof require('url')['parse'] === 'function');
}
time: number;