This repository was archived by the owner on Sep 21, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +37
-2
lines changed Expand file tree Collapse file tree 5 files changed +37
-2
lines changed Original file line number Diff line number Diff line change @@ -205,6 +205,10 @@ Rejects promise if critical error occurred.
205
205
206
206
* ` gemini.browserIds ` – list of all browser identificators to use for tests.
207
207
208
+ * ` Gemini.readRawConfig ` - reads configuration file for specified ` filePath `
209
+ and returns content as JS object. This method does not validate and analyze
210
+ gemini configuration.
211
+
208
212
## Events
209
213
210
214
` gemini ` instance emits some events, which can be used by external scripts or
Original file line number Diff line number Diff line change @@ -55,6 +55,8 @@ Config.prototype.isCoverageEnabled = function() {
55
55
return this . system . coverage . enabled ;
56
56
} ;
57
57
58
+ Config . readRawConfig = readConfig ;
59
+
58
60
function readConfig ( filePath ) {
59
61
var config = configReader . read ( filePath ) ,
60
62
configDir = filePath ? path . dirname ( filePath ) : process . cwd ( ) ;
Original file line number Diff line number Diff line change @@ -38,6 +38,10 @@ module.exports = class Gemini extends PassthroughEmitter {
38
38
this . _loadPlugins ( ) ;
39
39
}
40
40
41
+ static readRawConfig ( filePath ) {
42
+ return Config . readRawConfig ( filePath ) ;
43
+ }
44
+
41
45
_run ( stateProcessor , paths , options ) {
42
46
if ( ! options ) {
43
47
//if there are only two arguments, they are
Original file line number Diff line number Diff line change @@ -18,9 +18,21 @@ describe('config', function() {
18
18
assert . calledWith ( configReader . read , '/some/path' ) ;
19
19
} ) ;
20
20
21
+ it ( 'should have static API for reading of a configuration file' , ( ) => {
22
+ sandbox . stub ( configReader , 'read' )
23
+ . withArgs ( '/some/path' )
24
+ . returns ( { foo : 'bar' } ) ;
25
+
26
+ assert . deepEqual ( Config . readRawConfig ( '/some/path' ) , {
27
+ foo : 'bar' ,
28
+ system : {
29
+ projectRoot : '/some'
30
+ }
31
+ } ) ;
32
+ } ) ;
33
+
21
34
describe ( 'overrides' , function ( ) {
22
35
beforeEach ( function ( ) {
23
- /*jshint -W069*/
24
36
this . configValue = '/from/config' ;
25
37
this . envValue = '/from/env' ;
26
38
this . cliValue = '/from/cli' ;
@@ -42,7 +54,6 @@ describe('config', function() {
42
54
} ) ;
43
55
44
56
afterEach ( function ( ) {
45
- /*jshint -W069*/
46
57
delete process . env [ 'gemini_system_project_root' ] ;
47
58
process . argv = this . oldArgv ;
48
59
} ) ;
Original file line number Diff line number Diff line change @@ -336,4 +336,18 @@ describe('gemini', () => {
336
336
. then ( ( ) => assert . calledWith ( console . warn , sinon . match ( 'Unknown browsers id: b2' ) ) ) ;
337
337
} ) ;
338
338
} ) ;
339
+
340
+ describe ( 'readRawConfig' , ( ) => {
341
+ beforeEach ( ( ) => {
342
+ sandbox . stub ( Config , 'readRawConfig' ) ;
343
+ } ) ;
344
+
345
+ it ( 'should read configuration object from file by given path' , ( ) => {
346
+ Config . readRawConfig
347
+ . withArgs ( 'some/file/path' )
348
+ . returns ( { foo : 'bar' } ) ;
349
+
350
+ assert . deepEqual ( Gemini . readRawConfig ( 'some/file/path' ) , { foo : 'bar' } ) ;
351
+ } ) ;
352
+ } ) ;
339
353
} ) ;
You can’t perform that action at this time.
0 commit comments