File tree Expand file tree Collapse file tree 8 files changed +24
-18
lines changed Expand file tree Collapse file tree 8 files changed +24
-18
lines changed Original file line number Diff line number Diff line change 42
42
43
43
## Day 6 - Simplify & automate your tests
44
44
45
- 1 . Put test call in package.json script
46
- 2 . Refactor tests using mocha.opts
47
- 3 . Add mocha watch command
48
- 4 . Skipping tests
49
- 5 . Isolating tests
50
- 6 . Increase timeouts
51
- 7 . Install husky
45
+ 1 . Customising your package.json scripts
46
+ 2 . Add mocha watch command
47
+ 3 . Refactor tests using mocha.opts
48
+ 4 . Recursive testing
49
+ 5 . Skipping tests
50
+ 6 . Isolating tests
51
+ 7 . Install git hooks
52
52
8 . Run tests when commit or push
53
53
54
54
## Day 7 - JavaScript testing recap
Original file line number Diff line number Diff line change 4
4
"description" : " " ,
5
5
"main" : " index.js" ,
6
6
"scripts" : {
7
- "test" : " echo \" Error: no test specified\" && exit 1"
7
+ "precommit" : " npm test" ,
8
+ "prepush" : " npm test" ,
9
+ "test" : " mocha" ,
10
+ "test:watch" : " mocha --watch"
8
11
},
9
12
"repository" : {
10
13
"type" : " git" ,
21
24
"babel-preset-env" : " ~1.6.0" ,
22
25
"babel-register" : " ~6.24.1" ,
23
26
"chai" : " ~4.1.1" ,
27
+ "husky" : " ~0.14.3" ,
24
28
"mocha" : " ~3.5.0" ,
25
29
"sinon" : " ~3.2.1"
26
30
},
Original file line number Diff line number Diff line change
1
+ --require babel-register
2
+ --recursive
3
+ --require test/support
Original file line number Diff line number Diff line change
1
+ import { expect } from 'chai' ;
2
+ import sinon from 'sinon' ;
3
+
4
+ global . expect = expect ;
5
+ global . sinon = sinon ;
Original file line number Diff line number Diff line change 1
- import { expect } from 'chai' ;
2
- import day2 from '../src/day2' ;
1
+ import day2 from '../../src/day2' ;
3
2
4
3
describe ( 'day2 tests' , ( ) => {
5
4
describe ( 'check data type' , ( ) => {
Original file line number Diff line number Diff line change 1
- import { expect } from 'chai' ;
2
- import day3 from '../src/day3' ;
1
+ import day3 from '../../src/day3' ;
3
2
4
3
describe ( 'day 3 tests' , ( ) => {
5
4
it ( 'should return expected value from callback' , ( done ) => {
Original file line number Diff line number Diff line change 1
- import sinon from 'sinon' ;
2
- import { expect } from 'chai' ;
3
- import { timeout , dateDescriber } from '../src/day4' ;
1
+ import { timeout , dateDescriber } from '../../src/day4' ;
4
2
5
3
describe ( 'day 4 tests' , ( ) => {
6
4
describe ( 'timeout tests' , ( ) => {
Original file line number Diff line number Diff line change 1
- import { expect } from 'chai' ;
2
- import sinon from 'sinon' ;
3
1
import request from 'request' ;
4
- import day5 from '../src/day5' ;
2
+ import day5 from '../../ src/day5' ;
5
3
6
4
describe ( 'day5 tests' , ( ) => {
7
5
You can’t perform that action at this time.
0 commit comments