无法跳过茉莉花测试中的控制台错误

时间:2019-04-02 11:30:25

标签: angularjs maven jasmine phantomjs

我正在为angularjs项目开发茉莉花单元测试用例,并使用maven茉莉花插件和幻像插件来执行它。如果我给出mvn jasmine:bdd命令,它可以正常工作,但是在运行mvn时,由于控制台错误,全新安装会失败。

我尝试使用

跳过控制台错误

<sourceIncludes> <include>${project.basedir}/src/main/webapp/*.js</include> </sourceIncludes>

,但随后显示注入错误。但是可以与jasmine:bdd命令一起使用

<plugin>
            <groupId>com.github.searls</groupId>
            <artifactId>jasmine-maven-plugin</artifactId>
            <version>2.2</version>
            <executions>
                <execution>
                    <goals>
                        <goal>test</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <skipJasmineTests>${js-tests.skip}</skipJasmineTests>
                <webDriverClassName>org.openqa.selenium.phantomjs.PhantomJSDriver</webDriverClassName>
                <!--<webDriverCapabilities>
                  <capability>
                    <name>phantomjs.binary.path</name>
                    <value>${project.basedir}/target/phantomjs-maven-plugin/phantomjs-2.1.1-linux-x86_64/bin/phantomjs</value>
                  </capability>
                </webDriverCapabilities>-->
                <jsSrcDir>${project.basedir}/src/main/webapp</jsSrcDir>
                <jsTestSrcDir>${project.basedir}/src/main/webapp/tests/spec</jsTestSrcDir>
                <preloadSources>
                    <source>${project.basedir}/src/main/webapp/libs/vendor/jquery-latest.min.js</source>
                    <source>${project.basedir}/src/main/webapp/libs/vendor/angular.min.js</source>
                    <source>${project.basedir}/src/main/webapp/libs/vendor/angular-mocks.js</source>
                    <source>${project.basedir}/src/main/webapp/libs/vendor/angular-resource.js</source>
                    <source>${project.basedir}/src/main/webapp/libs/vendor/jasmine-jquery.js</source>
                    <source>${project.basedir}/src/main/webapp/app/app.js</source>
                </preloadSources>
                <sourceIncludes>
                  <include>${project.basedir}/src/main/webapp/*.js</include>
                </sourceIncludes>
              <specExcludes>
                    <include>${project.basedir}/src/main/webapp/modules/*/controllers/*.js</include>
                </specExcludes>
               <specIncludes>
                   <include>${project.basedir}/src/main/webapp/commonServicesTest.spec.js</include>
                   <include>${project.basedir}/src/main/webapp/supportLinksController.controller.spec.js</include>
                   <include>${project.basedir}/src/main/webapp/servicenowIncidents.controller.spec.js</include>
                   <include>${project.basedir}/src/main/webapp/oncallDetails.controller.spec.js</include>
               </specIncludes>
            </configuration>
        </plugin>

尝试过specIncludes不会显示错误,但不会运行任何规范。请帮忙 。预先感谢

0 个答案:

没有答案