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 1
1
{
2
2
"name" : " coderoad-cli" ,
3
- "version" : " 0.3.12 " ,
3
+ "version" : " 0.3.13 " ,
4
4
"description" : " Command line interface for CodeRoad. Build project files." ,
5
5
"keywords" : [
6
6
" coderoad"
20
20
"dependencies" : {
21
21
"chalk" : " 1.1.1" ,
22
22
"commander" : " 2.9.0" ,
23
- "lodash" : " 4.2.1 " ,
24
- "prompt" : " ^0.2.14 "
23
+ "lodash" : " 4.5.0 " ,
24
+ "prompt" : " 1.0.0 "
25
25
},
26
26
"devDependencies" : {
27
27
"chai" : " 3.5.0" ,
Original file line number Diff line number Diff line change 2
2
"name" : " coderoad-package-name" ,
3
3
"version" : " 0.1.0" ,
4
4
"description" : " Coderoad tutorial" ,
5
- "author" : " " ,
5
+ "author" : " Name <email> (site) " ,
6
6
"contributers" : [],
7
7
"main" : " coderoad.json" ,
8
+ "files" : [
9
+ " coderoad.json" ,
10
+ " tutorial"
11
+ ],
8
12
"keywords" : [" coderoad" , " tutorial" ],
9
- "dependencies" : {},
10
- "devDependencies" : {},
13
+ "engines" : {
14
+ "node" : " >=0.10.3"
15
+ },
16
+ "dependencies" : {
17
+ "mocha-coderoad" : " ^0.3.1"
18
+ },
11
19
"license" : " MIT" ,
12
- "coderoad " : {
20
+ "config " : {
13
21
"testDir" : " tutorial" ,
14
- "testSuffix" : " .spec.js"
22
+ "testSuffix" : " .spec.js" ,
23
+ "testRunner" : " mocha-coderoad"
15
24
}
16
25
}
Original file line number Diff line number Diff line change 1
1
var expect = require ( 'chai' ) . expect ;
2
- var context = require ( 'test-context' ) ;
3
- var filePath = '../../../example.js' ;
4
- context ( filePath ) ;
5
2
6
- describe ( 'addOne' , function ( ) {
3
+ var loadJS = require ( './common/loadJS' ) . default ;
4
+ loadJS ( 'page-01.js' )
5
+
6
+ describe ( '01 addOne' , function ( ) {
7
7
8
8
it ( 'doesn\'t exist' , function ( ) {
9
9
expect ( addOne ) . to . not . be . undefined ;
10
10
} ) ;
11
11
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 ) ;
14
14
} ) ;
15
15
16
16
it ( 'doesn\'t return anything' , function ( ) {
17
17
expect ( addOne ( 1 ) ) . to . exist ;
18
18
} ) ;
19
19
20
- it ( 'doesn\'t output a number' , function ( ) {
20
+ it ( 'should output a number' , function ( ) {
21
21
expect ( addOne ( 1 ) ) . to . be . a ( 'number' ) ;
22
22
} ) ;
23
23
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) {
16
16
Try making your own basic functions.
17
17
18
18
+ 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
+ ))
20
26
21
27
+ 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 1
1
var expect = require ( 'chai' ) . expect ;
2
- var context = require ( 'test-context' ) ;
3
- context ( '../../../example.js' ) ;
4
2
5
- describe ( 'divideOne' , function ( ) {
3
+ var loadJS = require ( './common/loadJS' ) . default ;
4
+ loadJS ( 'page-02.js' )
5
+
6
+
7
+ describe ( '01 divideOne' , function ( ) {
6
8
7
9
it ( 'doesn\'t exist' , function ( ) {
8
10
expect ( divideOne ) . to . not . be . undefined ;
9
11
} ) ;
10
12
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 ) ;
13
15
} ) ;
14
16
15
17
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 ( ) {
6
2
7
3
it ( 'doesn\'t exist' , function ( ) {
8
4
expect ( multiplyOne ) . to . not . be . undefined ;
9
5
} ) ;
10
6
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 ) ;
13
9
} ) ;
14
10
15
- it ( 'doesn\'t output a number' , function ( ) {
11
+ it ( 'should output a number' , function ( ) {
16
12
expect ( multiplyOne ( 1 ) ) . to . be . a ( 'number' ) ;
17
13
} ) ;
18
14
Original file line number Diff line number Diff line change @@ -4,7 +4,19 @@ Writing basic functions continued.
4
4
We'll write two more basic functions, this time without any help.
5
5
6
6
+ 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
+ ))
8
14
9
15
+ 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