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

alovajs / alova / #183

13 Jun 2024 08:41AM UTC coverage: 97.363% (+0.005%) from 97.358%
#183

push

github

web-flow
fix: remove slash at the end when sending with empty url(#384)

524 of 547 branches covered (95.8%)

Branch coverage included in aggregate %.

7 of 7 new or added lines in 1 file covered. (100.0%)

2688 of 2752 relevant lines covered (97.67%)

149.91 hits per line

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

86.36
/src/predefine/defaultCacheLogger.ts
1
import { STORAGE_RESTORE, isSSR, len } from '@/utils/variables';
1✔
2
import { CacheMode } from '~/typings';
1✔
3
import { Method } from '..';
1✔
4

1✔
5
const titleStyle = 'color: black; font-size: 12px; font-weight: bolder';
1✔
6
/**
1✔
7
 * 默认cacheLogger函数
1✔
8
 */
1✔
9
export default (response: any, methodInstance: Method, cacheMode: CacheMode, tag: string | number | undefined) => {
1✔
10
  const cole = console,
5✔
11
    log = (...args: any[]) => console.log(...args),
5✔
12
    url = methodInstance.url,
5✔
13
    isRestoreMode = cacheMode === STORAGE_RESTORE,
5✔
14
    hdStyle = '\x1B[42m%s\x1B[49m',
5✔
15
    labelStyle = '\x1B[32m%s\x1B[39m',
5✔
16
    startSep = ` [HitCache]${url} `,
5✔
17
    endSepFn = () => Array(len(startSep) + 1).join('^');
5✔
18
  if (isSSR) {
5!
19
    log(hdStyle, startSep);
×
20
    log(labelStyle, ' Cache ', response);
×
21
    log(labelStyle, ' Mode  ', cacheMode);
×
22
    isRestoreMode && log(labelStyle, ' Tag   ', tag);
×
23
    log(labelStyle, endSepFn());
×
24
  } else {
5✔
25
    cole.groupCollapsed
5✔
26
      ? cole.groupCollapsed('%cHitCache', 'padding: 2px 6px; background: #c4fcd3; color: #53b56d;', url)
5✔
27
      : log(hdStyle, startSep);
5✔
28

5✔
29
    log('%c[Cache]', titleStyle, response);
5✔
30
    log('%c[Mode]', titleStyle, cacheMode);
5✔
31
    isRestoreMode && log('%c[Tag]', titleStyle, tag);
5✔
32
    log('%c[Method]', titleStyle, methodInstance);
5✔
33
    cole.groupEnd ? cole.groupEnd() : log(labelStyle, endSepFn());
5✔
34
  }
5✔
35
};
5✔
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

© 2026 Coveralls, Inc