gpt4 book ai didi

javascript - 如何安装 Jasmine : the javascript test tool on Velocity project

转载 作者:行者123 更新时间:2023-11-28 02:43:04 26 4
gpt4 key购买 nike

我正在网上搜索安装 jasmine 以测试我的 javascript 文件。大多数地方都假设我会将它作为 gem 安装在 ruby​​ 项目中。但我正在运行velocity/Java项目。

如何安装它?是否有一个简单易用的指南来逐步解释如何使其发挥作用?

最佳答案

有一个 Maven 插件可以实现这一点。以下是如何使用它的示例:

首先,在您项目的 POM 中,configure the plugin to be executed :

  <plugin>
<groupId>com.github.searls</groupId>
<artifactId>jasmine-maven-plugin</artifactId>
<version>1.0.2-beta-5</version>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<sourceIncludes>
<!-- relative to $jsSrcDir, defined further down -->
<include>js/prototype/prototype.js</include>
<include>uicomponents/widgets/list/xlist.js</include>
<include>uicomponents/suggest/suggest.js</include>
<include>uicomponents/model/entityReference.js</include>
</sourceIncludes>
<specIncludes>
<!-- relative to src/test/javascript/ -->
<include>spec/**/*.js</include>
</specIncludes>
<jsSrcDir>${project.basedir}/src/main/webapp/resources</jsSrcDir>
</configuration>
</plugin>

然后写规范,在src/test/javascript/spec/中,使用 Jasmine 的标准。

下次您 mvn install 项目时,Jasmine 测试也会执行,如果出现问题,则构建失败。

关于javascript - 如何安装 Jasmine : the javascript test tool on Velocity project,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12365117/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com