Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ofhouse committed Dec 21, 2020
1 parent dfecde2 commit a96367f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 7 additions & 6 deletions test/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, Array<string>> = {}; // or just '{}', an empty object

for (const name of Object.keys(nets)) {
for (const net of nets[name]) {
Expand All @@ -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;
}
}
}

/**
Expand Down

0 comments on commit a96367f

Please sign in to comment.