unit testing - Angular Test tutorials on Jasmine website not working -
i started practice tests on angular-seed app based on jasmine. when using first test example found on pivotal.github.io/jasmine/ fails on app.
test example code:
describe("a suite", function() { it("contains spec expectation", function() { expect(true).tobe(true); }); });
but passes on tryjasmine.com
i did test content , views/partials, pass. 1 on jasmine site fails. missing or there config need setup?
karma.conf.js file:
basepath = '../'; files = [ jasmine, jasmine_adapter, 'app/lib/angular/angular.js', 'app/lib/angular/angular-*.js', 'test/lib/angular/angular-mocks.js', 'app/js/**/*.js', 'test/unit/**/*.js' ]; autowatch = true; browsers = ['chrome']; junitreporter = { outputfile: 'test_out/unit.xml', suite: 'unit' };
karma-e2e.conf.js file:
basepath = '../'; files = [ angular_scenario, angular_scenario_adapter, 'test/e2e/**/*.js' ]; autowatch = false; browsers = ['chrome']; singlerun = true; proxies = { '/': 'http://localhost:8000/' }; junitreporter = { outputfile: 'test_out/e2e.xml', suite: 'e2e' };
according http://pivotal.github.io/jasmine/#section-the_runner_and_reporter on runner , reporter section of doc there is:
document.queryselector('.version').innerhtml = jasmineenv.versionstring();
browser console throws error
uncaught typeerror: cannot set property 'innerhtml' of null
after looking around found other examples dont have line. used example in tuts+ http://net.tutsplus.com/tutorials/javascript-ajax/testing-your-javascript-with-jasmine/
on tutorial there specrunner.html
has block of code without document.queryselector('.version').innerhtml = jasmineenv.versionstring();
and works expected.
Comments
Post a Comment