github
439 of 627 branches covered (70.02%)
Branch coverage included in aggregate %.
19 of 26 new or added lines in 3 files covered. (73.08%)
8 existing lines in 3 files now uncovered.4835 of 5315 relevant lines covered (90.97%)
1090.78 hits per line
1 |
import { |
4✔ |
2 |
writeFileSync, |
4✔ |
3 |
readFileSync, |
4✔ |
4 |
existsSync, |
4✔ |
5 |
} from 'fs'; |
4✔ |
6 |
import { |
4✔ |
7 |
createHash, |
4✔ |
8 |
} from 'crypto'; |
4✔ |
9 |
import { |
4✔ |
10 |
sep, |
4✔ |
11 |
} from 'path'; |
4✔ |
12 |
import { |
4✔ |
13 |
FRAMEWORK_ROOT, |
4✔ |
14 |
TEMP_DIR, |
4✔ |
15 |
} from './constants.js'; |
4✔ |
16 |
|
4✔ |
17 |
const hash = createHash('sha256',) |
4✔ |
18 |
.update(FRAMEWORK_ROOT,) |
4✔ |
19 |
.digest('hex',); |
4✔ |
20 |
|
4✔ |
21 |
export default { |
4✔ |
22 |
get(defaulted: boolean,): boolean { |
|
23 |
if (! existsSync(TEMP_DIR + sep + 'api-bench-r' + hash,)) { |
|
UNCOV
24
|
return defaulted;
|
× |
UNCOV
25
|
} |
× |
26 |
return readFileSync(
|
8✔ |
27 |
TEMP_DIR + sep + 'api-bench-r' + hash, |
8✔ |
28 |
'utf8', |
8✔ |
29 |
) === 'true'; |
8✔ |
30 |
}, |
4✔ |
31 |
set(value: boolean,): void {
|
|
32 |
writeFileSync( |
12✔ |
33 |
TEMP_DIR + sep + 'api-bench-r' + hash, |
12✔ |
34 |
value ? 'true' : 'false', |
|
35 |
'utf8', |
12✔ |
36 |
); |
12✔ |
37 |
}, |
4✔ |
38 |
}; |
4✔ |