Open AlexeyPotopakhin opened 2 years ago
Hi @AlexeyPotopakhin,
I've tried to reproduce that, but looks it is working just fine on my side: ngx-pug-builders version: 12.0.0 Angular version: 12.2.16
Could you upload minimal reproduction to Github or StackBlitz, please?
Hi @lekhmanrus, thank you for attention! I've created fresh project from the Angular CLI and added ngx-pug-builders
as dependency and builder in angular.json
. Also I've created two components with html
(AppHtmlComponent) and pug
(AppComponent) templates for demonstration. Tests with html
component are passing successfully, but test should render title
with pug
template fails.
https://github.com/AlexeyPotopakhin/ngx-pug-builders-karma-issue
Thanks @AlexeyPotopakhin! I was able to reproduce the issue. I'll try to allocate some time for this issue this weekend.
Hello there :) I have same issue with it. How is work going on to resolve the bug? :)
Hello, I have the same problem and I think that the JIT compilation just doesn't work yet with this project, my pug files are all generating errors while using JIT but never while using AOT. The problem is that ng test is only using JIT from what I know
I've found one ugly solution, but it works. I use gulp task
to copy all project files to temporary directory and compile pug code to html in all pug files before testing. Copy operation is too long (~2 mins for my project, cause of heavy node_modules
directory).
gulpfile.js
const {src, dest, series} = require('gulp');
const rename = require("gulp-rename");
const pug = require('gulp-pug');
function pug2html () {
return src('./src/**/*.pug')
.pipe(pug({ doctype: 'html' }))
.pipe(rename({ extname: '.pug' }))
.pipe(dest('.dist/src'));
}
function copyProject () {
return src('**/*')
.pipe(dest('./dist'));
}
exports.test = series(copyProject, pug2html);
And in package.json:
"test": "gulp test && cd dist && npm i && ng test --karma-config karma.conf.js"
I gas it's possible to avoid copy
operation and compile it directly in your project and then revert compiled html code in git :). Maybe it can help someone as temporary solution.
Looks like the issue is fixed for Angular CLI >= 13.1.0-rc.0 ("@angular-devkit/build-angular": "13.1.0-rc.0"
).
Feature Description
Hello. I have the following karma configuration in
karma.conf.js
:In
angular.json
:Tests not working and print the following errors:
It's looks like that
pug
templates not compiling to thehtml
code. But in development and production everything works ok. Thank you!ngx-pug-builders version: 12.0.0 Angular version: 12
Use Case
No response