ne peut pas charger angular.js pour le test de l'unité avec le karma, de jasmin, de phantomjs, et maven

Je suis en train de ranger ma soupe à l'alphabet de anguleux, de karma, de jasmin, de phantomjs, et maven. Je fais cela avec un jouet projet pour l'instant, dans la préparation de l'intégration dans un projet réel.

Voici ma liste de fichiers:

./pom.xml
./src/main/webapp/index.html
./src/main/webapp/js/blog.js
./src/test/webapp/js/blogSpec.js
./src/test/webapp/js/karma.conf.js
./src/test/webapp/js/libs/angular-mocks.js
./src/test/webapp/js/libs/angular.js

Voici ma pom:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.att.cdits</groupId>
  <artifactId>angularjsexp</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  <build>
    <plugins>
      <plugin>
        <groupId>com.kelveden</groupId>
        <artifactId>maven-karma-plugin</artifactId>
        <version>1.5</version>
        <executions>
          <execution>
            <goals>
              <goal>start</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
            <configFile>${basedir}/src/test/webapp/js/karma.conf.js</configFile>
            <browsers>PhantomJS</browsers>
            <reporters>dots</reporters>
            <colors>false</colors>
            <autoWatch>false</autoWatch>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <dependencies>
    <dependency>
        <groupId>com.kelveden</groupId>
        <artifactId>maven-karma-plugin</artifactId>
        <version>1.5</version>
    </dependency>
  </dependencies>
</project>

Et mon "karma.conf.js" fichier:

module.exports = function(config) {
  config.set({
    basePath: '',
    frameworks: ['jasmine'],
    files: [
      "../../../../src/test/webapp/js/libs/*.js",
      "../../../../src/main/webapp/js/*.js",
      "../../../../src/test/webapp/js/*.js"
    ],
    exclude: [],
    reporters: ['dots'],
    port: 9876,
    colors: false,
    logLevel: config.LOG_DEBUG,
    autoWatch: false,
    browsers: ['PhantomJS'],
    captureTimeout: 60000,
    singleRun: true
  });
};

Ce qui suit est un extrait de mon "mvn install" de sortie, en commençant à la Meilleure exécution:

[INFO] --- maven-surefire-plugin:2.10:test (default-test) @ angularjsexp ---
[INFO] Surefire report directory: myhome\workspace6\angularjsexp\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO] 
[INFO] --- maven-karma-plugin:1.5:start (default) @ angularjsexp ---
cmd /C karma start myhome\workspace6\angularjsexp\src\test\webapp\js\karma.conf.js --browsers PhantomJS --reporters dots --single-run --no-auto-watch --colors false
DEBUG [plugin]: Loading karma-* from myhome\AppData\Roaming\npm\node_modules 
DEBUG [plugin]: Loading plugin myhome\AppData\Roaming\npm\node_modules/karma-chrome-launcher. 
DEBUG [plugin]: Loading plugin myhome\AppData\Roaming\npm\node_modules/karma-coffee-preprocessor. 
DEBUG [plugin]: Loading plugin myhome\AppData\Roaming\npm\node_modules/karma-firefox-launcher. 
DEBUG [plugin]: Loading plugin myhome\AppData\Roaming\npm\node_modules/karma-html2js-preprocessor. 
DEBUG [plugin]: Loading plugin myhome\AppData\Roaming\npm\node_modules/karma-jasmine. 
DEBUG [plugin]: Loading plugin myhome\AppData\Roaming\npm\node_modules/karma-phantomjs-launcher. 
DEBUG [plugin]: Loading plugin myhome\AppData\Roaming\npm\node_modules/karma-requirejs. 
DEBUG [plugin]: Loading plugin myhome\AppData\Roaming\npm\node_modules/karma-script-launcher. 
DEBUG [plugin]: Loading inlined plugin (defining ). 
INFO [karma]: Karma v0.10.2 server started at http://localhost:9876/
INFO [launcher]: Starting browser PhantomJS 
DEBUG [launcher]: Creating temp dir at C:\Cygwin\tmp\karma-77302282 
DEBUG [launcher]: myhome\AppData\Roaming\npm\node_modules\karma-phantomjs-launcher\node_modules\phantomjs\lib\phantom\phantomjs.exe C:\Cygwin\tmp\karma-77302282/capture.js 
DEBUG [watcher]: Excluded file "myhome/workspace6/angularjsexp/src/test/webapp/js/karma.conf.js" 
DEBUG [watcher]: Resolved files: 
    myhome/AppData/Roaming/npm/node_modules/karma-jasmine/lib/jasmine.js 
    myhome/AppData/Roaming/npm/node_modules/karma-jasmine/lib/adapter.js 
    myhome/workspace6/angularjsexp/src/test/webapp/js/libs/angular-mocks.js 
    myhome/workspace6/angularjsexp/src/test/webapp/js/libs/angular.js 
    myhome/workspace6/angularjsexp/src/main/webapp/js/blog.js 
    myhome/workspace6/angularjsexp/src/main/webapp/js/checkbox-array.js 
    myhome/workspace6/angularjsexp/src/main/webapp/js/my-include.js 
    myhome/workspace6/angularjsexp/src/test/webapp/js/blogSpec.js 
DEBUG [web-server]: serving: myhome\AppData\Roaming\npm\node_modules\karma\static/client.html 
DEBUG [web-server]: serving: myhome\AppData\Roaming\npm\node_modules\karma\static/karma.js 
DEBUG [karma]: A browser has connected on socket LI1NDCsuY-0i0Uxwkhs_ 
INFO [PhantomJS 1.9.2 (Windows 7)]: Connected on socket LI1NDCsuY-0i0Uxwkhs_ 
DEBUG [karma]: All browsers are ready, executing 
DEBUG [web-server]: serving: myhome\AppData\Roaming\npm\node_modules\karma\static/context.html 
DEBUG [web-server]: serving: myhome/AppData/Roaming/npm/node_modules/karma-jasmine/lib/adapter.js 
DEBUG [web-server]: serving: myhome/AppData/Roaming/npm/node_modules/karma-jasmine/lib/jasmine.js 
DEBUG [web-server]: serving: myhome/workspace6/angularjsexp/src/test/webapp/js/libs/angular.js 
DEBUG [web-server]: serving: myhome/workspace6/angularjsexp/src/main/webapp/js/checkbox-array.js 
DEBUG [web-server]: serving: myhome/workspace6/angularjsexp/src/main/webapp/js/blog.js 
DEBUG [web-server]: serving: myhome/workspace6/angularjsexp/src/main/webapp/js/my-include.js 
DEBUG [web-server]: serving: myhome/workspace6/angularjsexp/src/test/webapp/js/blogSpec.js 
DEBUG [web-server]: serving: myhome/workspace6/angularjsexp/src/test/webapp/js/libs/angular-mocks.js 
PhantomJS 1.9.2 (Windows 7) ERROR 
    ReferenceError: Can't find variable: angular 
    at myhome/workspace6/angularjsexp/src/test/webapp/js/libs/angular-mocks.js:16 
PhantomJS 1.9.2 (Windows 7) ERROR 
    ReferenceError: Can't find variable: myApp 
    at myhome/workspace6/angularjsexp/src/main/webapp/js/checkbox-array.js:1 
PhantomJS 1.9.2 (Windows 7) ERROR 
    ReferenceError: Can't find variable: myApp 
    at myhome/workspace6/angularjsexp/src/main/webapp/js/my-include.js:1 
PhantomJS 1.9.2 (Windows 7) ERROR 
    ReferenceError: Can't find variable: module 
    at myhome/workspace6/angularjsexp/src/test/webapp/js/blogSpec.js:5 
PhantomJS 1.9.2 (Windows 7): Executed 0 of 0 ERROR (0.273 secs /0 secs) 

J'ai les problèmes suivants jusqu'à présent, les quelques désagréments, certains bêtabloquants:
* C'est bizarre que le karma décide chemin du fichier de références par rapport à l'endroit où il a trouvé mon fichier conf, je souhaite que je pourrais le remplacer.
* Il semble que Surefire feux avant de Karma. Est-il possible d'intégrer ces?
* Mes références à "angulaire" et d'autres objets dans mes scripts sont évidemment défaut. Je ne comprends pas comment résoudre ce problème.

OriginalL'auteur David M. Karr | 2013-10-01