rxjs-marbles
Advanced tools
Comparing version 4.2.1 to 4.3.0
@@ -8,2 +8,3 @@ import { TestContext } from "ava"; | ||
export * from "../expect"; | ||
export * from "../fake"; | ||
export interface CasesFunction { | ||
@@ -22,1 +23,2 @@ <T extends UnnamedCase>(name: string, func: (context: Context, _case: T, t: TestContext) => void, cases: { | ||
export { cases, marbles }; | ||
export declare function fakeSchedulers(fakeTest: (t: TestContext) => any): (t: TestContext) => any; |
@@ -17,5 +17,7 @@ "use strict"; | ||
var configuration_1 = require("../configuration"); | ||
var fake_1 = require("../fake"); | ||
var marbles_1 = require("../marbles"); | ||
__export(require("../configuration")); | ||
__export(require("../expect")); | ||
__export(require("../fake")); | ||
function configure(configuration) { | ||
@@ -40,1 +42,5 @@ var factory = function (t) { return ({ | ||
exports.marbles = marbles; | ||
function fakeSchedulers(fakeTest) { | ||
return fake_1.fakeSchedulers(fakeTest); | ||
} | ||
exports.fakeSchedulers = fakeSchedulers; |
@@ -0,1 +1,8 @@ | ||
<a name="4.3.0"></a> | ||
## [4.3.0](https://github.com/cartant/rxjs-marbles/compare/v4.2.1...v4.3.0) (2018-06-24) | ||
### Features | ||
* Add `fakeSchedulers` helpers for all frameworks. ([54b86de](https://github.com/cartant/rxjs-marbles/commit/54b86de)) | ||
<a name="4.2.1"></a> | ||
@@ -2,0 +9,0 @@ ## [4.2.1](https://github.com/cartant/rxjs-marbles/compare/v4.2.0...v4.2.1) (2018-06-10) |
import { test } from "ava"; | ||
import { _cases } from "../cases"; | ||
import { defaults } from "../configuration"; | ||
import { fakeSchedulers as _fakeSchedulers } from "../fake"; | ||
import { configure as _configure } from "../marbles"; | ||
export * from "../configuration"; | ||
export * from "../expect"; | ||
export * from "../fake"; | ||
export function configure(configuration) { | ||
@@ -24,1 +26,4 @@ const factory = (t) => ({ | ||
export { cases, marbles }; | ||
export function fakeSchedulers(fakeTest) { | ||
return _fakeSchedulers(fakeTest); | ||
} |
@@ -6,6 +6,5 @@ import { fakeAsync, tick } from "@angular/core/testing"; | ||
try { | ||
let fakeTime = 0; | ||
asyncScheduler.now = () => fakeTime; | ||
fakeTest(milliseconds => { | ||
fakeTime += milliseconds; | ||
asyncScheduler.now = () => Date.now(); | ||
return fakeTest(milliseconds => { | ||
console.log("The tick parameter passed to the fakeSchedulers test is deprecated; call the @angular/core/testing tick function instead. See the examples for the intended usage."); | ||
tick(milliseconds); | ||
@@ -12,0 +11,0 @@ }); |
import { _cases } from "../cases"; | ||
import { defaults } from "../configuration"; | ||
import { fakeSchedulers as _fakeSchedulers } from "../fake"; | ||
import { configure as _configure } from "../marbles"; | ||
export * from "../configuration"; | ||
export * from "../expect"; | ||
export * from "../fake"; | ||
export * from "./observe"; | ||
@@ -26,1 +28,4 @@ export function configure(configuration) { | ||
export { cases, marbles }; | ||
export function fakeSchedulers(fakeTest) { | ||
return _fakeSchedulers(fakeTest); | ||
} |
@@ -8,3 +8,3 @@ import { asapScheduler, asyncScheduler } from "rxjs"; | ||
asyncScheduler.now = () => fakeTime; | ||
fakeTest(milliseconds => { | ||
return fakeTest(milliseconds => { | ||
fakeTime += milliseconds; | ||
@@ -11,0 +11,0 @@ jest.advanceTimersByTime(milliseconds); |
import { _cases } from "../cases"; | ||
import { defaults } from "../configuration"; | ||
import { fakeSchedulers as _fakeSchedulers } from "../fake"; | ||
import { configure as _configure } from "../marbles"; | ||
@@ -26,1 +27,4 @@ export * from "../configuration"; | ||
export { cases, marbles }; | ||
export function fakeSchedulers(fakeTest) { | ||
return _fakeSchedulers(fakeTest); | ||
} |
import * as tape from "tape"; | ||
import { _cases } from "../cases"; | ||
import { defaults } from "../configuration"; | ||
import { fakeSchedulers as _fakeSchedulers } from "../fake"; | ||
import { configure as _configure } from "../marbles"; | ||
export * from "../configuration"; | ||
export * from "../expect"; | ||
export * from "../fake"; | ||
export function configure(configuration) { | ||
@@ -24,1 +26,4 @@ const factory = (t) => ({ | ||
export { cases, marbles }; | ||
export function fakeSchedulers(fakeTest) { | ||
return _fakeSchedulers(fakeTest); | ||
} |
@@ -12,5 +12,7 @@ var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
import { defaults } from "../configuration"; | ||
import { fakeSchedulers as _fakeSchedulers } from "../fake"; | ||
import { configure as _configure } from "../marbles"; | ||
export * from "../configuration"; | ||
export * from "../expect"; | ||
export * from "../fake"; | ||
export function configure(configuration) { | ||
@@ -33,1 +35,4 @@ var factory = function (t) { return ({ | ||
export { cases, marbles }; | ||
export function fakeSchedulers(fakeTest) { | ||
return _fakeSchedulers(fakeTest); | ||
} |
@@ -6,6 +6,5 @@ import { fakeAsync, tick } from "@angular/core/testing"; | ||
try { | ||
var fakeTime_1 = 0; | ||
asyncScheduler.now = function () { return fakeTime_1; }; | ||
fakeTest(function (milliseconds) { | ||
fakeTime_1 += milliseconds; | ||
asyncScheduler.now = function () { return Date.now(); }; | ||
return fakeTest(function (milliseconds) { | ||
console.log("The tick parameter passed to the fakeSchedulers test is deprecated; call the @angular/core/testing tick function instead. See the examples for the intended usage."); | ||
tick(milliseconds); | ||
@@ -12,0 +11,0 @@ }); |
import { _cases } from "../cases"; | ||
import { defaults } from "../configuration"; | ||
import { fakeSchedulers as _fakeSchedulers } from "../fake"; | ||
import { configure as _configure } from "../marbles"; | ||
export * from "../configuration"; | ||
export * from "../expect"; | ||
export * from "../fake"; | ||
export * from "./observe"; | ||
@@ -38,1 +40,4 @@ export function configure(configuration) { | ||
export { cases, marbles }; | ||
export function fakeSchedulers(fakeTest) { | ||
return _fakeSchedulers(fakeTest); | ||
} |
@@ -8,3 +8,3 @@ import { asapScheduler, asyncScheduler } from "rxjs"; | ||
asyncScheduler.now = function () { return fakeTime_1; }; | ||
fakeTest(function (milliseconds) { | ||
return fakeTest(function (milliseconds) { | ||
fakeTime_1 += milliseconds; | ||
@@ -11,0 +11,0 @@ jest.advanceTimersByTime(milliseconds); |
import { _cases } from "../cases"; | ||
import { defaults } from "../configuration"; | ||
import { fakeSchedulers as _fakeSchedulers } from "../fake"; | ||
import { configure as _configure } from "../marbles"; | ||
@@ -38,1 +39,4 @@ export * from "../configuration"; | ||
export { cases, marbles }; | ||
export function fakeSchedulers(fakeTest) { | ||
return _fakeSchedulers(fakeTest); | ||
} |
@@ -12,5 +12,7 @@ var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
import { defaults } from "../configuration"; | ||
import { fakeSchedulers as _fakeSchedulers } from "../fake"; | ||
import { configure as _configure } from "../marbles"; | ||
export * from "../configuration"; | ||
export * from "../expect"; | ||
export * from "../fake"; | ||
export function configure(configuration) { | ||
@@ -33,1 +35,4 @@ var factory = function (t) { return ({ | ||
export { cases, marbles }; | ||
export function fakeSchedulers(fakeTest) { | ||
return _fakeSchedulers(fakeTest); | ||
} |
@@ -1,1 +0,1 @@ | ||
export declare function fakeSchedulers(fakeTest: (tick: (milliseconds: number) => void) => void): () => void; | ||
export declare function fakeSchedulers(fakeTest: (tick: (milliseconds: number) => void) => any): () => any; |
@@ -8,6 +8,5 @@ "use strict"; | ||
try { | ||
var fakeTime_1 = 0; | ||
rxjs_1.asyncScheduler.now = function () { return fakeTime_1; }; | ||
fakeTest(function (milliseconds) { | ||
fakeTime_1 += milliseconds; | ||
rxjs_1.asyncScheduler.now = function () { return Date.now(); }; | ||
return fakeTest(function (milliseconds) { | ||
console.log("The tick parameter passed to the fakeSchedulers test is deprecated; call the @angular/core/testing tick function instead. See the examples for the intended usage."); | ||
testing_1.tick(milliseconds); | ||
@@ -14,0 +13,0 @@ }); |
@@ -8,2 +8,3 @@ import { NamedCase, UnnamedCase } from "../cases"; | ||
export * from "../expect"; | ||
export * from "../fake"; | ||
export { MarblesFunction } from "../marbles"; | ||
@@ -23,1 +24,2 @@ export * from "./observe"; | ||
export { cases, marbles }; | ||
export declare function fakeSchedulers(fakeTest: () => any): () => any; |
@@ -8,5 +8,7 @@ "use strict"; | ||
var configuration_1 = require("../configuration"); | ||
var fake_1 = require("../fake"); | ||
var marbles_1 = require("../marbles"); | ||
__export(require("../configuration")); | ||
__export(require("../expect")); | ||
__export(require("../fake")); | ||
__export(require("./observe")); | ||
@@ -46,1 +48,5 @@ function configure(configuration) { | ||
exports.marbles = marbles; | ||
function fakeSchedulers(fakeTest) { | ||
return fake_1.fakeSchedulers(fakeTest); | ||
} | ||
exports.fakeSchedulers = fakeSchedulers; |
@@ -1,1 +0,1 @@ | ||
export declare function fakeSchedulers(fakeTest: (advance: (milliseconds: number) => void) => void): () => void; | ||
export declare function fakeSchedulers(fakeTest: (advance: (milliseconds: number) => void) => any): () => any; |
@@ -10,3 +10,3 @@ "use strict"; | ||
rxjs_1.asyncScheduler.now = function () { return fakeTime_1; }; | ||
fakeTest(function (milliseconds) { | ||
return fakeTest(function (milliseconds) { | ||
fakeTime_1 += milliseconds; | ||
@@ -13,0 +13,0 @@ jest.advanceTimersByTime(milliseconds); |
@@ -22,1 +22,2 @@ import { NamedCase, UnnamedCase } from "../cases"; | ||
export { cases, marbles }; | ||
export declare function fakeSchedulers(fakeTest: () => any): () => any; |
@@ -8,2 +8,3 @@ "use strict"; | ||
var configuration_1 = require("../configuration"); | ||
var fake_1 = require("../fake"); | ||
var marbles_1 = require("../marbles"); | ||
@@ -46,1 +47,5 @@ __export(require("../configuration")); | ||
exports.marbles = marbles; | ||
function fakeSchedulers(fakeTest) { | ||
return fake_1.fakeSchedulers(fakeTest); | ||
} | ||
exports.fakeSchedulers = fakeSchedulers; |
@@ -46,4 +46,4 @@ { | ||
"unpkg": "./bundles/rxjs-marbles.umd.js", | ||
"version": "4.2.1", | ||
"version": "4.3.0", | ||
"ava": {} | ||
} |
@@ -249,6 +249,6 @@ # rxjs-marbles | ||
In Jest and when testing Angular components with Jasmine, the test framework can be configured to use its own concept of fake time. | ||
With Jest and Jasmine, the test framework can be configured to use its own concept of fake time. AVA, Mocha and Tape don't have built-in support for fake time, but the functionality can be added via `sinon.useFakeTimers()`. | ||
It's possible to test observables using the test framework's concept of fake time, but the `now` method of the `AsyncScheduler` has to be patched. The `fakeSchedulers` can be used to do this. | ||
It's possible to test observables using the test framework's concept of fake time, but the `now` method of the `AsyncScheduler` has to be patched. The `fakeSchedulers` helper can be used to do this. | ||
See the [examples](./examples) for usage. |
@@ -8,2 +8,3 @@ import * as tape from "tape"; | ||
export * from "../expect"; | ||
export * from "../fake"; | ||
export interface CasesFunction { | ||
@@ -22,1 +23,2 @@ <T extends UnnamedCase>(name: string, func: (context: Context, _case: T, t: tape.Test) => void, cases: { | ||
export { cases, marbles }; | ||
export declare function fakeSchedulers(fakeTest: (t: tape.Test) => any): (t: tape.Test) => any; |
@@ -17,5 +17,7 @@ "use strict"; | ||
var configuration_1 = require("../configuration"); | ||
var fake_1 = require("../fake"); | ||
var marbles_1 = require("../marbles"); | ||
__export(require("../configuration")); | ||
__export(require("../expect")); | ||
__export(require("../fake")); | ||
function configure(configuration) { | ||
@@ -40,1 +42,5 @@ var factory = function (t) { return ({ | ||
exports.marbles = marbles; | ||
function fakeSchedulers(fakeTest) { | ||
return fake_1.fakeSchedulers(fakeTest); | ||
} | ||
exports.fakeSchedulers = fakeSchedulers; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
968654
107
9970
627