• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

realm / realm-js / 14195959854

01 Apr 2025 12:45PM UTC coverage: 85.03% (-0.3%) from 85.343%
14195959854

push

github

kraenhansen
Run coverage tests on push to main

1357 of 1780 branches covered (76.24%)

Branch coverage included in aggregate %.

4113 of 4653 relevant lines covered (88.39%)

882.02 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

39.13
/packages/realm/src/platform/node/sync-proxy-config.ts
1
////////////////////////////////////////////////////////////////////////////
2
//
3
// Copyright 2023 Realm Inc.
4
//
5
// Licensed under the Apache License, Version 2.0 (the "License");
6
// you may not use this file except in compliance with the License.
7
// You may obtain a copy of the License at
8
//
9
// http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing, software
12
// distributed under the License is distributed on an "AS IS" BASIS,
13
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
// See the License for the specific language governing permissions and
15
// limitations under the License.
16
//
17
////////////////////////////////////////////////////////////////////////////
18

19
import process from "node:process";
1✔
20
import { URL } from "node:url";
1✔
21

22
import { binding } from "../binding";
23
import { inject } from "../sync-proxy-config";
1✔
24

25
import ProxyType = binding.ProxyType;
26

27
inject({
1✔
28
  create() {
29
    for (const envVar of ["HTTPS_PROXY", "https_proxy", "HTTP_PROXY", "http_proxy"]) {
1,941✔
30
      const proxyUrlAsString = process.env[envVar];
7,764✔
31
      if (proxyUrlAsString) {
7,764!
32
        let type: ProxyType;
33
        const proxyUrl = new URL(proxyUrlAsString);
×
34
        const protocol = proxyUrl.protocol;
×
35
        if (protocol === "http:") {
×
36
          type = ProxyType.Http;
×
37
        } else if (protocol === "https:") {
×
38
          type = ProxyType.Https;
×
39
        } else {
40
          throw new Error(`Expected either 'http' or 'https' as protocol for ${envVar} (got ${protocol})`);
×
41
        }
42

43
        const config = {
×
44
          address: proxyUrl.hostname,
45
          type,
46
          port: parseInt(proxyUrl.port, 10),
47
        };
48
        return config;
×
49
      }
50
    }
51

52
    // no environment variable found, and we skip the proxy configuration
53
    return undefined;
1,941✔
54
  },
55
});
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc