@naturalcycles/dev-lib 13.32.6 → 13.34.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.
@@ -87,11 +87,6 @@ module.exports = {
87
87
  skipNodeResolution: true,
88
88
  testEnvironment: 'node',
89
89
  errorOnDeprecated: true,
90
- snapshotFormat: {
91
- // todo: remove when jest@29 makes it default
92
- escapeString: false,
93
- printBasicPrototype: false,
94
- },
95
90
  restoreMocks: true,
96
91
  unmockedModulePathPatterns: [],
97
92
  setupFilesAfterEnv,
@@ -137,4 +132,5 @@ module.exports = {
137
132
  },
138
133
  ],
139
134
  ].filter(Boolean),
135
+ prettierPath: null, // todo: remove when jest has fixed it https://github.com/jestjs/jest/issues/14305
140
136
  }
package/cfg/tsconfig.json CHANGED
@@ -14,6 +14,7 @@
14
14
  "lib": ["esnext"], // add "dom" if needed
15
15
  "module": "commonjs",
16
16
  "moduleResolution": "node",
17
+ "moduleDetection": "force",
17
18
 
18
19
  // Emit
19
20
  "sourceMap": false,
@@ -2,3 +2,7 @@
2
2
  * Based on: https://github.com/palmerj3/jest-offline/blob/master/index.js
3
3
  */
4
4
  export declare function jestOffline(): void;
5
+ /**
6
+ * Undo/reset the jestOffline() function by allowing network calls again.
7
+ */
8
+ export declare function jestOnline(): void;
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.jestOffline = void 0;
3
+ exports.jestOnline = exports.jestOffline = void 0;
4
4
  const testing_1 = require("./testing");
5
5
  const LOCAL_HOSTS = ['localhost', '127.0.0.1'];
6
6
  const detectLeaks = process.argv.some(a => a.includes('detectLeaks'));
7
+ let mitm;
7
8
  /**
8
9
  * Based on: https://github.com/palmerj3/jest-offline/blob/master/index.js
9
10
  */
@@ -14,7 +15,7 @@ function jestOffline() {
14
15
  }
15
16
  (0, testing_1.jestLog)('jest offline mode');
16
17
  const createMitm = require('mitm');
17
- const mitm = createMitm();
18
+ mitm ||= createMitm();
18
19
  mitm.on('connect', (socket, opts) => {
19
20
  const { host } = opts;
20
21
  if (!LOCAL_HOSTS.includes(host)) {
@@ -24,3 +25,10 @@ function jestOffline() {
24
25
  });
25
26
  }
26
27
  exports.jestOffline = jestOffline;
28
+ /**
29
+ * Undo/reset the jestOffline() function by allowing network calls again.
30
+ */
31
+ function jestOnline() {
32
+ mitm?.disable();
33
+ }
34
+ exports.jestOnline = jestOnline;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/dev-lib",
3
- "version": "13.32.6",
3
+ "version": "13.34.0",
4
4
  "scripts": {
5
5
  "prepare": "husky install",
6
6
  "tsn-debug": "tsn testScript.ts",