Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
bcomnes opened this issue Sep 2, 2019 · 3 comments
Open

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

bcomnes opened this issue Sep 2, 2019 · 3 comments
Labels

Comments

@bcomnes
Copy link

bcomnes commented Sep 2, 2019

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.

@juliangruber
Copy link
Collaborator

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? :)

@bcomnes
Copy link
Author

bcomnes commented Sep 2, 2019

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

@bcomnes
Copy link
Author

bcomnes commented Sep 12, 2019

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.

@fregante fregante added the bug label Dec 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants