You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Why did it take a few seconds? Because your container runtime likely had to pull the image first. If you run the test again, it'll likely pass much faster.
47
50
48
-
Testcontainers is built with TypeScript and offers first-class support for TypeScript users:
51
+
It would be nice to see what Testcontainers is doing while the test is running. You can enable all debug logging by setting the `DEBUG` environment variable. For example:
49
52
50
-
```typescript
51
-
import {
52
-
TestContainer,
53
-
StartedTestContainer,
54
-
StoppedTestContainer,
55
-
GenericContainer
56
-
} from"testcontainers";
53
+
```bash
54
+
DEBUG=testcontainers* npm test
55
+
```
56
+
57
+
If we run the test again, we'll see a lot of debug output:
[936d82e9964e] Created container for image "redis:latest"
116
+
[936d82e9964e] Starting container for image "redis:latest"...
117
+
[936d82e9964e] Starting container...
118
+
[936d82e9964e] Started container
119
+
[936d82e9964e] Started container for image "redis:latest"
120
+
[936d82e9964e] Fetching container logs...
121
+
[936d82e9964e] Demuxing stream...
122
+
[936d82e9964e] Demuxed stream
123
+
[936d82e9964e] Fetched container logs
124
+
[936d82e9964e] Waiting for container to be ready...
125
+
[936d82e9964e] Waiting for host port 32775...
126
+
[936d82e9964e] Waiting for internal port 6379...
127
+
[936d82e9964e] 1:C 24 Mar 2025 12:10:17.419 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
128
+
[936d82e9964e] 1:C 24 Mar 2025 12:10:17.419 * Redis version=7.4.2, bits=64, commit=00000000, modified=0, pid=1, just started
129
+
[936d82e9964e] 1:C 24 Mar 2025 12:10:17.419 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
[936d82e9964e] 1:M 24 Mar 2025 12:10:17.419 * Running mode=standalone, port=6379.
132
+
[936d82e9964e] 1:M 24 Mar 2025 12:10:17.420 * Server initialized
133
+
[936d82e9964e] 1:M 24 Mar 2025 12:10:17.420 * Ready to accept connections tcp
134
+
[DEBUG] [936d82e9964e] Host port 32775 ready
135
+
[DEBUG] [936d82e9964e] Host port wait strategy complete
136
+
[DEBUG] [936d82e9964e] Internal port 6379 ready
137
+
[INFO] [936d82e9964e] Container is ready
138
+
[INFO] [936d82e9964e] Stopping container...
139
+
[DEBUG] [936d82e9964e] Stopping container...
140
+
[936d82e9964e] 1:signal-handler (1742818217) Received SIGTERM scheduling shutdown...
141
+
[DEBUG] [936d82e9964e] Stopped container
142
+
[DEBUG] [936d82e9964e] Removing container...
143
+
[DEBUG] [936d82e9964e] Removed container
144
+
[INFO] [936d82e9964e] Stopped container
145
+
```
146
+
147
+
These logs are very useful for debugging when a container isn't working as expected. You can see there are logs from the Testcontainers library, as well as logs emitted from all Testcontainers-managed containers.
0 commit comments