Hello everyone,
I’m trying to migrate to jest as a test framework in my project, but what I’m getting from the components spec files is:
console.log
Error: Template markup must be wrapped in a <template> element e.g. <template> <!-- markup here --> </template>
at NodeJsDom.createTemplateFromMarkup (C:\..\node_modules\aurelia-pal-nodejs\dist\nodejs-dom.js:70:19)
at TextTemplateLoader.<anonymous> (C:\..\node_modules\aurelia-loader-nodejs\dist\commonjs\aurelia-loader-nodejs.js:101:60)
at step (C:\..\node_modules\aurelia-loader-nodejs\dist\commonjs\aurelia-loader-nodejs.js:42:23)
at Object.next (C:\..\node_modules\aurelia-loader-nodejs\dist\commonjs\aurelia-loader-nodejs.js:23:53)
at fulfilled (C:\..n\node_modules\aurelia-loader-nodejs\dist\commonjs\aurelia-loader-nodejs.js:14:58)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
…where the project uses .jade templates.
In my package json I have:
@useView(PLATFORM.moduleName('./base.jade'))
@customElement('base-button')
@inject(Element)
export class BaseButton {
.....
}
I have this error, which comes from the Aurelia Pal Node JS. This is because the view passed to that loader is not HTML, but jade. When I change the row to
`@useView(PLATFORM.moduleName('./base.html'))` - things seems to work.
I need a way (somehow) to compile the jade template before running the test and pass to useView decorator compiled version. Is this possible in Aurelia?
Really random guess: you can inject aurelia loader node js and register a handler for .jade extension, so it’ll be retrieving the html instead, but since you are using the webpack plugin, it shouldn’t be necessary.
Is there any error? can you paste the error message here?
Hi @bigopon ,
I want toi thank you for helping me with this first.
When I have @useView('./base.jade')
I’ve got an error from the aurelia pal nodejs, line 70 or something saying:
console.log
Error: Template markup must be wrapped in a <template> element e.g. <template> <!-- markup here --> </template>
at NodeJsDom.createTemplateFromMarkup (C:\..\node_modules\aurelia-pal-nodejs\dist\nodejs-dom.js:70:19)
at TextTemplateLoader.<anonymous> (C:\..\node_modules\aurelia-loader-nodejs\dist\commonjs\aurelia-loader-nodejs.js:101:60)
at step (C:\..\node_modules\aurelia-loader-nodejs\dist\commonjs\aurelia-loader-nodejs.js:42:23)
at Object.next (C:\..\node_modules\aurelia-loader-nodejs\dist\commonjs\aurelia-loader-nodejs.js:23:53)
at fulfilled (C:\..n\node_modules\aurelia-loader-nodejs\dist\commonjs\aurelia-loader-nodejs.js:14:58)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
when I change it to .HTML @useView(PLATFORM.moduleName('./base.html')) - it works.
All I need is a way to tell the test runner to process the jade templates before load the component.
In my jest config I have: