Trying to create a mock environment for testing a pallet, but getting an error msg failed to resolve: could not find tt_error_token in the crate root whenever trying to add my pallet in the mock environment.

  • are you importing the pallet and implementing its Configs before adding it to construct_runtime?
    – Discardo
    Feb 8, 2023 at 7:24

1 Answer 1


I'd suggest to take this pallet as a template for yours. Is a pallet template from the Substrate Developer Hub repo.

In this you can see how to mock the environment:

 pub enum Test where
    Block = Block,
    NodeBlock = Block,
    UncheckedExtrinsic = UncheckedExtrinsic,
    System: frame_system,
    TemplateModule: pallet_template,

Adding the pallet_template:

impl pallet_template::Config for Test {
  type RuntimeEvent = RuntimeEvent;

And how to create the unit tests.

Not the answer you're looking for? Browse other questions tagged or ask your own question.