aurelia / aurelia/testing

Handlers called twice because cleanup between tests is late

Open
#93 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
38
Forks
27
PR merge metrics
No merged PRs in 30d

Description

**I'm submitting a bug report**

* **Library Version:**
1.0.0

**Please tell us about your environment:**
* **Operating System:**
Linux (Ubuntu 18.04.3)

* **Node Version:**
8.16.1

* **NPM Version:**
6.8.0

* **JSPM OR Webpack AND Version**
JSPM 0.16.53

* **Browser:**
Chrome 77

* **Language:**
TypeScript 3.5.3

**Current behavior:**
When running a lot of tests, every so often I will get errors because an event handler (usually a click handler) that has been registered with `click.delegate` is called twice. I'm assuming this is because the handler registered in the preceeding test hasn't been cleaned up in time. I'm calling `ComponentTester.dispose()` in my tear down but it's not enough.

**Expected/desired behavior:**
If a test cannot be reliably cleaned up synchronously, `ComponentTester.dispose()` should return a promise that resolves when cleanup is complete. Most testing frameworks these days support returning a promise from a tear down and waiting for this to complete.

Contributor guide

Open the contributing guide

Research direction

Start at ComponentTester.dispose and trace the cleanup lifecycle used between tests; reproduce the duplicate click-handler behavior with repeated tests. Done means disposal reliably waits for cleanup and callers can await it, preventing handlers from being invoked twice.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.