File tree 7 files changed +37
-5
lines changed
7 files changed +37
-5
lines changed Original file line number Diff line number Diff line change
1
+ language : node_js
2
+ node_js :
3
+ - " 6"
Original file line number Diff line number Diff line change
1
+ // This file isn't transpiled, so must use CommonJS and ES5
2
+
3
+ // Register babel to transpile before our tests run.
4
+ require ( 'babel-register' ) ;
5
+
6
+ // Disable webpack features that Mocha doesn't understand.
7
+ require . extensions [ '.css' ] = function ( ) { } ;
Original file line number Diff line number Diff line change 8
8
"license" : " MIT" ,
9
9
"scripts" : {
10
10
"prestart" : " babel-node build_scripts/development-server-start-message.js" ,
11
- "start" : " npm-run-all --parallel security-check start:development:server" ,
11
+ "start" : " npm-run-all --parallel security-check start:development:server lint:watch test:watch " ,
12
12
"start:development:server" : " babel-node build_scripts/development-server.js" ,
13
13
"start:production:server" : " " ,
14
14
"security-check" : " nsp check" ,
15
15
"localtunnel" : " lt --port 3001" ,
16
16
"share:development" : " npm-run-all --parallel start:development:server localtunnel" ,
17
- "lint" : " esw webpack.config.* src --color" ,
18
- "lint:watch" : " npm run lint -- --watch"
17
+ "lint" : " esw webpack.config.* src --fix --color" ,
18
+ "lint:watch" : " npm run lint -- --watch" ,
19
+ "test" : " mocha --reporter progress build_scripts/test-config.js \" src/**/*.test.js\" " ,
20
+ "test:watch" : " npm run test -- --watch"
19
21
},
20
22
"dependencies" : {
21
23
"whatwg-fetch" : " ^2.0.3" ,
Original file line number Diff line number Diff line change 6
6
< script src ="bundle.js "> </ script >
7
7
</ head >
8
8
< body >
9
- < h1 > Hello World</ h1 >
9
+ < h1 > Hello World? </ h1 >
10
10
</ body >
11
11
</ html >
Original file line number Diff line number Diff line change @@ -3,4 +3,3 @@ import './index.css';
3
3
4
4
const courseValue = numeral ( 1000 ) . format ( '$0,0.00' ) ;
5
5
console . log ( `I would like to pay ${ courseValue } for this awesome course!` ) ;
6
-
Original file line number Diff line number Diff line change
1
+ import { expect } from 'chai' ;
2
+
3
+ const jsdom = require ( 'jsdom' ) ;
4
+
5
+ const { JSDOM } = jsdom ;
6
+ import fs from 'fs' ;
7
+
8
+ describe ( 'Our first test' , ( ) => {
9
+ it ( 'should pass' , ( ) => {
10
+ expect ( true ) . to . equal ( true ) ;
11
+ } ) ;
12
+ } ) ;
13
+
14
+ describe ( 'index.html' , ( ) => {
15
+ it ( 'should say hello' , ( ) => {
16
+ const index = fs . readFileSync ( './src/index.html' , 'utf-8' ) ;
17
+ const dom = new JSDOM ( index ) ;
18
+ const h1 = dom . window . document . querySelector ( 'h1' ) . textContent ;
19
+ expect ( h1 ) . to . equal ( 'Hello World' ) ;
20
+ } ) ;
21
+ } ) ;
You can’t perform that action at this time.
0 commit comments