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

Investigate deprecation of --compilers #2493

Closed
boneskull opened this issue Sep 19, 2016 · 9 comments
Closed

Investigate deprecation of --compilers #2493

boneskull opened this issue Sep 19, 2016 · 9 comments
Assignees
Labels
type: question support question

Comments

@boneskull
Copy link
Member

--compilers may be useless with later versions of Node.js, and commonly --require is sufficient instead. Example:

--compilers js:babel-register

Is better written as

--require babel-register

I don't know if this

--compilers coffee:coffee-script/register

Is equivalent to this:

--require coffee-script

If so, it's probably only true for some versions of Node.js and/or coffee-script.

If you use a different extension with Babel--say .es6--I think you would need --compilers? How does this work with TypeScript?

Regardless, --compilers js:some_module may always be better written with --require if that extension is .js. Something similar is noted in the docs.

@boneskull boneskull added the type: question support question label Sep 19, 2016
@ScottFreeCode
Copy link
Contributor

ScottFreeCode commented Dec 14, 2016

I just looked at the code, and it doesn't seem like Mocha is actually doing anything to associate the particular compiler with the particular extension, just requireing the compiler and adding the extension to the list of test/watch extensions, which I believe is used somewhere in the file lookup logic if you haven't specified a glob. In other words, if I understand correct, --compilers <ext>:<compiler> <folder> should be equivalent to --require <compiler> "<folder>/*.{js,<ext>}" and --compilers <ext>:<compiler> --recursive <folder> should be equivalent to --require <compiler> "<folder>/**/*.{js,<ext>}". With --watch I'm not sure if there's an equivalent (since I'm not aware of any way to specify which files/folders to watch), but considering we would really like to get Mocha to where we can stop having to handle such stuff in --watch too...

@stale stale bot added the stale this has been inactive for a while... label May 24, 2017
@stale
Copy link

stale bot commented May 24, 2017

I am a bot that watches issues for inactivity.
This issue hasn't had any recent activity, and I'm labeling it stale. In 14 days, if there are no further comments or activity, I will close this issue.
Thanks for contributing to Mocha!

@stale stale bot removed the stale this has been inactive for a while... label May 25, 2017
@ScottFreeCode
Copy link
Contributor

I just double-checked control of watch's extensions, and there is indeed another commandline argument for that. --compilers <ext>:<compiler> --watch <folder> should be equivalent to --require <compiler> --watch-extensions <ext> --watch "<folder>/*.{js,<ext>}" and --compilers <ext>:<compiler> --watch --recursive <folder> should be equivalent to --require <compiler> --watch-extensions <ext> --watch "<folder>/**/*.{js,<ext>}"

As far as I can see, we should go ahead and document that --compilers is just a shortcut for --require and adding extensions to your test files pattern (and to --watch-extensions if using --watch), and then we can get rid of --compilers in a semver major version.

@fesebuv
Copy link

fesebuv commented Aug 24, 2017

@ScottFreeCode is this issue resolved? Does it require further action?

@ScottFreeCode
Copy link
Contributor

As far as I recall, we figured out how to entirely replace --compilers with --require, --watch-extensions and globbing, but I don't remember whether we verified that the needed glob pattern can be quoted with the same syntax on both Unixy and non-Unixy OSes (:cough-windows-cough:), and I'm fairly sure we didn't decide whether to deprecate it or merely document what it's shorthand for. I will double-check that the relevant glob syntax is useable portably and if so ping the team for a decision on deprecation.

@fesebuv
Copy link

fesebuv commented Aug 25, 2017

@ScottFreeCode excellent!

@boneskull
Copy link
Member Author

Regarding .mjs, see @std/esm, which is pretty awesome.

@ScottFreeCode
Copy link
Contributor

Created #3005 to prove with testing that one can glob multiple extensions, works in both OSes.

The glob has changed since my prior investigation, due to upgrading the Glob package; it is now @(first_extension|second_extension) instead of {first_extension,second_extension}.

@boneskull
Copy link
Member Author

closed via #3038

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question support question
Projects
None yet
Development

No branches or pull requests

3 participants