mirror of
https://github.com/pnpm/pnpm.git
synced 2026-05-05 14:36:10 -04:00
test: use isExecutable from @pnpm/assert-project
This commit is contained in:
@@ -5,7 +5,6 @@ import path = require('path')
|
||||
import exists = require('path-exists')
|
||||
import rimraf = require('rimraf-then')
|
||||
import testDefaults from './utils/testDefaults'
|
||||
import isExecutable from './utils/isExecutable'
|
||||
|
||||
const fixtures = path.join(__dirname, 'fixtures')
|
||||
|
||||
@@ -19,7 +18,7 @@ test('installing a simple project', async (t) => {
|
||||
t.ok(project.requireModule('is-negative'), 'dev dep installed')
|
||||
t.ok(project.requireModule('colors'), 'optional dep installed')
|
||||
|
||||
await isExecutable(t, path.join(prefix, 'node_modules', '.bin', 'rimraf'))
|
||||
await project.isExecutable('.bin/rimraf')
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
import isWindows = require('is-windows')
|
||||
import isexe = require('isexe')
|
||||
import fs = require('mz/fs')
|
||||
import {Test} from 'tape'
|
||||
|
||||
const IS_WINDOWS = isWindows()
|
||||
|
||||
export default async function isExecutable (t: Test, filePath: string) {
|
||||
if (IS_WINDOWS) {
|
||||
t.ok(isexe(filePath), `${filePath} is executable`)
|
||||
return
|
||||
}
|
||||
|
||||
const stat = await fs.stat(filePath)
|
||||
t.equal(stat.mode, parseInt('100755', 8), `${filePath} is executable`)
|
||||
t.ok(stat.isFile(), `${filePath} refers to a file`)
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user