Skip to content

promise "already completed" exception when executing more than one "testgroup run" #312

@techfg

Description

@techfg

The test framework utilizes promises to drive behavior and transition from one test to another. On the first test "run", this works as expected, however on subsequent test runs the promises are not cleared prior to running the test. The output makes it appear as if the test was successful, however underneath the promise is rejected because it already exists in the cache and was already been completed. This results in the test not actually running as expected.

To reproduce and see this behavior:

  1. Clone Repo
  2. Open /tests/imagemapster-test-runner.html
  3. Click "events" test
  4. Click "run tests"
  5. Open Dev Tools and put a breakpoint on Line 77
  6. Select "rerun last group" (or "run tests") - Will produce the following exception:
Error: already completed
    at alreadyCompleted (file://wsl%24/Ubuntu-20.04/home/barry/repos/ImageMapster/tests/redist/iqtest-browser-default.js:325:23)
    at init.resolve (file://wsl%24/Ubuntu-20.04/home/barry/repos/ImageMapster/tests/redist/iqtest-browser-default.js:268:13)
    at m.MapData.initialize (file://wsl%24/Ubuntu-20.04/home/barry/repos/ImageMapster/src/mapdata.js:740:35)
    at file://wsl%24/Ubuntu-20.04/home/barry/repos/ImageMapster/src/core.js:991:28
    at p.then (file://wsl%24/Ubuntu-20.04/home/barry/repos/ImageMapster/src/redist/when.js:74:47)
    at Object.then (file://wsl%24/Ubuntu-20.04/home/barry/repos/ImageMapster/src/redist/when.js:188:24)
    at HTMLImageElement.<anonymous> (file://wsl%24/Ubuntu-20.04/home/barry/repos/ImageMapster/src/core.js:990:37)
    at Function.each (file://wsl%24/Ubuntu-20.04/home/barry/repos/ImageMapster/tests/redist/jquery.1.9.1.js:648:23)
    at init.each (file://wsl%24/Ubuntu-20.04/home/barry/repos/ImageMapster/tests/redist/jquery.1.9.1.js:270:17)
    at init.$.mapster.impl.me.bind (file://wsl%24/Ubuntu-20.04/home/barry/repos/ImageMapster/src/core.js:952:25)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions