14
14
* See the License for the specific language governing permissions and
15
15
* limitations under the License.
16
16
*/
17
+ const runfiles = require ( process . env [ 'BAZEL_NODE_RUNFILES_HELPER' ] ) ;
17
18
const path = require ( 'path' ) ;
18
19
19
20
function log_verbose ( ...m ) {
@@ -76,7 +77,7 @@ let conf = {};
76
77
77
78
// Import the user's base protractor configuration if specified
78
79
if ( configPath ) {
79
- const baseConf = require ( configPath ) ;
80
+ const baseConf = require ( runfiles . resolve ( configPath ) ) ;
80
81
if ( ! baseConf . config ) {
81
82
throw new Error ( 'Invalid base protractor configuration. Expected config to be exported.' ) ;
82
83
}
@@ -86,7 +87,7 @@ if (configPath) {
86
87
87
88
// Import the user's on prepare function if specified
88
89
if ( onPreparePath ) {
89
- const onPrepare = require ( onPreparePath ) ;
90
+ const onPrepare = require ( runfiles . resolve ( onPreparePath ) ) ;
90
91
if ( typeof onPrepare === 'function' ) {
91
92
const original = conf . onPrepare ;
92
93
conf . onPrepare = function ( ) {
@@ -104,15 +105,15 @@ if (onPreparePath) {
104
105
setConf ( conf , 'framework' , 'jasmine2' , 'is set to jasmine2' ) ;
105
106
106
107
const specs =
107
- [ TMPL_specs ] . map ( s => require . resolve ( s ) ) . filter ( s => / ( \b | _ ) ( s p e c | t e s t ) \. j s $ / . test ( s ) ) ;
108
+ [ TMPL_specs ] . map ( s => runfiles . resolve ( s ) ) . filter ( s => / ( \b | _ ) ( s p e c | t e s t ) \. j s $ / . test ( s ) ) ;
108
109
109
110
setConf ( conf , 'specs' , specs , 'are determined by the srcs and deps attribute' ) ;
110
111
111
112
// WEB_TEST_METADATA is configured in rules_webtesting based on value
112
113
// of the browsers attribute passed to karma_web_test_suite
113
114
// We setup the protractor configuration based on the values in this object
114
115
if ( process . env [ 'WEB_TEST_METADATA' ] ) {
115
- const webTestMetadata = require ( process . env [ 'WEB_TEST_METADATA' ] ) ;
116
+ const webTestMetadata = require ( runfiles . resolve ( process . env [ 'WEB_TEST_METADATA' ] ) ) ;
116
117
log_verbose ( `WEB_TEST_METADATA: ${ JSON . stringify ( webTestMetadata , null , 2 ) } ` ) ;
117
118
if ( webTestMetadata [ 'environment' ] === 'local' ) {
118
119
// When a local chrome or firefox browser is chosen such as
@@ -123,8 +124,8 @@ if (process.env['WEB_TEST_METADATA']) {
123
124
const webTestNamedFiles = webTestMetadata [ 'webTestFiles' ] [ 0 ] [ 'namedFiles' ] ;
124
125
const headless = ! process . env [ 'DISPLAY' ] ;
125
126
if ( webTestNamedFiles [ 'CHROMIUM' ] ) {
126
- const chromeBin = require . resolve ( webTestNamedFiles [ 'CHROMIUM' ] ) ;
127
- const chromeDriver = require . resolve ( webTestNamedFiles [ 'CHROMEDRIVER' ] ) ;
127
+ const chromeBin = runfiles . resolve ( webTestNamedFiles [ 'CHROMIUM' ] ) ;
128
+ const chromeDriver = runfiles . resolve ( webTestNamedFiles [ 'CHROMEDRIVER' ] ) ;
128
129
129
130
// The sandbox needs to be disabled, because it causes Chrome to crash on some environments.
130
131
// See: http://chromedriver.chromium.org/help/chrome-doesn-t-start
@@ -146,7 +147,7 @@ if (process.env['WEB_TEST_METADATA']) {
146
147
// TODO(gmagolan): implement firefox support for protractor
147
148
throw new Error ( 'Firefox not yet support by protractor_web_test_suite' ) ;
148
149
149
- // const firefoxBin = require .resolve(webTestNamedFiles['FIREFOX'])
150
+ // const firefoxBin = runfiles .resolve(webTestNamedFiles['FIREFOX'])
150
151
// const args = [];
151
152
// if (headless) {
152
153
// args.push("--headless")
0 commit comments