Skip to content

Package declaration produce empty output for JUnit target #168

@leomillon

Description

@leomillon

Hello,

Thanks for this great project!

It seems there is an issue with the JUnit target (aka /test) when a package declaration is present.

Simple working use-case

Given the following working use-case:

import org.junit.Assert
import org.junit.Test

class TestStart {
    @Test fun testOk() {
        Assert.assertEquals("OK", "OK")
    }
}

The output is:

Passed: testOk

Request payload

{
  "args": "",
  "files": [
    {
      "name": "File.kt",
      "text": "import org.junit.Assert\nimport org.junit.Test\n\nclass TestStart {\n    @Test fun testOk() {\n        Assert.assertEquals(\"OK\", \"OK\")\n    }\n}",
      "publicId": ""
    }
  ]
}

Response body

{
  "testResults": {
    "TestStart": [
      {
        "output": "",
        "className": "TestStart",
        "methodName": "testOk",
        "executionTime": 1,
        "exception": null,
        "comparisonFailure": null,
        "status": "OK"
      }
    ]
  },
  "errors": {
    "File.kt": []
  }
}

Same use-case with package declaration

Now if we just add a package declaration (for example package anything.there:

package anything.there

import org.junit.Assert
import org.junit.Test

class TestStart {
    @Test fun testOk() {
        Assert.assertEquals("OK", "OK")
    }
}

The output is empty:

Request payload

{
  "args": "",
  "files": [
    {
      "name": "File.kt",
      "text": "package anything.there\n\nimport org.junit.Assert\nimport org.junit.Test\n\nclass TestStart {\n    @Test fun testOk() {\n        Assert.assertEquals(\"OK\", \"OK\")\n    }\n}",
      "publicId": ""
    }
  ]
}

Response body

{"errors":{"File.kt":[]}}

It seems to be working fine with a simple JVM target execution, but not with the JUnit target...

Is there anything known about this bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingjunit

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions