Skip to content

Commit

Permalink
Add tests for isFromNpx
Browse files Browse the repository at this point in the history
  • Loading branch information
cezaraugusto committed Sep 4, 2024
1 parent e5daf9a commit b9aeae0
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion programs/develop/webpack/lib/__spec__/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,18 @@ describe('utils', () => {
expect(result).toBe(false)
})
})
})

describe('isFromNpx', () => {
it('should return "npm" if the command is from npx', () => {
process.env.npm_execpath = 'npx'
const result = utils.isFromNpx()
expect(result).toBe('npm')
})

it('should return false if npm_execpath is not set', () => {
delete process.env.npm_execpath
const result = utils.isFromNpx()
expect(result).toBe(false)
})
})
})

0 comments on commit b9aeae0

Please sign in to comment.