Add a version function

This commit is contained in:
Will O'Beirne 2019-10-25 16:35:44 -04:00
parent 1585dbb62a
commit db73df9b0f
No known key found for this signature in database
GPG key ID: 44C190DB5DEAF9F6
2 changed files with 10 additions and 0 deletions

View file

@ -235,3 +235,7 @@ export const port = function (service: string, containerPort: string | number, o
return execCompose('port', args, options);
};
export const version = function (options?: IDockerComposeOptions): Promise<IDockerComposeResult> {
return execCompose('version', [ '--short' ], options);
};

View file

@ -490,3 +490,9 @@ test('returns the port for a started service', async (): Promise<void> => {
expect(port.out).toMatch(/.*:[0-9]{1,5}/);
await compose.down(config);
});
test('returns version information', async (): Promise<void> => {
const version = await compose.version();
expect(version.out).toBeTruthy();
});