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 c6aeec6 commit 4ad1f6d
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/parse-plugin-name.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,31 +106,31 @@ describe('parsePluginName', () => {

test('should return a plugin name from a stack if it is in .pnpm', () => {
const stack = `
at Hermione.herm.<computed> (/Users/da-levkovets/arcadia/search-interfaces/oceania/projects/web4/node_modules/.pnpm/hermione-plugins-profiler@0.2.3/node_modules/hermione-plugins-profiler/build/wrap-hermione-handler.js:13:19)
at module.exports (/Users/da-levkovets/arcadia/search-interfaces/oceania/projects/web4/node_modules/.pnpm/[email protected]/node_modules/hermione-passive-browsers/lib/index.js:54:14)
at /Users/da-levkovets/arcadia/search-interfaces/oceania/projects/web4/node_modules/.pnpm/plugins-loader@1.2.0/node_modules/plugins-loader/lib/loader.js:19:80
at Hermione.herm.<computed> (/Users/name/prj/node_modules/.pnpm/hermione-plugins-profiler@0.0.0/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('hermione-passive-browsers');
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/da-levkovets/.pnpm-store/oceania-virtual-store/hermione-plugins-profiler@0.2.3/node_modules/hermione-plugins-profiler/build/wrap-hermione-handler.js:14:29)
at module.exports (/Users/da-levkovets/.pnpm-store/oceania-virtual-store/@yandex-int+html-reporter-dumps-plugin@0.5.7_56d91d656e193c0ca144cec591e28121/node_modules/@yandex-int/html-reporter-dumps-plugin/src/hermione/index.ts:22:14)
at /Users/da-levkovets/.pnpm-store/oceania-virtual-store/plugins-loader@1.2.0/node_modules/plugins-loader/lib/loader.js:19:80
at /Users/da-levkovets/.pnpm-store/oceania-virtual-store/plugins-loader@1.2.0/node_modules/plugins-loader/lib/index.js:9:26
at Hermione.herm.<computed> [as on] (/Users/name/.pnpm-store/some-virtual-store/hermione-plugins-profiler@0.0.0/node_modules/hermione-plugins-profiler/index.js:48:20)
at module.exports (/Users/name/.pnpm-store/some-virtual-store/@some-plugin@0.0.0_56d91d656e193c0ca144cec591e28121/node_modules/@yandex-int/some-plugin/index.js:48:20)
at /Users/name/.pnpm-store/some-virtual-store/plugins-loader@0.0.0/node_modules/plugins-loader/lib/index.js:48:20
at /Users/name/.pnpm-store/some-virtual-store/plugins-loader@0.0.0/node_modules/plugins-loader/lib/index.js:48:20
`;

const err = new Error();

err.stack = stack;

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

0 comments on commit 4ad1f6d

Please sign in to comment.