@naturalcycles/dev-lib 19.12.1 → 19.12.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.
@@ -7,12 +7,13 @@ let mitm;
7
7
  * Based on: https://github.com/palmerj3/jest-offline/blob/master/index.js
8
8
  */
9
9
  export function testOffline() {
10
+ if (mitm)
11
+ return; // already applied
10
12
  if (detectLeaks) {
11
13
  console.log('NOT applying testOffline() when --detectLeaks is on');
12
14
  return;
13
15
  }
14
- console.log('test offline mode');
15
- mitm ||= createMitm();
16
+ mitm = createMitm();
16
17
  mitm.on('connect', (socket, opts) => {
17
18
  const { host } = opts;
18
19
  if (!LOCAL_HOSTS.includes(host)) {
@@ -27,4 +28,5 @@ export function testOffline() {
27
28
  */
28
29
  export function testOnline() {
29
30
  mitm?.disable();
31
+ mitm = undefined;
30
32
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/dev-lib",
3
3
  "type": "module",
4
- "version": "19.12.1",
4
+ "version": "19.12.2",
5
5
  "dependencies": {
6
6
  "@biomejs/biome": "^2",
7
7
  "@commitlint/cli": "^19",