Skip to content

.only() fails with asynchronous tests #585

Open
@finetjul

Description

@finetjul

If tests are added with <script> (which is the case with karma), the nextTick() callback may be processed before loading a test that has the .only property. In such case, the first tests will be executed.

E.g.

<script type="text/javascript" src="test1.js" ></script>
<script type="text/javascript" src="test2.js" ></script>
<script type="text/javascript" src="test3.js" ></script>
...
<script type="text/javascript" src="test23.js" ></script>
// at this time, maybe JRE is processing the timeouts, hence first tests are ran
<script type="text/javascript" src="test24.js" ></script>
<script type="text/javascript" src="test25.js" ></script>
...
<script type="text/javascript" src="test53.js" ></script>
<script type="text/javascript" src="testwith.only().js" ></script> // by the time, this script is parsed, many tests have already been executed
...
<script type="module">window.__karma__.loaded()</script>

Adding defer or async does not change anything.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions