-
-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Basic test setup for html-spa (#433)
- Loading branch information
1 parent
f6bb0b4
commit 025e8af
Showing
14 changed files
with
135 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"presets": ["@babel/preset-env", "@babel/preset-react"] | ||
"presets": [["@babel/preset-env", { "modules": "commonjs" }], "@babel/preset-react"] | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict'; | ||
|
||
const path = require('path'); | ||
|
||
module.exports = { | ||
entry: path.resolve(__dirname, 'src/index.js'), | ||
output: { | ||
path: path.resolve(__dirname, 'assets'), | ||
filename: 'bundle.js' | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
exclude: /node_modules/, | ||
use: { | ||
loader: 'babel-loader' | ||
} | ||
} | ||
] | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
packages/istanbul-reports/test/html-spa/src/getChildData.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
'use strict'; | ||
/* globals describe, it */ | ||
const assert = require('chai').assert; | ||
const getChildData = require('../../../lib/html-spa/src/getChildData'); | ||
|
||
const mediumMetrics = { | ||
statements: { | ||
total: 2100, | ||
covered: 1337, | ||
skipped: 0, | ||
pct: 63.67, | ||
classForPercent: 'medium' | ||
}, | ||
branches: { | ||
total: 983, | ||
covered: 606, | ||
skipped: 0, | ||
pct: 61.65, | ||
classForPercent: 'medium' | ||
}, | ||
functions: { | ||
total: 476, | ||
covered: 312, | ||
skipped: 0, | ||
pct: 65.55, | ||
classForPercent: 'medium' | ||
}, | ||
lines: { | ||
total: 2044, | ||
covered: 1313, | ||
skipped: 0, | ||
pct: 64.24, | ||
classForPercent: 'medium' | ||
} | ||
}; | ||
|
||
const simpleSourceData = { | ||
file: '', | ||
isEmpty: false, | ||
metrics: mediumMetrics, | ||
children: [ | ||
{ | ||
file: 'istanbul-lib-coverage', | ||
isEmpty: false, | ||
metrics: mediumMetrics, | ||
children: [ | ||
{ | ||
file: 'index.js', | ||
isEmpty: false, | ||
metrics: mediumMetrics | ||
} | ||
] | ||
} | ||
] | ||
}; | ||
|
||
describe('getChildData', () => { | ||
it('does nothing if not asked to', () => { | ||
assert.deepEqual( | ||
getChildData( | ||
simpleSourceData, | ||
{ lines: true, branches: true }, | ||
null, | ||
false, | ||
{ low: true, medium: true, high: true }, | ||
null | ||
), | ||
simpleSourceData.children | ||
); | ||
}); | ||
}); |