0
테스트에 Jasmine을 사용하고 테스트 러너로 Karma를 사용하고 있습니다.Jasmine Karma Array.find는 함수가 아닙니다.
TypeError: myns.dataList.find is not a function
이이 기능을 이해할 수없는 제안 :
나는 오류와 함께 실패 Array.prototype.find()를 사용하여 간단한 찾기 방법이있다. 또한 동일한 파일에 메서드에 대한 polyfill이 있고 노드에 an es6 shim도 설치되어 있습니다.describe('the description', function() {
it('should work', function() {
jasmine.getJSONFixtures().fixturesPath = 'base/path/to/json/';
myns.dataList = loadJSONFixtures('dataList.json');
console.log(myns.dataList); /* all ok here, json is loaded */
var theName = myns.dataList.find(function(entry) {
return entry.name === selfName;
});
expect(2 + 2).not.toEqual(4); /* doesn't get here because of TypeError */
});
});
참고 : 크롬 51.0.2704을
이 내가 노력하고있어되어 사용
이는 재스민 브라우저에서 직접 실행하면 정상적으로 작동