简体   繁体   English

如何将XML文件包含在Mocha测试用例中

[英]How can an XML file be included into a mocha test case

I have written a test in mocha which is runned in karma. 我已经在以业力运行的摩卡咖啡中编写了一个测试。 This test make use of some test xml data included in a separate file. 该测试利用了包含在单独文件中的一些测试xml数据。 The purpose of the test is to evaluate a parser. 测试的目的是评估解析器。 I have tried to include it using files in karma. 我试图使用业力中的文件包括它。 But then I get an error "unexpected token <". 但是然后我得到一个错误“意外的令牌<”。

Got it to work, had left out "included: false" from {pattern: 'test/mock/description.xml', watched: false, served: true} which caused it to default to true. 使它正常工作,从{pattern: 'test/mock/description.xml', watched: false, served: true}删除了“ included:false” {pattern: 'test/mock/description.xml', watched: false, served: true} ,这使其默认为true。 This lead to karma trying to including it in the html causing the error. 这导致业力试图将其包含在html中,从而导致错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM