tape-run icon indicating copy to clipboard operation
tape-run copied to clipboard

--node and --basedir appear to not be working

Open bcomnes opened this issue 6 years ago • 3 comments

Maybe I am mistaken here (still digging around), but the --node and --basedir flags are no longer working because tape-run sets the loc option in electron-stream, which disables these.

bcomnes avatar Sep 02 '19 12:09 bcomnes

These work in browser-run (https://github.com/juliangruber/browser-run/blob/master/test/electron.js), which this is just a wrapper of. Can you share a reproduction case? :)

juliangruber avatar Sep 02 '19 14:09 juliangruber

Yeah, sorry for the sparse details, let me whip something up.

bcomnes avatar Sep 02 '19 14:09 bcomnes

Ok, writing down some notes of the problem I identified:

In electron-stream, the loc option notes that:

loc: a full url like http://localhost:8080/ for using an existing http server. When loc is supplied, options node, basedir, and static are all ignored.

This is indeed true, and can be seen here:

// Use existing http(s) server with {loc: 'http://url'},
// this skips creating inner http server in _createSourceUrl.
// Use name "loc" because it's the property browser-run uses.
if (this.opts.loc) {
return cb(this.opts.loc);
  }
if (this.opts.nodeIntegration) {
return this._createNodeUrl(cb)
  }
this._createSourceUrl(cb);
};

https://github.com/juliangruber/electron-stream/blob/0e25d5571b9dfaf4e828ab372c6cdad9b3b5f7f1/index.js#L65-L77

While options from tape-run are passed directly to browser-run:

https://github.com/juliangruber/tape-run/blob/01b5790f45e1623a9a422696998cb1fddf5b4483/index.js#L8-L19

browser-run overrides some of these in all cases:

      launch(extend(opts, {
        loc: 'http://localhost:' + port,
        name: opts.browser,
        bundle: bundle
      }), function(err, _browser){

https://github.com/juliangruber/browser-run/blob/master/index.js#L98-L102

Note, loc is set, therefore overriding the critical --node and --basedir opts. And this is why it appears the node integration flags aren't working in my tests that require it.

Let me dig into the electron tests in browser run to see if I am missing something or something is getting overlooked.

bcomnes avatar Sep 12 '19 11:09 bcomnes