File tree Expand file tree Collapse file tree 2 files changed +57
-2
lines changed Expand file tree Collapse file tree 2 files changed +57
-2
lines changed Original file line number Diff line number Diff line change @@ -9,10 +9,11 @@ function getConfig(){
9
9
var config = defaultConfig ;
10
10
11
11
if ( module . exports . config ) {
12
- config . rootDirectory = module . exports . config . rootDirectory || config . module . rootDirectory ;
12
+ config . rootDirectory = module . exports . config . rootDirectory || config . rootDirectory ;
13
+ config . protractorConfig = module . exports . config . protractorConfig || config . protractorConfig ;
13
14
}
14
15
15
- var protractorConfigFile = path . join ( config . rootDirectory , module . exports . config . protractorConfig || config . protractorConfig ) ;
16
+ var protractorConfigFile = path . join ( config . rootDirectory , config . protractorConfig ) ;
16
17
var protractorConfig = require ( protractorConfigFile ) . config ;
17
18
18
19
config . mocks = protractorConfig . mocks || defaultConfig . mocks ;
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ var fs = require ( 'fs' ) ;
4
+ var path = require ( 'path' ) ;
5
+
6
+ var initDataModule = {
7
+ path : '../lib/initData' ,
8
+ require : function ( ) {
9
+ return require ( this . path ) ;
10
+ } ,
11
+ teardown : function ( ) {
12
+ delete require . cache [ require . resolve ( this . path ) ] ;
13
+ }
14
+ } ;
15
+
16
+ var defaultConfig = {
17
+ path : path . join ( __dirname , '../protractor-conf.js' ) ,
18
+ setup : function ( ) {
19
+ fs . writeFileSync ( this . path , 'exports.config = {}' ) ;
20
+ } ,
21
+ teardown : function ( ) {
22
+ fs . unlinkSync ( this . path ) ;
23
+ }
24
+ } ;
25
+
26
+ var globalMocks = {
27
+ setup : function ( ) {
28
+ global . protractor = { } ;
29
+ global . browser = {
30
+ addMockModule : function ( ) { }
31
+ } ;
32
+ } ,
33
+ teardown : function ( ) {
34
+ delete global . protractor ;
35
+ delete global . browser ;
36
+ }
37
+ } ;
38
+
39
+
40
+ describe ( 'init data' , function ( ) {
41
+ beforeEach ( function ( ) {
42
+ this . initData = initDataModule . require ( ) ;
43
+ globalMocks . setup ( ) ;
44
+ defaultConfig . setup ( ) ;
45
+ } ) ;
46
+ afterEach ( function ( ) {
47
+ initDataModule . teardown ( ) ;
48
+ globalMocks . teardown ( ) ;
49
+ defaultConfig . teardown ( ) ;
50
+ } ) ;
51
+ it ( 'will not error when not providing config' , function ( ) {
52
+ expect ( this . initData ) . not . toThrow ( ) ;
53
+ } ) ;
54
+ } ) ;
You can’t perform that action at this time.
0 commit comments