-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: jest changed to vitest (#386)
- Loading branch information
Showing
19 changed files
with
596 additions
and
631 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
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,54 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const camelCase = require('lodash/camelCase'); | ||
|
||
const DomParser = require('dom-parser'); | ||
|
||
const parser = new DomParser(); | ||
|
||
function resolveCwd(...args) { | ||
args.unshift(process.cwd()); | ||
return path.join(...args); | ||
} | ||
|
||
fs.readFile(resolveCwd('test/coverage/index.html'), 'utf8', (err, html) => { | ||
if (err) { | ||
console.log('please execute npm run test:unit-coverage first!', err); | ||
return; | ||
} | ||
|
||
if (!err) { | ||
const dom = parser.parseFromString(html); | ||
const tds = dom.getElementsByTagName('td'); | ||
|
||
const size = 10; | ||
const groups = Math.ceil(tds.length / size); | ||
const componentCoverage = []; | ||
for (let i = 0; i < groups; i++) { | ||
componentCoverage.push(tds.slice(i * size, (i + 1) * size)); | ||
} | ||
|
||
const resultCoverage = {}; | ||
componentCoverage.forEach((item, index) => { | ||
const dataVal = item[0].getAttribute('data-value'); | ||
|
||
const name = dataVal; | ||
const statements = `${item[2].getAttribute('data-value')}%`; | ||
const branches = `${item[4].getAttribute('data-value')}%`; | ||
const functions = `${item[6].getAttribute('data-value')}%`; | ||
const lines = `${item[8].getAttribute('data-value')}%`; | ||
|
||
const key = camelCase(name); | ||
resultCoverage[key] = { | ||
statements, | ||
branches, | ||
functions, | ||
lines, | ||
}; | ||
}); | ||
|
||
const finalRes = `module.exports = ${JSON.stringify(resultCoverage)}`; | ||
fs.writeFileSync(resolveCwd('site/test-coverage.js'), finalRes); | ||
console.log('successful re-generate coverage'); | ||
} | ||
}); |
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,4 @@ | ||
module.exports = { | ||
button: { statements: '100%', branches: '66.66%', functions: '100%', lines: '100%' }, | ||
configProvider: { statements: '100%', branches: '100%', functions: '100%', lines: '100%' }, | ||
}; |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
// Vitest Snapshot v1 | ||
|
||
exports[`base.jsx 1`] = ` | ||
<DocumentFragment> | ||
|
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.