From aa2c073c6e7ebc53b987e2b0b20d6868584a664a Mon Sep 17 00:00:00 2001 From: Shinnosuke Watanabe Date: Fri, 19 Apr 2019 04:55:48 +0900 Subject: [PATCH] remove a workaround for Windows It's fixed in https://github.com/istanbuljs/v8-to-istanbul/commit/c59a21ad306d434ecb11e3b3756a290eba45d49c --- index.js | 16 ---------------- package-lock.json | 6 +++--- package.json | 3 +-- patch.txt | 14 -------------- 4 files changed, 4 insertions(+), 35 deletions(-) delete mode 100755 patch.txt diff --git a/index.js b/index.js index 096e997..4f91835 100755 --- a/index.js +++ b/index.js @@ -31,22 +31,6 @@ const isTravisCi = process.env.TRAVIS === 'true'; const codecovBashPath = process.platform === 'win32' ? join(cwd, 'coverage', uuidV4()) : null; (async () => { - // Remove this workaround when https://github.com/istanbuljs/v8-to-istanbul/pull/16 is merged - if (process.platform === 'win32') { - try { - const patchPath = require.resolve('./patch.txt'); - const {readFile, unlink, writeFile} = require('fs'); - - const originalScriptPath = require.resolve('v8-to-istanbul/lib/script'); - const originalScript = await promisify(readFile)(originalScriptPath, 'utf8'); - await promisify(writeFile)(originalScriptPath, originalScript.replace( - /_buildLines \(source, lines, shebangLength\) \{[^9]*(?=applyCoverage)/um, - await promisify(readFile)(patchPath, 'utf8') - )); - await promisify(unlink)(patchPath); - } catch {} - } - if (command === undefined) { require(c8BinPath); return; diff --git a/package-lock.json b/package-lock.json index 0caf653..9747bbd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1919,9 +1919,9 @@ "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" }, "v8-to-istanbul": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-2.0.4.tgz", - "integrity": "sha512-eAHPnQYNHlZWxfa76dUrgdBK7cTmSSoX1aPq1yH/0tImW2gAGLw2GF+hhMaKAD9RvyJUP6pfSLVmV3HkoRv5oA==" + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-2.0.5.tgz", + "integrity": "sha512-DllgVqHN51hqeDg5icNaLdh6UmbHox/4DFYDEymSeWjHs61IRO+hdA8cYIVHv6Pw9XNVnFx9m7fkqClk50zD0g==" }, "validate-npm-package-license": { "version": "3.0.4", diff --git a/package.json b/package.json index 23b84bf..517113a 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,7 @@ "test": "node . node . test.js" }, "files": [ - "index.js", - "patch.txt" + "index.js" ], "bin": { "coverage": "index.js" diff --git a/patch.txt b/patch.txt deleted file mode 100755 index cfff8f2..0000000 --- a/patch.txt +++ /dev/null @@ -1,14 +0,0 @@ -_buildLines(source, lines, shebangLength) { - let position = 0; - for (const [i, lineStr] of source.trim().split(/(?<=\r?\n)/u).entries()) { - const matchedNewLineChar = lineStr.match(/\r?\n$/u); - const newLineLength = matchedNewLineChar ? matchedNewLineChar[0].length : 0; - this.eof = position + lineStr.length - newLineLength; - const line = new CovLine(i + 1, position, this.eof); - if (i === 0 && shebangLength !== 0) { - line.count = 1; - } - lines.push(line); - position += lineStr.length; - } -}