@naturalcycles/dev-lib 16.0.0 → 16.0.2

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,8 +1,6 @@
1
- import { expectTypeOf } from 'expect-type';
2
1
  import timekeeper from 'timekeeper';
3
- export * from '../jestOffline.util';
4
- export * from './expect.util';
5
2
  export * from './mockAllKindsOfThings';
6
3
  export * from './testing.util';
4
+ export * from './testOffline.util';
7
5
  export * from './time.util';
8
- export { expectTypeOf, timekeeper };
6
+ export { timekeeper };
@@ -1,13 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.timekeeper = exports.expectTypeOf = void 0;
3
+ exports.timekeeper = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const expect_type_1 = require("expect-type");
6
- Object.defineProperty(exports, "expectTypeOf", { enumerable: true, get: function () { return expect_type_1.expectTypeOf; } });
7
5
  const timekeeper_1 = tslib_1.__importDefault(require("timekeeper"));
8
6
  exports.timekeeper = timekeeper_1.default;
9
- tslib_1.__exportStar(require("../jestOffline.util"), exports);
10
- tslib_1.__exportStar(require("./expect.util"), exports);
11
7
  tslib_1.__exportStar(require("./mockAllKindsOfThings"), exports);
12
8
  tslib_1.__exportStar(require("./testing.util"), exports);
9
+ tslib_1.__exportStar(require("./testOffline.util"), exports);
13
10
  tslib_1.__exportStar(require("./time.util"), exports);
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Based on: https://github.com/palmerj3/jest-offline/blob/master/index.js
3
3
  */
4
- export declare function jestOffline(): void;
4
+ export declare function testOffline(): void;
5
5
  /**
6
6
  * Undo/reset the jestOffline() function by allowing network calls again.
7
7
  */
@@ -1,26 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.jestOffline = jestOffline;
3
+ exports.testOffline = testOffline;
4
4
  exports.jestOnline = jestOnline;
5
- const testing_1 = require("./testing");
5
+ const index_1 = require("./index");
6
6
  const LOCAL_HOSTS = ['localhost', '127.0.0.1'];
7
7
  const detectLeaks = process.argv.some(a => a.includes('detectLeaks'));
8
8
  let mitm;
9
9
  /**
10
10
  * Based on: https://github.com/palmerj3/jest-offline/blob/master/index.js
11
11
  */
12
- function jestOffline() {
12
+ function testOffline() {
13
13
  if (detectLeaks) {
14
- (0, testing_1.jestLog)('NOT applying jestOffline() when --detectLeaks is on');
14
+ (0, index_1.jestLog)('NOT applying testOffline() when --detectLeaks is on');
15
15
  return;
16
16
  }
17
- (0, testing_1.jestLog)('jest offline mode');
17
+ (0, index_1.jestLog)('test offline mode');
18
18
  const createMitm = require('mitm');
19
19
  mitm ||= createMitm();
20
20
  mitm.on('connect', (socket, opts) => {
21
21
  const { host } = opts;
22
22
  if (!LOCAL_HOSTS.includes(host)) {
23
- throw new Error(`Network request forbidden by jestOffline(): ${host}`);
23
+ throw new Error(`Network request forbidden by testOffline(): ${host}`);
24
24
  }
25
25
  socket.bypass();
26
26
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/dev-lib",
3
- "version": "16.0.0",
3
+ "version": "16.0.2",
4
4
  "scripts": {
5
5
  "prepare": "husky",
6
6
  "tsn-debug": "tsn testScript.ts",
@@ -34,7 +34,6 @@
34
34
  "eslint-plugin-simple-import-sort": "^12",
35
35
  "eslint-plugin-unicorn": "^57",
36
36
  "eslint-plugin-vue": "^10",
37
- "expect-type": "^1",
38
37
  "globals": "^16",
39
38
  "husky": "^9",
40
39
  "lint-staged": "^15",
@@ -1,8 +0,0 @@
1
- /**
2
- * expectResults(v => JSON.stringify(v), [
3
- * 1,
4
- * 2,
5
- * 3
6
- * ]).toMatchSnapshot()
7
- */
8
- export declare function expectResults(fn: (...args: any[]) => any, values: any[]): jest.JestMatchers<Map<any, any>>;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.expectResults = expectResults;
4
- /**
5
- * expectResults(v => JSON.stringify(v), [
6
- * 1,
7
- * 2,
8
- * 3
9
- * ]).toMatchSnapshot()
10
- */
11
- function expectResults(fn, values) {
12
- return expect(new Map(values.map(v => [v, fn(v)])));
13
- }