current-git-branch
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -50,1 +50,2 @@ 'use strict'; | ||
exports.default = isGitAdded; | ||
module.exports = exports['default']; |
{ | ||
"name": "current-git-branch", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "A tool to check if files are added in a git repository", | ||
@@ -9,3 +9,3 @@ "main": "build.js", | ||
"test": "nyc ava", | ||
"lint": "eslint index.js", | ||
"lint": "eslint index.js test.js", | ||
"coveralls": "nyc report --reporter=text-lcov | coveralls", | ||
@@ -46,2 +46,3 @@ "prepublish": "npm run babel", | ||
"dependencies": { | ||
"babel-plugin-add-module-exports": "^0.2.1", | ||
"execa": "^0.6.1", | ||
@@ -60,5 +61,4 @@ "is-git-repository": "^1.0.0" | ||
"husky": "^0.13.2", | ||
"is-ci": "^1.0.10", | ||
"nyc": "^10.1.2" | ||
} | ||
} |
35
test.js
@@ -0,34 +1,33 @@ | ||
import fs from 'fs'; | ||
import { homedir } from 'os'; | ||
import test from 'ava'; | ||
import path from 'path'; | ||
import execa from 'execa'; | ||
import fs from 'fs-extra'; | ||
import isCi from 'is-ci'; | ||
import branchName from './index'; | ||
const fixtures = 'test/fixtures'; | ||
const fixtures = path.join(process.cwd(), 'test', 'fixtures'); | ||
test('check if the given directory is the branch master', (t) => { | ||
t.plan(1); | ||
const folders = [ | ||
'feat_test', | ||
'master', | ||
]; | ||
if (isCi) { | ||
t.is(branchName(path.join(fixtures, 'master')).slice(0, 14), '(HEAD detached'); | ||
} else { | ||
t.is(branchName(path.join(fixtures, 'master')), 'master'); | ||
} | ||
test.before('rename git folders', () => { | ||
folders.map(folder => fs.renameSync(path.join(fixtures, folder, 'git'), path.join(fixtures, folder, '.git'))); | ||
}); | ||
test('check if the given directory is the branch feat/test', (t) => { | ||
t.plan(1); | ||
test.after.always('rename .git folders', () => { | ||
folders.map(folder => fs.renameSync(path.join(fixtures, folder, '.git'), path.join(fixtures, folder, 'git'))); | ||
}); | ||
if (isCi) { | ||
t.is(branchName(path.join(fixtures, 'feat_test')).slice(0, 14), '(HEAD detached'); | ||
} else { | ||
t.is(branchName(path.join(fixtures, 'feat_test')), 'feat/test'); | ||
} | ||
test('check if the given directory is the branch master', (t) => { | ||
t.is(branchName(path.join(fixtures, 'master')), 'master'); | ||
}); | ||
test('check if the given directory is the branch feat/test', (t) => { | ||
t.is(branchName(path.join(fixtures, 'feat_test')), 'feat_test'); | ||
}); | ||
test('check the branch name of the home dir', (t) => { | ||
t.false(branchName(homedir())); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 2 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
177618
10
55
3
63
2
+ Addedbabel-plugin-add-module-exports@0.2.1(transitive)