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

Use paths browserify option with mochify #76

Closed
gryzzly opened this issue Mar 11, 2015 · 8 comments
Closed

Use paths browserify option with mochify #76

gryzzly opened this issue Mar 11, 2015 · 8 comments

Comments

@gryzzly
Copy link

gryzzly commented Mar 11, 2015

Hey!

I'm using the following in the browserify config:

browserify(
  entries: src + '/scripts/Main.js',
  dest: dest + '/js',
  outputName: 'Main.js',
  paths: ['./app/scripts/']
)

And I use the following in mochify config:

mochify('./test/**/*.js', {
    reporter : 'spec',
    paths: ['./app/scripts/']
})

However, the paths option doesn't seem to be picked up. How can I pass browserify option to browserify?

Thanks!

@mantoni
Copy link
Owner

mantoni commented Mar 11, 2015

Thanks for reporting this. This option isn't supported yet. Should be easy to add. Care to look into it?

@gryzzly
Copy link
Author

gryzzly commented Mar 12, 2015

@mantoni thanks for the prompt reply. Not urgent for me right now, so I'll try to look into it over next couple of days.

@mantoni
Copy link
Owner

mantoni commented Mar 16, 2015

I just had a look at this and noticed that the paths option is not in the Browserify API documentation. If it's not an officially supported option, I would rather not add it to Mochify. What do you think?

@wjordan
Copy link

wjordan commented Mar 20, 2015

The browserify maintainer strongly recommends against using the paths option:

that approach is a deprecated part of the module system in node and browserify, so it could stop working at any time.

Instead of adding entries to paths, the recommended approach looks to be adding a symlink in ./node_modules/ pointing to any local modules you want to reference without using relative requires.

@mantoni
Copy link
Owner

mantoni commented Mar 20, 2015

Thanks for the clarification @wjordan

@mantoni mantoni closed this as completed Mar 20, 2015
@wjordan
Copy link

wjordan commented Mar 23, 2015

Slight update- it looks like the paths option was just now added to the Browserify documentation (see PR #1167), so I guess it's no longer considered to be deprecated/unsupported. Here's the added text:

opts.paths is an array of directories that browserify searches when looking
for modules which are not referenced using relative path. Can be absolute or
relative to basedir. Equivalent of setting NODE_PATH environmental variable
when calling browserify command.

@mantoni
Copy link
Owner

mantoni commented Mar 23, 2015

Cool. Reopening. PR welcome in that case :)

@mantoni
Copy link
Owner

mantoni commented Feb 23, 2016

The paths config and the corresponding --path command line switch where just introduced in the fresh 2.17.0 release.

@mantoni mantoni closed this as completed Feb 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants