Skip to content

Commit

Permalink
fix(spec): get tests running using compatibility package
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonaden committed Mar 15, 2018
1 parent 6131529 commit 916e968
Show file tree
Hide file tree
Showing 182 changed files with 271 additions and 279 deletions.
6 changes: 5 additions & 1 deletion compat/Rx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
// Subject extends Observable and Observable references Subject in it's
// definition
export {Observable, Subject} from 'rxjs';
export {AnonymousSubject} from 'rxjs/internal-compatibility';
/* tslint:enable:no-unused-variable */

export { config } from 'rxjs/internal-compatibility';

// statics
/* tslint:disable:no-use-before-declare */
import './add/observable/bindCallback';
Expand Down Expand Up @@ -157,12 +160,13 @@ export {

export {TestScheduler} from 'rxjs/testing';

export { Operator, Subscriber, AsyncSubject, ConnectableObservable, TimeoutError, TimeInterval, Timestamp, VirtualTimeScheduler } from 'rxjs';
export { Operator, Subscriber, AsyncSubject, ConnectableObservable, TimeoutError, VirtualTimeScheduler } from 'rxjs';
export { AjaxRequest, AjaxResponse, AjaxError, AjaxTimeoutError } from 'rxjs/ajax';

import { asapScheduler, asyncScheduler, queueScheduler, animationFrameScheduler, SchedulerLike } from 'rxjs';

import { iterator, observable, rxSubscriber } from 'rxjs/internal-compatibility';
export { TimeInterval, Timestamp } from 'rxjs/internal-compatibility';

import * as _operators from 'rxjs/operators';

Expand Down
2 changes: 1 addition & 1 deletion compat/add/observable/throw.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Observable, throwError as staticThrowError } from 'rxjs';

(Observable as any).throw = staticThrowError;
(Observable as any).throwError = staticThrowError;
Observable.throwError = staticThrowError;

declare module 'rxjs/internal/Observable' {
namespace Observable {
Expand Down
1 change: 1 addition & 0 deletions compat/scheduler/animationFrame.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { animationFrameScheduler as animationFrame } from 'rxjs';
1 change: 1 addition & 0 deletions compat/scheduler/asap.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { asapScheduler as asap } from 'rxjs';
1 change: 1 addition & 0 deletions compat/scheduler/async.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { asyncScheduler as async } from 'rxjs';
1 change: 1 addition & 0 deletions compat/scheduler/queue.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { queueScheduler as queue } from 'rxjs';
1 change: 1 addition & 0 deletions legacy-reexport/scheduler/animationFrame.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from 'rxjs-compat/scheduler/animationFrame';
1 change: 1 addition & 0 deletions legacy-reexport/scheduler/asap.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from 'rxjs-compat/scheduler/asap';
1 change: 1 addition & 0 deletions legacy-reexport/scheduler/async.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from 'rxjs-compat/scheduler/async';
1 change: 1 addition & 0 deletions legacy-reexport/scheduler/queue.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from 'rxjs-compat/scheduler/queue';
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
"prepublish": "shx rm -rf ./typings && npm run build_all",
"publish_docs": "./publish_docs.sh",
"test_browser": "npm-run-all build_spec_browser && opn spec/support/mocha-browser-runner.html",
"test": "cross-env TS_NODE_FAST=true cross-env NODE_PATH=./dist-compat/package mocha --require ts-node/register --opts spec/support/coverage.opts \"spec/**/*-spec.ts\"",
"test": "cross-env TS_NODE_FAST=true NODE_PATH=./dist-compat:./dist mocha --require ts-node/register --opts spec/support/coverage.opts \"spec/**/*-spec.ts\"",
"test:cover": "cross-env TS_NODE_FAST=true nyc npm test",
"test:circular": "dependency-cruise --validate .dependency-cruiser.json -x \"^node_modules\" src",
"test:systemjs": "node integration/systemjs/systemjs-compatibility-spec.js",
Expand Down
2 changes: 1 addition & 1 deletion spec/Notification-spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from 'chai';
import * as Rx from '../src/internal/Rx';
import * as Rx from 'rxjs/Rx';
import { expectObservable } from './helpers/marble-testing';

const Notification = Rx.Notification;
Expand Down
2 changes: 1 addition & 1 deletion spec/Observable-spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai';
import * as sinon from 'sinon';
import * as Rx from '../src/internal/Rx';
import * as Rx from 'rxjs/Rx';
import { Observer, TeardownLogic } from '../src/internal/types';
import { cold, expectObservable, expectSubscriptions } from './helpers/marble-testing';
import { map } from '../src/internal/operators/map';
Expand Down
2 changes: 1 addition & 1 deletion spec/Scheduler-spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from 'chai';
import * as Rx from '../src/internal/Rx';
import * as Rx from 'rxjs/Rx';

const Scheduler = Rx.Scheduler;

Expand Down
2 changes: 1 addition & 1 deletion spec/Subject-spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from 'chai';
import * as Rx from '../src/internal/Rx';
import * as Rx from 'rxjs/Rx';
import { hot, expectObservable } from './helpers/marble-testing';

const Subject = Rx.Subject;
Expand Down
2 changes: 1 addition & 1 deletion spec/Subscriber-spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from 'chai';
import * as Rx from '../src/internal/Rx';
import * as Rx from 'rxjs/Rx';

const Subscriber = Rx.Subscriber;

Expand Down
2 changes: 1 addition & 1 deletion spec/Subscription-spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from 'chai';
import * as Rx from '../src/internal/Rx';
import * as Rx from 'rxjs/Rx';

const Observable = Rx.Observable;
const Subscription = Rx.Subscription;
Expand Down
2 changes: 1 addition & 1 deletion spec/ajax/index-spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as index from '../../src/ajax/index';
import * as index from 'rxjs/ajax';
import { expect } from 'chai';

describe('index', () => {
Expand Down
30 changes: 4 additions & 26 deletions spec/exports-spec.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,7 @@
import { expect } from 'chai';
import { bindCallback } from '../src/internal/observable/bindCallback';
import { bindNodeCallback } from '../src/internal/observable/bindNodeCallback';
import { combineLatest } from '../src/internal/observable/combineLatest';
import { concat } from '../src/internal/observable/concat';
import { defer } from '../src/internal/observable/defer';
import { empty } from '../src/internal/observable/empty';
import { forkJoin } from '../src/internal/observable/forkJoin';
import { from } from '../src/internal/observable/from';
import { fromEvent } from '../src/internal/observable/fromEvent';
import { fromEventPattern } from '../src/internal/observable/fromEventPattern';
import { fromPromise } from '../src/internal/observable/fromPromise';
import { iif } from '../src/internal/observable/iif';
import { interval } from '../src/internal/observable/interval';
import { merge } from '../src/internal/observable/merge';
import { never } from '../src/internal/observable/never';
import { of } from '../src/internal/observable/of';
import { onErrorResumeNext } from '../src/internal/observable/onErrorResumeNext';
import { pairs } from '../src/internal/observable/pairs';
import { race } from '../src/internal/observable/race';
import { range } from '../src/internal/observable/range';
import { throwError } from '../src/internal/observable/throwError';
import { timer } from '../src/internal/observable/timer';
import { using } from '../src/internal/observable/using';
import { zip } from '../src/internal/observable/zip';
import * as Rx from '../src/internal/Rx';
import { bindCallback, bindNodeCallback, combineLatest, concat, defer, empty, forkJoin, from, fromEvent, fromEventPattern,
iif, interval, merge, NEVER, of, onErrorResumeNext, pairs, race, range, throwError, timer, using, zip } from 'rxjs';
import * as Rx from 'rxjs/Rx';

describe('exports', () => {
it('should have rxjs/observable/bindCallback', () => {
Expand Down Expand Up @@ -67,7 +45,7 @@ describe('exports', () => {
});

it('should have rxjs/observable/fromPromise', () => {
expect(fromPromise).to.equal(Rx.Observable.fromPromise);
expect(from).to.equal(Rx.Observable.fromPromise);
});

it('should have rxjs/observable/iif', () => {
Expand Down
5 changes: 3 additions & 2 deletions spec/helpers/marble-testing.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Observable } from '../../src/internal/Observable';
import { Observable } from 'rxjs';
import { TestScheduler } from 'rxjs/testing';
import { SubscriptionLog } from '../../src/internal/testing/SubscriptionLog';
import { ColdObservable } from '../../src/internal/testing/ColdObservable';
import { HotObservable } from '../../src/internal/testing/HotObservable';
import { TestScheduler, observableToBeFn, subscriptionLogsToBeFn } from '../../src/internal/testing/TestScheduler';
import { observableToBeFn, subscriptionLogsToBeFn } from '../../src/internal/testing/TestScheduler';

declare const global: any;

Expand Down
9 changes: 4 additions & 5 deletions spec/helpers/test-helper.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
declare const global: any;

import * as Rx from '../../src/internal/Rx';
import { ObservableInput } from '../../src/internal/types';
import { root } from '../../src/internal/util/root';
import { $$iterator } from '../../src/internal/symbol/iterator';
import * as Rx from 'rxjs/Rx';
import { ObservableInput } from 'rxjs';
import { iterator, root } from 'rxjs/internal-compatibility';
import $$symbolObservable from 'symbol-observable';

export function lowerCaseO<T>(...args: Array<any>): Rx.Observable<T> {
Expand All @@ -30,7 +29,7 @@ export const createObservableInputs = <T>(value: T) => Rx.Observable.of<Observab
[value],
Promise.resolve(value),
<any>({
[$$iterator]: () => {
[iterator]: () => {
const iteratorResults = [
{ value, done: false },
{ done: true }
Expand Down
2 changes: 1 addition & 1 deletion spec/helpers/testScheduler-ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as _ from 'lodash';
import * as chai from 'chai';
import * as sinonChai from 'sinon-chai';

import * as Rx from '../../src/internal/Rx';
import * as Rx from 'rxjs/Rx';
import * as marble from './marble-testing';

//tslint:disable:no-var-requires no-require-imports
Expand Down
4 changes: 2 additions & 2 deletions spec/helpers/tests2png/diagram-test-runner.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { painter } from './painter';
import { Observable } from '../../../src/internal/Observable';
import { Observable } from 'rxjs';
import { TestScheduler } from 'rxjs/testing';
import { TestMessage } from '../../../src/internal/testing/TestMessage';
import { ColdObservable } from '../../../src/internal/testing/ColdObservable';
import { HotObservable } from '../../../src/internal/testing/HotObservable';
import { TestScheduler, observableToBeFn, subscriptionLogsToBeFn } from '../../../src/internal/testing/TestScheduler';
import { TestStream } from './types';

declare const global: any;
Expand Down
2 changes: 1 addition & 1 deletion spec/helpers/tests2png/painter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as gm from 'gm';
import * as Color from 'color';
import { cloneDeep, isEqual} from 'lodash';
import { TestMessage } from '../../../src/internal/testing/TestMessage';
import { Observable } from '../../../src/internal/Observable';
import { Observable } from 'rxjs';
import { GMObject, MarbleContent, TestStream } from './types';

let canvasHeight: number | undefined;
Expand Down
12 changes: 6 additions & 6 deletions spec/internal/rxjs-spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { expect } from 'chai';
import * as umd from '../../src/internal/umd';
import * as rx_index from '../../src';
import * as rx_operators from '../../src/operators';
import * as rx_testing from '../../src/testing';
import * as rx_ajax from '../../src/ajax';
import * as rx_websocket from '../../src/websocket';
import * as umd from 'rxjs/internal/umd';
import * as rx_index from 'rxjs';
import * as rx_operators from 'rxjs/operators';
import * as rx_testing from 'rxjs/testing';
import * as rx_ajax from 'rxjs/ajax';
import * as rx_websocket from 'rxjs/websocket';

describe('rxjs exports', () => {
Object.keys(rx_index).forEach(key => {
Expand Down
6 changes: 3 additions & 3 deletions spec/observables/IteratorObservable-spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from 'chai';
import * as Rx from '../../src/internal/Rx';
import { queue } from '../../src/internal/scheduler/queue';
import { fromIterable } from '../../src/internal/observable/fromIterable';
import * as Rx from 'rxjs/Rx';
import { queue } from 'rxjs/scheduler/queue';
import { fromIterable } from 'rxjs/internal-compatibility';

declare const expectObservable: any;
declare const rxTestScheduler: Rx.TestScheduler;
Expand Down
4 changes: 2 additions & 2 deletions spec/observables/ScalarObservable-spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai';
import * as Rx from '../../src/internal/Rx';
import { scalar } from '../../src/internal/observable/scalar';
import * as Rx from 'rxjs/Rx';
import { scalar } from 'rxjs/internal-compatibility';

declare const rxTestScheduler: Rx.TestScheduler;

Expand Down
4 changes: 2 additions & 2 deletions spec/observables/SubscribeOnObservable-spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from 'chai';
import * as sinon from 'sinon';
import * as Rx from '../../src/internal/Rx';
import { SubscribeOnObservable } from '../../src/internal/observable/SubscribeOnObservable';
import * as Rx from 'rxjs/Rx';
import { SubscribeOnObservable } from 'rxjs/internal-compatibility';
import { hot, expectObservable, expectSubscriptions } from '../helpers/marble-testing';

declare const rxTestScheduler: Rx.TestScheduler;
Expand Down
4 changes: 2 additions & 2 deletions spec/observables/bindCallback-spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from 'chai';
import * as sinon from 'sinon';
import { bindCallback } from '../../src/';
import { TestScheduler } from '../../src/testing';
import { bindCallback } from 'rxjs';
import { TestScheduler } from 'rxjs/testing';

declare const rxTestScheduler: TestScheduler;

Expand Down
4 changes: 2 additions & 2 deletions spec/observables/bindNodeCallback-spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from 'chai';
import * as sinon from 'sinon';
import { bindNodeCallback } from '../../src';
import { TestScheduler } from '../../src/testing';
import { bindNodeCallback } from 'rxjs';
import { TestScheduler } from 'rxjs/testing';

declare const rxTestScheduler: TestScheduler;

Expand Down
2 changes: 1 addition & 1 deletion spec/observables/combineLatest-spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from 'chai';
import * as Rx from '../../src/internal/Rx';
import * as Rx from 'rxjs/Rx';
import { hot, cold, expectObservable, expectSubscriptions } from '../helpers/marble-testing';

declare const type: Function;
Expand Down
2 changes: 1 addition & 1 deletion spec/observables/concat-spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from 'chai';
import * as Rx from '../../src/internal/Rx';
import * as Rx from 'rxjs/Rx';
import { lowerCaseO } from '../helpers/test-helper';
import { hot, cold, emptySubs, expectObservable, expectSubscriptions } from '../helpers/marble-testing';

Expand Down
4 changes: 2 additions & 2 deletions spec/observables/defer-spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai';
import { defer } from '../../src/';
import { Observable } from '../../src';
import { defer } from 'rxjs';
import { Observable } from 'rxjs';
import { hot, cold, expectObservable, expectSubscriptions } from '../helpers/marble-testing';

declare function asDiagram(arg: string): Function;
Expand Down
4 changes: 2 additions & 2 deletions spec/observables/dom/ajax-spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from 'chai';
import * as sinon from 'sinon';
import * as Rx from '../../../src/internal/Rx';
import { root } from '../../../src/internal/util/root';
import * as Rx from 'rxjs/Rx';
import { root } from 'rxjs/internal-compatibility';

declare const global: any;

Expand Down
2 changes: 1 addition & 1 deletion spec/observables/dom/webSocket-spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai';
import * as sinon from 'sinon';
import * as Rx from '../../../src/internal/Rx';
import * as Rx from 'rxjs/Rx';

declare const __root__: any;

Expand Down
6 changes: 3 additions & 3 deletions spec/observables/empty-spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { expect } from 'chai';
import { expectObservable } from '../helpers/marble-testing';
import { empty } from '../../src/';
import { EMPTY } from '../../src';
import { TestScheduler } from '../../src/testing';
import { empty } from 'rxjs';
import { EMPTY } from 'rxjs';
import { TestScheduler } from 'rxjs/testing';

declare const asDiagram: any;
declare const rxTestScheduler: TestScheduler;
Expand Down
2 changes: 1 addition & 1 deletion spec/observables/forkJoin-spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from 'chai';
import { Observable, forkJoin, of } from '../../src';
import { Observable, forkJoin, of } from 'rxjs';
import { lowerCaseO } from '../helpers/test-helper';
import { hot, expectObservable, expectSubscriptions } from '../helpers/marble-testing';

Expand Down
2 changes: 1 addition & 1 deletion spec/observables/from-promise-spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai';
import * as sinon from 'sinon';
import * as Rx from '../../src/internal/Rx';
import * as Rx from 'rxjs/Rx';

declare const process: any;
const Observable = Rx.Observable;
Expand Down
6 changes: 3 additions & 3 deletions spec/observables/from-spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from 'chai';
import { TestScheduler } from '../../src/testing';
import { Observable, asapScheduler, asyncScheduler, Observer } from '../../src';
import { of, from } from '../../src/';
import { TestScheduler } from 'rxjs/testing';
import { Observable, asapScheduler, asyncScheduler, Observer } from 'rxjs';
import { of, from } from 'rxjs';

// tslint:disable:no-any
declare const asDiagram: any;
Expand Down
4 changes: 2 additions & 2 deletions spec/observables/fromEvent-spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from 'chai';
import { expectObservable } from '../helpers/marble-testing';
import { fromEvent, NEVER, timer } from '../../src';
import { TestScheduler } from '../../src/testing';
import { fromEvent, NEVER, timer } from 'rxjs';
import { TestScheduler } from 'rxjs/testing';

declare function asDiagram(arg: string): Function;
declare const rxTestScheduler: TestScheduler;
Expand Down
4 changes: 2 additions & 2 deletions spec/observables/fromEventPattern-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { expect } from 'chai';
import * as sinon from 'sinon';
import { expectObservable } from '../helpers/marble-testing';

import { fromEventPattern, noop, NEVER, timer } from '../../src';
import { TestScheduler } from '../../src/testing';
import { fromEventPattern, noop, NEVER, timer } from 'rxjs';
import { TestScheduler } from 'rxjs/testing';

declare function asDiagram(arg: string): Function;
declare const rxTestScheduler: TestScheduler;
Expand Down
Loading

0 comments on commit 916e968

Please sign in to comment.