@naturalcycles/dev-lib 19.13.0 → 19.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,4 @@
1
+ import { AppError } from '@naturalcycles/js-lib/error/error.util.js';
1
2
  import { red } from '@naturalcycles/nodejs-lib/colors';
2
3
  import createMitm from 'mitm';
3
4
  const LOCAL_HOSTS = ['localhost', '127.0.0.1'];
@@ -19,7 +20,9 @@ export function testOffline(opt) {
19
20
  if (!LOCAL_HOSTS.includes(host)) {
20
21
  process.stderr.write(red(`Network request forbidden by testOffline: ${host}\n`));
21
22
  opt?.onForbiddenRequest?.(host);
22
- throw new Error(`Network request forbidden by testOffline: ${host}`);
23
+ throw new AppError(`Network request forbidden by testOffline: ${host}`, {
24
+ backendResponseStatusCode: 410,
25
+ });
23
26
  }
24
27
  socket.bypass();
25
28
  });
@@ -1,3 +1,3 @@
1
1
  export declare function silentConsole(): void;
2
- export declare const testLogger: import("@naturalcycles/js-lib/log").CommonLogger;
3
- export declare const testLog: import("@naturalcycles/js-lib/log").CommonLogFunction;
2
+ export declare const testLogger: any;
3
+ export declare const testLog: any;
@@ -1,8 +1,2 @@
1
1
  import type { UnixTimestamp } from '@naturalcycles/js-lib/types';
2
2
  export declare const MOCK_TS_2018_06_21: UnixTimestamp;
3
- /**
4
- * Locks time-related functions to return always same time.
5
- * For deterministic tests.
6
- */
7
- export declare function mockTime(ts?: UnixTimestamp): void;
8
- export declare function resetTime(): void;
@@ -1,12 +1 @@
1
- import timekeeper from 'timekeeper';
2
- export const MOCK_TS_2018_06_21 = 1_529_539_200;
3
- /**
4
- * Locks time-related functions to return always same time.
5
- * For deterministic tests.
6
- */
7
- export function mockTime(ts = MOCK_TS_2018_06_21) {
8
- timekeeper.freeze(ts * 1000);
9
- }
10
- export function resetTime() {
11
- timekeeper.reset();
12
- }
1
+ export const MOCK_TS_2018_06_21 = 1529539200;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/dev-lib",
3
3
  "type": "module",
4
- "version": "19.13.0",
4
+ "version": "19.14.0",
5
5
  "dependencies": {
6
6
  "@biomejs/biome": "^2",
7
7
  "@commitlint/cli": "^19",
@@ -24,7 +24,6 @@
24
24
  "micromatch": "^4",
25
25
  "mitm": "^1",
26
26
  "prettier": "^3",
27
- "timekeeper": "^2",
28
27
  "typescript-eslint": "^8",
29
28
  "vue-eslint-parser": "^10"
30
29
  },