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

Orckestra / orc-scripts / 109957

29 Jul 2026 01:19PM UTC coverage: 31.54% (-0.6%) from 32.18%
109957

push

Azure Pipelines

Jocelyn
Generate the CLAUDE.md file and modified how the SSL certificate is resolved

Story: AB#87607, AB#87608:w

153 of 469 branches covered (32.62%)

Branch coverage included in aggregate %.

0 of 27 new or added lines in 1 file covered. (0.0%)

1 existing line in 1 file now uncovered.

275 of 888 relevant lines covered (30.97%)

3.82 hits per line

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

0.0
/src/scripts/start.js
1
const DevServer = require("webpack-dev-server");
×
2
const webpack = require("webpack");
×
3
const path = require("path");
×
4
const fs = require("fs");
×
5

6
const HOST = process.env.HOSTNAME || "localhost";
×
7

8
const args = process.argv.slice(2);
×
9
const argPort = args.indexOf("--port") !== -1 ? args[args.indexOf("--port") + 1] : null;
×
10
const PORT = argPort || process.env.PORT || 5000;
×
11

NEW
12
const findSslPasswordFromParametersFile = certFile => {
×
13
        // reference: https://hals.app/blog/recursively-read-parent-folder-nodejs/
14

15
        let parentDirectory = path.dirname(certFile);
×
16
        while (fs.existsSync(parentDirectory)) {
×
NEW
17
                console.log("Looking for certificate password in: " + parentDirectory);
×
18
                const fileToFindPath = path.join(parentDirectory, "parameters.dev.xml");
×
19
                if (fs.existsSync(fileToFindPath)) {
×
20
                        const fileContent = fs.readFileSync(fileToFindPath, "utf8");
×
21

22
                        // Using regex to parse the XML to avoid adding a dependency on an XML package
23

NEW
24
                        const matchResult = /<param\s+name="SSL_CertificatePfxPassword"\s+value="(?<Value>[^"]+)"\s*\/>/.exec(
×
25
                                fileContent,
26
                        );
NEW
27
                        if (matchResult && matchResult.groups && matchResult.groups["Value"]) {
×
28
                                console.log("Certificate password found");
×
NEW
29
                                return matchResult.groups["Value"];
×
30
                        }
31

NEW
32
                        console.warn("Could not find SSL_CertificatePfxPassword in file " + fileToFindPath);
×
33
                        return null;
×
34
                }
35

36
                // The trick is here:
37
                // Using path.dirname() of a directory returns the parent directory!
38
                const parentDirname = path.dirname(parentDirectory);
×
39
                // But only to a certain point (file system root) (So to avoid infinite loops lets stop here)
40
                if (parentDirectory === parentDirname) {
×
41
                        return null;
×
42
                }
43

44
                parentDirectory = parentDirname;
×
45
        }
46

47
        return null;
×
48
};
49

NEW
50
const resolveSslCertPath = certPath => {
×
51
        let stats;
52

NEW
53
        try {
×
NEW
54
                stats = fs.statSync(certPath);
×
55
        } catch (error) {
NEW
56
                if (error.code === "ENOENT") {
×
NEW
57
                        throw new Error("SSL_CERT_PATH does not exist: " + certPath);
×
58
                }
59

NEW
60
                const exception = new Error("SSL_CERT_PATH is not a valid path: " + certPath);
×
NEW
61
                exception.cause = error;
×
NEW
62
                throw exception;
×
63
        }
64

NEW
65
        if (stats.isFile()) {
×
NEW
66
                return certPath;
×
67
        }
68

NEW
69
        const folder = certPath;
×
NEW
70
        const pfxFiles = fs.readdirSync(folder).filter(file => path.extname(file).toLowerCase() === ".pfx");
×
71

NEW
72
        if (pfxFiles.length > 1) {
×
NEW
73
                throw new Error("Multiple PFX files found in " + folder + ": " + pfxFiles.join(", "));
×
74
        }
NEW
75
        if (pfxFiles.length === 0) {
×
NEW
76
                throw new Error("No PFX file found in " + folder);
×
77
        }
78

NEW
79
        return path.join(folder, pfxFiles[0]);
×
80
};
81

82
const config = require("../config/webpack.config.js");
×
83
const options = {
×
84
        historyApiFallback: true,
85
        hot: "only",
86
        port: PORT,
87
        host: HOST,
88
        static: "./dist",
89
        devMiddleware: {
90
                publicPath: process.env.WEBPACK_PUBLIC_PATH || "/",
×
91
        },
92
};
93

94
if (HOST !== "localhost" || args.indexOf("--https") !== -1 || process.env.HTTPS) {
×
NEW
95
        options.server = "https";
×
96
}
97

NEW
98
if (options.server === "https" && process.env.SSL_CERT_PATH) {
×
NEW
99
        process.env.SSL_CERT_PATH = resolveSslCertPath(process.env.SSL_CERT_PATH);
×
100

NEW
101
        console.log("Certificate PFX found: " + process.env.SSL_CERT_PATH);
×
102

UNCOV
103
        options.server = {
×
104
                type: "https",
105
                options: {
106
                        pfx: process.env.SSL_CERT_PATH,
107
                        passphrase: process.env.SSL_CERT_PASSWORD || findSslPasswordFromParametersFile(process.env.SSL_CERT_PATH),
×
108
                },
109
        };
110
}
111

112
const compiler = webpack(config);
×
113

114
const server = new DevServer(options, compiler);
×
115

116
(async () => {
×
117
        await server.start();
×
118
})();
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc