@timberio/tools
Advanced tools
Comparing version 0.16.0 to 0.17.0
@@ -9,3 +9,3 @@ "use strict"; | ||
/* | ||
* Min buffer Size to flush when limit is about to reach. | ||
* Min buffer size to flush when limit is about to be reached. | ||
*/ | ||
@@ -12,0 +12,0 @@ const MAX_BUFFER_SIZE = 100; |
@@ -6,6 +6,7 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const nock_1 = __importDefault(require("nock")); | ||
const cross_fetch_1 = __importDefault(require("cross-fetch")); | ||
const types_1 = require("@timberio/types"); | ||
const batch_1 = __importDefault(require("./batch")); | ||
const throttle_1 = __importDefault(require("./throttle")); | ||
const types_1 = require("@timberio/types"); | ||
const fetch_mock_1 = __importDefault(require("fetch-mock")); | ||
/** | ||
@@ -16,2 +17,3 @@ * Create a log with a random string / current date | ||
return { | ||
$schema: "https://raw.githubusercontent.com/timberio/log-event-json-schema/v4.1.0/schema.json", | ||
dt: new Date(), | ||
@@ -115,3 +117,5 @@ level: types_1.LogLevel.Info, | ||
it("should not fire timeout while a send was happening.", async (done) => { | ||
fetch_mock_1.default.mock("http://example.com", new Promise(res => setTimeout(() => res(200), 1003))); | ||
nock_1.default("http://example.com") | ||
.get("/") | ||
.reply(200, new Promise(res => setTimeout(() => res(200), 1003))); | ||
const called = jest.fn(); | ||
@@ -124,3 +128,3 @@ const size = 5; | ||
try { | ||
await fetch("http://example.com"); | ||
await cross_fetch_1.default("http://example.com"); | ||
} | ||
@@ -134,8 +138,10 @@ catch (e) { | ||
}); | ||
fetch_mock_1.default.restore(); | ||
expect(called).toHaveBeenCalledTimes(1); | ||
nock_1.default.restore(); | ||
done(); | ||
}); | ||
it("should handle another log that comes in while it's sending...", async (done) => { | ||
fetch_mock_1.default.mock("http://example.com", new Promise(res => setTimeout(() => res(200), 1003))); | ||
nock_1.default("http://example.com") | ||
.get("/") | ||
.reply(200, new Promise(res => setTimeout(() => res(200), 1003))); | ||
const called = jest.fn(); | ||
@@ -148,3 +154,3 @@ const size = 5; | ||
try { | ||
await fetch("http://example.com"); | ||
await cross_fetch_1.default("http://example.com"); | ||
} | ||
@@ -158,4 +164,4 @@ catch (e) { | ||
}); | ||
fetch_mock_1.default.restore(); | ||
expect(called).toHaveBeenCalledTimes(2); | ||
nock_1.default.restore(); | ||
done(); | ||
@@ -162,0 +168,0 @@ }); |
@@ -7,3 +7,3 @@ /* | ||
/* | ||
* Min buffer Size to flush when limit is about to reach. | ||
* Min buffer size to flush when limit is about to be reached. | ||
*/ | ||
@@ -10,0 +10,0 @@ const MAX_BUFFER_SIZE = 100; |
@@ -0,5 +1,6 @@ | ||
import nock from "nock"; | ||
import fetch from "cross-fetch"; | ||
import { LogLevel } from "@timberio/types"; | ||
import makeBatch from "./batch"; | ||
import makeThrottle from "./throttle"; | ||
import { LogLevel } from "@timberio/types"; | ||
import fetchMock from "fetch-mock"; | ||
/** | ||
@@ -10,2 +11,3 @@ * Create a log with a random string / current date | ||
return { | ||
$schema: "https://raw.githubusercontent.com/timberio/log-event-json-schema/v4.1.0/schema.json", | ||
dt: new Date(), | ||
@@ -109,3 +111,5 @@ level: LogLevel.Info, | ||
it("should not fire timeout while a send was happening.", async (done) => { | ||
fetchMock.mock("http://example.com", new Promise(res => setTimeout(() => res(200), 1003))); | ||
nock("http://example.com") | ||
.get("/") | ||
.reply(200, new Promise(res => setTimeout(() => res(200), 1003))); | ||
const called = jest.fn(); | ||
@@ -127,8 +131,10 @@ const size = 5; | ||
}); | ||
fetchMock.restore(); | ||
expect(called).toHaveBeenCalledTimes(1); | ||
nock.restore(); | ||
done(); | ||
}); | ||
it("should handle another log that comes in while it's sending...", async (done) => { | ||
fetchMock.mock("http://example.com", new Promise(res => setTimeout(() => res(200), 1003))); | ||
nock("http://example.com") | ||
.get("/") | ||
.reply(200, new Promise(res => setTimeout(() => res(200), 1003))); | ||
const called = jest.fn(); | ||
@@ -150,4 +156,4 @@ const size = 5; | ||
}); | ||
fetchMock.restore(); | ||
expect(called).toHaveBeenCalledTimes(2); | ||
nock.restore(); | ||
done(); | ||
@@ -154,0 +160,0 @@ }); |
{ | ||
"name": "@timberio/tools", | ||
"version": "0.16.0", | ||
"version": "0.17.0", | ||
"description": "Javascript logging tools", | ||
@@ -24,7 +24,9 @@ "main": "dist/cjs/index.js", | ||
"devDependencies": { | ||
"@types/fetch-mock": "^6.0.4", | ||
"@types/jest": "^23.3.10", | ||
"@types/nock": "^9.3.0", | ||
"@types/node": "^10.12.10", | ||
"@types/source-map": "^0.5.7", | ||
"cross-fetch": "^3.0.0", | ||
"jest": "^23.6.0", | ||
"nock": "^10.0.4", | ||
"npm-run-all": "^4.1.5", | ||
@@ -35,6 +37,6 @@ "prettier": "^1.15.3", | ||
}, | ||
"gitHead": "13fe691283afc3d96d5bc1ff7b13173f55389621", | ||
"gitHead": "4e067b488fd87e43621d053b58e665bf55632bd8", | ||
"dependencies": { | ||
"@timberio/types": "^0.16.0" | ||
"@timberio/types": "^0.17.0" | ||
} | ||
} |
@@ -0,5 +1,6 @@ | ||
import nock from "nock"; | ||
import fetch from "cross-fetch"; | ||
import { ITimberLog, LogLevel } from "@timberio/types"; | ||
import makeBatch from "./batch"; | ||
import makeThrottle from "./throttle"; | ||
import { ITimberLog, LogLevel } from "@timberio/types"; | ||
import fetchMock from "fetch-mock"; | ||
@@ -11,2 +12,4 @@ /** | ||
return { | ||
$schema: | ||
"https://raw.githubusercontent.com/timberio/log-event-json-schema/v4.1.0/schema.json", | ||
dt: new Date(), | ||
@@ -137,6 +140,6 @@ level: LogLevel.Info, | ||
it("should not fire timeout while a send was happening.", async done => { | ||
fetchMock.mock( | ||
"http://example.com", | ||
new Promise(res => setTimeout(() => res(200), 1003)) | ||
); | ||
nock("http://example.com") | ||
.get("/") | ||
.reply(200, new Promise(res => setTimeout(() => res(200), 1003))); | ||
const called = jest.fn(); | ||
@@ -159,4 +162,4 @@ const size = 5; | ||
}); | ||
fetchMock.restore(); | ||
expect(called).toHaveBeenCalledTimes(1); | ||
nock.restore(); | ||
done(); | ||
@@ -166,6 +169,6 @@ }); | ||
it("should handle another log that comes in while it's sending...", async done => { | ||
fetchMock.mock( | ||
"http://example.com", | ||
new Promise(res => setTimeout(() => res(200), 1003)) | ||
); | ||
nock("http://example.com") | ||
.get("/") | ||
.reply(200, new Promise(res => setTimeout(() => res(200), 1003))); | ||
const called = jest.fn(); | ||
@@ -188,4 +191,4 @@ const size = 5; | ||
}); | ||
fetchMock.restore(); | ||
expect(called).toHaveBeenCalledTimes(2); | ||
nock.restore(); | ||
done(); | ||
@@ -192,0 +195,0 @@ }); |
@@ -21,3 +21,3 @@ import { ITimberLog } from "@timberio/types"; | ||
/* | ||
* Min buffer Size to flush when limit is about to reach. | ||
* Min buffer size to flush when limit is about to be reached. | ||
*/ | ||
@@ -24,0 +24,0 @@ const MAX_BUFFER_SIZE = 100; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
123753
96
2394
3
11
+ Added@timberio/types@0.17.0(transitive)
- Removed@timberio/types@0.16.0(transitive)
Updated@timberio/types@^0.17.0