在使用Yarn更新我的aurelia-dependency-injection库之后,我开始在我的Jest测试中得到以下错误。
似乎由于某些原因,依赖注入库并没有像预期的那样工作?
● Datepicker › click date icon opens calendar
Loader must implement loadTemplate(url).
at Loader.loadTemplate (node_modules/aurelia-loader/dist/commonjs/aurelia-loader.js:119:11)
at ensureRegistryEntry (node_modules/aurelia-templating/dist/commonjs/aurelia-templating.js:3382:17)
at ViewEngine.loadViewFactory (node_modules/aurelia-templating/dist/commonjs/aurelia-templating.js:3456:12)
at RelativeViewStrategy.loadViewFactory (node_modules/aurelia-templating/dist/commonjs/aurelia-templating.js:562:23)
at HtmlBehaviorResource.load (node_modules/aurelia-templating/dist/commonjs/aurelia-templating.js:4238:27)
at ResourceDescription.load (node_modules/aurelia-templating/dist/commonjs/aurelia-templating.js:3258:26)
at ResourceModule.load (node_modules/aurelia-templating/dist/commonjs/aurelia-templating.js:3200:23)
at node_modules/aurelia-templating/dist/commonjs/aurelia-templating.js:3587:41发布于 2019-01-24 11:16:18
问题是我的yarn.lock文件有重复的aurelia-dependency-injection引用:
aurelia-dependency-injection@^1.0.0, aurelia-dependency-injection@^1.3.1:
version "1.4.1"
resolved "https://private-yarn-mirror/aurelia-dependency-injection/-/aurelia-dependency-injection-1.4.1.tgz#fb916e1809446600fb2cdf062f549060df49ef86"
dependencies:
aurelia-metadata "^1.0.0"
aurelia-pal "^1.0.0"
aurelia-dependency-injection@^1.4.2:
version "1.4.2"
resolved "https://private-yarn-mirror/aurelia-dependency-injection/-/aurelia-dependency-injection-1.4.2.tgz#fa9d1a9f4931e353fb8f938ee0c54b9fbf3f341a"
dependencies:
aurelia-metadata "^1.0.0"
aurelia-pal "^1.0.0"我的解决方案是简单地删除顶部引用,这样我的yarn.lock看起来就像这样:
aurelia-dependency-injection@^1.4.2:
version "1.4.2"
resolved "https://private-yarn-mirror/aurelia-dependency-injection/-/aurelia-dependency-injection-1.4.2.tgz#fa9d1a9f4931e353fb8f938ee0c54b9fbf3f341a"
dependencies:
aurelia-metadata "^1.0.0"
aurelia-pal "^1.0.0"然后,我执行了以下命令,以确保在手动编辑后能够正确地生成yarn.lock。
yarn add aurelia-framework@latest这样做之后,我的yarn.lock看起来像这样:
aurelia-dependency-injection@^1.0.0, aurelia-dependency-injection@^1.3.1, aurelia-dependency-injection@^1.4.1, aurelia-dependency-injection@^1.4.2:
version "1.4.2"
resolved "https://private-yarn-mirror/aurelia-dependency-injection/-/aurelia-dependency-injection-1.4.2.tgz#fa9d1a9f4931e353fb8f938ee0c54b9fbf3f341a"
dependencies:
aurelia-metadata "^1.0.0"
aurelia-pal "^1.0.0"现在,我的Jest测试运行得很好,所有东西在其他地方也运行得很好。
不久之后,我发现了这篇讨论这个问题的文章,尽管我个人并没有使用那里的工具:
https://stackoverflow.com/questions/54338886
复制相似问题