mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-17 10:41:06 +01:00
fix collecting coverage for jest tests
This commit is contained in:
15
scm-ui/jest-preset/src/findName.js
Normal file
15
scm-ui/jest-preset/src/findName.js
Normal file
@@ -0,0 +1,15 @@
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
|
||||
function findName(directory) {
|
||||
const packageJSON = JSON.parse(fs.readFileSync(path.join(directory, "package.json"), {encoding: "UTF-8"}));
|
||||
|
||||
let name = packageJSON.name;
|
||||
const orgaIndex = name.indexOf("/");
|
||||
if (orgaIndex > 0) {
|
||||
return name.substring(orgaIndex + 1);
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
module.exports = findName;
|
||||
Reference in New Issue
Block a user