Skip to content

How to avoid "Unexpected test after runEnd." warning when using dynamic imports in test.html #1694

@i94alan

Description

@i94alan
  • QUnit version: 2.17.0
  • Which environment are you using? (e.g., browser, Node): browser
  • How are you running QUnit? (e.g., QUnit CLI, Grunt, Karma, manually in browser): manually in browser

What are you trying to do?

Originally, I run parent.js with qunit.js in a test.html: with qunit-2.16.0

<!DOCTYPE html>
<html>
<head>
...
</head>
<body>
    <div id="qunit"></div>
    <div id="qunit-fixture"></div>
    <script src="third_party/qunit/qunit-qunit-2.16.0.js"></script>
    <script type="module" src="parent.js"></script>
</body>
</html>

parent.js uses dynamic import to import child1.js and child2.js which contain Qunit tests, and they are executed successfully.

Now,

I upgrade Qunit to 2.17.0, then Qunit test in child1.js and child2.js has this problem:
qunit.js:2843 Unexpected test after runEnd. This is unstable and will fail in QUnit 3.0.

BUT, if I use static import for child1.js and child2.js, their test will be executed successfully.

Question: Can QUnit 2.17.0 support dynamic import of a Javaacript Qunit test files( in my case, child1.js, child2.js). If it does not support dynamic import, then I will have to test child1.js and child2.js with static import:

<!DOCTYPE html>
<html>
<head>
...
</head>
<body>
    <div id="qunit"></div>
    <div id="qunit-fixture"></div>
    <script src="third_party/qunit/qunit-qunit-2.16.0.js"></script>
    <script type="module" src="parent.js"></script>
    <script type="module" src="child1.js"></script>
    <script type="module" src="child2.js"></script>
</body>
</html>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: QuestionAsk questions or seek assistance.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions