Skip to content

Latest commit

 

History

History
505 lines (500 loc) · 15.3 KB

index.spec.js.md

File metadata and controls

505 lines (500 loc) · 15.3 KB

Snapshot report for build/__tests__/index.spec.js

The actual snapshot is saved in index.spec.js.snap.

Generated by AVA.

should detect clones in javascript files with total reporters

Snapshot 1

[
  {
    duplicationA: {
      end: {
        column: 2,
        line: 27,
      },
      fragment: `/**␊
       * Hello␊
       * @type {{html: {template: string}, webpack: (function(*))}}␊
       */␊
      module.exports = {␊
          html: {␊
              template: 'src/index.html'␊
          },␊
          webpack (config) {␊
              config.module.rules.push({␊
                  test: /\\.(code|path)$/,␊
                  use: [{ loader: 'raw-loader' }]␊
              })␊
              config.module.rules.push({␊
                  test: /\\.(code|path)$/,␊
                  use: [{ loader: 'raw-loader' }]␊
              })␊
              config.module.rules.push({␊
                  test: /\\.(code|path)$/,␊
                  use: [{ loader: 'raw-loader' }]␊
              })␊



              return config␊
          }␊
      }`,
      range: [
        0,
        585,
      ],
      sourceId: 'javascript:test-pathA',
      start: {
        column: 1,
        line: 1,
      },
    },
    duplicationB: {
      end: {
        column: 2,
        line: 24,
      },
      fragment: `/**␊
       * Hello␊
       * @type {{html: {template: string}, webpack: (function(*))}}␊
       */␊
      module.exports = {␊
          html: {␊
              template: 'src/index.html'␊
          },␊
          webpack (config) {␊
              config.module.rules.push({␊
                  test: /\\.(code|path)$/,␊
                  use: [{ loader: 'raw-loader' }]␊
              })␊
              config.module.rules.push({␊
                  test: /\\.(code|path)$/,␊
                  use: [{ loader: 'raw-loader' }]␊
              })␊
              config.module.rules.push({␊
                  test: /\\.(code|path)$/,␊
                  use: [{ loader: 'raw-loader' }]␊
              })␊
              return config␊
          }␊
      }`,
      range: [
        0,
        582,
      ],
      sourceId: 'javascript:test-pathB',
      start: {
        column: 1,
        line: 1,
      },
    },
    format: 'javascript',
    foundDate: 123123,
  },
  {
    duplicationA: {
      end: {
        column: 3,
        line: 28,
      },
      fragment: `module.exports = function (store) {␊
          function getset (name, value) {␊
              var node = vars.store;␊
              var keys = name.split('.');␊
              keys.slice(0,-1).forEach(function (k) {␊
                  if (node[k] === undefined) node[k] = {};␊
                  node = node[k]␊
              });␊
              var key = keys[keys.length - 1];␊
              if (arguments.length == 1) {␊
                  return node[key];␊
              }␊
              else {␊
                  return node[key] = value;␊
              }␊
          }␊

          var vars = {␊
              get : function (name) {␊
                  return getset(name);␊
              },␊
              set : function (name, value) {␊
                  return getset(name, value);␊
              },␊
              store : store || {},␊
          };␊
          return vars;␊
      };`,
      range: [
        0,
        705,
      ],
      sourceId: 'javascript:test-pathA',
      start: {
        column: 1,
        line: 1,
      },
    },
    duplicationB: {
      end: {
        column: 3,
        line: 55,
      },
      fragment: `module.exports = function (store) {␊
          function getset (name, value) {␊
              var node = vars.store;␊
              var keys = name.split('.');␊
              keys.slice(0,-1).forEach(function (k) {␊
                  if (node[k] === undefined) node[k] = {};␊
                  node = node[k]␊
              });␊
              var key = keys[keys.length - 1];␊
              if (arguments.length == 1) {␊
                  return node[key];␊
              }␊
              else {␊
                  return node[key] = value;␊
              }␊
          }␊

          var vars = {␊
              get : function (name) {␊
                  return getset(name);␊
              },␊
              set : function (name, value) {␊
                  return getset(name, value);␊
              },␊
              store : store || {},␊
          };␊
          return vars;␊
      };`,
      range: [
        810,
        1515,
      ],
      sourceId: 'javascript:test-pathB',
      start: {
        column: 1,
        line: 28,
      },
    },
    format: 'javascript',
    foundDate: 123123,
  },
  {
    duplicationA: {
      end: {
        column: 3,
        line: 56,
      },
      fragment: `module.exports = function (store) {␊
          function getset (name, value) {␊
              var node = vars.store;␊
              var keys = name.split('.');␊
              keys.slice(0,-1).forEach(function (k) {␊
                  if (node[k] === undefined) node[k] = {};␊
                  node = node[k]␊
              });␊
              var key = keys[keys.length - 1];␊
              if (arguments.length == 1) {␊
                  return node[key];␊
              }␊
              else {␊
                  return node[key] = value;␊
              }␊
          }␊

          var vars = {␊
              get : function (name) {␊
                  return getset(name);␊
              },␊
              set : function (name, value) {␊
                  return getset(name, value);␊
              },␊
              store : store || {},␊
          };␊
          return vars;␊
      };`,
      range: [
        706,
        1411,
      ],
      sourceId: 'javascript:test-pathA',
      start: {
        column: 1,
        line: 29,
      },
    },
    duplicationB: {
      end: {
        column: 3,
        line: 55,
      },
      fragment: `module.exports = function (store) {␊
          function getset (name, value) {␊
              var node = vars.store;␊
              var keys = name.split('.');␊
              keys.slice(0,-1).forEach(function (k) {␊
                  if (node[k] === undefined) node[k] = {};␊
                  node = node[k]␊
              });␊
              var key = keys[keys.length - 1];␊
              if (arguments.length == 1) {␊
                  return node[key];␊
              }␊
              else {␊
                  return node[key] = value;␊
              }␊
          }␊

          var vars = {␊
              get : function (name) {␊
                  return getset(name);␊
              },␊
              set : function (name, value) {␊
                  return getset(name, value);␊
              },␊
              store : store || {},␊
          };␊
          return vars;␊
      };`,
      range: [
        810,
        1515,
      ],
      sourceId: 'javascript:test-pathB',
      start: {
        column: 1,
        line: 28,
      },
    },
    format: 'javascript',
    foundDate: 123123,
  },
  {
    duplicationA: {
      end: {
        column: 3,
        line: 52,
      },
      fragment: `function utf8_encode ( str_data ) {␊
          // Encodes an ISO-8859-1 string to UTF-8␊
          //␊
          // +   original by: Webtoolkit.info (http://www.webtoolkit.info/)␊
          str_data = str_data.replace(/\\r\\n/g,"\\n");␊
          var utftext = "";␊

          for (var n = 0; n < str_data.length; n++) {␊
              var c = str_data.charCodeAt(n);␊
              if (c < 128) {␊
                  utftext += String.fromCharCode(c);␊
              } else if((c > 127) && (c < 2048)) {␊
                  utftext += String.fromCharCode((c >> 6) | 192);␊
                  utftext += String.fromCharCode((c & 63) | 128);␊
              } else {␊
                  utftext += String.fromCharCode((c >> 12) | 224);␊
                  utftext += String.fromCharCode(((c >> 6) & 63) | 128);␊
                  utftext += String.fromCharCode((c & 63) | 128);␊
              }␊
          }␊

          return utftext;␊
      }␊

      module.exports = function (store) {␊
          function getset (name, value) {␊
              var node = vars.store;␊
              var keys = name.split('.');␊
              keys.slice(0,-1).forEach(function (k) {␊
                  if (node[k] === undefined) node[k] = {};␊
                  node = node[k]␊
              });␊
              var key = keys[keys.length - 1];␊
              if (arguments.length == 1) {␊
                  return node[key];␊
              }␊
              else {␊
                  return node[key] = value;␊
              }␊
          }␊

          var vars = {␊
              get : function (name) {␊
                  return getset(name);␊
              },␊
              set : function (name, value) {␊
                  return getset(name, value);␊
              },␊
              store : store || {},␊
          };␊
          return vars;␊
      };`,
      range: [
        0,
        1501,
      ],
      sourceId: 'javascript:test-pathA',
      start: {
        column: 1,
        line: 1,
      },
    },
    duplicationB: {
      end: {
        column: 3,
        line: 55,
      },
      fragment: `function utf8_encode ( str_data ) {␊
          // Encodes an ISO-8859-1 string to UTF-8␊
          //␊
          // +   original by: Webtoolkit.info (http://www.webtoolkit.info/)␊
          str_data = str_data.replace(/\\r\\n/g,"\\n");␊
          var utftext = "";␊

          for (var n = 0; n < str_data.length; n++) {␊
              var c = str_data.charCodeAt(n);␊
              if (c < 128) {␊
                  utftext += String.fromCharCode(c);␊
              } else if((c > 127) && (c < 2048)) {␊
                  utftext += String.fromCharCode((c >> 6) | 192);␊
                  utftext += String.fromCharCode((c & 63) | 128);␊
              } else {␊
                  utftext += String.fromCharCode((c >> 12) | 224);␊
                  utftext += String.fromCharCode(((c >> 6) & 63) | 128);␊
                  utftext += String.fromCharCode((c & 63) | 128);␊
              }␊
          }␊

          return utftext;␊
      }␊

      module.exports = function (store) {␊
          function getset (name, value) {␊
              var node = vars.store;␊
              var keys = name.split('.');␊
              keys.slice(0,-1).forEach(function (k) {␊
                  if (node[k] === undefined) node[k] = {};␊
                  node = node[k]␊
              });␊
              var key = keys[keys.length - 1];␊
              if (arguments.length == 1) {␊
                  return node[key];␊
              }␊
              else {␊
                  return node[key] = value;␊
              }␊
          }␊

          var vars = {␊
              get : function (name) {␊
                  return getset(name);␊
              },␊
              set : function (name, value) {␊
                  return getset(name, value);␊
              },␊
              store : store || {},␊
          };␊
          return vars;␊
      };`,
      range: [
        14,
        1515,
      ],
      sourceId: 'javascript:test-pathB',
      start: {
        column: 1,
        line: 4,
      },
    },
    format: 'javascript',
    foundDate: 123123,
  },
  {
    duplicationA: {
      end: {
        column: 43,
        line: 83,
      },
      fragment: `;␊

      eldest = 24 > 21 ? "Liz" : "Ike";␊


      var volume, winner;␊

      if (ignition === true) {␊
          launch();␊
      }␊

      if (band !== SpinalTap) {␊
          volume = 10;␊
      }␊

      if (answer !== false) {␊
          letTheWildRumpusBegin();␊
      }␊

      if (car.speed < limit) {␊
          accelerate();␊
      }␊

      if (pick === 47 || pick === 92 || pick === 13) {␊
          winner = true;␊
      }␊

      print(inspect("My name is " + this.name));`,
      range: [
        943,
        1306,
      ],
      sourceId: 'javascript:test-pathA',
      start: {
        column: 74,
        line: 56,
      },
    },
    duplicationB: {
      end: {
        column: 43,
        line: 42,
      },
      fragment: `;␊

      eldest = 24 > 21 ? "Liz" : "Ike";␊


      var volume, winner;␊

      if (ignition === true) {␊
          launch();␊
      }␊

      if (band !== SpinalTap) {␊
          volume = 10;␊
      }␊

      if (answer !== false) {␊
          letTheWildRumpusBegin();␊
      }␊

      if (car.speed < limit) {␊
          accelerate();␊
      }␊

      if (pick === 47 || pick === 92 || pick === 13) {␊
          winner = true;␊
      }␊

      print(inspect("My name is " + this.name));`,
      range: [
        287,
        650,
      ],
      sourceId: 'javascript:test-pathB',
      start: {
        column: 2,
        line: 15,
      },
    },
    format: 'javascript',
    foundDate: 123123,
  },
]