You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refer to [official docs](https://nodejs.org/en/download/). Alternatively you may use Node version manager like [nvm](https://github.com/nvm-sh/nvm).
17
17
18
-
### Yarn (3.x)
19
-
20
-
```bash
21
-
npm install -g yarn
22
-
```
23
18
24
19
### Setup project
25
20
26
-
Update yarn to 3.x version:
27
-
28
-
```bash
29
-
yarn set version berry
30
-
```
31
-
32
21
Install project dependencies:
33
22
34
23
```bash
35
-
yarn install
36
-
```
37
-
38
-
Setup husky:
39
-
40
-
```bash
41
-
yarn prepare
24
+
npm i
42
25
```
43
26
44
27
## Commands
45
28
46
29
```bash
47
-
yarn build[:w]
30
+
npm run build[:w]
48
31
```
49
32
50
33
Transpiles `.ts` sources and tests (`src` and `test` dirs) and outputs JS files to `build` directory. When run with `:w` it will watch for changes and rebuild automatically.
51
34
52
35
```bash
53
-
yarn test[:w]
36
+
npm run test[:w]
54
37
```
55
38
56
39
Runs all tests from `test` folder. It runs `build` internally so it doesn't have to be run manually. When run with `:w` it will watch for changes, rebuild and rerun test automatically.
57
40
58
41
```bash
59
-
yarn bdd
42
+
npm run bdd
60
43
```
61
44
62
45
Runs all BDD tests from `bdd` directory. It runs `build` internally so it doesn't have to be run manually.
63
46
64
47
```bash
65
-
yarn coverage
48
+
npm run coverage
66
49
```
67
50
68
51
Checks code coverage, generates HTML report and serves it on 8080 port.
69
52
70
53
```bash
71
-
yarn coverage:check
54
+
npm run coverage:check
72
55
```
73
56
74
57
Checks code coverage. Will fail if it is below a threshold defined in `package.json`. Useful as a CI job.
75
58
76
59
```bash
77
-
yarn coverage:generate
60
+
npm run coverage:generate
78
61
```
79
62
80
63
Checks code coverage and generates HTML report.
81
64
82
65
```bash
83
-
yarn coverage:[unit|bdd]
66
+
npm run coverage:[unit|bdd]
84
67
```
85
68
86
69
Generates code coverage for given set of tests. _It's a subtask and should not be run separately_.
87
70
88
71
```bash
89
-
yarn coverage:report
72
+
npm run coverage:report
90
73
```
91
74
92
75
Creates coverage report based on generated coverage files from unit and bdd tests. _It's a subtask and should not be run separately_.
93
76
94
77
```bash
95
-
yarn dist
78
+
npm run dist
96
79
```
97
80
98
81
Builds dist files - similar to `build` but skips `test` folder and additionaly generates source maps and TS typings files.
99
82
100
83
```bash
101
-
yarn lint
84
+
npm run lint
102
85
```
103
86
104
87
Lints `src` and `test` dirs. Used as a `pre-commit` hook.
105
88
106
89
```bash
107
-
yarn prepare
90
+
npm run prepare
108
91
```
109
92
110
93
Installs husky hooks. Necessary only for development. Needs to be run only once after repo checkout.
@@ -114,19 +97,19 @@ Installs husky hooks. Necessary only for development. Needs to be run only once
114
97
Single test file can be run by passing its path to `test` command:
115
98
116
99
```bash
117
-
yarn test build/test/ifca/common.spec.js
100
+
npm run test -- build/test/ifca/common.spec.js
118
101
```
119
102
120
103
While specific test cases can be run using `-m` (match) option:
121
104
122
105
```bash
123
-
yarn test -m "*default*"
106
+
npm run test -- -m "*default*"
124
107
```
125
108
126
109
Both can be mixed to run specific tests from a given file or folder:
127
110
128
111
```bash
129
-
yarn test build/test/ifca/common.spec.js -m "*default*"
112
+
npm run test -- build/test/ifca/common.spec.js -m "*default*"
130
113
```
131
114
132
115
## Publish
@@ -138,4 +121,5 @@ yarn test build/test/ifca/common.spec.js -m "*default*"
0 commit comments