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

realm / realm-js / 7681391482

27 Jan 2024 10:00PM CUT coverage: 85.346%. Remained the same
7681391482

Pull #6431

github

web-flow
Update source-map-loader to version 5.0.0
Pull Request #6431: Update source-map-loader 4.0.2 → 5.0.0 (major)

942 of 1164 branches covered (0.0%)

Branch coverage included in aggregate %.

2372 of 2719 relevant lines covered (87.24%)

1015.64 hits per line

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

26.32
/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";
20
import { URL } from "node:url";
21

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

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

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

50
    // no environment variable found, and we skip the proxy configuration
51
    return undefined;
1,799✔
52
  },
53
});
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

© 2025 Coveralls, Inc