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

mendersoftware / gui / 917894278

pending completion
917894278

Pull #3837

gitlab-ci

web-flow
chore: bump @playwright/test from 1.35.0 to 1.35.1 in /tests/e2e_tests

Bumps [@playwright/test](https://github.com/Microsoft/playwright) from 1.35.0 to 1.35.1.
- [Release notes](https://github.com/Microsoft/playwright/releases)
- [Commits](https://github.com/Microsoft/playwright/compare/v1.35.0...v1.35.1)

---
updated-dependencies:
- dependency-name: "@playwright/test"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #3837: chore: bump @playwright/test from 1.35.0 to 1.35.1 in /tests/e2e_tests

4399 of 6397 branches covered (68.77%)

8302 of 10074 relevant lines covered (82.41%)

167.35 hits per line

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

91.67
/src/js/helpers.js
1
// Copyright 2017 Northern.tech AS
2
//
3
//    Licensed under the Apache License, Version 2.0 (the "License");
4
//    you may not use this file except in compliance with the License.
5
//    You may obtain a copy of the License at
6
//
7
//        http://www.apache.org/licenses/LICENSE-2.0
8
//
9
//    Unless required by applicable law or agreed to in writing, software
10
//    distributed under the License is distributed on an "AS IS" BASIS,
11
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
//    See the License for the specific language governing permissions and
13
//    limitations under the License.
14
import React from 'react';
15

16
import jwtDecode from 'jwt-decode';
17
import pluralize from 'pluralize';
18

19
import { getToken } from './auth';
20
import { DARK_MODE } from './constants/appConstants';
21
import {
22
  DEPLOYMENT_STATES,
23
  defaultStats,
24
  deploymentDisplayStates,
25
  deploymentStatesToSubstates,
26
  deploymentStatesToSubstatesWithSkipped
27
} from './constants/deploymentConstants';
28
import { ATTRIBUTE_SCOPES, DEVICE_FILTERING_OPTIONS } from './constants/deviceConstants';
29

30
const isEncoded = uri => {
187✔
31
  uri = uri || '';
8✔
32
  return uri !== decodeURIComponent(uri);
8✔
33
};
34

35
export const fullyDecodeURI = uri => {
187✔
36
  while (isEncoded(uri)) {
6✔
37
    uri = decodeURIComponent(uri);
2✔
38
  }
39
  return uri;
6✔
40
};
41

42
export const groupDeploymentDevicesStats = deployment => {
187✔
43
  const deviceStatCollector = (deploymentStates, devices) =>
2✔
44
    Object.values(devices).reduce((accu, device) => (deploymentStates.includes(device.status) ? accu + 1 : accu), 0);
55✔
45

46
  const inprogress = deviceStatCollector(deploymentStatesToSubstates.inprogress, deployment.devices);
2✔
47
  const pending = deviceStatCollector(deploymentStatesToSubstates.pending, deployment.devices);
2✔
48
  const successes = deviceStatCollector(deploymentStatesToSubstates.successes, deployment.devices);
2✔
49
  const failures = deviceStatCollector(deploymentStatesToSubstates.failures, deployment.devices);
2✔
50
  const paused = deviceStatCollector(deploymentStatesToSubstates.paused, deployment.devices);
2✔
51
  return { inprogress, paused, pending, successes, failures };
2✔
52
};
53

54
export const statCollector = (items, statistics) => items.reduce((accu, property) => accu + Number(statistics[property] || 0), 0);
53,245✔
55
export const groupDeploymentStats = (deployment, withSkipped) => {
187✔
56
  const { statistics = {} } = deployment;
4,087✔
57
  const { status = {} } = statistics;
4,087✔
58
  const stats = { ...defaultStats, ...status };
4,087✔
59
  let groupStates = deploymentStatesToSubstates;
4,087✔
60
  let result = {};
4,087✔
61
  if (withSkipped) {
4,087✔
62
    groupStates = deploymentStatesToSubstatesWithSkipped;
2,163✔
63
    result.skipped = statCollector(groupStates.skipped, stats);
2,163✔
64
  }
65
  result = {
4,087✔
66
    ...result,
67
    // don't include 'pending' as inprogress, as all remaining devices will be pending - we don't discriminate based on phase membership
68
    inprogress: statCollector(groupStates.inprogress, stats),
69
    pending: (deployment.max_devices ? deployment.max_devices - deployment.device_count : 0) + statCollector(groupStates.pending, stats),
4,087✔
70
    successes: statCollector(groupStates.successes, stats),
71
    failures: statCollector(groupStates.failures, stats),
72
    paused: statCollector(groupStates.paused, stats)
73
  };
74
  return result;
4,087✔
75
};
76

77
export const getDeploymentState = deployment => {
187✔
78
  const { status: deploymentStatus = DEPLOYMENT_STATES.pending } = deployment;
1,906✔
79
  const { inprogress: currentProgressCount, paused } = groupDeploymentStats(deployment);
1,906✔
80

81
  let status = deploymentDisplayStates[deploymentStatus];
1,906✔
82
  if (deploymentStatus === DEPLOYMENT_STATES.pending && currentProgressCount === 0) {
1,906✔
83
    status = 'queued';
951✔
84
  } else if (paused > 0) {
955!
85
    status = deploymentDisplayStates.paused;
×
86
  }
87
  return status;
1,906✔
88
};
89

90
export const decodeSessionToken = token => {
187✔
91
  try {
4✔
92
    var decoded = jwtDecode(token);
4✔
93
    return decoded.sub;
2✔
94
  } catch (err) {
95
    //console.log(err);
96
    return;
2✔
97
  }
98
};
99

100
export const isEmpty = obj => {
187✔
101
  for (const _ in obj) {
144✔
102
    return false;
76✔
103
  }
104
  return true;
68✔
105
};
106

107
export const extractErrorMessage = (err, fallback = '') =>
187✔
108
  err.response?.data?.error?.message || err.response?.data?.error || err.error || err.message || fallback;
5!
109

110
export const preformatWithRequestID = (res, failMsg) => {
187✔
111
  // ellipsis line
112
  if (failMsg.length > 100) failMsg = `${failMsg.substring(0, 220)}...`;
9✔
113

114
  try {
9✔
115
    if (res?.data && Object.keys(res.data).includes('request_id')) {
9✔
116
      let shortRequestUUID = res.data['request_id'].substring(0, 8);
2✔
117
      return `${failMsg} [Request ID: ${shortRequestUUID}]`;
2✔
118
    }
119
  } catch (e) {
120
    console.log('failed to extract request id:', e);
×
121
  }
122
  return failMsg;
7✔
123
};
124

125
export const versionCompare = (v1, v2) => {
187✔
126
  const partsV1 = `${v1}`.split('.');
16✔
127
  const partsV2 = `${v2}`.split('.');
16✔
128
  for (let index = 0; index < partsV1.length; index++) {
16✔
129
    const numberV1 = partsV1[index];
21✔
130
    const numberV2 = partsV2[index];
21✔
131
    if (numberV1 > numberV2) {
21✔
132
      return 1;
11✔
133
    }
134
    if (numberV2 > numberV1) {
10✔
135
      return -1;
4✔
136
    }
137
  }
138
  return 0;
1✔
139
};
140

141
/*
142
 *
143
 * Deep compare
144
 *
145
 */
146
// eslint-disable-next-line sonarjs/cognitive-complexity
147
export function deepCompare() {
148
  var i, l, leftChain, rightChain;
149

150
  function compare2Objects(x, y) {
151
    var p;
152

153
    // remember that NaN === NaN returns false
154
    // and isNaN(undefined) returns true
155
    if (isNaN(x) && isNaN(y) && typeof x === 'number' && typeof y === 'number') {
198!
156
      return true;
×
157
    }
158

159
    // Compare primitives and functions.
160
    // Check if both arguments link to the same object.
161
    // Especially useful on the step where we compare prototypes
162
    if (x === y) {
198✔
163
      return true;
70✔
164
    }
165

166
    // Works in case when functions are created in constructor.
167
    // Comparing dates is a common scenario. Another built-ins?
168
    // We can even handle functions passed across iframes
169
    if (
128!
170
      (typeof x === 'function' && typeof y === 'function') ||
641!
171
      (x instanceof Date && y instanceof Date) ||
172
      (x instanceof RegExp && y instanceof RegExp) ||
173
      (x instanceof String && y instanceof String) ||
174
      (x instanceof Number && y instanceof Number)
175
    ) {
176
      return x.toString() === y.toString();
×
177
    }
178

179
    // At last checking prototypes as good as we can
180
    if (!(x instanceof Object && y instanceof Object)) {
128✔
181
      return false;
8✔
182
    }
183

184
    if (x.isPrototypeOf(y) || y.isPrototypeOf(x)) {
120!
185
      return false;
×
186
    }
187

188
    if (x.constructor !== y.constructor) {
120!
189
      return false;
×
190
    }
191

192
    if (x.prototype !== y.prototype) {
120!
193
      return false;
×
194
    }
195

196
    // Check for infinitive linking loops
197
    if (leftChain.indexOf(x) > -1 || rightChain.indexOf(y) > -1) {
120!
198
      return false;
×
199
    }
200

201
    // Quick checking of one object being a subset of another.
202
    // todo: cache the structure of arguments[0] for performance
203
    for (p in y) {
120✔
204
      if (y.hasOwnProperty(p) !== x.hasOwnProperty(p) || typeof y[p] !== typeof x[p]) {
462✔
205
        return false;
49✔
206
      }
207
    }
208

209
    for (p in x) {
71✔
210
      if (y.hasOwnProperty(p) !== x.hasOwnProperty(p) || typeof y[p] !== typeof x[p]) {
173✔
211
        return false;
8✔
212
      }
213

214
      switch (typeof x[p]) {
165✔
215
        case 'object':
216
        case 'function':
217
          leftChain.push(x);
75✔
218
          rightChain.push(y);
75✔
219

220
          if (!compare2Objects(x[p], y[p])) {
75✔
221
            return false;
10✔
222
          }
223

224
          leftChain.pop();
65✔
225
          rightChain.pop();
65✔
226
          break;
65✔
227

228
        default:
229
          if (x[p] !== y[p]) {
90✔
230
            return false;
8✔
231
          }
232
          break;
82✔
233
      }
234
    }
235

236
    return true;
45✔
237
  }
238

239
  if (arguments.length < 1) {
121!
240
    return true; //Die silently? Don't know how to handle such case, please help...
×
241
    // throw "Need two or more arguments to compare";
242
  }
243

244
  for (i = 1, l = arguments.length; i < l; i++) {
121✔
245
    leftChain = []; //Todo: this can be cached
123✔
246
    rightChain = [];
123✔
247

248
    if (!compare2Objects(arguments[0], arguments[i])) {
123✔
249
      return false;
73✔
250
    }
251
  }
252

253
  return true;
48✔
254
}
255

256
export const stringToBoolean = content => {
187✔
257
  if (!content) {
208✔
258
    return false;
185✔
259
  }
260
  const string = content + '';
23✔
261
  switch (string.trim().toLowerCase()) {
23✔
262
    case 'true':
263
    case 'yes':
264
    case '1':
265
      return true;
19✔
266
    case 'false':
267
    case 'no':
268
    case '0':
269
    case null:
270
      return false;
3✔
271
    default:
272
      return Boolean(string);
1✔
273
  }
274
};
275

276
export const toggle = current => !current;
187✔
277

278
export const formatTime = date => {
187✔
279
  if (date && Object.prototype.toString.call(date) === '[object Date]' && !isNaN(date)) {
74✔
280
    return date.toISOString().slice(0, -1);
1✔
281
  } else if (date) {
73✔
282
    return date.replace(' ', 'T').replace(/ /g, '').replace('UTC', '');
63✔
283
  }
284
};
285

286
export const customSort = (direction, field) => (a, b) => {
754✔
287
  if (typeof a[field] === 'string') {
153,245✔
288
    const result = a[field].localeCompare(b[field], { sensitivity: 'case' });
153,188✔
289
    return direction ? result * -1 : result;
153,188✔
290
  }
291
  if (a[field] > b[field]) return direction ? -1 : 1;
57!
292
  if (a[field] < b[field]) return direction ? 1 : -1;
47!
293
  return 0;
10✔
294
};
295

296
export const duplicateFilter = (item, index, array) => array.indexOf(item) == index;
1,878✔
297

298
export const attributeDuplicateFilter = (filterableArray, attributeName = 'key') =>
187!
299
  filterableArray.filter(
5✔
300
    (item, index, array) => array.findIndex(filter => filter[attributeName] === item[attributeName] && filter.scope === item.scope) == index
266✔
301
  );
302

303
export const unionizeStrings = (someStrings, someOtherStrings) => {
187✔
304
  const startingPoint = new Set(someStrings.filter(item => item.length));
24✔
305
  const uniqueStrings = someOtherStrings.length
24✔
306
    ? someOtherStrings.reduce((accu, item) => {
307
        if (item.trim().length) {
33✔
308
          accu.add(item.trim());
14✔
309
        }
310
        return accu;
33✔
311
      }, startingPoint)
312
    : startingPoint;
313
  return [...uniqueStrings];
24✔
314
};
315

316
export const generateDeploymentGroupDetails = (filter, groupName) =>
187✔
317
  filter && filter.terms?.length
3✔
318
    ? `${groupName} (${filter.terms
319
        .map(filter => `${filter.attribute || filter.key} ${DEVICE_FILTERING_OPTIONS[filter.type || filter.operator].shortform} ${filter.value}`)
4✔
320
        .join(', ')})`
321
    : groupName;
322

323
export const tryMapDeployments = (accu, id) => {
187✔
324
  if (accu.state.deployments.byId[id]) {
1,624✔
325
    accu.deployments.push(accu.state.deployments.byId[id]);
1,623✔
326
  }
327
  return accu;
1,624✔
328
};
329

330
export const mapDeviceAttributes = (attributes = []) =>
187✔
331
  attributes.reduce(
140✔
332
    (accu, attribute) => {
333
      if (!(attribute.value && attribute.name) && attribute.scope === ATTRIBUTE_SCOPES.inventory) {
1,617!
334
        return accu;
×
335
      }
336
      accu[attribute.scope || ATTRIBUTE_SCOPES.inventory] = {
1,617✔
337
        ...accu[attribute.scope || ATTRIBUTE_SCOPES.inventory],
1,623✔
338
        [attribute.name]: attribute.value
339
      };
340
      if (attribute.name === 'device_type' && attribute.scope === ATTRIBUTE_SCOPES.inventory) {
1,617✔
341
        accu.inventory.device_type = [].concat(attribute.value);
78✔
342
      }
343
      return accu;
1,617✔
344
    },
345
    { inventory: { device_type: [], artifact_name: '' }, identity: {}, monitor: {}, system: {}, tags: {} }
346
  );
347

348
export const getFormattedSize = bytes => {
187✔
349
  const suffixes = ['Bytes', 'KB', 'MB', 'GB'];
88✔
350
  const i = Math.floor(Math.log(bytes) / Math.log(1024));
88✔
351
  if (!bytes) {
88✔
352
    return '0 Bytes';
29✔
353
  }
354
  return `${(bytes / Math.pow(1024, i)).toFixed(2)} ${suffixes[i]}`;
59✔
355
};
356

357
export const FileSize = React.forwardRef(({ fileSize, style }, ref) => (
187✔
358
  <div ref={ref} style={style}>
79✔
359
    {getFormattedSize(fileSize)}
360
  </div>
361
));
362
FileSize.displayName = 'FileSize';
187✔
363

364
const collectAddressesFrom = devices =>
187✔
365
  devices.reduce((collector, { attributes = {} }) => {
12!
366
    const ips = Object.entries(attributes).reduce((accu, [name, value]) => {
32✔
367
      if (name.startsWith('ipv4')) {
68✔
368
        if (Array.isArray(value)) {
22!
369
          const texts = value.map(text => text.slice(0, text.indexOf('/')));
×
370
          accu.push(...texts);
×
371
        } else {
372
          const text = value.slice(0, value.indexOf('/'));
22✔
373
          accu.push(text);
22✔
374
        }
375
      }
376
      return accu;
68✔
377
    }, []);
378
    collector.push(...ips);
32✔
379
    return collector;
32✔
380
  }, []);
381

382
export const getDemoDeviceAddress = (devices, onboardingApproach) => {
187✔
383
  const defaultVitualizedIp = '10.0.2.15';
12✔
384
  const addresses = collectAddressesFrom(devices);
12✔
385
  const address = addresses.reduce((accu, item) => {
12✔
386
    if (accu && item === defaultVitualizedIp) {
22!
387
      return accu;
×
388
    }
389
    return item;
22✔
390
  }, null);
391
  if (!address || (onboardingApproach === 'virtual' && (navigator.appVersion.indexOf('Win') != -1 || navigator.appVersion.indexOf('Mac') != -1))) {
12✔
392
    return 'localhost';
1✔
393
  }
394
  return address;
11✔
395
};
396

397
export const detectOsIdentifier = () => {
187✔
398
  if (navigator.appVersion.indexOf('Win') != -1) return 'Windows';
3!
399
  if (navigator.appVersion.indexOf('Mac') != -1) return 'MacOs';
3✔
400
  if (navigator.appVersion.indexOf('X11') != -1) return 'Unix';
2!
401
  return 'Linux';
2✔
402
};
403

404
export const getRemainderPercent = phases => {
187✔
405
  // remove final phase size if set
406
  phases[phases.length - 1].batch_size = null;
87✔
407
  // use this to get remaining percent of final phase so we don't set a hard number
408
  return phases.reduce((accu, phase) => (phase.batch_size ? accu - phase.batch_size : accu), 100);
235✔
409
};
410

411
export const validatePhases = (phases, deploymentDeviceCount, hasFilter) => {
187✔
412
  if (!phases?.length) {
36✔
413
    return true;
11✔
414
  }
415
  const remainder = getRemainderPercent(phases);
25✔
416
  return phases.reduce((accu, phase) => {
25✔
417
    if (!accu) {
66✔
418
      return accu;
5✔
419
    }
420
    const deviceCount = Math.floor((deploymentDeviceCount / 100) * (phase.batch_size || remainder));
61✔
421
    return deviceCount >= 1 || hasFilter;
61✔
422
  }, true);
423
};
424

425
export const getPhaseDeviceCount = (numberDevices = 1, batchSize, remainder, isLastPhase) =>
187✔
426
  isLastPhase ? Math.ceil((numberDevices / 100) * (batchSize || remainder)) : Math.floor((numberDevices / 100) * (batchSize || remainder));
160✔
427

428
export const startTimeSort = (a, b) => (b.created > a.created) - (b.created < a.created);
272✔
429

430
export const standardizePhases = phases =>
187✔
431
  phases.map((phase, index) => {
3✔
432
    let standardizedPhase = { batch_size: phase.batch_size, start_ts: index };
8✔
433
    if (phase.delay) {
8✔
434
      standardizedPhase.delay = phase.delay;
5✔
435
      standardizedPhase.delayUnit = phase.delayUnit || 'hours';
5✔
436
    }
437
    if (index === 0) {
8✔
438
      // delete the start timestamp from a deployment pattern, to default to starting without delay
439
      delete standardizedPhase.start_ts;
3✔
440
    }
441
    return standardizedPhase;
8✔
442
  });
443

444
const getInstallScriptArgs = ({ isHosted, isPreRelease }) => {
187✔
445
  let installScriptArgs = '--demo';
11✔
446
  installScriptArgs = isPreRelease ? `${installScriptArgs} -c experimental` : installScriptArgs;
11✔
447
  installScriptArgs = isHosted ? `${installScriptArgs} --commercial --jwt-token $JWT_TOKEN` : installScriptArgs;
11✔
448
  return installScriptArgs;
11✔
449
};
450

451
const getSetupArgs = ({ deviceType = 'generic-armv6', ipAddress, isDemoMode, tenantToken, isOnboarding }) => {
187✔
452
  let menderSetupArgs = `--quiet --device-type "${deviceType}"`;
11✔
453
  menderSetupArgs = tenantToken ? `${menderSetupArgs} --tenant-token $TENANT_TOKEN` : menderSetupArgs;
11✔
454
  // in production we use polling intervals from the client examples: https://github.com/mendersoftware/mender/blob/master/examples/mender.conf.production
455
  menderSetupArgs = isDemoMode || isOnboarding ? `${menderSetupArgs} --demo` : `${menderSetupArgs} --retry-poll 300 --update-poll 1800 --inventory-poll 28800`;
11✔
456
  if (isDemoMode) {
11✔
457
    // Demo installation, either OS os Enterprise. Install demo cert and add IP to /etc/hosts
458
    menderSetupArgs = `${menderSetupArgs}${ipAddress ? ` --server-ip ${ipAddress}` : ''}`;
6!
459
  } else {
460
    // Production installation, either OS, HM, or Enterprise
461
    menderSetupArgs = `${menderSetupArgs} --server-url https://${window.location.hostname} --server-cert=""`;
5✔
462
  }
463
  return menderSetupArgs;
11✔
464
};
465

466
export const getDebConfigurationCode = props => {
187✔
467
  const { tenantToken, isPreRelease } = props;
11✔
468
  const envVars = tenantToken ? `JWT_TOKEN="${getToken()}"\nTENANT_TOKEN="${tenantToken}"\n` : '';
11✔
469
  const installScriptArgs = getInstallScriptArgs(props);
11✔
470
  const scriptUrl = isPreRelease ? 'https://get.mender.io/staging' : 'https://get.mender.io';
11✔
471
  const menderSetupArgs = getSetupArgs(props);
11✔
472
  return `${envVars}wget -O- ${scriptUrl} | sudo bash -s -- ${installScriptArgs} -- ${menderSetupArgs}`;
11✔
473
};
474

475
export const getSnackbarMessage = (skipped, done) => {
187✔
476
  pluralize.addIrregularRule('its', 'their');
1✔
477
  const skipText = skipped
1!
478
    ? `${skipped} ${pluralize('devices', skipped)} ${pluralize('have', skipped)} more than one pending authset. Expand ${pluralize(
479
        'this',
480
        skipped
481
      )} ${pluralize('device', skipped)} to individually adjust ${pluralize('their', skipped)} authorization status. `
482
    : '';
483
  const doneText = done ? `${done} ${pluralize('device', done)} ${pluralize('was', done)} updated successfully. ` : '';
1!
484
  return `${doneText}${skipText}`;
1✔
485
};
486

487
export const extractSoftware = (attributes = {}) => {
187✔
488
  const softwareKeys = Object.keys(attributes).reduce((accu, item) => {
55✔
489
    if (item.endsWith('.version')) {
151✔
490
      accu.push(item.substring(0, item.lastIndexOf('.')));
66✔
491
    }
492
    return accu;
151✔
493
  }, []);
494
  return Object.entries(attributes).reduce(
55✔
495
    (accu, item) => {
496
      if (softwareKeys.some(key => item[0].startsWith(key))) {
261✔
497
        accu.software.push(item);
81✔
498
      } else {
499
        accu.nonSoftware.push(item);
70✔
500
      }
501
      return accu;
151✔
502
    },
503
    { software: [], nonSoftware: [] }
504
  );
505
};
506

507
export const extractSoftwareItem = (artifactProvides = {}) => {
187✔
508
  const { software } = extractSoftware(artifactProvides);
29✔
509
  return (
29✔
510
    software
511
      .reduce((accu, item) => {
512
        const infoItems = item[0].split('.');
27✔
513
        if (infoItems[infoItems.length - 1] !== 'version') {
27!
514
          return accu;
×
515
        }
516
        accu.push({ key: infoItems[0], name: infoItems.slice(1, infoItems.length - 1).join('.'), version: item[1], nestingLevel: infoItems.length });
27✔
517
        return accu;
27✔
518
      }, [])
519
      // we assume the smaller the nesting level in the software name, the closer the software is to the rootfs/ the higher the chances we show the rootfs
520
      // sort based on this assumption & then only return the first item (can't use index access, since there might not be any software item at all)
521
      .sort((a, b) => a.nestingLevel - b.nestingLevel)
×
522
      .reduce((accu, item) => accu ?? item, undefined)
27✔
523
  );
524
};
525

526
export const createDownload = (target, filename) => {
187✔
527
  let link = document.createElement('a');
1✔
528
  link.setAttribute('href', target);
1✔
529
  link.setAttribute('download', filename);
1✔
530
  link.style.display = 'none';
1✔
531
  document.body.appendChild(link);
1✔
532
  link.click();
1✔
533
  document.body.removeChild(link);
1✔
534
};
535

536
export const createFileDownload = (content, filename) => createDownload('data:text/plain;charset=utf-8,' + encodeURIComponent(content), filename);
187✔
537

538
export const getISOStringBoundaries = currentDate => {
187✔
539
  const date = [currentDate.getUTCFullYear(), `0${currentDate.getUTCMonth() + 1}`.slice(-2), `0${currentDate.getUTCDate()}`.slice(-2)].join('-');
376✔
540
  return { start: `${date}T00:00:00.000Z`, end: `${date}T23:59:59.999Z` };
376✔
541
};
542

543
export const isDarkMode = mode => mode === DARK_MODE;
665✔
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