[FIX] app: take into account config.dev if it is set#1740
[FIX] app: take into account config.dev if it is set#1740
config.dev if it is set#1740Conversation
__Behavior before commit:__ When [`mountWithCleanup`] is called, the config to create a new instance of `App` contains `dev: false` and `test: true`. In the constructor of [`TemplateSet`], `this.dev` is set to `config.dev` but it's then it's overwritten in the constructor of `App` if `config.test` is set. This has the annoying side-effect of calling `wrapError` during Hoot tests, which adds quite a big performance and memory overhead. __Fix:__ Make sure that `this.dev` is set to `config.dev` even if `config.test` is `true`. [`mountWithCleanup`]: https://github.com/odoo/odoo/blob/7fd5f90fe8fce4de49ec10c683f92e7a3557981a/addons/web/static/tests/_framework/component_test_helpers.js#L138 [`TemplateSet`]: https://github.com/odoo/owl/blob/4e834369527f5d747de8f13236504dc20731c1c8/src/runtime/template_set.ts#L38 task-5269391
|
@ged-odoo can you check this PR when you have time 😉 ? |
|
@Dj0ulo
For the purpose of test development we want:
In odoo's tests, disabling the dev mode mostly defeats the purpose of tests: ensure boot, API etc... I do not close this as the issue is relevant and probably needs work, however I don't think the fix is right. Note that if you are bothered in your tests by performance, you may test your components with the mountWithCleanUp ; then the business use cases with some other mounting function...... |
|
@kebeclibre Thanks for the detailed explanation! I'll let this PR as it is until a better solution is found then. |
|
@kebeclibre Shouldn't this line be removed to be coherent? Edit: my bad it's for the props validation part 🤔 |
Behavior before commit:
When
mountWithCleanupis called, the config to create a new instanceof
Appcontainsdev: falseandtest: true.In the constructor of
TemplateSet,this.devis set toconfig.devbut it's then it's overwritten in the constructor of
Appifconfig.testis set.This has the annoying side-effect of calling
wrapErrorduring Hoottests, which adds quite a big performance and memory overhead.
Fix:
Make sure that
this.devis set toconfig.deveven ifconfig.testis
true.task-5269391