apache / cordova-serve
Showing 1 of 2 files from the diff.
Other files ignored by Codecov
README.md has changed.

@@ -49,6 +49,7 @@
Loading
49 49
    } else {
50 50
        return getBrowser(target, opts.dataDir).then(browser => {
51 51
            let args;
52 +
            let urlAdded = false;
52 53
53 54
            switch (process.platform) {
54 55
            case 'darwin':
@@ -67,6 +68,11 @@
Loading
67 68
                // Furthermore, if "cmd /c" double-quoted the first parameter, then "start" will interpret it as a window title,
68 69
                // so we need to add a dummy empty-string window title: http://stackoverflow.com/a/154090/3191
69 70
71 +
                if (target === 'edge') {
72 +
                    browser += `:${url}`;
73 +
                    urlAdded = true;
74 +
                }
75 +
70 76
                args = ['cmd /c start ""', browser];
71 77
                break;
72 78
            case 'linux':
@@ -76,7 +82,9 @@
Loading
76 82
                break;
77 83
            }
78 84
79 -
            args.push(url);
85 +
            if (!urlAdded) {
86 +
                args.push(url);
87 +
            }
80 88
            const command = args.join(' ');
81 89
            const result = exec(command);
82 90
            result.catch(() => {
@@ -104,14 +112,15 @@
Loading
104 112
            safari: 'safari',
105 113
            opera: 'opera',
106 114
            firefox: 'firefox',
107 -
            edge: `msedge --user-data-dir=%TEMP%\\${dataDir}`
115 +
            edge: 'microsoft-edge',
116 +
            edgechromium: `msedge --user-data-dir=%TEMP%\\${dataDir}`
108 117
        },
109 118
        darwin: {
110 119
            chrome: `"Google Chrome" --args${chromeArgs}`,
111 120
            safari: 'safari',
112 121
            firefox: 'firefox',
113 122
            opera: 'opera',
114 -
            edge: `"Microsoft Edge" --args${chromeArgs}`
123 +
            edgechromium: `"Microsoft Edge" --args${chromeArgs}`
115 124
        },
116 125
        linux: {
117 126
            chrome: `google-chrome${chromeArgs}`,
@@ -145,14 +154,23 @@
Loading
145 154
    const promise = new Promise((resolve, reject) => {
146 155
        // Windows displays a dialog if the browser is not installed. We'd prefer to avoid that.
147 156
        if (process.platform === 'win32') {
148 -
            browserInstalled(browser)
149 -
                .then(() => {
157 +
            if (target === 'edge') {
158 +
                oldEdgeSupported().then(() => {
150 159
                    resolve();
151 160
                })
152 -
                .catch(err => {
153 -
                    const errMessage = getErrorMessage(err, target, NOT_INSTALLED);
154 -
                    reject(errMessage);
155 -
                });
161 +
                    .catch(err => {
162 +
                        const errMessage = getErrorMessage(err, target, NOT_INSTALLED);
163 +
                        reject(errMessage);
164 +
                    });
165 +
            } else {
166 +
                browserInstalled(browser).then(() => {
167 +
                    resolve();
168 +
                })
169 +
                    .catch(err => {
170 +
                        const errMessage = getErrorMessage(err, target, NOT_INSTALLED);
171 +
                        reject(errMessage);
172 +
                    });
173 +
            }
156 174
        } else {
157 175
            resolve();
158 176
        }
@@ -160,6 +178,24 @@
Loading
160 178
    return promise;
161 179
}
162 180
181 +
function oldEdgeSupported () {
182 +
    const prom = new Promise((resolve, reject) => {
183 +
        child_process.exec('ver', (err, stdout, stderr) => {
184 +
            if (err || stderr) {
185 +
                reject(err || stderr);
186 +
            } else {
187 +
                const windowsVersion = stdout.match(/([0-9.])+/g)[0];
188 +
                if (parseInt(windowsVersion) < 10) {
189 +
                    reject(new Error('The browser target is not supported on this version of Windows: %target%'));
190 +
                } else {
191 +
                    resolve();
192 +
                }
193 +
            }
194 +
        });
195 +
    });
196 +
    return prom;
197 +
}
198 +
163 199
const regItemPattern = /\s*\([^)]+\)\s+(REG_SZ)\s+([^\s].*)\s*/;
164 200
function browserInstalled (browser) {
165 201
    // On Windows, the 'start' command searches the path then 'App Paths' in the registry.
Files Coverage
src 28.11%
Project Totals (6 files) 28.11%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading