Thread: [PATCH] Support for the source-map in Karma test framework

[PATCH] Support for the source-map in Karma test framework

From
Ashesh Vashi
Date:
Hi Team,

Debugging the failed jasmine test-cases is very difficult with the current implementation.
The stack-traces does not give the correct information as It does not have source-map support for the original code.
And, that makes it very difficult to debug the issue during development. 

Please attached a patch for adding the support for the source-map in the karma test framework.

I have also attached another patch, which will definitely fail some of the test-cases to show the stack-traces of the failed cases.

Please find the output of 'yarn run test:karma-once' before applying the proposed patch as below:
...
HeadlessChrome 0.0.0 (Mac OS X 10.11.6) tree tests TreeNode #hasParent parent exists returns true FAILED

Expected true to be false.
    at UserContext.<anonymous> (regression/javascript/tree/tree_spec.js:780:40)
HeadlessChrome 0.0.0 (Mac OS X 10.11.6): Executed 534 of 586 (1 FAILED) (0 secs / 10.361 secs)
HeadlessChrome 0.0.0 (Mac OS X 10.11.6) tree tests TreeNode #hasParent parent exists returns true FAILED
Expected true to be false.
HeadlessChrome 0.0.0 (Mac OS X 10.11.6) tree tests TreeNode #reload reloads the node and its children FAILED
TypeError: Cannot read property 'fakeFail' of undefined
    at TreeFake.addNewNode (regression/javascript/tree/tree_spec.js:237:22)
    at TreeFake.addNewNode (regression/javascript/tree/tree_spec.js:465:116)
    at UserContext.<anonymous> (regression/javascript/tree/tree_spec.js:790:14)
TypeError: Cannot read property 'reload' of undefined
    at UserContext.<anonymous> (regression/javascript/tree/tree_spec.js:798:16)
HeadlessChrome 0.0.0 (Mac OS X 10.11.6): Executed 535 of 586 (2 FAILED) (0 secs / 10.365 secs)
HeadlessChrome 0.0.0 (Mac OS X 10.11.6) tree tests TreeNode #reload reloads the node and its children FAILED
TypeError: Cannot read property 'fakeFail' of undefined
    at TreeFake.addNewNode (regression/javascript/tree/tree_spec.js:237:22)
    at TreeFake.addNewNode (regression/javascript/tree/tree_spec.js:465:116)
    at UserContext.<anonymous> (regression/javascript/tree/tree_spec.js:790:14)
TypeError: Cannot read property 'reload' of undefined
...

After applying the proposed patch:
...
HeadlessChrome 0.0.0 (Mac OS X 10.11.6) tree tests TreeNode #hasParent parent exists returns true FAILED
Expected true to be false.
    at UserContext.<anonymous> (regression/javascript/tree/webpack:/regression/javascript/tree/tree_spec.js:233:40)
HeadlessChrome 0.0.0 (Mac OS X 10.11.6): Executed 534 of 586 (1 FAILED) (0 secs / 8.157 secs)
HeadlessChrome 0.0.0 (Mac OS X 10.11.6) tree tests TreeNode #hasParent parent exists returns true FAILED
Expected true to be false.
HeadlessChrome 0.0.0 (Mac OS X 10.11.6) tree tests TreeNode #reload reloads the node and its children FAILED
TypeError: Cannot read property 'fakeFail' of undefined
    at TreeFake.addNewNode (regression/javascript/tree/webpack:/pgadmin/static/js/tree/tree.js:96:18)
    at TreeFake.addNewNode (regression/javascript/tree/webpack:/regression/javascript/tree/tree_fake.js:25:5)
    at UserContext.<anonymous> (regression/javascript/tree/webpack:/regression/javascript/tree/tree_spec.js:243:14)
TypeError: Cannot read property 'reload' of undefined
    at UserContext.<anonymous> (regression/javascript/tree/webpack:/regression/javascript/tree/tree_spec.js:252:16)
HeadlessChrome 0.0.0 (Mac OS X 10.11.6): Executed 535 of 586 (2 FAILED) (0 secs / 8.179 secs)
HeadlessChrome 0.0.0 (Mac OS X 10.11.6) tree tests TreeNode #reload reloads the node and its children FAILED
TypeError: Cannot read property 'fakeFail' of undefined
    at TreeFake.addNewNode (regression/javascript/tree/webpack:/pgadmin/static/js/tree/tree.js:96:18)
    at TreeFake.addNewNode (regression/javascript/tree/webpack:/regression/javascript/tree/tree_fake.js:25:5)
    at UserContext.<anonymous> (regression/javascript/tree/webpack:/regression/javascript/tree/tree_spec.js:243:14)
TypeError: Cannot read property 'reload' of undefined
...


As you can see, it gives a lot more relevant information in the stack trace.

Please let me know if you have any objection to the proposed patch.

--

Thanks & Regards,

Ashesh Vashi
EnterpriseDB INDIA: Enterprise PostgreSQL Company


http://www.linkedin.com/in/asheshvashi

Attachment

Re: [PATCH] Support for the source-map in Karma test framework

From
Joao De Almeida Pereira
Date:
Hello Ashesh

The change looks great. This will help the community a lot when we are TDDing new features.

Please do not forget NOT to commit the second patch.

Thanks
Victoria && Joao

On Wed, May 30, 2018 at 3:51 AM Ashesh Vashi <ashesh.vashi@enterprisedb.com> wrote:
Hi Team,

Debugging the failed jasmine test-cases is very difficult with the current implementation.
The stack-traces does not give the correct information as It does not have source-map support for the original code.
And, that makes it very difficult to debug the issue during development. 

Please attached a patch for adding the support for the source-map in the karma test framework.

I have also attached another patch, which will definitely fail some of the test-cases to show the stack-traces of the failed cases.

Please find the output of 'yarn run test:karma-once' before applying the proposed patch as below:
...
HeadlessChrome 0.0.0 (Mac OS X 10.11.6) tree tests TreeNode #hasParent parent exists returns true FAILED

Expected true to be false.
    at UserContext.<anonymous> (regression/javascript/tree/tree_spec.js:780:40)
HeadlessChrome 0.0.0 (Mac OS X 10.11.6): Executed 534 of 586 (1 FAILED) (0 secs / 10.361 secs)
HeadlessChrome 0.0.0 (Mac OS X 10.11.6) tree tests TreeNode #hasParent parent exists returns true FAILED
Expected true to be false.
HeadlessChrome 0.0.0 (Mac OS X 10.11.6) tree tests TreeNode #reload reloads the node and its children FAILED
TypeError: Cannot read property 'fakeFail' of undefined
    at TreeFake.addNewNode (regression/javascript/tree/tree_spec.js:237:22)
    at TreeFake.addNewNode (regression/javascript/tree/tree_spec.js:465:116)
    at UserContext.<anonymous> (regression/javascript/tree/tree_spec.js:790:14)
TypeError: Cannot read property 'reload' of undefined
    at UserContext.<anonymous> (regression/javascript/tree/tree_spec.js:798:16)
HeadlessChrome 0.0.0 (Mac OS X 10.11.6): Executed 535 of 586 (2 FAILED) (0 secs / 10.365 secs)
HeadlessChrome 0.0.0 (Mac OS X 10.11.6) tree tests TreeNode #reload reloads the node and its children FAILED
TypeError: Cannot read property 'fakeFail' of undefined
    at TreeFake.addNewNode (regression/javascript/tree/tree_spec.js:237:22)
    at TreeFake.addNewNode (regression/javascript/tree/tree_spec.js:465:116)
    at UserContext.<anonymous> (regression/javascript/tree/tree_spec.js:790:14)
TypeError: Cannot read property 'reload' of undefined
...

After applying the proposed patch:
...
HeadlessChrome 0.0.0 (Mac OS X 10.11.6) tree tests TreeNode #hasParent parent exists returns true FAILED
Expected true to be false.
    at UserContext.<anonymous> (regression/javascript/tree/webpack:/regression/javascript/tree/tree_spec.js:233:40)
HeadlessChrome 0.0.0 (Mac OS X 10.11.6): Executed 534 of 586 (1 FAILED) (0 secs / 8.157 secs)
HeadlessChrome 0.0.0 (Mac OS X 10.11.6) tree tests TreeNode #hasParent parent exists returns true FAILED
Expected true to be false.
HeadlessChrome 0.0.0 (Mac OS X 10.11.6) tree tests TreeNode #reload reloads the node and its children FAILED
TypeError: Cannot read property 'fakeFail' of undefined
    at TreeFake.addNewNode (regression/javascript/tree/webpack:/pgadmin/static/js/tree/tree.js:96:18)
    at TreeFake.addNewNode (regression/javascript/tree/webpack:/regression/javascript/tree/tree_fake.js:25:5)
    at UserContext.<anonymous> (regression/javascript/tree/webpack:/regression/javascript/tree/tree_spec.js:243:14)
TypeError: Cannot read property 'reload' of undefined
    at UserContext.<anonymous> (regression/javascript/tree/webpack:/regression/javascript/tree/tree_spec.js:252:16)
HeadlessChrome 0.0.0 (Mac OS X 10.11.6): Executed 535 of 586 (2 FAILED) (0 secs / 8.179 secs)
HeadlessChrome 0.0.0 (Mac OS X 10.11.6) tree tests TreeNode #reload reloads the node and its children FAILED
TypeError: Cannot read property 'fakeFail' of undefined
    at TreeFake.addNewNode (regression/javascript/tree/webpack:/pgadmin/static/js/tree/tree.js:96:18)
    at TreeFake.addNewNode (regression/javascript/tree/webpack:/regression/javascript/tree/tree_fake.js:25:5)
    at UserContext.<anonymous> (regression/javascript/tree/webpack:/regression/javascript/tree/tree_spec.js:243:14)
TypeError: Cannot read property 'reload' of undefined
...


As you can see, it gives a lot more relevant information in the stack trace.

Please let me know if you have any objection to the proposed patch.

--

Thanks & Regards,

Ashesh Vashi
EnterpriseDB INDIA: Enterprise PostgreSQL Company


http://www.linkedin.com/in/asheshvashi

Re: [PATCH] Support for the source-map in Karma test framework

From
Dave Page
Date:
Thanks, applied.

On Wed, May 30, 2018 at 3:50 AM, Ashesh Vashi <ashesh.vashi@enterprisedb.com> wrote:
Hi Team,

Debugging the failed jasmine test-cases is very difficult with the current implementation.
The stack-traces does not give the correct information as It does not have source-map support for the original code.
And, that makes it very difficult to debug the issue during development. 

Please attached a patch for adding the support for the source-map in the karma test framework.

I have also attached another patch, which will definitely fail some of the test-cases to show the stack-traces of the failed cases.

Please find the output of 'yarn run test:karma-once' before applying the proposed patch as below:
...
HeadlessChrome 0.0.0 (Mac OS X 10.11.6) tree tests TreeNode #hasParent parent exists returns true FAILED

Expected true to be false.
    at UserContext.<anonymous> (regression/javascript/tree/tree_spec.js:780:40)
HeadlessChrome 0.0.0 (Mac OS X 10.11.6): Executed 534 of 586 (1 FAILED) (0 secs / 10.361 secs)
HeadlessChrome 0.0.0 (Mac OS X 10.11.6) tree tests TreeNode #hasParent parent exists returns true FAILED
Expected true to be false.
HeadlessChrome 0.0.0 (Mac OS X 10.11.6) tree tests TreeNode #reload reloads the node and its children FAILED
TypeError: Cannot read property 'fakeFail' of undefined
    at TreeFake.addNewNode (regression/javascript/tree/tree_spec.js:237:22)
    at TreeFake.addNewNode (regression/javascript/tree/tree_spec.js:465:116)
    at UserContext.<anonymous> (regression/javascript/tree/tree_spec.js:790:14)
TypeError: Cannot read property 'reload' of undefined
    at UserContext.<anonymous> (regression/javascript/tree/tree_spec.js:798:16)
HeadlessChrome 0.0.0 (Mac OS X 10.11.6): Executed 535 of 586 (2 FAILED) (0 secs / 10.365 secs)
HeadlessChrome 0.0.0 (Mac OS X 10.11.6) tree tests TreeNode #reload reloads the node and its children FAILED
TypeError: Cannot read property 'fakeFail' of undefined
    at TreeFake.addNewNode (regression/javascript/tree/tree_spec.js:237:22)
    at TreeFake.addNewNode (regression/javascript/tree/tree_spec.js:465:116)
    at UserContext.<anonymous> (regression/javascript/tree/tree_spec.js:790:14)
TypeError: Cannot read property 'reload' of undefined
...

After applying the proposed patch:
...
HeadlessChrome 0.0.0 (Mac OS X 10.11.6) tree tests TreeNode #hasParent parent exists returns true FAILED
Expected true to be false.
    at UserContext.<anonymous> (regression/javascript/tree/webpack:/regression/javascript/tree/tree_spec.js:233:40)
HeadlessChrome 0.0.0 (Mac OS X 10.11.6): Executed 534 of 586 (1 FAILED) (0 secs / 8.157 secs)
HeadlessChrome 0.0.0 (Mac OS X 10.11.6) tree tests TreeNode #hasParent parent exists returns true FAILED
Expected true to be false.
HeadlessChrome 0.0.0 (Mac OS X 10.11.6) tree tests TreeNode #reload reloads the node and its children FAILED
TypeError: Cannot read property 'fakeFail' of undefined
    at TreeFake.addNewNode (regression/javascript/tree/webpack:/pgadmin/static/js/tree/tree.js:96:18)
    at TreeFake.addNewNode (regression/javascript/tree/webpack:/regression/javascript/tree/tree_fake.js:25:5)
    at UserContext.<anonymous> (regression/javascript/tree/webpack:/regression/javascript/tree/tree_spec.js:243:14)
TypeError: Cannot read property 'reload' of undefined
    at UserContext.<anonymous> (regression/javascript/tree/webpack:/regression/javascript/tree/tree_spec.js:252:16)
HeadlessChrome 0.0.0 (Mac OS X 10.11.6): Executed 535 of 586 (2 FAILED) (0 secs / 8.179 secs)
HeadlessChrome 0.0.0 (Mac OS X 10.11.6) tree tests TreeNode #reload reloads the node and its children FAILED
TypeError: Cannot read property 'fakeFail' of undefined
    at TreeFake.addNewNode (regression/javascript/tree/webpack:/pgadmin/static/js/tree/tree.js:96:18)
    at TreeFake.addNewNode (regression/javascript/tree/webpack:/regression/javascript/tree/tree_fake.js:25:5)
    at UserContext.<anonymous> (regression/javascript/tree/webpack:/regression/javascript/tree/tree_spec.js:243:14)
TypeError: Cannot read property 'reload' of undefined
...


As you can see, it gives a lot more relevant information in the stack trace.

Please let me know if you have any objection to the proposed patch.

--

Thanks & Regards,

Ashesh Vashi
EnterpriseDB INDIA: Enterprise PostgreSQL Company


http://www.linkedin.com/in/asheshvashi




--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company