aurelia / documentation

The documentation for Aurelia.
MIT License
105 stars 111 forks source link

doc(testing): add section on ignoring dependencies #389

Closed RomkeVdMeulen closed 5 years ago

RomkeVdMeulen commented 5 years ago

This describes a new feature of aurelia-testing introduced by https://github.com/aurelia/testing/pull/89

RomkeVdMeulen commented 5 years ago

The section isn't very extensive, but the API is pretty straight-forward anyway. I tried to match the tone of the rest of the article.

The PR to aurelia-testing already includes a test that pretty much matches the code sample I added here. But to be complete, something like this might be added to to doc-samples.spec.ts as well:


describe('MyParentComponent', () => {

  it('doesn\'t load the subcomponent', async () => {
    const component = StageComponent
      .withResources('test/resources/my-parent-component')
      .inView('<my-parent-component></my-parent-component>')
      .ignoreDependencies('test/resources/my-component');
    await component.create(bootstrap);
    expect(component.element.textContent!.trim()).toEqual('');
  });
});
bigopon commented 5 years ago

This is nice. I think we may want to emphasize how url will be matched though: loader will resolve dependencies to their absolute url, based on its base url. So if the router base url is at '.' and you want ignore something at src/something, it should be done by:

ignoreDependencies('src/something');
RomkeVdMeulen commented 5 years ago

Something like that?

RomkeVdMeulen commented 5 years ago

@EisenbergEffect The feature being described here isn't finished yet. I'm not sure this change should be going live yet.

bigopon commented 5 years ago

Yes, there are subtle differences between webpack-loader / default-loader that I haven't been able to address. I've put it on hold so far. Default loader seems to be harder to debug than I imagined

EisenbergEffect commented 5 years ago

Apologies! I've reverted the documentation so it doesn't go out on Monday. Sorry for the hassle, but when it's ready can you submit a new PR? Thank you.