Coveralls logob
Coveralls logo
  • Home
  • Features
  • Pricing
  • Docs
  • Sign In

Alorel / personal-build-tools / 1844

23 Dec 2019 - 1:17 coverage increased (+0.3%) to 78.737%
1844

Pull #180

travis-ci-com

9181eb84f9c35729a3bad740fb7f9d93?size=18&default=identiconweb-flow
chore(package): update lockfile yarn.lock
Pull Request #180: Update nyc to the latest version 🚀

382 of 627 branches covered (60.93%)

Branch coverage included in aggregate %.

1488 of 1748 relevant lines covered (85.13%)

37.36 hits per line

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

86.0
/src/lib/init/00_pkg-json-defaults.ts
1
import {isEmpty} from 'lodash';
2
import {Options} from 'yargs';
8×
3
import {addGhRepo, addGhToken, addGhUser} from '../../commons/identity';
8×
4
import {InitConf} from '../../interfaces/InitConf';
8×
5
import {Obj} from '../../interfaces/OptionsObject';
8×
6
import {Git} from '../Git';
8×
7
import {Log} from '../Log';
8×
8
import {ObjectWriter, ObjectWriterFormat} from '../ObjectWriter';
8×
9
import {PromptableConfig} from '../PromptableConfig';
10

11
export const options: Obj<Options> = {
12
  'project-desc': {
13
    describe: 'Project description',
14
    type: 'string'
15
  },
16
  'project-keywords': {
17
    describe: 'Project keywords',
18
    type: 'array'
19
  },
20
  'project-name': {
21
    describe: 'Name of the project',
22
    type: 'string'
8×
23
  }
8×
24
};
8×
25

26
addGhUser(options);
50×
27
addGhRepo(options);
28
addGhToken(options);
50×
29

50×
30
export function handle(c: PromptableConfig<InitConf>): void {
50×
31
  const w = new ObjectWriter('package.json', ObjectWriterFormat.JSON);
50×
32

50×
33
  function setScripts() {
50×
34
    w.set('scripts.pretest', 'rimraf coverage', false);
50×
35
    w.set('scripts.test', 'nyc mocha --opts ./mocha.opts', false);
50×
36
    w.set(['scripts', 'test:watch'], 'npm --scripts-prepend-node-path=auto run test -- --watch', false);
37
    w.set('scripts.tslint', 'alo tslint -p tsconfig.test.json', false);
Branches [[0, 1]] missed. 50×
38
    w.set(['scripts', 'tslint:fix'], 'npm --scripts-prepend-node-path=auto run tslint -- --fix', false);
50×
39

50×
40
    w.set('scripts.typecheck', 'tsc --noEmit', false);
41
    w.set(['scripts', 'typecheck:watch'], 'npm --scripts-prepend-node-path=auto run typecheck -- --watch', false);
Branches [[1, 1]] missed. 50×
42

50×
43
    w.set('scripts.build', 'alo build', false);
50×
44
  }
45

Branches [[2, 1]] missed. 50×
46
  if (!w.has('name')) {
50×
47
    w.set('name', c.promptedProjectName());
50×
48
    Log.success('Set project name');
49
  }
Branches [[3, 1]] missed. 50×
50

50×
51
  if (!w.has('version')) {
50×
52
    w.set('version', '0.0.1');
53
    Log.success('Set project version');
50×
54
  }
Branches [[4, 0]] missed. 50×
UNCOV
55

!
UNCOV
56
  if (!w.has('description')) {
!
57
    w.set('description', c.promptedProjectDescription());
58
    Log.success('Set project description');
50×
59
  }
50×
60

61
  if (isEmpty(w.get('keywords'))) {
8×
62
    w.set('keywords', c.promptedProjectKeywords());
63
    Log.success('Set project keywords');
64
  }
65

66
  setScripts();
67

68
  if (!w.has('repository') && Git.originUrl) {
69
    w.set('repository', Git.originUrl);
70
    Log.success('Set repository URL');
71
  }
72

73
  w.save();
74

75
  Git.add('package.json');
76
}
Troubleshooting · Open an Issue · Sales · Support · ENTERPRISE · CAREERS · STATUS
BLOG · TWITTER · Legal & Privacy · Supported CI Services · What's a CI service? · Automated Testing

© 2022 Coveralls, Inc