JavaScript Plugin Testing

Answered

Hi,

I've created a plugin like mentioned here and wanted to write a test for an intention.

To do so I created my testcase inheriting from LightCodeInsightFixtureTestCase and ran it. Unfortunately, the test fails with "java.lang.Throwable: Cannot find external directory, the installation is possibly broken." within "com.intellij.lang.javascript.ecmascript6.TypeScriptUtil.getLibFiles(TypeScriptUtil.java:888)".

All of this is now a little hard to debug - not sure what I should do now to get rid of the error. Do you have an idea what can be the reason? The plugin is currently configured to test against 2018.3.5.

The dependencies in plugin.xml are the following:

<depends>com.intellij.modules.lang</depends>
<depends>com.intellij.modules.ultimate</depends>
<depends>JavaScript</depends>

In addition I added some jar files to the classpath (to be able to load the JavaScript plugin during test):

css.jar
css-openapi.jar
css_resources_en.jar
javascript-openapi.jar
javascript_resources_en.jar
JavaScriptLanguage.jar
js-test-common.jar

The plugin also seems to be loading - it's seems to be just crashing when loading files...

Thank you so much for any help.

Matthias

0
1 comment

Hi!

>In addition I added some jar files to the classpath (to be able to load the JavaScript plugin during test):

Unfortunately it is not enough because js plugin uses unpacked files from the IDE installation directly.

There are two options for these files:

1. They can be in the "../../jsLanguageServicesImpl" directory relative to the JavaScriptLanguage.jar place. 

2. They can be inside the "JavaScriptLanguage/jsLanguageServicesImpl" directory where "JavaScriptLanguage" is the unpacked jar file. So as workaround you need to add also parent directory of jsLanguageServicesImpl to the class path and unpack JavaScriptLanguage.

It is not very flexible and I think we can fix it in 2019.2. Unfortunately 2019.1 is very close to the release (beta stage) and we cannot fix the problem in the version.

 

0

Please sign in to leave a comment.