Czy można mieszać Testacular (Karma) ze scenariuszem kątowym?
Testacular (teraz Karma) jest niesamowita, podobnie jak scenariusz kątowy. Używanie ich razem okazuje się jednak wyzwaniem. W Testacular istnieje ANGULARNY SCENARIUSZ-ADAPTER, który jednak łamie proste testy. Jeśli sam włączysz angular-scenario.js, Testacular w ogóle nie uruchomi żadnych testów. Czy ktoś działa prawidłowo?
SCENARIUSZE ANGULARNEPróbowałem użyć tego z trywialnym testem, ale widziałem dziwne zachowanie:
Test:
describe('Simple', function(){
it('should compare strings', function(){
expect('foo').toBe('foo');
});
});
Normalne zachowanie z konfiguracją:
files = [
JASMINE,
JASMINE_ADAPTER,
// ANGULAR_SCENARIO,
// ANGULAR_SCENARIO_ADAPTER,
'tests/lib/angular/angular.js',
'tests/sample.js'
];
wydajność:
$ 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)
Podczas dodawania konfiguracji adaptera ANGULAR:
files = [
JASMINE,
JASMINE_ADAPTER,
ANGULAR_SCENARIO,
ANGULAR_SCENARIO_ADAPTER,
'tests/lib/angular/angular.js',
'tests/sample.js'
];
wyjście to:
$ 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)
Dodanie angular-scenario.js i nadzieja, że JASMINE-ADAPTER może sobie z tym poradzić.Próbowałem również dołączyćangular-scenario.js
ja, ale to ślepy zaułek.
//inside testacular.conf.js
files = [
JASMINE,
JASMINE_ADAPTER,
'tests/lib/angular/angular.js',
'tests/sample.js'
];
Otrzymuję dane wyjściowe:
$ 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)
Jeśli dodam scenariusz kątowy do miksu:
//inside testacular.conf.js
files = [
JASMINE,
JASMINE_ADAPTER,
'tests/lib/angular/angular.js',
'tests/lib/angular/angular-scenario.js',
'tests/sample.js'
];
Testy nie są w ogóle prowadzone:
$ 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)
Czy ktoś działa prawidłowo? Co z tymtrue
twarzowyundefined
?