@kiwiproject/kiwi-test-js 0.2.0 → 0.3.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.
@@ -12,15 +12,25 @@ declare function startMinioContainer(accessKey?: string, secretKey?: string, ima
12
12
  */
13
13
  declare function stopMinioContainer(): Promise<void>;
14
14
  declare function setMinioPort(port: number): void;
15
+ declare function setMinioHost(host: string): void;
15
16
  /**
16
17
  * Retrieves the mapped external port of the started Minio container. Error will be thrown if startMinioContainer was
17
18
  * not previously called.
18
19
  */
19
20
  declare function getMinioPort(): number;
21
+ /**
22
+ * Retrieves the host of the started Minio container. Error will be thrown if startMinioContainer was
23
+ * not previously called.
24
+ *
25
+ * Note: In most cases this should return localhost.
26
+ */
27
+ declare function getMinioHost(): string;
20
28
  export declare const MinioExtension: {
21
29
  startMinioContainer: typeof startMinioContainer;
22
30
  stopMinioContainer: typeof stopMinioContainer;
23
31
  setMinioPort: typeof setMinioPort;
24
32
  getMinioPort: typeof getMinioPort;
33
+ getMinioHost: typeof getMinioHost;
34
+ setMinioHost: typeof setMinioHost;
25
35
  };
26
36
  export {};
@@ -33,6 +33,7 @@ function startMinioContainer(accessKey = "minioadmin", secretKey = "keyboard cat
33
33
  .withCommand(["server", "/data"])
34
34
  .start();
35
35
  setMinioPort(container.getMappedPort(9000));
36
+ setMinioHost(container.getHost());
36
37
  // NOTE: This will only work if tests are runInBand (i.e. not in parallel)
37
38
  global.MINIO_CONTAINER = container;
38
39
  });
@@ -47,11 +48,15 @@ function stopMinioContainer() {
47
48
  yield global.MINIO_CONTAINER.stop();
48
49
  global.MINIO_CONTAINER = undefined;
49
50
  delete process.env.MINIO_EXTENSION_PORT;
51
+ delete process.env.MINIO_EXTENSION_HOST;
50
52
  });
51
53
  }
52
54
  function setMinioPort(port) {
53
55
  process.env.MINIO_EXTENSION_PORT = String(port);
54
56
  }
57
+ function setMinioHost(host) {
58
+ process.env.MINIO_EXTENSION_HOST = host;
59
+ }
55
60
  /**
56
61
  * Retrieves the mapped external port of the started Minio container. Error will be thrown if startMinioContainer was
57
62
  * not previously called.
@@ -60,9 +65,21 @@ function getMinioPort() {
60
65
  kiwi_js_1.KiwiPreconditions.checkState(process.env.MINIO_EXTENSION_PORT !== undefined, "Minio container has not been previously started");
61
66
  return parseInt(process.env.MINIO_EXTENSION_PORT, 10);
62
67
  }
68
+ /**
69
+ * Retrieves the host of the started Minio container. Error will be thrown if startMinioContainer was
70
+ * not previously called.
71
+ *
72
+ * Note: In most cases this should return localhost.
73
+ */
74
+ function getMinioHost() {
75
+ kiwi_js_1.KiwiPreconditions.checkState(process.env.MINIO_EXTENSION_HOST !== undefined, "Minio container has not been previously started");
76
+ return process.env.MINIO_EXTENSION_HOST;
77
+ }
63
78
  exports.MinioExtension = {
64
79
  startMinioContainer,
65
80
  stopMinioContainer,
66
81
  setMinioPort,
67
82
  getMinioPort,
83
+ getMinioHost,
84
+ setMinioHost,
68
85
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiwiproject/kiwi-test-js",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "kiwi-test-js is a test utility library. Most of these utilities are ports from the Java Kiwi-test library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -22,27 +22,27 @@
22
22
  ]
23
23
  },
24
24
  "dependencies": {
25
- "@elastic/elasticsearch": "8.8.1",
26
- "@jest/globals": "29.6.4",
25
+ "@elastic/elasticsearch": "8.9.0",
26
+ "@jest/globals": "29.7.0",
27
27
  "@kiwiproject/kiwi-js": "0.8.0",
28
28
  "@testcontainers/elasticsearch": "10.2.1",
29
29
  "@testcontainers/postgresql": "10.2.1",
30
- "jest": "29.6.4",
31
- "mongodb": "5.8.1",
30
+ "jest": "29.7.0",
31
+ "mongodb": "6.0.0",
32
32
  "pg": "8.11.3",
33
33
  "testcontainers": "10.2.1"
34
34
  },
35
35
  "devDependencies": {
36
- "@babel/core": "7.22.10",
37
- "@babel/preset-env": "7.22.10",
38
- "@babel/preset-typescript": "7.22.5",
39
- "@types/node": "20.5.4",
36
+ "@babel/core": "7.22.17",
37
+ "@babel/preset-env": "7.22.15",
38
+ "@babel/preset-typescript": "7.22.15",
39
+ "@types/node": "20.6.0",
40
40
  "@types/pg": "8.10.2",
41
- "@typescript-eslint/eslint-plugin": "6.4.1",
42
- "@typescript-eslint/parser": "6.4.1",
43
- "babel-jest": "29.6.3",
44
- "eslint": "8.47.0",
45
- "prettier": "3.0.2",
46
- "typescript": "5.1.6"
41
+ "@typescript-eslint/eslint-plugin": "6.7.0",
42
+ "@typescript-eslint/parser": "6.7.0",
43
+ "babel-jest": "29.7.0",
44
+ "eslint": "8.49.0",
45
+ "prettier": "3.0.3",
46
+ "typescript": "5.2.2"
47
47
  }
48
48
  }