11'use strict' ;
22
33const _ = require ( 'lodash' ) ;
4+ const path = require ( 'path' ) ;
45const SetsBuilder = require ( 'gemini-core' ) . SetsBuilder ;
56const Suite = require ( './suite' ) ;
67const Events = require ( './constants/events' ) ;
@@ -9,15 +10,17 @@ const utils = require('./utils');
910
1011const DEFAULT_DIR = require ( '../package' ) . name ;
1112
12- const loadSuites = ( sets , emitter ) => {
13+ const loadSuites = ( sets , emitter , projectRoot ) => {
1314 const rootSuite = Suite . create ( '' ) ;
1415
15- _ . forEach ( sets . groupByFile ( ) , ( browsers , path ) => {
16- global . gemini = testsApi ( rootSuite , browsers ) ;
16+ _ . forEach ( sets . groupByFile ( ) , ( browsers , filePath ) => {
17+ const relativeFilePath = path . relative ( projectRoot , filePath ) ;
1718
18- emitter . emit ( Events . BEFORE_FILE_READ , path ) ;
19- utils . requireWithNoCache ( path ) ;
20- emitter . emit ( Events . AFTER_FILE_READ , path ) ;
19+ global . gemini = testsApi ( rootSuite , browsers , relativeFilePath ) ;
20+
21+ emitter . emit ( Events . BEFORE_FILE_READ , filePath ) ;
22+ utils . requireWithNoCache ( filePath ) ;
23+ emitter . emit ( Events . AFTER_FILE_READ , filePath ) ;
2124
2225 delete global . gemini ;
2326 } ) ;
@@ -32,5 +35,5 @@ module.exports = (emitter, config, opts) => {
3235 . useFiles ( opts . paths )
3336 . useBrowsers ( opts . browsers )
3437 . build ( config . system . projectRoot , { ignore : config . system . exclude } )
35- . then ( ( setCollection ) => loadSuites ( setCollection , emitter ) ) ;
38+ . then ( ( setCollection ) => loadSuites ( setCollection , emitter , config . system . projectRoot ) ) ;
3639} ;
0 commit comments