# Kibana Plugin App Testing Problem

**URL:** <https://discuss.elastic.co/t/kibana-plugin-app-testing-problem/125191>\
**Category:** Kibana\
**Created:** [March 22, 2018, 12:52pm UTC](https://discuss.elastic.co/t/kibana-plugin-app-testing-problem/125191 "2018-03-22T12:52:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![skyfusion](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/skyfusion/32/29136_2.png) [@skyfusion](https://discuss.elastic.co/u/skyfusion)\
**Post date:** [March 22, 2018, 12:52pm UTC](https://discuss.elastic.co/t/kibana-plugin-app-testing-problem/125191/1 "2018-03-22T12:52:21Z")

</div>

Hello there,  
I have a problem with my Kibana Plugin App and I would really love to get some help.

I am trying to write some tests for my Plugin, but I'm hitting a brick wall.  
I'm using version 6.2.3 of Kibana and I've developed my plugin using this [plugin template generator](https://github.com/elastic/template-kibana-plugin/) .  
My Plugin works like a charm, but when I try to run  
npm run test:server  
for example, I get this error  
\> plugin-helpers test:server

```
module.js:471
throw err;
^

Error: Cannot find module '/kibana-projects/kibana/test/mocha_setup.js'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at /kibana-projects/kibana/node_modules/mocha/bin/_mocha:346:3
at Array.forEach (native)
at Object.<anonymous> (/kibana-projects/kibana/node_modules/mocha/bin/_mocha:345:10)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:383:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:496:3
child_process.js:496
throw err;
^

```

I've been trying to find information about how to set up very simple tests, like for testing the routes of my app or the controller functions but I can't find anything so far.  
Could you please help me out with this problem and point me in the right direction?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Nathan\_Reese](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nathan_reese/32/84829_2.png) [@Nathan\_Reese](https://discuss.elastic.co/u/Nathan_Reese)\
**Post date:** [March 22, 2018, 5:06pm UTC](https://discuss.elastic.co/t/kibana-plugin-app-testing-problem/125191/2 "2018-03-22T17:06:55Z")

</div>

where are you running `npm run test:server`?

---

<div class="post-metadata">

**Author:** ![skyfusion](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/skyfusion/32/29136_2.png) [@skyfusion](https://discuss.elastic.co/u/skyfusion)\
**Post date:** [March 23, 2018, 9:22am UTC](https://discuss.elastic.co/t/kibana-plugin-app-testing-problem/125191/3 "2018-03-23T09:22:28Z")

</div>

In my Plugin's directory.

---

<div class="post-metadata">

**Author:** ![Nathan\_Reese](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nathan_reese/32/84829_2.png) [@Nathan\_Reese](https://discuss.elastic.co/u/Nathan_Reese)\
**Post date:** [March 23, 2018, 2:47pm UTC](https://discuss.elastic.co/t/kibana-plugin-app-testing-problem/125191/4 "2018-03-23T14:47:10Z")

</div>

`npm run test:server` can only be run from the top level kibana directory.

---

<div class="post-metadata">

**Author:** ![skyfusion](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/skyfusion/32/29136_2.png) [@skyfusion](https://discuss.elastic.co/u/skyfusion)\
**Post date:** [March 23, 2018, 3:02pm UTC](https://discuss.elastic.co/t/kibana-plugin-app-testing-problem/125191/5 "2018-03-23T15:02:00Z")

</div>

If I run npm run test:server from the kibana directory, it runs all tests for the kibana itself. What I want is to run just the tests for my Plugin. Is this possible?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 20, 2018, 3:02pm UTC](https://discuss.elastic.co/t/kibana-plugin-app-testing-problem/125191/6 "2018-04-20T15:02:50Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
