Sails: Ignore common test file patterns and common test folders

Created on 21 Jun 2017  路  3Comments  路  Source: balderdashy/sails

Sails version: 0.12.13
Node version: 6.11.0
NPM version: 3.10.10
Operating system: macOS 10.12.5



We use jest for testing and want to colocate our test files and folders with our code in api/. We created __tests__ folder within api/ folder and also within api/controllers/, api/services, etc. folders.
But it seems that include-all tries to include them too, which of course does not work. Example error message:

error: `include-all` attempted to `require(/..../sails/api/controllers/__tests__/IndexController.js)`

Is it possible to configure the regex/pattern include-all uses to find models, controllers, etc. within the api folder? if not, would it be possible to add common test file/folder patterns to be ignored by include-all? See here for example, for the default pattern for Jest: http://facebook.github.io/jest/docs/en/configuration.html#testmatch-array-string but it is also valid and very common for Jasmine and mocha, etc to use these patterns or variations of these patterns.

Most helpful comment

@sgress454 Why was this closed out? I think with a lot of modern testing frameworks like Jest this pattern is becoming more popular, and actually preferred among developers. Is there not even room for discussion on whether or not this should be supported?

At the very least it I think it'd be good to provide a way to configure this or some optional glob patterns for the framework to ignore?

All 3 comments

@thomasfr Thanks for posting, we'll take a look as soon as possible.


For help with questions about Sails, click here. If you’re interested in hiring @sailsbot and her minions in Austin, click here.

The convention for Sails is to only put code files in api, with the exception of README (so .md and .txt files are ignored). This is not currently overridable. Tests are typically stored in a top-level test folder (as is done in the main Sails repo).

@sgress454 Why was this closed out? I think with a lot of modern testing frameworks like Jest this pattern is becoming more popular, and actually preferred among developers. Is there not even room for discussion on whether or not this should be supported?

At the very least it I think it'd be good to provide a way to configure this or some optional glob patterns for the framework to ignore?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

randallmeeker picture randallmeeker  路  4Comments

Sytten picture Sytten  路  4Comments

kesavkolla picture kesavkolla  路  4Comments

anissen picture anissen  路  3Comments

radoslavpetranov picture radoslavpetranov  路  4Comments