-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
Question:
How do you unit test the SPFx web part, written in typescript (react), that uses @pnp Call to communicate with SharePoint?
How to mock PNP call or how to make ignorable for the test case.
below I mentions the error related to PNP
E:\Projects\Unit Testing\SPFx-unit-testing\node_modules\@pnp\logging\index.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){export * from "./logger";
^^^^^^
SyntaxError: Unexpected token export
3 | import { IPnpSpCrudProps } from './IPnpSpCrudProps';
4 | import { escape } from '@microsoft/sp-lodash-subset';
> 5 | require("@pnp/logging");
| ^
6 | require("@pnp/common");
7 | require("@pnp/odata");
8 | import { sp } from "@pnp/sp/presets/all";
I have configured the unit test and sample test execute successfully (without PNP)
SPFx-unit-testing
Let me know your thoughts
@andrewconnell
Thanks
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels