From 84bca86788cd29017f5bb4e6efe5c8d2e4cdc1fb Mon Sep 17 00:00:00 2001 From: Cezar Augusto Date: Tue, 3 Sep 2024 00:54:12 -0300 Subject: [PATCH] Add tests for coverage support --- .../webpack/lib/__spec__/utils.spec.ts | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/programs/develop/webpack/lib/__spec__/utils.spec.ts b/programs/develop/webpack/lib/__spec__/utils.spec.ts index 626d223f..800c64b0 100644 --- a/programs/develop/webpack/lib/__spec__/utils.spec.ts +++ b/programs/develop/webpack/lib/__spec__/utils.spec.ts @@ -209,4 +209,26 @@ describe('utils', () => { }) }) }) + + describe('isFromPnpx', () => { + it('should return "pnpm" if the command is from pnpm', () => { + process.env.npm_config_user_agent = 'pnpm' + const result = utils.isFromPnpx() + expect(result).toBe('pnpm') + }) + + it('should return false if the command is not from pnpm', () => { + process.env.npm_config_user_agent = 'npm' + const result = utils.isFromPnpx() + expect(result).toBe(false) + }) + + it('should return false if npm_config_user_agent is not set', () => { + delete process.env.npm_config_user_agent + const result = utils.isFromPnpx() + expect(result).toBe(false) + }) + }) }) + +