Skip to content

Commit

Permalink
build(platform-browser): exclude node incompatible tests from :test t…
Browse files Browse the repository at this point in the history
…arget. (angular#21053)

PR Close angular#21053
  • Loading branch information
mhevery authored and IgorMinar committed Dec 22, 2017
1 parent 6b81d1c commit 533a010
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down Expand Up @@ -307,7 +308,7 @@ import {el} from '../../testing/src/browser_util';
expect(renderer.log).toEqual(['begin', 'end']);
});
});
}
})();

@Injectable()
class MockAnimationEngine extends InjectableAnimationEngine {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {el} from '../../testing/src/browser_util';

{
describe('BrowserAnimationBuilder', () => {
if (isNode) return;
let element: any;
beforeEach(() => {
element = el('<div></div>');
Expand Down
1 change: 1 addition & 0 deletions packages/platform-browser/test/browser/bootstrap_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ function bootstrap(
lightDom: any /** TODO #9100 */;

describe('bootstrap factory method', () => {
if (isNode) return;
let compilerConsole: DummyConsole;

beforeEachProviders(() => { return [Log]; });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
1 change: 1 addition & 0 deletions packages/platform-browser/test/browser/tools/tools_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {SpyComponentRef, callNgProfilerTimeChangeDetection} from './spies';

{
describe('profiler', () => {
if (isNode) return;
beforeEach(() => { enableDebugTools((<any>new SpyComponentRef())); });

afterEach(() => { disableDebugTools(); });
Expand Down
1 change: 1 addition & 0 deletions packages/platform-browser/test/dom/dom_renderer_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {NAMESPACE_URIS} from '../../src/dom/dom_renderer';

{
describe('DefaultDomRendererV2', () => {
if (isNode) return;
let renderer: Renderer2;

beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -319,7 +320,7 @@ import {el} from '../../../testing/src/browser_util';
expect(receivedEvent).toBe(null);
});
});
}
})();

/** @internal */
class FakeEventManagerPlugin extends EventManagerPlugin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion packages/service-worker/worker/testing/scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 533a010

Please sign in to comment.