-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4f436a2
commit 9482661
Showing
3 changed files
with
16 additions
and
25 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,6 +1,6 @@ | ||
{ | ||
"name": "babel-plugin-canyon", | ||
"version": "1.8.81", | ||
"version": "1.8.78-beta.22", | ||
"description": "A Babel plugin cooperates with istanbul to report the coverage", | ||
"author": "Allen Zhang <[email protected]>", | ||
"license": "MIT", | ||
|
26 changes: 13 additions & 13 deletions
26
plugins/babel-plugin-canyon/src/helpers/generate-initial-coverage.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 |
---|---|---|
@@ -1,20 +1,20 @@ | ||
// import fs from 'fs'; | ||
// import path from 'path' | ||
import fs from 'fs'; | ||
import path from 'path' | ||
import {extractCoverageData} from "./extract-coverage-data"; | ||
|
||
|
||
export const generateInitialCoverage = (paramsPath) => { | ||
const initialCoverageDataForTheCurrentFile = extractCoverageData(paramsPath) | ||
// const filePath = './.canyon_output/coverage-final.json'; | ||
// const dir = path.dirname(filePath); | ||
// if (!fs.existsSync(dir)) { | ||
// fs.mkdirSync(dir, {recursive: true}); | ||
// } | ||
// // 防止返回的数据为空 | ||
// if (initialCoverageDataForTheCurrentFile && initialCoverageDataForTheCurrentFile.path) { | ||
// fs.writeFileSync(`./.canyon_output/coverage-${Math.random()}.json`, JSON.stringify({ | ||
// [initialCoverageDataForTheCurrentFile.path]: initialCoverageDataForTheCurrentFile | ||
// }, null, 2), 'utf-8'); | ||
// } | ||
const filePath = './.canyon_output/coverage-final.json'; | ||
const dir = path.dirname(filePath); | ||
if (!fs.existsSync(dir)) { | ||
fs.mkdirSync(dir, {recursive: true}); | ||
} | ||
// 防止返回的数据为空 | ||
if (initialCoverageDataForTheCurrentFile && initialCoverageDataForTheCurrentFile.path) { | ||
fs.writeFileSync(`./.canyon_output/coverage-${Math.random()}.json`, JSON.stringify({ | ||
[initialCoverageDataForTheCurrentFile.path]: initialCoverageDataForTheCurrentFile | ||
}, null, 2), 'utf-8'); | ||
} | ||
return initialCoverageDataForTheCurrentFile; | ||
} |
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