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

pkgxdev / libpkgx / 6509994306

13 Oct 2023 03:13PM UTC coverage: 80.838%. First build
6509994306

Pull #48

github

web-flow
Merge 8cb573d81 into 99c9c22af
Pull Request #48: v1 wip

475 of 667 branches covered (0.0%)

Branch coverage included in aggregate %.

141 of 163 new or added lines in 12 files covered. (86.5%)

2149 of 2579 relevant lines covered (83.33%)

1029.77 hits per line

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

86.49
/src/hooks/useTestConfig.ts
1
import useConfig, { ConfigDefault } from "./useConfig.ts"
45✔
2
import { copySync } from "deno/fs/copy.ts"
45✔
3
import Path from "../utils/Path.ts"
45✔
4

5
export function useBaseTestConfig(env?: Record<string, string>) {
45✔
6
  env ??= {}
127✔
7

8
  /// always prefer a new prefix
127✔
9
  env.HOME ??= Path.mktemp().string
127✔
10
  env.PKGX_DIR ??= Path.mktemp().string
127✔
11
  env.XDG_DATA_HOME ??= Path.mktemp().string
127✔
12
  env.XDG_CACHE_HOME ??= Path.mktemp().string
127✔
13

14
  const config = ConfigDefault(env)
127✔
15
  if ('UserAgent' in env) {
127✔
16
    config.UserAgent = env['UserAgent']
130✔
17
  }
130✔
18

19
  return useConfig(config)
127✔
20
}
127✔
21

22
import usePantry from "./usePantry.ts"
45✔
23

24
export function useTestConfig(env?: Record<string, string>) {
45✔
25
  const conf = useBaseTestConfig(env)
127✔
26
  copySync(srcroot.join("fixtures/projects").string, usePantry().prefix.parent().mkdir('p').join("projects").string)
127✔
27
  return conf
127✔
28
}
127✔
29

30
export const srcroot = (() => {
45✔
31
  // because when running via dnt the path of this file is different
90✔
NEW
32
  if (Path.cwd().parent().parent().join("fixtures").isDirectory()) {
×
NEW
33
    return Path.cwd().parent().parent()
×
NEW
34
  } else {
×
35
    let path = new URL(import.meta.url).pathname
90✔
36
    if (Deno.build.os == 'windows') {
30!
37
      path = path.slice(1) // /D:/foo/bar -> D:/foo/bar
30✔
38
    }
30✔
39
    return new Path(path).parent().parent().parent()
90✔
40
  }
90✔
41
})()
45✔
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