angular-builders icon indicating copy to clipboard operation
angular-builders copied to clipboard

Q: Why `warning: unable to locate custom jest configuration file`?

Open snebjorn opened this issue 3 years ago • 4 comments

https://github.com/just-jeb/angular-builders/blob/aa088a500f40cd802a24840264d6e58e866aa489/packages/jest/src/custom-config.resolver.ts#L24

I was wondering why it's warning me that I don't have a jest.config.js in my project. Isn't it just as good to put the config inside angular.json or even have no config?

snebjorn avatar Jan 20 '22 08:01 snebjorn

True, it is as good. The warning was aiming to solve this issue by increasing visibility for misplaced configs.
That said even back then I wasn't quite sure about the solution.
I guess it can be changed to an info instead of warning and just say that it is looking for a custom config at this path and falling back to default config because the config is not found. Another option is some kind of verbose flag, although I'd like to keep the list of arguments to the builder as close as possible to the list of arguments of Jest.
Open to any suggestions.

just-jeb avatar Jan 21 '22 11:01 just-jeb

It could print what config files it found and use and perhaps list them in the override order. So something like:

Found custom jest configuration: package.json (workspace root) -> jest.config.js (workspace root) -> angular.json ([your project]) -> path/to/jest.config.js

It would only list found configs. So if a workspace only had jest.config.js in the workspace root and in angular.json it would look like this:

Found custom jest configuration: jest.config.js (workspace root) -> angular.json ([your project])

This would make it very easy to figure out what configs were used and help debug configs :)

snebjorn avatar Jan 21 '22 14:01 snebjorn

I like the idea. Don't know when I can get to it because there are some more important issues to deal with but it sounds simple enough, so if anyone wants to go ahead and come up with a PR, they're most welcome to do so 😉

just-jeb avatar Jan 21 '22 16:01 just-jeb