0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

sfdx-lwc-jest のまとめ

Posted at

"Using the Apex Wire Adapter" error: "TypeError: getAccountList.emit is not a function"

Try this

import getAccountList from '@salesforce/apex/AccountController.getAccountList';

jest.mock(
  '@salesforce/apex/AccountController.getAccountList',
  ()=>{
    const { createApexTestWireAdapter } = require("@salesforce/sfdx-lwc-jest");
    return {
      default: createApexTestWireAdapter(jest.fn()),
    };
  },
  {virtual: true}
);

In the test class, execute the following emit ()

getAccountList.emit(mockGetAccountList);

インストールできていない?

image.png

image.png

I've changed the default package.json to use eslint ^8.57.0 like eslint-plugin-lwc does for now and it's working.

https://github.com/forcedotcom/cli/issues/3056

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?