Disclaimer: I also posted this question on StackOverflow.
I set up a web project with a static HTML file and some vanilla JavaScript files. I'm using Jest to perform unit tests on them.
I'm using Tern with Emacs to have some completions.
I want to get a conditional applying of type definitions and plugins on path patterns:
node plugin to be active only in unit test files handled by Jest, matching .*.test.js, to get variables like process and __dirname.
browser type definitions applied only in JavaScript files not matching .*.test.js to have in web scripts some definitions like the Document interface of the DOM API.
How can I achieve that? Is there a better approach?
Here is my .tern-project so far:
{
"libs": [
"ecmascript",
"browser"
],
"plugins": {
"es_modules": {},
"node": {}
}
}
Disclaimer: I also posted this question on StackOverflow.
I set up a web project with a static HTML file and some vanilla JavaScript files. I'm using Jest to perform unit tests on them.
I'm using Tern with Emacs to have some completions.
I want to get a conditional applying of type definitions and plugins on path patterns:
nodeplugin to be active only in unit test files handled by Jest, matching.*.test.js, to get variables likeprocessand__dirname.browsertype definitions applied only in JavaScript files not matching.*.test.jsto have in web scripts some definitions like theDocumentinterface of the DOM API.How can I achieve that? Is there a better approach?
Here is my
.tern-projectso far: