From bf8210ae9b88cf8559c5b746e273c16cc538a6a8 Mon Sep 17 00:00:00 2001 From: Alexander Zeitler Date: Sat, 10 Apr 2021 23:24:15 +0200 Subject: [PATCH] style: fix lint errors --- package.json | 2 +- src/index.ts | 1 - test/index.test.ts | 16 ++++++++++------ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 68f3e30..05887da 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "types": "dist/index.d.ts", "scripts": { "test": "jest test --verbose", - "eslint": "eslint src/**/*.ts test/**/*.ts", + "lint": "eslint src/**/*.ts test/**/*.ts", "build": "tsc", "prepublishOnly": "tsc", "release": "yarn build && standard-version" diff --git a/src/index.ts b/src/index.ts index 06aa4d7..e2ba734 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,4 @@ import childProcess from 'child_process' -import { Readable } from 'stream' export interface IDockerComposeOptions { cwd?: string config?: string | string[] diff --git a/test/index.test.ts b/test/index.test.ts index a7a39f0..e54331f 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -70,7 +70,7 @@ test('ensure container gets started', async (): Promise => { test('ensure exit code is returned correctly', async (): Promise => { let result = await compose.down({ cwd: path.join(__dirname), log: logOutput }) - await expect(result).toMatchObject({ + expect(result).toMatchObject({ exitCode: 0 }) @@ -78,12 +78,17 @@ test('ensure exit code is returned correctly', async (): Promise => { expect(result).toMatchObject({ exitCode: 0 }) + + let failedResult = 0 try { - await compose.logs('non_existent_service', { cwd: path.join(__dirname) }) - expect(false).toBeTruthy() - } catch (rejectionResult) { - expect(rejectionResult.exitCode).toBe(1) + await compose.logs('non_existent_service', { + cwd: path.join(__dirname) + }) + } catch (error) { + failedResult = error.exitCode } + expect(failedResult).toBe(1) + await compose.down({ cwd: path.join(__dirname), log: logOutput }) }) @@ -291,7 +296,6 @@ test('ensure run and exec are working', async (): Promise => { const opts = { cwd: path.join(__dirname), log: logOutput } await compose.upAll(opts) - const console = require('console') expect(await isContainerRunning('/compose_test_web')).toBeTruthy() let std = await compose.exec('web', 'cat /etc/os-release', opts)