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

nilfalse / ctf / 5752977660

pending completion
5752977660

Pull #298

github

web-flow
Merge b6f7f6972 into da4e6f9f9
Pull Request #298: Update all of jest 27.5.1 → 29.6.2 (major)

0 of 266 branches covered (0.0%)

Branch coverage included in aggregate %.

0 of 613 relevant lines covered (0.0%)

0.0 hits per line

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

0.0
/packages/runtime/services/icon/icon_service.ts
1
import { Report } from '../../lib/report';
2
import * as debug from '../../util/debug';
3
import { twemoji } from '../emoji/emoji_service';
4
import * as env from '../env/env_service';
5
import * as preferenceService from '../preference/preference_service';
6
import * as renderingService from '../rendering/rendering_service';
7
import * as svg from '../svg/svg_service';
8

9
export type Icon = Unwrap<ReturnType<typeof getIcon>>;
10

11
export const sizes = [16, 32, 64, 128, 160] as const;
×
12

13
export const defaultIconPromise = createImageData((size: number) =>
×
14
  svg.toDataURI(svg.char('🏁', size))
×
15
);
16

17
export async function getIcon(
18
  { flag, iso }: Report,
19
  pref = preferenceService.getValue('render')
×
20
) {
21
  switch (pref) {
×
22
    case 'twemoji': {
23
      const path = twemoji.getFilePath(iso);
×
24

25
      if (env.supportsActionSVG) {
×
26
        return { path };
×
27
      } else {
28
        const content = await fetch(path);
×
29
        const dataUri = svg.toDataURI(await content.text());
×
30

31
        return createImageData(() => dataUri);
×
32
      }
33
    }
34

35
    case 'emoji': {
36
      const dataUriFactory = (size: number) =>
×
37
        svg.toDataURI(svg.char(flag.emoji, size));
×
38

39
      return createImageData(dataUriFactory);
×
40
    }
41

42
    default: {
43
      return debug.never(
×
44
        `Unexpected preference value "${
45
          pref as string
46
        }" while rendering data URI`
47
      );
48
    }
49
  }
50
}
51

52
async function createImageData(factory: (size: number) => string) {
53
  const images = sizes.map((size) => ({
×
54
    size,
55
    dataUri: factory(size),
56
  }));
57

58
  return {
×
59
    imageData: await renderingService.render(images),
60
  };
61
}
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