testing infra improvement - disable silent errors

actions/join test fixed
This commit is contained in:
Milos Brzakovic (E-Search)
2021-10-21 14:44:04 +02:00
parent b78a8d5d2a
commit 68b5445689
2 changed files with 23 additions and 8 deletions

View File

@@ -172,6 +172,12 @@
'spec/validations/suspicious_name.js'
];
window.executionErrors = [];
window.onerror = function (message, source, line, col) {
window.executionErrors.push("message" + message + " source" + source + " line" + line + " col" + col);
};
var isPhantomJS = !!(navigator.userAgent.match(/PhantomJS/));
var isIE11 = !!(navigator.userAgent.match(/Trident/) && !navigator.userAgent.match(/MSIE/));
@@ -191,6 +197,15 @@
(function nextScript() {
if (!scripts.length) {
window.mocha.run();
if (window.executionErrors.length > 0){
console.log('\n\n[Execution errors exist] Please resolve the following: \n');
for (var i = 0; i < window.executionErrors.length; i++){
console.log('[Execution error] ' + window.executionErrors[i]);
}
console.log('\n Disposing mocha. Expect mocha dispose log like: \'Uncaught error outside test suite\'... \n');
window.mocha.dispose();
}
return;
}
var src = scripts.shift();

View File

@@ -97,7 +97,7 @@ describe('iD.actionJoin', function () {
});
['restriction', 'connectivity'].forEach(function (type) {
it(`returns '${type}' in situations where a ${type} relation would be damaged (a)`, function () {
it('returns ' + type + ' in situations where a ' + type + 'relation would be damaged (a)', function () {
// a --> b ==> c
// from: -
// to: =
@@ -108,7 +108,7 @@ describe('iD.actionJoin', function () {
iD.osmNode({id: 'c', loc: [4,0]}),
iD.osmWay({id: '-', nodes: ['a', 'b']}),
iD.osmWay({id: '=', nodes: ['b', 'c']}),
iD.osmRelation({id: 'r', tags: {type}, members: [
iD.osmRelation({id: 'r', tags: {'type': type}, members: [
{type: 'way', id: '-', role: 'from'},
{type: 'way', id: '=', role: 'to'},
{type: 'node', id: 'b', role: 'via'}
@@ -118,7 +118,7 @@ describe('iD.actionJoin', function () {
expect(iD.actionJoin(['-', '=']).disabled(graph)).to.equal(type);
});
it(`returns '${type}' in situations where a ${type} relation would be damaged (b)`, function () {
it('returns ' + type + ' in situations where a ' + type + 'relation would be damaged (b)', function () {
// a --> b ==> c
// |
// d
@@ -133,7 +133,7 @@ describe('iD.actionJoin', function () {
iD.osmWay({id: '-', nodes: ['a', 'b']}),
iD.osmWay({id: '=', nodes: ['b', 'c']}),
iD.osmWay({id: '|', nodes: ['b', 'd']}),
iD.osmRelation({id: 'r', tags: {type}, members: [
iD.osmRelation({id: 'r', tags: {'type': type}, members: [
{type: 'way', id: '-', role: 'from'},
{type: 'way', id: '|', role: 'to'},
{type: 'node', id: 'b', role: 'via'}
@@ -143,7 +143,7 @@ describe('iD.actionJoin', function () {
expect(iD.actionJoin(['-', '=']).disabled(graph)).to.equal(type);
});
it(`returns falsy in situations where a ${type} relation wouldn't be damaged (a)`, function () {
it('returns falsy in situations where a '+ type + 'relation wouldn\'t be damaged (a)', function () {
// a --> b ==> c
// |
// d
@@ -158,7 +158,7 @@ describe('iD.actionJoin', function () {
iD.osmWay({id: '-', nodes: ['a', 'b']}),
iD.osmWay({id: '=', nodes: ['b', 'c']}),
iD.osmWay({id: '|', nodes: ['a', 'd']}),
iD.osmRelation({id: 'r', tags: {type}, members: [
iD.osmRelation({id: 'r', tags: {'type': type}, members: [
{type: 'way', id: '-', role: 'from'},
{type: 'way', id: '|', role: 'to'},
{type: 'node', id: 'a', role: 'via'}
@@ -168,7 +168,7 @@ describe('iD.actionJoin', function () {
expect(iD.actionJoin(['-', '=']).disabled(graph)).not.to.be.ok;
});
it(`returns falsy in situations where a ${type} restriction wouldn't be damaged (b)`, function () {
it('returns falsy in situations where a ' + type + 'restriction wouldn\'t be damaged (b)', function () {
// d
// |
// a --> b ==> c
@@ -187,7 +187,7 @@ describe('iD.actionJoin', function () {
iD.osmWay({id: '=', nodes: ['b', 'c']}),
iD.osmWay({id: '|', nodes: ['d', 'b']}),
iD.osmWay({id: '\\', nodes: ['b', 'e']}),
iD.osmRelation({id: 'r', tags: {type}, members: [
iD.osmRelation({id: 'r', tags: {'type': type}, members: [
{type: 'way', id: '|', role: 'from'},
{type: 'way', id: '\\', role: 'to'},
{type: 'node', id: 'b', role: 'via'}