From a96367fbd4092c7c49e6f1b864ad01a13ea185ad Mon Sep 17 00:00:00 2001 From: Felix Haus Date: Mon, 21 Dec 2020 20:31:39 +0100 Subject: [PATCH] Fix CI --- .github/workflows/test.yml | 5 +---- test/lib/utils.ts | 13 +++++++------ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 73e38e61..616a5d29 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -84,7 +84,4 @@ jobs: name: e2e-fixtures - run: yarn install --frozen-lockfile --check-files - name: Run e2e-test - run: | - export HOST_IP=$(ip route show | awk '/default/ {print $3}') - echo "Host ip address: $HOST_IP" - yarn test:e2e --runInBand + run: yarn test:e2e --runInBand diff --git a/test/lib/utils.ts b/test/lib/utils.ts index 8e921c51..a07d4a74 100644 --- a/test/lib/utils.ts +++ b/test/lib/utils.ts @@ -84,12 +84,8 @@ export function unzipToLocation(zipPath: string, location: string) { * @see: https://stackoverflow.com/a/8440736/831465 */ export function getLocalIpAddressFromHost() { - if (process.env.HOST_IP) { - return process.env.HOST_IP; - } - const nets = networkInterfaces(); - const results = Object.create(null); // or just '{}', an empty object + const results: Record> = {}; // or just '{}', an empty object for (const name of Object.keys(nets)) { for (const net of nets[name]) { @@ -104,7 +100,12 @@ export function getLocalIpAddressFromHost() { } } - return results['en0'][0]; + // Get the first address we find + for (const [, addresses] of Object.entries(results)) { + for (const address of addresses) { + return address; + } + } } /**