File tree 5 files changed +11
-7
lines changed
5 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @eresearchqut/jest-testcontainers" ,
3
- "version" : " 3.7.0 " ,
3
+ "version" : " 3.7.1 " ,
4
4
"description" : " Jest preset for starting docker containers that stay up while your tests run." ,
5
5
"main" : " dist/index" ,
6
6
"types" : " dist/index" ,
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ describe("config", () => {
8
8
// Arrange
9
9
const firstContainer : any = {
10
10
image : "first" ,
11
+ privileged : true ,
11
12
wait : {
12
13
text : "hello" ,
13
14
type : "text"
@@ -35,6 +36,7 @@ describe("config", () => {
35
36
const expectedConfig : JestTestcontainersConfig = {
36
37
first : {
37
38
image : "first" ,
39
+ privileged : true ,
38
40
wait : {
39
41
text : "hello" ,
40
42
type : "text"
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ export interface SingleContainerConfig {
43
43
command ?: string [ ] ;
44
44
entrypoint ?: string [ ] ;
45
45
resourcesQuota ?: ResourcesQuotaConfig ;
46
- withPrivilegedMode ?: boolean ;
46
+ privileged ?: boolean ;
47
47
}
48
48
49
49
interface PortsWaitConfig {
@@ -185,6 +185,7 @@ function parseContainerConfig(config: any): JestTestcontainersConfig {
185
185
command,
186
186
entrypoint,
187
187
resourcesQuota,
188
+ privileged
188
189
} = config ;
189
190
const parsed = {
190
191
image,
@@ -197,6 +198,7 @@ function parseContainerConfig(config: any): JestTestcontainersConfig {
197
198
command,
198
199
entrypoint,
199
200
resourcesQuota,
201
+ privileged
200
202
} ;
201
203
202
204
return Object . keys ( parsed ) . reduce (
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ describe("containers", () => {
83
83
// Arrange
84
84
const config : SingleContainerConfig = {
85
85
image : "redis" ,
86
- withPrivilegedMode : true
86
+ privileged : true
87
87
} ;
88
88
89
89
// Act
Original file line number Diff line number Diff line change @@ -102,10 +102,10 @@ const addResourcesQuotaToContainer = (resourcesQuota?: ResourcesQuotaConfig) =>
102
102
return container . withResourcesQuota ( resourcesQuota ) ;
103
103
}
104
104
105
- const addWithPrivilegedMode = ( withPrivilegedMode ?: boolean ) => (
105
+ const addWithPrivilegedMode = ( privileged ?: boolean ) => (
106
106
container : TestContainer
107
107
) : TestContainer => {
108
- if ( ! withPrivilegedMode ) {
108
+ if ( privileged === undefined || ! privileged ) {
109
109
return container ;
110
110
}
111
111
return container . withPrivilegedMode ( ) ;
@@ -125,7 +125,7 @@ export function buildTestcontainer(
125
125
command,
126
126
entrypoint,
127
127
resourcesQuota,
128
- withPrivilegedMode
128
+ privileged
129
129
} = containerConfig ;
130
130
const sanitizedTag = tag ?? "latest" ;
131
131
const container = new GenericContainer ( `${ image } :${ sanitizedTag } ` ) ;
@@ -137,7 +137,7 @@ export function buildTestcontainer(
137
137
addCommandToContainer ( command ) ,
138
138
addEntrypointToContainer ( entrypoint ) ,
139
139
addResourcesQuotaToContainer ( resourcesQuota ) ,
140
- addWithPrivilegedMode ( withPrivilegedMode )
140
+ addWithPrivilegedMode ( privileged )
141
141
] . reduce < TestContainer > (
142
142
( res , func ) => func ( res ) ,
143
143
addNameToContainer ( name ) ( container )
You can’t perform that action at this time.
0 commit comments