Skip to content

Commit

Permalink
Parse plugin-name from .pnpm/.pnpm-store
Browse files Browse the repository at this point in the history
  • Loading branch information
da-levkovets committed Nov 20, 2023
1 parent 70fb975 commit c52e41b
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/parse-plugin-name.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,34 @@ describe('parsePluginName', () => {
'@some-org/some-plugin-name'
);
});

test('should return a plugin name from a stack if it is in .pnpm', () => {
const stack = `
at Hermione.herm.<computed> (/Users/name/prj/node_modules/.pnpm/[email protected]/node_modules/hermione-plugins-profiler/index.js:48:20)
at module.exports (/Users/name/prj/node_modules/.pnpm/[email protected]/node_modules/some-plugin/index.js:48:20)
at /Users/name/prj/node_modules/.pnpm/plugins-loader/node_modules/plugins-loader/index.js:48:20
at Module.load (node:internal/modules/cjs/loader:1037:32)
`;

const err = new Error();

err.stack = stack;

expect(parsePluginName(err)).toEqual('some-plugin');
});

test('should return a plugin name from a stack if it is in .pnpm-store', () => {
const stack = `
at Hermione.herm.<computed> [as on] (/Users/name/.pnpm-store/some-virtual-store/[email protected]/node_modules/hermione-plugins-profiler/index.js:48:20)
at module.exports (/Users/name/.pnpm-store/some-virtual-store/@[email protected]_56d91d656e193c0ca144cec591e28121/node_modules/@yandex-int/some-plugin/index.js:48:20)
at /Users/name/.pnpm-store/some-virtual-store/[email protected]/node_modules/plugins-loader/lib/index.js:48:20
at /Users/name/.pnpm-store/some-virtual-store/[email protected]/node_modules/plugins-loader/lib/index.js:48:20
`;

const err = new Error();

err.stack = stack;

expect(parsePluginName(err)).toEqual('@yandex-int/some-plugin');
});
});

0 comments on commit c52e41b

Please sign in to comment.