@midnightntwrk/testkit-js 0.0.0-stage → 5.0.1
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.
- package/README.md +409 -2
- package/dist/fixtures/hf/README.md +781 -0
- package/dist/fixtures/hf/coin-receiver-016/coin-receiver.compact +24 -0
- package/dist/fixtures/hf/coin-receiver-016/compiled/compiler/contract-info.json +104 -0
- package/dist/fixtures/hf/coin-receiver-016/compiled/contract/index.d.ts +47 -0
- package/dist/fixtures/hf/coin-receiver-016/compiled/contract/index.js +412 -0
- package/dist/fixtures/hf/coin-receiver-016/receive-coin-transcript.recording.json +668 -0
- package/dist/fixtures/hf/coin-receiver-016/state-v6-envelope.hex +1 -0
- package/dist/fixtures/hf/coin-receiver-016/state-v9.hex +1 -0
- package/dist/fixtures/hf/counter-016/compiled/compiler/contract-info.json +31 -0
- package/dist/fixtures/hf/counter-016/compiled/contract/index.d.ts +39 -0
- package/dist/fixtures/hf/counter-016/compiled/contract/index.js +189 -0
- package/dist/fixtures/hf/counter-016/compiled/keys/increment.prover +0 -0
- package/dist/fixtures/hf/counter-016/compiled/keys/increment.verifier +0 -0
- package/dist/fixtures/hf/counter-016/compiled/zkir/increment.bzkir +0 -0
- package/dist/fixtures/hf/counter-016/compiled/zkir/increment.zkir +22 -0
- package/dist/fixtures/hf/counter-016/increment-transcript.golden.json +23 -0
- package/dist/fixtures/hf/fixtures.json +69 -0
- package/dist/fixtures/hf/pre-fork-private-state-store/.gitattributes +8 -0
- package/dist/fixtures/hf/pre-fork-private-state-store/ENVELOPE.md +70 -0
- package/dist/fixtures/hf/pre-fork-private-state-store/store/000005.ldb +0 -0
- package/dist/fixtures/hf/pre-fork-private-state-store/store/000006.log +0 -0
- package/dist/fixtures/hf/pre-fork-private-state-store/store/CURRENT +1 -0
- package/dist/fixtures/hf/pre-fork-private-state-store/store/MANIFEST-000004 +0 -0
- package/dist/fixtures/hf/private-counter-016/README.md +13 -0
- package/dist/fixtures/hf/private-counter-016/compiled/compiler/contract-info.json +40 -0
- package/dist/fixtures/hf/private-counter-016/compiled/contract/index.d.ts +40 -0
- package/dist/fixtures/hf/private-counter-016/compiled/contract/index.js +211 -0
- package/dist/fixtures/hf/private-counter-twin/compiled/compiler/contract-info.json +41 -0
- package/dist/fixtures/hf/private-counter-twin/compiled/contract/index.js +271 -0
- package/dist/fixtures/hf/private-counter-twin/private-counter.compact +27 -0
- package/dist/fixtures/hf/state-both-keys.hex +1 -0
- package/dist/fixtures/hf/state-co-v2-only-foreign.hex +1 -0
- package/dist/fixtures/hf/state-migrated-v9-merkle.hex +1 -0
- package/dist/fixtures/hf/state-migrated-v9.hex +1 -0
- package/dist/fixtures/hf/state-tampered-bytes.hex +1 -0
- package/dist/fixtures/hf/state-tampered-keyset-v8to9.hex +1 -0
- package/dist/fixtures/hf/state-tampered-keyset-v9to8.hex +1 -0
- package/dist/fixtures/hf/state-v8-v6-envelope.hex +1 -0
- package/dist/fixtures/hf/state-v8.hex +1 -0
- package/dist/fixtures/hf/twin-contract/compiled/compiler/contract-info.json +31 -0
- package/dist/fixtures/hf/twin-contract/compiled/compiler/contract-manifest.json +58 -0
- package/dist/fixtures/hf/twin-contract/compiled/contract/index.d.ts +40 -0
- package/dist/fixtures/hf/twin-contract/compiled/contract/index.js +196 -0
- package/dist/fixtures/hf/twin-contract/compiled/keys/increment.prover +0 -0
- package/dist/fixtures/hf/twin-contract/compiled/keys/increment.verifier +0 -0
- package/dist/fixtures/hf/twin-contract/compiled/zkir/increment.bzkir +0 -0
- package/dist/fixtures/hf/twin-contract/compiled/zkir/increment.zkir +22 -0
- package/dist/fixtures/hf/twin-contract/counter.compact +15 -0
- package/dist/fixtures-hf.d.ts +70 -0
- package/dist/fixtures-hf.js +161 -0
- package/dist/fixtures-hf.js.map +1 -0
- package/dist/index.d.ts +1067 -0
- package/dist/index.js +3459 -0
- package/dist/index.js.map +1 -0
- package/package.json +82 -3
package/README.md
CHANGED
|
@@ -1,3 +1,410 @@
|
|
|
1
|
-
#
|
|
1
|
+
# What is this?
|
|
2
|
+
A comprehensive testing solution for your Midnight.JS applications, providing seamless integration with various test environments.
|
|
2
3
|
|
|
3
|
-
This
|
|
4
|
+
This package was created for the [Midnight network](https://midnight.network).
|
|
5
|
+
|
|
6
|
+
Please visit the [Midnight Developer Hub](https://midnight.network/developer-hub) to learn more.
|
|
7
|
+
|
|
8
|
+
# Use only in Midnight test environments
|
|
9
|
+
Image exclusively for Midnight test environments use.
|
|
10
|
+
|
|
11
|
+
# Agree to Terms
|
|
12
|
+
By downloading and using this image, you agree to [Midnight’s Terms and Conditions](https://midnight.network/static/terms.pdf), which includes the [Privacy Policy](https://midnight.network/static/privacy-policy.pdf).
|
|
13
|
+
|
|
14
|
+
# License
|
|
15
|
+
The software provided herein is licensed under the [Apache License V2.0](http://www.apache.org/licenses/LICENSE-2.0).
|
|
16
|
+
|
|
17
|
+
## Table of Contents
|
|
18
|
+
1. [Installation](#installation)
|
|
19
|
+
2. [Getting Started](#getting-started)
|
|
20
|
+
3. [Features](#Features)
|
|
21
|
+
4. [Limitations](#Limitations)
|
|
22
|
+
5. [Examples of Usage](#Examples-of-Usage)
|
|
23
|
+
6. [Containers Configuration](#8-containers-configuration)
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
Before using the testing library, ensure you have the following prerequisites:
|
|
29
|
+
1. Node.js and yarn installed
|
|
30
|
+
2. Docker Desktop (optional for local dockerized tests)
|
|
31
|
+
3. Midnight.JS project set up
|
|
32
|
+
|
|
33
|
+
Install the testing library by running the following command in your terminal:
|
|
34
|
+
```
|
|
35
|
+
yarn add -D @midnightntwrk/testkit-js
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Getting Started
|
|
39
|
+
To use the testing library, create a new file called `midnight.test.js` in the `__tests__` directory of your project. In this file, import the necessary dependencies:
|
|
40
|
+
```typescript
|
|
41
|
+
import { getTestEnvironment } from '@midnightntwrk/testkit-js';
|
|
42
|
+
|
|
43
|
+
beforeAll(async () => {
|
|
44
|
+
testEnvironment = getTestEnvironment(logger);
|
|
45
|
+
environmentConfiguration = await testEnvironment.start();
|
|
46
|
+
walletProvider = await testEnvironment.getMidnightWalletProvider();
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
afterAll(async () => {
|
|
50
|
+
await testEnvironment.shutdown();
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Features
|
|
57
|
+
|
|
58
|
+
Set of functions that simplify testing of DApps in Midnight
|
|
59
|
+
|
|
60
|
+
- [x] Standard Dockerized environment setup - both live and local
|
|
61
|
+
- [x] Predefined Midnight environments configuration
|
|
62
|
+
- [x] Proof server control
|
|
63
|
+
- [x] Wallets management
|
|
64
|
+
- [x] Fund wallets
|
|
65
|
+
- [x] Check system health
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Environment variables
|
|
70
|
+
|
|
71
|
+
### Environment selection:
|
|
72
|
+
- MN_TEST_ENVIRONMENT controls the environment to be used for testing. It can take one of these values:
|
|
73
|
+
- undeployed
|
|
74
|
+
- qanet
|
|
75
|
+
- preview
|
|
76
|
+
- preprod
|
|
77
|
+
- env-var-remote
|
|
78
|
+
|
|
79
|
+
If **MN_TEST_ENVIRONMENT** is not set, the default value will be `undeployed`.
|
|
80
|
+
If **MN_TEST_ENVIRONMENT** is set to `undeployed`, the testing environment will be deployed locally using Docker.
|
|
81
|
+
If **MN_TEST_ENVIRONMENT** is set to `qanet`, `preview`, `preprod`, or `env-var-remote` the testing environment will be the corresponding live network, with proof server setup using predefined NETWORK_ID.
|
|
82
|
+
If **MN_TEST_ENVIRONMENT** is set to `env-var-remote`, below environment variables must be set:
|
|
83
|
+
- *MN_TEST_NETWORK_ID* - Proof server NETWORK_ID
|
|
84
|
+
- *MN_TEST_INDEXER* - Indexer URL
|
|
85
|
+
- *MN_TEST_INDEXER_WS* - Indexer WebSocket URL
|
|
86
|
+
- *MN_TEST_NODE* - Node URL
|
|
87
|
+
- *MN_TEST_FAUCET* - Faucet URL
|
|
88
|
+
|
|
89
|
+
### Wallet setup:
|
|
90
|
+
- MN_TEST_WALLET_SEED can be used to set a specific seed phrase for the wallet. If not set, a random seed phrase will be used.
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Limitations
|
|
95
|
+
|
|
96
|
+
- Localnet wallets limit count is 4
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Examples of Usage
|
|
101
|
+
|
|
102
|
+
### 1. Selecting Different Environments
|
|
103
|
+
|
|
104
|
+
You can control the test environment using the `MN_TEST_ENVIRONMENT` environment variable. Here's how you can set it:
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
const testEnvironment = getTestEnvironment(logger);
|
|
108
|
+
environmentConfiguration = await testEnvironment.start();
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
```shell
|
|
112
|
+
# Example: Set the environment variable before initializing the test environment
|
|
113
|
+
MN_TEST_ENVIRONMENT='preview'; yarn test
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
This allows you to easily switch between predefined environments like `qanet`, `preview`, `preprod`, and others.
|
|
117
|
+
Default (undefined) value is `undeployed` which will deploy the testing environment locally using Docker.
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
### 2. Creating and Managing Wallets
|
|
122
|
+
|
|
123
|
+
Here's an example of creating wallets in your test environment:
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
// Example: Create multiple wallets in a test environment
|
|
127
|
+
const testEnvironment = getTestEnvironment(logger);
|
|
128
|
+
await testEnvironment.start();
|
|
129
|
+
|
|
130
|
+
// Create 2 wallets
|
|
131
|
+
const wallets = await testEnvironment.startMidnightWalletProviders(2);
|
|
132
|
+
|
|
133
|
+
// Verify wallet properties
|
|
134
|
+
expect(wallets).toHaveLength(2);
|
|
135
|
+
wallets.forEach(async (wallet) => {
|
|
136
|
+
expect(wallet.coinPublicKey).not.toBeUndefined();
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
// Shutdown the environment after testing
|
|
140
|
+
await testEnvironment.shutdown();
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
This demonstrates how to create wallets and verify their properties, such as the `coinPublicKey`.
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
### 3. Setting Wallet Seeds
|
|
148
|
+
|
|
149
|
+
If you need to use specific wallet seeds for testing, you can do the following:
|
|
150
|
+
|
|
151
|
+
```typescript
|
|
152
|
+
// Example: Create a wallet with a predefined seed phrase
|
|
153
|
+
const wallet = await testEnvironment.getMidnightWalletProvider();
|
|
154
|
+
|
|
155
|
+
expect(wallet.coinPublicKey).not.toBeUndefined();
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
```shell
|
|
159
|
+
# Example: Set the environment variable before initializing the test environment
|
|
160
|
+
MN_TEST_WALLET_SEED='00000000000000000000000000000042'; yarn test
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
This allows you to test specific scenarios using known wallet seeds.
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
### 4. Handling Environment Configuration
|
|
168
|
+
|
|
169
|
+
You can also customize the test environment configuration by modifying the `defaultContainersConfiguration` object:
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
import {
|
|
173
|
+
defaultContainersConfiguration,
|
|
174
|
+
getContainersConfiguration,
|
|
175
|
+
setContainersConfiguration
|
|
176
|
+
} from '../configuration';
|
|
177
|
+
|
|
178
|
+
// Example: Modify default environment configuration before starting
|
|
179
|
+
const config: ContainersConfiguration = {
|
|
180
|
+
...defaultContainersConfiguration,
|
|
181
|
+
proofServer: {
|
|
182
|
+
...defaultContainersConfiguration.proofServer,
|
|
183
|
+
fileName: 'proof-server.yml'
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
setContainersConfiguration(config);
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
This gives developers flexibility in configuring the test environment according to their needs.
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
### 5. Error Handling
|
|
194
|
+
|
|
195
|
+
Here's an example of handling errors when setting up wallets:
|
|
196
|
+
|
|
197
|
+
```typescript
|
|
198
|
+
// Example: Test for maximum wallet limit exceeded
|
|
199
|
+
process.env.MN_TEST_ENVIRONMENT = undefined; // Use local environment
|
|
200
|
+
const testEnvironment = getTestEnvironment(logger);
|
|
201
|
+
await testEnvironment.start();
|
|
202
|
+
|
|
203
|
+
try {
|
|
204
|
+
await testEnvironment.startMidnightWalletProviders(5); // Assuming max is 4
|
|
205
|
+
} catch (error) {
|
|
206
|
+
expect(error.message).toContain('Maximum supported number of wallets for this environment reached');
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
await testEnvironment.shutdown();
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
This demonstrates how to handle cases where the wallet limit is exceeded.
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
### 6. Advanced Usage with Proof Server
|
|
217
|
+
|
|
218
|
+
Here's an example of integrating with the proof server:
|
|
219
|
+
|
|
220
|
+
```typescript
|
|
221
|
+
// Example: Start a proof server with network ID = preview and ID = 123
|
|
222
|
+
const proofServer = await DynamicProofServerContainer.start(logger, '123', 'preview');
|
|
223
|
+
|
|
224
|
+
//stop the proof server
|
|
225
|
+
await proofServer.stop();
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
This shows how to integrate with and customize the proof server for testing.
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
### 7. Customized test environments
|
|
233
|
+
|
|
234
|
+
Library is provided with set of predefined environment configurations i.e.:
|
|
235
|
+
|
|
236
|
+
- LocalTestEnvironment
|
|
237
|
+
- PreviewTestEnvironment
|
|
238
|
+
- PreprodTestEnvironment
|
|
239
|
+
|
|
240
|
+
By using `getTestEnvironment(logger);` based on environment variable MN_TEST_ENVIRONMENT test environment configuration is provided.
|
|
241
|
+
|
|
242
|
+
`ForkTestEnvironment` is a fourth environment, and deliberately not one of the above: it stands up a
|
|
243
|
+
chain that crosses the ledger-8 to ledger-9 boundary and `getTestEnvironment` never returns it. A
|
|
244
|
+
test that wants it constructs it directly (`new ForkTestEnvironment(logger)`), then calls
|
|
245
|
+
`enactFork()` to move the chain across. It does not support wallets. See
|
|
246
|
+
`docs/architecture/fork-e2e-environment.md`.
|
|
247
|
+
However, you can either create your own class defining the environment endpoints or use below enviroment variables.
|
|
248
|
+
|
|
249
|
+
Here's an example of fully customized endpoints of the test environment, that you can provide using environment variables:
|
|
250
|
+
|
|
251
|
+
```shell
|
|
252
|
+
MN_TEST_ENVIRONMENT="env-var-remote" \
|
|
253
|
+
MN_TEST_NETWORK_ID="undeployed" \
|
|
254
|
+
MN_TEST_INDEXER="http://localhost:3085/api/" \
|
|
255
|
+
MN_TEST_INDEXER_WS="ws://localhost:3085/ws/" \
|
|
256
|
+
MN_TEST_NODE="http://localhost:3086" \
|
|
257
|
+
yarn test
|
|
258
|
+
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
### 8. Containers Configuration
|
|
264
|
+
|
|
265
|
+
The testkit uses a centralized `ContainersConfiguration` object that controls proof server, standalone containers, and logging. Two predefined configurations are available:
|
|
266
|
+
|
|
267
|
+
- `defaultContainersConfiguration` — uses `proof-server.yml` and `compose.yml`
|
|
268
|
+
- `latestContainersConfiguration` — uses `proof-server-latest.yml` and `compose-latest.yml`
|
|
269
|
+
|
|
270
|
+
You can read and modify the active configuration at any time using `getContainersConfiguration()` and `setContainersConfiguration()`.
|
|
271
|
+
|
|
272
|
+
#### Configuration structure
|
|
273
|
+
|
|
274
|
+
```typescript
|
|
275
|
+
interface ContainersConfiguration {
|
|
276
|
+
proofServer: {
|
|
277
|
+
path: string; // Directory with the compose file (default: cwd)
|
|
278
|
+
fileName: string; // Compose file name (default: 'proof-server.yml')
|
|
279
|
+
container: {
|
|
280
|
+
name: string; // Container name (default: 'proof-server')
|
|
281
|
+
port: number; // Exposed port (default: 6300)
|
|
282
|
+
waitStrategy: WaitStrategy;
|
|
283
|
+
};
|
|
284
|
+
};
|
|
285
|
+
standalone: {
|
|
286
|
+
path: string; // Directory with the compose file (default: cwd)
|
|
287
|
+
fileName: string; // Compose file name (default: 'compose.yml')
|
|
288
|
+
container: {
|
|
289
|
+
proofServer: { name, port, waitStrategy }; // default: 'proof-server', 6300
|
|
290
|
+
node: { name, port, waitStrategy }; // default: 'node', 9944
|
|
291
|
+
indexer: { name, port, waitStrategy }; // default: 'indexer', 8088
|
|
292
|
+
};
|
|
293
|
+
};
|
|
294
|
+
log: {
|
|
295
|
+
path: string; // Log directory (default: '<cwd>/logs/tests/')
|
|
296
|
+
fileName: string; // Log file name (default: 'tests_<timestamp>.log')
|
|
297
|
+
level: string; // Log level (default: 'info')
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
#### Proof server configuration
|
|
303
|
+
|
|
304
|
+
Controls the proof server container used in both standalone and remote environments.
|
|
305
|
+
|
|
306
|
+
```typescript
|
|
307
|
+
import {
|
|
308
|
+
defaultContainersConfiguration,
|
|
309
|
+
setContainersConfiguration
|
|
310
|
+
} from '@midnightntwrk/testkit-js';
|
|
311
|
+
|
|
312
|
+
setContainersConfiguration({
|
|
313
|
+
...defaultContainersConfiguration,
|
|
314
|
+
proofServer: {
|
|
315
|
+
...defaultContainersConfiguration.proofServer,
|
|
316
|
+
fileName: 'my-proof-server.yml',
|
|
317
|
+
container: {
|
|
318
|
+
...defaultContainersConfiguration.proofServer.container,
|
|
319
|
+
port: 7300
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
#### Standalone containers configuration
|
|
326
|
+
|
|
327
|
+
Controls the full local environment (node, indexer, proof server) started via Docker Compose.
|
|
328
|
+
|
|
329
|
+
```typescript
|
|
330
|
+
import { Wait } from 'testcontainers';
|
|
331
|
+
import {
|
|
332
|
+
defaultContainersConfiguration,
|
|
333
|
+
setContainersConfiguration
|
|
334
|
+
} from '@midnightntwrk/testkit-js';
|
|
335
|
+
|
|
336
|
+
setContainersConfiguration({
|
|
337
|
+
...defaultContainersConfiguration,
|
|
338
|
+
standalone: {
|
|
339
|
+
...defaultContainersConfiguration.standalone,
|
|
340
|
+
fileName: 'my-compose.yml',
|
|
341
|
+
container: {
|
|
342
|
+
...defaultContainersConfiguration.standalone.container,
|
|
343
|
+
node: {
|
|
344
|
+
...defaultContainersConfiguration.standalone.container.node,
|
|
345
|
+
port: 9955,
|
|
346
|
+
waitStrategy: Wait.forListeningPorts().withStartupTimeout(5 * 60_000)
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
#### Logging configuration
|
|
354
|
+
|
|
355
|
+
The testkit uses [pino](https://github.com/pinojs/pino) with pretty-printing. Logs are written both to the console and to a file.
|
|
356
|
+
|
|
357
|
+
**Default values:**
|
|
358
|
+
- **Log level**: `info`
|
|
359
|
+
- **Log file**: `tests_<timestamp>.log` (e.g. `tests_2026-03-10T12_00_00.000Z.log`)
|
|
360
|
+
- **Log directory**: `<cwd>/logs/tests/`
|
|
361
|
+
|
|
362
|
+
**Available log levels** (from least to most verbose): `fatal`, `error`, `warn`, `info`, `debug`, `trace`
|
|
363
|
+
|
|
364
|
+
```typescript
|
|
365
|
+
import {
|
|
366
|
+
defaultContainersConfiguration,
|
|
367
|
+
setContainersConfiguration
|
|
368
|
+
} from '@midnightntwrk/testkit-js';
|
|
369
|
+
|
|
370
|
+
setContainersConfiguration({
|
|
371
|
+
...defaultContainersConfiguration,
|
|
372
|
+
log: {
|
|
373
|
+
...defaultContainersConfiguration.log,
|
|
374
|
+
level: 'debug',
|
|
375
|
+
path: '/custom/log/directory',
|
|
376
|
+
fileName: 'my-tests.log'
|
|
377
|
+
}
|
|
378
|
+
});
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
**Creating custom loggers:**
|
|
382
|
+
|
|
383
|
+
```typescript
|
|
384
|
+
import { createLogger, createDefaultTestLogger } from '@midnightntwrk/testkit-js';
|
|
385
|
+
|
|
386
|
+
// Logger with default configuration
|
|
387
|
+
const logger = createDefaultTestLogger();
|
|
388
|
+
|
|
389
|
+
// Logger writing to a specific file (within the configured log directory)
|
|
390
|
+
const customLogger = createLogger('my-custom-test.log');
|
|
391
|
+
|
|
392
|
+
// Logger writing to an absolute path
|
|
393
|
+
const absoluteLogger = createLogger('/tmp/my-test.log');
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
#### Using the latest configuration
|
|
397
|
+
|
|
398
|
+
To use the latest container images instead of the default pinned versions:
|
|
399
|
+
|
|
400
|
+
```typescript
|
|
401
|
+
import { latestContainersConfiguration, setContainersConfiguration } from '@midnightntwrk/testkit-js';
|
|
402
|
+
|
|
403
|
+
setContainersConfiguration(latestContainersConfiguration);
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
---
|
|
407
|
+
|
|
408
|
+
### 9. System health check before tests
|
|
409
|
+
|
|
410
|
+
For the remote test environments (preview, preprod, ...) simple health check is performed for each of the components to check their state before test.
|