Forum Discussion

NicolasD's avatar
NicolasD
New Contributor
4 years ago

Which JavaScript engine is used for TC ?

Hello All

 

I would like to know more about JavaScript engine used in TC.

I developed a Library in ES6 which works perfectly in NodeJs & Webapps on browser.
In TC, the script is executed without error, but the result is not as expected.

 

In one moment, In callstack, TC does not seen any local variable.

I expected an Array with rows, but in TC, it returns an empty arrows.

 

 

In the current screenshot, execution goes in the method add(), but nothing done.

 

I would like to understand why TC is not able to run correctly a basic JS Scripts which works anywhere?

 

Kindly Regards,

Nicolas D.

 

 

  • NicolasD's avatar
    NicolasD
    4 years ago

    Hello Mueller597,

     

    Thanks you for your reply.

    I found what was wrong.

     

    I have a statement which testing my argument is an Array.

    For TestComplete, my provided array is not considered as an instance of Array.

     

                                if (argv instanceof Array) {
                                    argv.forEach(function ($value) {
                                        Log.message("argv = Array // " + $value);
                                        if (data.lastIndexOf($value) < 0) {
                                            if (this.callbacks && this.callbacks.add && this.callbacks.add.push) {
                                                $value = this.callbacks.add.push.call(this, $value);
                                            }
                                            Log.message("Not found -> push");
                                            data.push($value);
                                        }
                                    }.bind(this));
                                }

      

    My arguments passed like this, in strict sense, it's not an instance of Array (!= new Array())

     

    const tablejs = require('tablejs');
    
    function run() {
        let table = new tablejs(
            ['FIELD'], [],
            [                           // <<
                ['A'],                  // <<
                ['B']                   // <<
            ]                           // <<
        );
        
        let ndu;
    }

     

    I was able to fix the issue !

     

    Kindly Regards,

    Nicolas D.

No RepliesBe the first to reply