분명히 실패한 JSpec Google Group에 게시 된 메시지를 두 번 시도해 본 결과, 여기에 대신 게시됩니다.JSpec - RangeError : 최대 호출 스택 크기 초과
JSpec과 같은 문제가 발생하여 특정 유형의 테스트 (아래)가 무한 재귀 루프로 바뀌고있는 것 같습니다. 어떤 아이디어? 거기에 내 코드가 잘못되었거나 JSpec입니까? Ruby Gem을 통해 JSpec 2.11.2를 실행 중입니다.
오류는 'RangeError : 최대 호출 스택 크기를 초과했습니다.'입니다. (Safari) 및 'InternalError : 너무 많은 재귀'(FF/Mac)가 있습니다. Firebug 콘솔을 사용하여 오류없이 항목을 방에 추가 할 수 있습니다.
문제를 재현하려면 'jspec init test'를 사용하여 jspec 프로젝트 템플릿을 만드십시오. 다음과 같이 다음과 같은 파일을 편집 :
이
var Game = {};
Game.item = function() {
var result = {
name : 'Undefined',
room : null
}
return result;
};
Game.room = function() {
var result = {
items : [],
addItem : function (name) {
var item = Game.item();
item.name = name;
item.room = this;
this.items.push(item);
return item;
}
};
return result;
};
spec.core.js
describe 'Room'
before_each
room = Game.room()
end
describe 'addItem()'
before_each
potion = room.addItem('Potion')
key = room.addItem('Key')
end
//this is fine
it 'should return two different items'
key.should_not.be potion
end
//InternalError: too much recursion
it 'should not give recursion error'
key.should.be potion
end
end
end
전에 JSpec 들어하지 마십시오. 미안 해요. (거의. "item.room = this;"를 제외하고는 거의 모든 코드가 미쳐 버릴 정도로 단순 해 보입니다. – Tei