Custom webpack loaders not applying in unit tests
See original GitHub issueDescribe the bug
Adding custom webpack loaders works perfect with ng serve
and ng build
but it doesn’t work with ng test
.
To Reproduce Steps to reproduce the behavior:
- Add extra webpack config for Pug templates:
module.exports = {module: {rules: [{test: /.pug$/, use: [{ loader: 'apply-loader' },{ loader: 'pug-loader' }]}]}};
- Create pug template. It works good with
ng serve
- Run
ng test
. You will see just a plain text instead of components.
OR (preferred way) A link to a repository with minimal reproduction: https://github.com/vadjs/custom-loaders-bug
Expected behavior Custom loaders should work properly during unit tests run.
Builder:
Libraries
angular-devkit/build-angular
: 8.2.0
Additional context
This problem appeared in Angular 8. Looks like Angular team dedicated unit tests config to a different place.
That’s not only @angular-builders/custom-webpack
bug because replacing common.js
file with webpack config in @angular-devkit/build-angular
produces the same bug.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
severals issues with my unit test config - Stack Overflow
I'm trying to build unit test for my angularjs es-6 app, using Karma, Webpack and mocha. The source code is under a src...
Read more >Writing a Loader - webpack
Before we dig into the different types of loaders, their usage, and examples, let's take a look at the three ways you can...
Read more >How to configure Webpack with React Testing Library from the ...
Then run this command jest. I hope all the test passes on your computer. Some of the modules that we installed were not...
Read more >Using with webpack - Jest
Jest caches files to speed up test execution. If you updated .babelrc and Jest is not working as expected, try clearing the cache...
Read more >Angular: Unit test environment configuration with Karma ...
We opted for webpack configurations throughout our apps in our aim to achieve a universal configuration that is not dependent on angular. I...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Must be the direct template loading option (which is enabled by default). Try to disable it.
An update for the latest Angular 11.1.0 version: https://github.com/just-jeb/angular-builders/issues/842#issuecomment-764573237