Skip to content

Async tests not handled correctly #8

@llaski

Description

@llaski

I don't think the async tests are currently being handled correctly. Examples below:

Test that fails correctly:

/** @test */
async_test_not_handled_correctly() {
        console.log('Before Promise')
        new Promise(resolve => setTimeout(resolve, 10))
        console.log('After Promise')

        this.assertEquals(1, 2);
}

Result:

Petrol Javascript Testing Framework

Preparing files...
Running tests...

Tests (1) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 /core-tests/VueAsyncTestCaseTest.js
Before Promise
After Promise
   ✖ Async test not handled correctly

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

1 Failing test

1) /core-tests/VueAsyncTestCaseTest.js async_test_not_handled_correctly
Failed: 
- 1
+ 2


Time: 1.274 seconds

Test that passes incorrectly incorrectly:

/** @test */
async async_test_not_handled_correctly() {
        console.log('Before Promise')
        await new Promise(resolve => setTimeout(resolve, 10))
        console.log('After Promise')

        this.assertEquals(1, 2);
}

Petrol Javascript Testing Framework

Preparing files...
Running tests...

Tests (1) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 /core-tests/VueAsyncTestCaseTest.js
Before Promise
   ✔ Async test not handled correctly (0.049ms)
After Promise
(node:26307) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Failed: Failed: 
- 1
+ 2
(node:26307) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Time: 1.323 seconds

OK (1 tests, 1 passing)


Currently running node v8.9.3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions