É possível misturar o Testacular (Karma) com o cenário angular?
Testacular (agora Karma) é incrível, então é um cenário angular. Usá-los juntos está provando um desafio no entanto. Existe um ANÁCULO-CENÁRIO-ADAPTADOR no Testacular, mas que quebra testes simples. Se você incluir o angular-scenario.js você mesmo Testacular não executará nenhum teste. Alguém tem isso funcionando corretamente?
CENÁRIO ANGULAR-ADAPTADOREu tentei usar isso com um teste trivial, mas eu vi um comportamento estranho:
Teste:
describe('Simple', function(){
it('should compare strings', function(){
expect('foo').toBe('foo');
});
});
Comportamento normal com config:
files = [
JASMINE,
JASMINE_ADAPTER,
// ANGULAR_SCENARIO,
// ANGULAR_SCENARIO_ADAPTER,
'tests/lib/angular/angular.js',
'tests/sample.js'
];
saída:
$ testacular start
info: Testacular server started at http://localhost:9876/
info (launcher): Starting browser ChromeCanary
info (Chrome 25.0): Connected on socket id KRwEUtKtiaJs3MoiEsNg
Chrome 25.0: Executed 1 of 1 SUCCESS (0.061 secs / 0.003 secs)
Ao adicionar a configuração do adaptador ANGULAR:
files = [
JASMINE,
JASMINE_ADAPTER,
ANGULAR_SCENARIO,
ANGULAR_SCENARIO_ADAPTER,
'tests/lib/angular/angular.js',
'tests/sample.js'
];
a saída é:
$ testacular start
info: Testacular server started at http://localhost:9876/
info (launcher): Starting browser ChromeCanary
info (Chrome 25.0): Connected on socket id 5YZA2fSuNXjmI-yRFGF6
Chrome 25.0 Simple should compare strings FAILED
expect undefined toBe "foo"
/Users/iwein/projects/epec/spa/tests/sample.js:3:9: expected "foo" but was undefined
Chrome 25.0: Executed 1 of 1 (1 FAILED) (0.195 secs / 0.018 secs)
Adicionando o angular-scenario.js e esperando que o JASMINE-ADAPTER possa lidar com isso.Eu também tentei incluirangular-scenario.js
eu mesmo, mas isso é um beco sem saída.
//inside testacular.conf.js
files = [
JASMINE,
JASMINE_ADAPTER,
'tests/lib/angular/angular.js',
'tests/sample.js'
];
Eu recebo saída:
$ testacular start
info: Testacular server started at http://localhost:9876/
info (launcher): Starting browser ChromeCanary
info (Chrome 24.0): Connected on socket id uEzVQ6tqSu7M7tak4F6v
Chrome 24.0 Array #indexOf() should return -1 when the value is not present FAILED
Expected true to be false.
Error: Expected true to be false.
at null.<anonymous> (/..../tests/sample.js:4:17)
Chrome 24.0: Executed 1 of 1 (1 FAILED) (0.07 secs / 0.004 secs)
Se eu adicionar cenário angular no mix:
//inside testacular.conf.js
files = [
JASMINE,
JASMINE_ADAPTER,
'tests/lib/angular/angular.js',
'tests/lib/angular/angular-scenario.js',
'tests/sample.js'
];
Os testes não são executados:
$ testacular start
info: Testacular server started at http://localhost:9876/
info (launcher): Starting browser ChromeCanary
info (Chrome 24.0): Connected on socket id GcyCTxuvhyFcCaE14BEP
Chrome 24.0: Executed 0 of 0 SUCCESS (0.116 secs / 0 secs)
Alguém tem isso funcionando corretamente? O que há com otrue
tornando-seundefined
?