Skip to main content

Tests

./gradlew build

This runs the tests in language/src/commonTest and server/src/commonTest on the JVM, on Node.js and natively. They include samples/example.dsl, which must parse without a single problem and fit its schema.

The libraries​

The tests of the Java library are written in Java and use the jar that is published. Those of the npm package use the package as an application does, with require and with import, and check its types with TypeScript:

./gradlew :npm:npmPackage
cd npm && npm install && npm test

The smoke test​

The smoke test starts a build of the server, opens a script and checks the answers. A script with a schema must fit it, and the test then also asks for a completion and adds a keyword the schema does not have. It runs against the jar, the Node.js script or a native executable. With --html it also writes the script colored by the semantic tokens.

node tools/lsp-smoke-test.mjs --html preview.html -- java -jar server/build/libs/dsl-lsp.jar

VS Code​

The VS Code test downloads VS Code, opens editors/vscode/test/example.dsl with the extension and checks the semantic tokens, the outline, a syntax error, and a completion and an error from its schema through VS Code itself (on a machine without a display, run it with xvfb-run -a):

cd editors/vscode && npm test

IntelliJ IDEA​

The test of the IntelliJ plugin runs in an IntelliJ IDEA that Gradle downloads. It starts the server the way the plugin does, with the jar that comes with the plugin on the Java runtime of the IDE, and checks that it answers:

./gradlew :intellij:test