question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Versions after 10.1.0 give module error for existing tests

See original GitHub issue

This basic test has been in place for a while but now throws an error if I upgrade shallow-render to a version after 10.1.0.

Error:
 FAIL  src/app/profile/mixcloud-widget/mixcloud-widget.component.spec.ts (9.021 s)
  ● MixcloudWidgetComponent › should create

    Component ProfilesComponent is not part of any NgModule or the module has not been imported into your module.

ProfilesComponent is another component declared within the same module as the component being tested, but neither use each other. I have the same error with other components in other modules. I’ve tried every version up to and including 10.1.4 and get the same result.

The test:

import { Shallow } from 'shallow-render';

import { MixcloudWidgetComponent } from './mixcloud-widget.component';
import { ProfileModule } from '../profile.module';

describe('MixcloudWidgetComponent', () => {
  let shallow: Shallow<MixcloudWidgetComponent>;

  beforeEach(() => {
    shallow = new Shallow(MixcloudWidgetComponent, ProfileModule);
  });

  it('should create', async () => {
    const { element } = await shallow.render();

    expect(element.nativeElement).toBeTruthy();
  });
});

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
getsafcommented, Oct 19, 2020

Thanks, I’m browsing the changes since version 10.0.0: https://github.com/getsaf/shallow-render/compare/v10.0.0...master

Nothing jumps out at me that indicates a changes the way components in modules are handled except for some new provider-mocking logic but I will continue to look. Might be tomorrow before I figure it out. If you happen see anything in that diff that looks weird, let me know.

1reaction
getsafcommented, Oct 19, 2020

Thanks, for the details, someone else mentioned this in another post recently too. I will look into it. First thing I need to do is to reproduce the issue so I’ll try to mirror your module setup to see if I can get the same error.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Upgrade to cypress 10 for typescript project broken (from 9.6)
When I upgrade our existing typescript project it fails with various typescript errors (see the issue listed above).
Read more >
Cypress 10 Upgrade - TestersDock
In this article, I will discuss in detail how I upgraded my current project to cypress 10 along with the issues I faced....
Read more >
IBM Workload Scheduler Version 10.1.0 Release Notes
The Release Notes for IBM Workload Scheduler, version 10.1.0 contain the following topics: Interoperability tables; Fix packs; Software limitations and ...
Read more >
Manager 10.1.0 Release Notes - Tosca - Tricentis
When executing tests in an existing Tosca TestEvent, you must now trigger or schedule the entire corresponding Test Cycle in qTest. This ...
Read more >
Changelog - Cypress Documentation
When a chromium based browser tab or process crashes, Cypress will no longer hang indefinitely but will fail the current test and move...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found