# Testing: Cannot find module

**URL:** <https://discourse.aurelia.io/t/testing-cannot-find-module/3471>\
**Category:** Help Requests\
**Created:** [May 7, 2020, 1:31pm UTC](https://discourse.aurelia.io/t/testing-cannot-find-module/3471 "2020-05-07T13:31:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![StefanNj](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/stefannj/32/1671_2.png) [@StefanNj](https://discourse.aurelia.io/u/StefanNj)\
**Post date:** [May 7, 2020, 1:31pm UTC](https://discourse.aurelia.io/t/testing-cannot-find-module/3471/1 "2020-05-07T13:31:37Z")

</div>

I’m getting this error:

Error: Cannot find module ‘…\test\unit\childCustomElement\childCustomElement’ from ‘aurelia-loader-nodejs.js’.

**parentComponent.html**

> ```
> <template>
> <require from="./childCustomElement/childCustomElement"></require>
> <child-custom-element if.bind="somethingTrue"></child-custom-element >
> </template>
> 
> ```

**parentComponent.spec.ts**

> describe(‘parentComponent’, () =\> {  
> let component;  
> beforeEach(() =\> {  
> component = StageComponent  
> .withResources(  
> PLATFORM.moduleName(‘…/…/src/views/parentComponent/parentComponent’))  
> .inView(‘`<parent-component></parent-component>`’);  
> });  
> …

It normaly finds and renders “ChildCustomElement” when I run application, but for some reason my test fails. Why is trying to find “ChildCustomElement” at “…test/unit/” path?

---

<div class="post-metadata">

**Author:** ![huochunpeng](https://avatars.discourse-cdn.com/v4/letter/h/49beb7/32.png) [@huochunpeng](https://discourse.aurelia.io/u/huochunpeng)\
**Post date:** [May 8, 2020, 4:42am UTC](https://discourse.aurelia.io/t/testing-cannot-find-module/3471/2 "2020-05-08T04:42:53Z")

</div>

Is your triple dots a typo (copy-paste)? I suppose they are double dots.

Our jest setup has this in your package.json jest config:

```auto
"modulePaths": [
      "<rootDir>/src",
      "<rootDir>/node_modules"
    ],

```

That means you can use absolute module path like

```auto
PLATFORM.moduleName('views/parentComponent/parentComponent')

```

**Jest will search the module at your local `src/` folder, you don’t need to use long relative path (our aurelia-loader-nodejs probably is confused about it, but I didn’t double check).**

---

<div class="post-metadata">

**Author:** ![StefanNj](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/stefannj/32/1671_2.png) [@StefanNj](https://discourse.aurelia.io/u/StefanNj)\
**Post date:** [May 8, 2020, 9:29am UTC](https://discourse.aurelia.io/t/testing-cannot-find-module/3471/3 "2020-05-08T09:29:17Z")

</div>

Thank you. I changed path in HTML file to absolute. Works perfect now.
