In my npm package, I would like to emulate the template that Meteor follows: the source file (named client.js) has a test file (named client.tests.js) in the folder src/. Tests are performed using the command npm test.
client.js
client.tests.js
src/
npm test
I follow the usage docs in 't'. I do not want to use findin my test team.
find
I understand that mocha can execute tests recursively:
mocha --recursive
I understand that mocha can run tests in a specific subfolder using the flag --recursive:
--recursive
mocha src --recursive
I also understand that I can tell glob to filter files by going *.tests.js:
*.tests.js
mocha * .tests.js
But I want all three. I want mocha to only test files ending in tests.jsin the src folder, recursively checking subdirectories.
tests.js
mocha --recursive *.tests.js // See the files? $ > ll ./src/app/ total 168 -rw-r--r-- ... client.js -rw-r--r-- ... client.tests.js // Option A $ > mocha --recursive *.tests.js Warning: Could not find any test files matching pattern: *.tests.js No test files found // Option B $ > mocha *.tests.js --recursive Warning: Could not find any test files matching pattern: *.tests.js No test files found. // Option C $ > mocha --recursive src/app/*.tests.js 3 passing (130ms) 3 failing
So...
--recursive . glob, , , glob, , , --recursive . --recursive glob, globs . :
mocha 'src/app/**/*.tests.js'
, *.tests.js src/app. , . , Mobba globbing. . , , ** *, .
src/app
**
*
Source: https://habr.com/ru/post/1016011/More articles:Π’Π΅ΠΊΡΡ ΠΏΠ°ΡΠ°Π»Π»Π°ΠΊΡΠ° ΠΠΆΠ°Π½ΠΊΠΈ Ρ GSAP - performanceWhy is my "add to home screen" web application "Installing a Banner" not displayed in my web application - html5JWT Unable to decode header as encoded string Base64Url - c #RangeError Diagnostics: Maximum Call Stack Size Exceeded in React KeyEscapeUtils - stack-overflowHow can I see the code generated for the Razor page when using Asp.Net Core? - asp.net-coreVS2017 Debugging Tuple Task - c #iOS values ββdo not match - ioscx_Oracle.InterfaceError: unable to access Oracle environment from Mac - pythonC # string.format add value "-"? - c #Javascript slider does not work correctly with transition completion - javascriptAll Articles