title: custom assertion to compare arrays in Nightwatch.js does not work
body: <p>I use <code>nightwatch-cucumber</code> that based on <code>Nightwatch.js</code> as testing framework to implement my automated end2end tests. So, I'm still new to 'JavaScript' and 'node.js'. Currently, I want to create a custom assertion in Nightwatch, but I get an error while test execution and I don't know what I'm doing wrong.</p>
  
  <p>I get the following error:</p>
  
  <p><code>Testing if arrays are equal. - Expected "true" but got: "[object Object]"</code></p>
  
  <p>The assertion should compare different arrays in a given array, if they inherit equal values. So the array to give as parameter should like this <code>var myArray[[1,2,3], [3,2,1]]</code>. The assertion should compare all arrays in a given array with each other.</p>
  
  <p>Here is my custom assertion:</p>
  
  <pre><code>var equals = require('array-equal');
  var util = require('util');
  
  exports.assertion = function(array, msg=null) {
      this.message = msg || util.format('Testing if arrays are equal.');
      this.expected = true;
  
      this.pass = function(value) {
          return value === this.expected;
      };
  
    this.value = function(result) {
      return result.value;
    };
  
      this.command = function(callback) {
          let params = [array];
  
        let execute = function(array) {
          for (var i = 0; i &lt; array.length; i++) {
            for (var k = i+1; k &lt; array.length; k++) {
              array[i].sort();
              array[k].sort();
              if (equals(array[i], array[k]) === false) {
                return false;
              }
            }
          }
          return true;
        };
  
        let execcallback = result =&gt; {
          if (callback) {
            return callback.call(this, result);
          }
        };
  
        return this.api.execute(execute, params, execcallback);
      };
  };
  </code></pre>
  
  <p>I use the <code>PageObject</code> pattern to write my tests.</p>
  
  <p>Here is my code for executing my assertion:</p>
  
  <pre><code>module.exports = {
    elements: {},
    commands: [{
  
      compareArrays() {
        var list = [[1,2,3],[3,2,1]];
        //I expect a passed assertion because the values in both arrays are equal
        this.assert.arraysEqual(list);
        return this.api;
      }
    }]
  };
  </code></pre>