File tree Expand file tree Collapse file tree 12 files changed +105
-67
lines changed Expand file tree Collapse file tree 12 files changed +105
-67
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " coderoad-cli" ,
3- "version" : " 0.3.12 " ,
3+ "version" : " 0.3.13 " ,
44 "description" : " Command line interface for CodeRoad. Build project files." ,
55 "keywords" : [
66 " coderoad"
2020 "dependencies" : {
2121 "chalk" : " 1.1.1" ,
2222 "commander" : " 2.9.0" ,
23- "lodash" : " 4.2.1 " ,
24- "prompt" : " ^0.2.14 "
23+ "lodash" : " 4.5.0 " ,
24+ "prompt" : " 1.0.0 "
2525 },
2626 "devDependencies" : {
2727 "chai" : " 3.5.0" ,
Original file line number Diff line number Diff line change 22 "name" : " coderoad-package-name" ,
33 "version" : " 0.1.0" ,
44 "description" : " Coderoad tutorial" ,
5- "author" : " " ,
5+ "author" : " Name <email> (site) " ,
66 "contributers" : [],
77 "main" : " coderoad.json" ,
8+ "files" : [
9+ " coderoad.json" ,
10+ " tutorial"
11+ ],
812 "keywords" : [" coderoad" , " tutorial" ],
9- "dependencies" : {},
10- "devDependencies" : {},
13+ "engines" : {
14+ "node" : " >=0.10.3"
15+ },
16+ "dependencies" : {
17+ "mocha-coderoad" : " ^0.3.1"
18+ },
1119 "license" : " MIT" ,
12- "coderoad " : {
20+ "config " : {
1321 "testDir" : " tutorial" ,
14- "testSuffix" : " .spec.js"
22+ "testSuffix" : " .spec.js" ,
23+ "testRunner" : " mocha-coderoad"
1524 }
1625}
Original file line number Diff line number Diff line change 11var expect = require ( 'chai' ) . expect ;
2- var context = require ( 'test-context' ) ;
3- var filePath = '../../../example.js' ;
4- context ( filePath ) ;
52
6- describe ( 'addOne' , function ( ) {
3+ var loadJS = require ( './common/loadJS' ) . default ;
4+ loadJS ( 'page-01.js' )
5+
6+ describe ( '01 addOne' , function ( ) {
77
88 it ( 'doesn\'t exist' , function ( ) {
99 expect ( addOne ) . to . not . be . undefined ;
1010 } ) ;
1111
12- it ( 'doesn\'t take any parameters ' , function ( ) {
13- expect ( addOne . length ) . to . be . above ( 0 ) ;
12+ it ( 'should take a parameter ' , function ( ) {
13+ expect ( addOne ) . to . have . length ( 1 ) ;
1414 } ) ;
1515
1616 it ( 'doesn\'t return anything' , function ( ) {
1717 expect ( addOne ( 1 ) ) . to . exist ;
1818 } ) ;
1919
20- it ( 'doesn\'t output a number' , function ( ) {
20+ it ( 'should output a number' , function ( ) {
2121 expect ( addOne ( 1 ) ) . to . be . a ( 'number' ) ;
2222 } ) ;
2323
Original file line number Diff line number Diff line change 1+ describe ( '02 subtractOne' , function ( ) {
2+
3+ it ( 'doesn\'t exist' , function ( ) {
4+ expect ( subtractOne ) . to . not . be . undefined ;
5+ } ) ;
6+
7+ it ( 'should take a parameter' , function ( ) {
8+ expect ( subtractOne ) . to . have . length ( 1 ) ;
9+ } ) ;
10+
11+ it ( 'should output a number' , function ( ) {
12+ expect ( subtractOne ( 1 ) ) . to . be . a ( 'number' ) ;
13+ } ) ;
14+
15+ it ( 'doesn\'t subtract 1' , function ( ) {
16+ expect ( subtractOne ( 1 ) ) . to . equal ( 0 ) ;
17+ expect ( subtractOne ( 10 ) ) . to . equal ( 9 ) ;
18+ } ) ;
19+
20+ } ) ;
Original file line number Diff line number Diff line change @@ -16,7 +16,19 @@ function doSomething(parameter) {
1616Try making your own basic functions.
1717
1818+ write a function ` addOne ` that adds one to a number
19- @test ('chapter-01/page-01/task-01')
19+ @test ('1/01/01')
20+ @action (open('page-01.js'))
21+ @action (set(
22+ ```
23+ // addOne
24+ ```
25+ ))
2026
2127+ write a function ` subtractOne ` that subtracts one from a number
22- @test ('chapter-01/page-01/task-02')
28+ @test ('1/01/02')
29+ @action (insert(
30+ ```
31+
32+ // subtractOne
33+ ```
34+ ))
Original file line number Diff line number Diff line change 11var expect = require ( 'chai' ) . expect ;
2- var context = require ( 'test-context' ) ;
3- context ( '../../../example.js' ) ;
42
5- describe ( 'divideOne' , function ( ) {
3+ var loadJS = require ( './common/loadJS' ) . default ;
4+ loadJS ( 'page-02.js' )
5+
6+
7+ describe ( '01 divideOne' , function ( ) {
68
79 it ( 'doesn\'t exist' , function ( ) {
810 expect ( divideOne ) . to . not . be . undefined ;
911 } ) ;
1012
11- it ( 'doesn\'t take any parameters ' , function ( ) {
12- expect ( divideOne . length ) . to . be . above ( 0 ) ;
13+ it ( 'should take a parameter ' , function ( ) {
14+ expect ( divideOne ) . to . have . length ( 1 ) ;
1315 } ) ;
1416
1517 it ( 'doesn\'t output a number' , function ( ) {
Original file line number Diff line number Diff line change 1- var expect = require ( 'chai' ) . expect ;
2- var context = require ( 'test-context' ) ;
3- context ( '../../../example.js' ) ;
4-
5- describe ( 'multiplyOne' , function ( ) {
1+ describe ( '02 multiplyOne' , function ( ) {
62
73 it ( 'doesn\'t exist' , function ( ) {
84 expect ( multiplyOne ) . to . not . be . undefined ;
95 } ) ;
106
11- it ( 'doesn\'t take any parameters ' , function ( ) {
12- expect ( multiplyOne . length ) . to . be . above ( 0 ) ;
7+ it ( 'should take a parameter ' , function ( ) {
8+ expect ( multiplyOne ) . to . have . length ( 1 ) ;
139 } ) ;
1410
15- it ( 'doesn\'t output a number' , function ( ) {
11+ it ( 'should output a number' , function ( ) {
1612 expect ( multiplyOne ( 1 ) ) . to . be . a ( 'number' ) ;
1713 } ) ;
1814
Original file line number Diff line number Diff line change @@ -4,7 +4,19 @@ Writing basic functions continued.
44We'll write two more basic functions, this time without any help.
55
66+ write a function ` divideOne ` divides a number by 1
7- @test ('chapter-01/page-02/task-01')
7+ @test ('1/02/01')
8+ @action (open('page-02.js'))
9+ @action (set(
10+ ```
11+ // divideOne
12+ ```
13+ ))
814
915+ write a function ` mutiplyone ` that multiplies a number by 1
10- @test ('chapter-01/page-02/task-02')
16+ @test ('1/02/02')
17+ @action (insert(
18+ ```
19+
20+ // multiplyOne
21+ ```
22+ ))
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ "use strict" ;
2+ var vm = require ( 'vm' ) ;
3+ var fs = require ( 'fs' ) ;
4+ var path = require ( 'path' ) ;
5+ function loadContext ( pathToContext ) {
6+ var absPath = path . join ( process . env . DIR , pathToContext ) ;
7+ var context = fs . readFileSync ( absPath , 'utf8' ) ;
8+ vm . runInThisContext ( context ) ;
9+ }
10+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
11+ exports . default = loadContext ;
You can’t perform that action at this time.
0 commit comments