Skip to content
This repository has been archived by the owner on Dec 31, 2019. It is now read-only.

Commit

Permalink
test: update expected cover to unexpected locations
Browse files Browse the repository at this point in the history
The new locations are pretty strange...
I don't really know when things went wrong...
I don't want to "fix" it...
This project should die anyway...
  • Loading branch information
douglasduteil committed Jul 5, 2018
1 parent 3763c5f commit fdcbf45
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 77 deletions.
147 changes: 96 additions & 51 deletions test/fixtures/es6-classes/expectedCover.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Compiled to ./compiled.js

const lostStatment = {
start: {line: 0, column: 0},
end: {line: 0, column: 0}
start: { line: 0, column: 0 },
end: { line: 0, column: 0 }
};

const skippedStatment = {
Expand All @@ -12,22 +12,21 @@ const skippedStatment = {

////

function generateNSkipedStatement(n){
return Array.from(Array(n)).map(() => skippedStatment );
function generateNSkipedStatement(n) {
return Array.from(Array(n)).map(() => skippedStatment);
}

function generateNSkipedFunction(...lostFnData){
function generateNSkipedFunction(...lostFnData) {
return lostFnData.map(fnData => {
return {
...fnData, loc: {...skippedStatment}, skip: true
};
return { ...fnData, loc: { ...(fnData.loc || skippedStatment) } };
});
}

function generateNSkipedBranch(...lostBranchData){
function generateNSkipedBranch(...lostBranchData) {
return lostBranchData.map(branchData => {
return {
...branchData, locations: [{...skippedStatment}, {...skippedStatment}]
...branchData,
locations: [{ ...skippedStatment }, { ...skippedStatment }]
};
});
}
Expand All @@ -40,71 +39,117 @@ module.exports = {
.concat([
// 20th statement
{
start: {line: 3, column: 0},
end: {line: 15, column: 1},
}
])
.concat(generateNSkipedStatement(3))
.concat([
start: { line: 3, column: 0 },
end: { line: 3, column: 0 }
},
// 21th statement
{
start: { line: 3, column: 4 },
end: { line: 3, column: 4 }
},
// 22th statement
{
start: { line: 3, column: 4 },
end: { line: 3, column: 4 }
},
// 23th statement
{
start: { line: 3, column: 4 },
end: { line: 3, column: 4 }
},
// 24th statement
{
start: {line: 5, column: 4},
end: {line: 5, column: 45}
start: { line: 5, column: 4 },
end: { line: 5, column: 4 }
},
// 25th statement
{
start: {line: 9, column: 4},
end: {line: 9, column: 19}
start: { line: 9, column: 4 },
end: { line: 9, column: 4 }
},
// 26th statement
{
start: {line: 13, column: 4},
end: {line: 13, column: 20}
start: { line: 13, column: 4 },
end: { line: 13, column: 4 }
},
// 26th statement
{
start: { line: 3, column: 4 },
end: { line: 3, column: 4 }
}
])
.concat(generateNSkipedStatement(2))
,

.concat(generateNSkipedStatement(1)),
fnMap: []
.concat(generateNSkipedFunction(
{name: '(anonymous_1)', line: 3},
{name: 'defineProperties', line: 3},
{name: '(anonymous_3)', line: 3},
{name: '_classCallCheck', line: 9}
))
.concat(
generateNSkipedFunction(
{ name: '(anonymous_1)', line: 7, skip: true },
{ name: 'defineProperties', line: 7, skip: true },
{ name: '(anonymous_3)', line: 7, skip: true },
{ name: '_classCallCheck', line: 9, skip: true }
)
)
.concat([
// 5th fn
{
name: '(anonymous_5)', line: 13,
name: '(anonymous_5)',
line: 13,
loc: {
start: {line: 3, column: 10},
end: {line: 3, column: 10}
start: { line: 3, column: 4 },
end: { line: 3, column: 4 }
}
}
])
.concat(generateNSkipedFunction(
{name: 'Animal', line: 14}
))
.concat(generateNSkipedFunction(
{name: 'sayHi', line: 20}
))
.concat(generateNSkipedFunction(
{name: 'sayOther', line: 25}
))
.concat(generateNSkipedFunction(
{name: 'getName', line: 30}
)),
.concat(
generateNSkipedFunction({
name: 'Animal',
line: 14,
loc: {
start: { line: 3, column: 4 },
end: { line: 3, column: 4 }
}
})
)
.concat(
generateNSkipedFunction({
name: 'sayHi',
line: 20,
loc: {
start: { line: 3, column: 4 },
end: { line: 4, column: 10 }
}
})
)
.concat(
generateNSkipedFunction({
name: 'sayOther',
line: 25,
loc: {
start: { line: 3, column: 4 },
end: { line: 8, column: 13 }
}
})
)
.concat(
generateNSkipedFunction({
name: 'getName',
line: 30,
loc: {
start: { line: 3, column: 4 },
end: { line: 12, column: 19 }
}
})
),

branchMap: generateNSkipedBranch(
// 1th branch
{line: 3, type: 'binary-expr'},
{ line: 7, type: 'binary-expr' },
// 2th branch
{line: 3, type: 'if'},
{ line: 7, type: 'if' },
// 3th branch
{line: 3, type: 'if'},
{ line: 7, type: 'if' },
// 4th branch
{line: 3, type: 'if'},
{ line: 7, type: 'if' },
// 5th branch
{line: 9, type: 'if'}
{ line: 9, type: 'if' }
)
};
52 changes: 26 additions & 26 deletions test/fixtures/virgin/expectedCover.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,17 @@
// 9. var a = 5;
// 10. }


module.exports = {
statementMap: [
{
// 3. ONE.foo = function (bar) {
// 4. return baz(bar ? 0 : 1);
// 5. };
start: {line: 3, column: 0},
end: {line: 5, column: 1}
// 3.
start: { line: 3, column: 0 },
end: { line: 3, column: 0 }
},
{
// 4. return baz(bar ? 0 : 1);
start: {line: 4, column: 2},
end: {line: 4, column: 26}
// 4.
start: { line: 4, column: 2 },
end: { line: 4, column: 2 }
},
{
// 5. };
Expand All @@ -33,41 +30,43 @@ module.exports = {
// 8. if (true) {
// 9. var a = 5;
// 10. }
start: {line: 5, column: 2},
end: {line: 10, column: 1},
start: { line: 8, column: 0 },
end: { line: 10, column: 1 },
skip: true
},
{
// 9. var a = 5;
start: {line: 9, column: 2},
end: {line: 9, column: 12},
start: { line: 9, column: 2 },
end: { line: 9, column: 2 },
skip: true
}
],

fnMap: [
{
// 3. ONE.foo = function (bar) {
name: '(anonymous_1)', line: 3,
name: '(anonymous_1)',
line: 3,
loc: {
start: {line: 3, column: 10},
end: {line: 3, column: 25}
start: { line: 3, column: 10 },
end: { line: 3, column: 25 }
}
}
],

branchMap: [
{
// 4. return baz(bar ? 0 : 1);
line: 4, type: 'cond-expr',
line: 4,
type: 'cond-expr',
locations: [
{
start: {line: 4, column: 19},
end: {line: 4, column: 20}
start: { line: 4, column: 19 },
end: { line: 4, column: 13 }
},
{
start: {line: 4, column: 23},
end: {line: 4, column: 24}
start: { line: 4, column: 23 },
end: { line: 4, column: 9 }
}
]
},
Expand All @@ -76,16 +75,17 @@ module.exports = {
// 6.
// 7. /* istanbul ignore next */
// 8. if (true) {
line: 8, type: 'if',
line: 8,
type: 'if',
locations: [
{
start: {line: 5, column: 2},
end: {line: 5, column: 2},
start: { line: 8, column: 0 },
end: { line: 8, column: 0 },
skip: true
},
{
start: {line: 5, column: 2},
end: {line: 5, column: 2},
start: { line: 8, column: 0 },
end: { line: 8, column: 0 },
skip: true
}
]
Expand Down

0 comments on commit fdcbf45

Please sign in to comment.