首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Aurelia Jest错误-加载器必须实现loadTemplate

Aurelia Jest错误-加载器必须实现loadTemplate
EN

Stack Overflow用户
提问于 2019-01-24 11:16:18
回答 1查看 133关注 0票数 1

在使用Yarn更新我的aurelia-dependency-injection库之后,我开始在我的Jest测试中得到以下错误。

似乎由于某些原因,依赖注入库并没有像预期的那样工作?

代码语言:javascript
复制
  ● 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
EN

回答 1

Stack Overflow用户

发布于 2019-01-24 11:16:18

问题是我的yarn.lock文件有重复的aurelia-dependency-injection引用:

代码语言:javascript
复制
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看起来就像这样:

代码语言:javascript
复制
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看起来像这样:

代码语言:javascript
复制
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测试运行得很好,所有东西在其他地方也运行得很好。

不久之后,我发现了这篇讨论这个问题的文章,尽管我个人并没有使用那里的工具:

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54338886

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档