次のコードは実行されません。
define("model/Contact", function() {
console.log(Contact);
describe('Something',function(){
it('shows no error',function(){
require(["model/MyModel"], function(MyModel) {
console.log(MyModel);
expect(false).toBeTruthy();
});
});
});
});
define ブロックを使用すると、jasmine maven プラグイン内でコードが実行されることはありません: http://searls.github.io/jasmine-maven-plugin/amd-support.html
私のプラグイン
<plugin>
<groupId>com.github.searls</groupId>
<artifactId>jasmine-maven-plugin</artifactId>
<version>1.3.1.2</version>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<specRunnerTemplate>REQUIRE_JS</specRunnerTemplate>
<jsSrcDir>${jsFolder}/src</jsSrcDir>
<jsTestSrcDir>${jsTestFolder}/specs</jsTestSrcDir>
<preloadSources>
<source>${jsFolder}/src/extlib/requirejs/require.js</source>
</preloadSources>
</configuration>
</plugin>
興味深いのは、次のコードです。
describe('Something',function(){
it('shows no error',function(){
require(["model/MyModel"], function(MyModel) {
console.log(MyModel);
expect(false).toBeTruthy();
});
});
});
このコードを使用すると、MyModel が定義されて使用可能になります。しかし、expect() 関数は決してエラーをスローしません。
私は何を間違っていますか?