Best JavaScript code snippet using playwright-internal
json_schema_test.js
Source:json_schema_test.js  
...52function assertEqualSets(set1, set2) {53  assertListConsistsOfElements(set1, set2);54  assertListConsistsOfElements(set2, set1);55}56function formatError(key, replacements) {57  return JSONSchemaValidator.formatError(key, replacements);58}59function testFormatError() {60  AssertTrue(formatError("propertyRequired") == "Property is required.");61  AssertTrue(formatError("invalidEnum", ["foo, bar"]) ==62         "Value must be one of: [foo, bar].");63  AssertTrue(formatError("invalidType", ["foo", "bar"]) ==64         "Expected 'foo' but got 'bar'.");65}66function testComplex() {67  var schema = {68    type: "array",69    items: [70      {71        type: "object",72        properties: {73          id: {74            type: "integer",75            minimum: 176          },77          url: {78            type: "string",79            pattern: /^https?\:/,80            optional: true81          },82          index: {83            type: "integer",84            minimum: 0,85            optional: true86          },87          selected: {88            type: "boolean",89            optional: true90          }91        }92      },93      { type: "function", optional: true },94      { type: "function", optional: true }95    ]96  };97  var instance = [98    {99      id: 42,100      url: "http://www.google.com/",101      index: 2,102      selected: true103    },104    function(){},105    function(){}106  ];107  assertValid("", instance, schema);108  instance.length = 2;109  assertValid("", instance, schema);110  instance.length = 1;111  instance.push({});112  assertNotValid("", instance, schema,113                 [formatError("invalidType", ["function", "object"])]);114  instance[1] = function(){};115  instance[0].url = "foo";116  assertNotValid("", instance, schema,117                 [formatError("stringPattern",118                              [schema.items[0].properties.url.pattern])]);119  delete instance[0].url;120  assertValid("", instance, schema);121  instance[0].id = 0;122  assertNotValid("", instance, schema,123                 [formatError("numberMinValue",124                              [schema.items[0].properties.id.minimum])]);125}126function testEnum() {127  var schema = {128    enum: ["foo", 42, false]129  };130  assertValid("", "foo", schema);131  assertValid("", 42, schema);132  assertValid("", false, schema);133  assertNotValid("", "42", schema, [formatError("invalidEnum",134                                                [schema.enum.join(", ")])]);135  assertNotValid("", null, schema, [formatError("invalidEnum",136                                                [schema.enum.join(", ")])]);137}138function testChoices() {139  var schema = {140    choices: [141      { type: "null" },142      { type: "undefined" },143      { type: "integer", minimum:42, maximum:42 },144      { type: "object", properties: { foo: { type: "string" } } }145    ]146  }147    assertValid("", null, schema);148    assertValid("", undefined, schema);149    assertValid("", 42, schema);150    assertValid("", {foo: "bar"}, schema);151    assertNotValid("", "foo", schema, [formatError("invalidChoice", [])]);152    assertNotValid("", [], schema, [formatError("invalidChoice", [])]);153    assertNotValid("", {foo: 42}, schema, [formatError("invalidChoice", [])]);154}155function testExtends() {156  var parent = {157    type: "number"158  }159  var schema = {160    extends: parent161  };162  assertValid("", 42, schema);163  assertNotValid("", "42", schema,164                 [formatError("invalidType", ["number", "string"])]);165  // Make the derived schema more restrictive166  parent.minimum = 43;167  assertNotValid("", 42, schema, [formatError("numberMinValue", [43])]);168  assertValid("", 43, schema);169}170function testObject() {171  var schema = {172    properties: {173      "foo": {174        type: "string"175      },176      "bar": {177        type: "integer"178      }179    }180  };181  assertValid("Object", {foo:"foo", bar:42}, schema);182  assertNotValid("Object", {foo:"foo", bar:42,"extra":true}, schema,183                 [formatError("unexpectedProperty")]);184  assertNotValid("Object", {foo:"foo"}, schema,185                 [formatError("propertyRequired")]);186  assertNotValid("Object", {foo:"foo", bar:"42"}, schema,187                 [formatError("invalidType", ["integer", "string"])]);188  schema.additionalProperties = { type: "any" };189  assertValid("Object", {foo:"foo", bar:42, "extra":true}, schema);190  assertValid("Object", {foo:"foo", bar:42, "extra":"foo"}, schema);191  schema.additionalProperties = { type: "boolean" };192  assertValid("Object", {foo:"foo", bar:42, "extra":true}, schema);193  assertNotValid("Object", {foo:"foo", bar:42, "extra":"foo"}, schema,194                 [formatError("invalidType", ["boolean", "string"])]);195  schema.properties.bar.optional = true;196  assertValid("Object", {foo:"foo", bar:42}, schema);197  assertValid("Object", {foo:"foo"}, schema);198  assertValid("Object", {foo:"foo", bar:null}, schema);199  assertValid("Object", {foo:"foo", bar:undefined}, schema);200  assertNotValid("Object", {foo:"foo", bar:"42"}, schema,201                 [formatError("invalidType", ["integer", "string"])]);202}203function testTypeReference() {204  var referencedTypes = [205    {206      id: "MinLengthString",207      type: "string",208      minLength: 2209    },210    {211      id: "Max10Int",212      type: "integer",213      maximum: 10214    }215  ];216  var schema = {217    type: "object",218    properties: {219      "foo": {220        type: "string"221      },222      "bar": {223        $ref: "Max10Int"224      },225      "baz": {226        $ref: "MinLengthString"227      }228    }229  };230  var schemaInlineReference = {231    type: "object",232    properties: {233      "foo": {234        type: "string"235      },236      "bar": {237        id: "NegativeInt",238        type: "integer",239        maximum: 0240      },241      "baz": {242        $ref: "NegativeInt"243      }244    }245  }246  // Valid type references externally added.247  assertValid("", {foo:"foo",bar:4,baz:"ab"}, schema, referencedTypes);248  // Valida type references internally defined.249  assertValid("", {foo:"foo",bar:-4,baz:-2}, schemaInlineReference);250  // Failures in validation, but succesful schema reference.251  assertNotValid("", {foo:"foo",bar:4,baz:"a"}, schema,252                [formatError("stringMinLength", [2])], referencedTypes);253  assertNotValid("", {foo:"foo",bar:20,baz:"abc"}, schema,254                [formatError("numberMaxValue", [10])], referencedTypes);255  // Remove MinLengthString type.256  referencedTypes.shift();257  assertNotValid("", {foo:"foo",bar:4,baz:"ab"}, schema,258                 [formatError("unknownSchemaReference", ["MinLengthString"])],259                 referencedTypes);260  // Remove internal type "NegativeInt"261  delete schemaInlineReference.properties.bar;262  assertNotValid("", {foo:"foo",baz:-2}, schemaInlineReference,263                 [formatError("unknownSchemaReference", ["NegativeInt"])]);264}265function testArrayTuple() {266  var schema = {267    items: [268      {269        type: "string"270      },271      {272        type: "integer"273      }274    ]275  };276  assertValid("Array", ["42", 42], schema);277  assertNotValid("Array", ["42", 42, "anything"], schema,278                 [formatError("arrayMaxItems", [schema.items.length])]);279  assertNotValid("Array", ["42"], schema, [formatError("itemRequired")]);280  assertNotValid("Array", [42, 42], schema,281                 [formatError("invalidType", ["string", "integer"])]);282  schema.additionalProperties = { type: "any" };283  assertValid("Array", ["42", 42, "anything"], schema);284  assertValid("Array", ["42", 42, []], schema);285  schema.additionalProperties = { type: "boolean" };286  assertNotValid("Array", ["42", 42, "anything"], schema,287                 [formatError("invalidType", ["boolean", "string"])]);288  assertValid("Array", ["42", 42, false], schema);289  schema.items[0].optional = true;290  assertValid("Array", ["42", 42], schema);291  assertValid("Array", [, 42], schema);292  assertValid("Array", [null, 42], schema);293  assertValid("Array", [undefined, 42], schema);294  assertNotValid("Array", [42, 42], schema,295                 [formatError("invalidType", ["string", "integer"])]);296}297function testArrayNonTuple() {298  var schema = {299    items: {300      type: "string"301    },302    minItems: 2,303    maxItems: 3304  };305  assertValid("Array", ["x", "x"], schema);306  assertValid("Array", ["x", "x", "x"], schema);307  assertNotValid("Array", ["x"], schema,308                 [formatError("arrayMinItems", [schema.minItems])]);309  assertNotValid("Array", ["x", "x", "x", "x"], schema,310                 [formatError("arrayMaxItems", [schema.maxItems])]);311  assertNotValid("Array", [42], schema,312                 [formatError("arrayMinItems", [schema.minItems]),313                  formatError("invalidType", ["string", "integer"])]);314}315function testString() {316  var schema = {317    minLength: 1,318    maxLength: 10,319    pattern: /^x/320  };321  assertValid("String", "x", schema);322  assertValid("String", "xxxxxxxxxx", schema);323  assertNotValid("String", "y", schema,324                 [formatError("stringPattern", [schema.pattern])]);325  assertNotValid("String", "xxxxxxxxxxx", schema,326                 [formatError("stringMaxLength", [schema.maxLength])]);327  assertNotValid("String", "", schema,328                 [formatError("stringMinLength", [schema.minLength]),329                  formatError("stringPattern", [schema.pattern])]);330}331function testNumber() {332  var schema = {333    minimum: 1,334    maximum: 100,335    maxDecimal: 2336  };337  assertValid("Number", 1, schema);338  assertValid("Number", 50, schema);339  assertValid("Number", 100, schema);340  assertValid("Number", 88.88, schema);341  assertNotValid("Number", 0.5, schema,342                 [formatError("numberMinValue", [schema.minimum])]);343  assertNotValid("Number", 100.1, schema,344                 [formatError("numberMaxValue", [schema.maximum])]);345  assertNotValid("Number", 100.111, schema,346                 [formatError("numberMaxValue", [schema.maximum]),347                  formatError("numberMaxDecimal", [schema.maxDecimal])]);348  var nan = 0/0;349  AssertTrue(isNaN(nan));350  assertNotValid("Number", nan, schema,351                 [formatError("numberFiniteNotNan", ["NaN"])]);352  assertNotValid("Number", Number.POSITIVE_INFINITY, schema,353                 [formatError("numberFiniteNotNan", ["Infinity"]),354                  formatError("numberMaxValue", [schema.maximum])355                 ]);356  assertNotValid("Number", Number.NEGATIVE_INFINITY, schema,357                 [formatError("numberFiniteNotNan", ["-Infinity"]),358                  formatError("numberMinValue", [schema.minimum])359                 ]);360}361function testIntegerBounds() {362  assertValid("Number",           0, {type:"integer"});363  assertValid("Number",          -1, {type:"integer"});364  assertValid("Number",  2147483647, {type:"integer"});365  assertValid("Number", -2147483648, {type:"integer"});366  assertNotValid("Number",           0.5, {type:"integer"},367                 [formatError("numberIntValue", [])]);368  assertNotValid("Number", 10000000000,   {type:"integer"},369                 [formatError("numberIntValue", [])]);370  assertNotValid("Number",  2147483647.5, {type:"integer"},371                 [formatError("numberIntValue", [])]);372  assertNotValid("Number",  2147483648,   {type:"integer"},373                 [formatError("numberIntValue", [])]);374  assertNotValid("Number",  2147483649,   {type:"integer"},375                 [formatError("numberIntValue", [])]);376  assertNotValid("Number", -2147483649,   {type:"integer"},377                 [formatError("numberIntValue", [])]);378}379function testType() {380  // valid381  assertValid("Type", {}, {type:"object"});382  assertValid("Type", [], {type:"array"});383  assertValid("Type", function(){}, {type:"function"});384  assertValid("Type", "foobar", {type:"string"});385  assertValid("Type", "", {type:"string"});386  assertValid("Type", 88.8, {type:"number"});387  assertValid("Type", 42, {type:"number"});388  assertValid("Type", 0, {type:"number"});389  assertValid("Type", 42, {type:"integer"});390  assertValid("Type", 0, {type:"integer"});391  assertValid("Type", true, {type:"boolean"});392  assertValid("Type", false, {type:"boolean"});393  assertValid("Type", null, {type:"null"});394  assertValid("Type", undefined, {type:"undefined"});395  // not valid396  assertNotValid("Type", [], {type: "object"},397                 [formatError("invalidType", ["object", "array"])]);398  assertNotValid("Type", null, {type: "object"},399                 [formatError("invalidType", ["object", "null"])]);400  assertNotValid("Type", function(){}, {type: "object"},401                 [formatError("invalidType", ["object", "function"])]);402  assertNotValid("Type", 42, {type: "array"},403                 [formatError("invalidType", ["array", "integer"])]);404  assertNotValid("Type", 42, {type: "string"},405                 [formatError("invalidType", ["string", "integer"])]);406  assertNotValid("Type", "42", {type: "number"},407                 [formatError("invalidType", ["number", "string"])]);408  assertNotValid("Type", 88.8, {type: "integer"},409                 [formatError("invalidTypeIntegerNumber")]);410  assertNotValid("Type", 1, {type: "boolean"},411                 [formatError("invalidType", ["boolean", "integer"])]);412  assertNotValid("Type", false, {type: "null"},413                 [formatError("invalidType", ["null", "boolean"])]);414  assertNotValid("Type", undefined, {type: "null"},415                 [formatError("invalidType", ["null", "undefined"])]);416  assertNotValid("Type", {}, {type: "function"},417                 [formatError("invalidType", ["function", "object"])]);418}419function testGetAllTypesForSchema() {420  var referencedTypes = [421    {422      id: "ChoicesRef",423      choices: [424        { type: "integer" },425        { type: "string" }426      ]427    },428    {429      id: "ObjectRef",430      type: "object",431    }432  ];433  var arraySchema = {434    type: "array"435  };436  var choicesSchema = {437    choices: [438      { type: "object" },439      { type: "function" }440    ]441  };442  var objectRefSchema = {443    $ref: "ObjectRef"444  };445  var complexSchema = {446    choices: [447      { $ref: "ChoicesRef" },448      { type: "function" },449      { $ref: "ObjectRef" }450    ]451  };452  var validator = new JSONSchemaValidator();453  validator.addTypes(referencedTypes);454  var arraySchemaTypes = validator.getAllTypesForSchema(arraySchema);455  assertEqualSets(arraySchemaTypes, ["array"]);456  var choicesSchemaTypes = validator.getAllTypesForSchema(choicesSchema);457  assertEqualSets(choicesSchemaTypes, ["object", "function"]);458  var objectRefSchemaTypes = validator.getAllTypesForSchema(objectRefSchema);459  assertEqualSets(objectRefSchemaTypes, ["object"]);460  var complexSchemaTypes = validator.getAllTypesForSchema(complexSchema);461  assertEqualSets(complexSchemaTypes,462      ["integer", "string", "function", "object"]);463}464function testIsValidSchemaType() {465  var referencedTypes = [466    {467      id: "ChoicesRef",468      choices: [469        { type: "integer" },470        { type: "string" }471      ]472    }473  ];474  var objectSchema = {475    type: "object",476    optional: true477  };478  var complexSchema = {479    choices: [480      { $ref: "ChoicesRef" },481      { type: "function" },482    ]483  };484  var validator = new JSONSchemaValidator();485  validator.addTypes(referencedTypes);486  AssertTrue(validator.isValidSchemaType("object", objectSchema));487  AssertTrue(!validator.isValidSchemaType("integer", objectSchema));488  AssertTrue(!validator.isValidSchemaType("array", objectSchema));489  AssertTrue(validator.isValidSchemaType("null", objectSchema));490  AssertTrue(validator.isValidSchemaType("undefined", objectSchema));491  AssertTrue(validator.isValidSchemaType("integer", complexSchema));492  AssertTrue(validator.isValidSchemaType("function", complexSchema));493  AssertTrue(validator.isValidSchemaType("string", complexSchema));494  AssertTrue(!validator.isValidSchemaType("object", complexSchema));495  AssertTrue(!validator.isValidSchemaType("null", complexSchema));496  AssertTrue(!validator.isValidSchemaType("undefined", complexSchema));497}498function testCheckSchemaOverlap() {499  var referencedTypes = [500    {501      id: "ChoicesRef",502      choices: [503        { type: "integer" },504        { type: "string" }505      ]506    },507    {508      id: "ObjectRef",509      type: "object",510    }511  ];512  var arraySchema = {513    type: "array"514  };515  var choicesSchema = {516    choices: [517      { type: "object" },518      { type: "function" }519    ]520  };521  var objectRefSchema = {522    $ref: "ObjectRef"523  };524  var complexSchema = {525    choices: [526      { $ref: "ChoicesRef" },527      { type: "function" },528      { $ref: "ObjectRef" }529    ]530  };531  var validator = new JSONSchemaValidator();532  validator.addTypes(referencedTypes);533  AssertTrue(!validator.checkSchemaOverlap(arraySchema, choicesSchema));534  AssertTrue(!validator.checkSchemaOverlap(arraySchema, objectRefSchema));535  AssertTrue(!validator.checkSchemaOverlap(arraySchema, complexSchema));536  AssertTrue(validator.checkSchemaOverlap(choicesSchema, objectRefSchema));537  AssertTrue(validator.checkSchemaOverlap(choicesSchema, complexSchema));538  AssertTrue(validator.checkSchemaOverlap(objectRefSchema, complexSchema));539}540function testInstanceOf() {541  function Animal() {};542  function Cat() {};543  function Dog() {};544  Cat.prototype = new Animal;545  Cat.prototype.constructor = Cat;546  Dog.prototype = new Animal;547  Dog.prototype.constructor = Dog;548  var cat = new Cat();549  var dog = new Dog();550  var num = new Number(1);551  // instanceOf should check type by walking up prototype chain.552  assertValid("", cat, {type:"object", isInstanceOf:"Cat"});553  assertValid("", cat, {type:"object", isInstanceOf:"Animal"});554  assertValid("", cat, {type:"object", isInstanceOf:"Object"});555  assertValid("", dog, {type:"object", isInstanceOf:"Dog"});556  assertValid("", dog, {type:"object", isInstanceOf:"Animal"});557  assertValid("", dog, {type:"object", isInstanceOf:"Object"});558  assertValid("", num, {type:"object", isInstanceOf:"Number"});559  assertValid("", num, {type:"object", isInstanceOf:"Object"});560  assertNotValid("", cat, {type:"object", isInstanceOf:"Dog"},561                 [formatError("notInstance", ["Dog"])]);562  assertNotValid("", dog, {type:"object", isInstanceOf:"Cat"},563                 [formatError("notInstance", ["Cat"])]);564  assertNotValid("", cat, {type:"object", isInstanceOf:"String"},565                 [formatError("notInstance", ["String"])]);566  assertNotValid("", dog, {type:"object", isInstanceOf:"String"},567                 [formatError("notInstance", ["String"])]);568  assertNotValid("", num, {type:"object", isInstanceOf:"Array"},569                [formatError("notInstance", ["Array"])]);570  assertNotValid("", num, {type:"object", isInstanceOf:"String"},571                [formatError("notInstance", ["String"])]);572}573// Tests exposed to schema_unittest.cc.574exports.testFormatError = testFormatError;575exports.testComplex = testComplex;576exports.testEnum = testEnum;577exports.testExtends = testExtends;578exports.testObject = testObject;579exports.testArrayTuple = testArrayTuple;580exports.testArrayNonTuple = testArrayNonTuple;581exports.testString = testString;582exports.testNumber = testNumber;583exports.testIntegerBounds = testIntegerBounds;584exports.testType = testType;585exports.testTypeReference = testTypeReference;...reporter.spec.js
Source:reporter.spec.js  
...21    })22    it('should call config.formatError if defined', () => {23      const spy = sandbox.spy()24      formatError = m.createErrorFormatter({ basePath: '', formatError: spy }, emitter)25      formatError()26      expect(spy).to.have.been.calledOnce27    })28    it('should not call config.formatError if not defined', () => {29      const spy = sandbox.spy()30      formatError()31      expect(spy).not.to.have.been.calledOnce32    })33    it('should pass the error message as the first config.formatError argument', () => {34      const ERROR = 'foo bar'35      const spy = sandbox.spy()36      formatError = m.createErrorFormatter({ basePath: '', formatError: spy }, emitter)37      formatError(ERROR)38      expect(spy.firstCall.args[0]).to.equal(ERROR)39    })40    it('should display the exact error returned by config.formatError', () => {41      const formattedError = 'A new error'42      formatError = m.createErrorFormatter({ basePath: '', formatError: () => formattedError }, emitter)43      expect(formatError('Something', '\t')).to.equal(formattedError)44    })45    it('should indent', () => {46      expect(formatError('Something', '\t')).to.equal('\tSomething\n')47    })48    it('should handle empty message', () => {49      expect(formatError(null)).to.equal('\n')50    })51    it('should handle arbitrary error objects', () => {52      expect(53        formatError({ hello: 'world' })54      ).to.equal(55        JSON.stringify({ hello: 'world' }) + '\n'56      )57    })58    it('should handle error objects', () => {59      expect(60        formatError(new Error('fail'))61      ).to.equal(62        'fail\n'63      )64    })65    it('should remove specified hostname from files', () => {66      expect(formatError('file http://localhost:8080/base/usr/a.js and http://127.0.0.1:8080/absolute/home/b.js')).to.be.equal('file usr/a.js and http://127.0.0.1:8080/home/b.js\n')67    })68    it('should remove shas', () => {69      const ERROR = 'file http://localhost:8080/base/usr/file.js?6e31cb249ee5b32d91f37ea516ca0f84bddc5aa9 and http://127.0.0.1:8080/absolute/home/file.js?6e31cb249ee5b32d91f37ea516ca0f84bddc5aa9'70      expect(formatError(ERROR)).to.be.equal('file usr/file.js and http://127.0.0.1:8080/home/file.js\n')71    })72    it('should indent all lines', () => {73      expect(formatError('first\nsecond\nthird', '\t')).to.equal('\tfirst\n\tsecond\n\tthird\n')74    })75    it('should restore base paths', () => {76      formatError = m.createErrorFormatter({ basePath: '/some/base', hostname: 'localhost', port: 123 }, emitter)77      expect(formatError('at http://localhost:123/base/a.js?123')).to.equal('at a.js\n')78    })79    it('should restore urlRoot paths', () => {80      formatError = m.createErrorFormatter({ urlRoot: '/__karma__', basePath: '/some/base', hostname: 'localhost', port: 123 }, emitter)81      expect(formatError('at http://localhost:123/__karma__/base/sub/a.js?123')).to.equal('at sub/a.js\n')82    })83    it('should restore absolute paths', () => {84      const ERROR = 'at http://localhost:8080/absolute/usr/path.js?6e31cb249ee5b32d91f37ea516ca0f84bddc5aa9'85      expect(formatError(ERROR)).to.equal('at /usr/path.js\n')86    })87    it('should preserve line numbers', () => {88      const ERROR = 'at http://localhost:8080/absolute/usr/path.js?6e31cb249ee5b32d91f37ea516ca0f84bddc5aa9:2'89      expect(formatError(ERROR)).to.equal('at /usr/path.js:2\n')90    })91    it('should preserve absolute word', () => {92      const ERROR = 'contains absolute'93      expect(formatError(ERROR)).to.equal('contains absolute\n')94    })95    it('should preserve base word', () => {96      const ERROR = 'contains base'97      expect(formatError(ERROR)).to.equal('contains base\n')98    })99    describe('source maps', () => {100      let originalPositionForCallCount = 0101      let sourceMappingPath = null102      class MockSourceMapConsumer {103        constructor (sourceMap) {104          this.source = sourceMap.content.replace('SOURCE MAP ', sourceMappingPath)105        }106        originalPositionFor (position) {107          originalPositionForCallCount++108          if (position.line === 0) {109            throw new TypeError('Line must be greater than or equal to 1, got 0')110          }111          return {112            source: this.source,113            line: position.line + 2,114            column: position.column + 2115          }116        }117      }118      beforeEach(() => {119        originalPositionForCallCount = 0120        sourceMappingPath = '/original/'121      })122      MockSourceMapConsumer.GREATEST_LOWER_BOUND = 1123      MockSourceMapConsumer.LEAST_UPPER_BOUND = 2124      it('should rewrite stack traces', (done) => {125        formatError = m.createErrorFormatter({ basePath: '/some/base', hostname: 'localhost', port: 123 }, emitter, MockSourceMapConsumer)126        const servedFiles = [new File('/some/base/a.js'), new File('/some/base/b.js')]127        servedFiles[0].sourceMap = { content: 'SOURCE MAP a.js' }128        servedFiles[1].sourceMap = { content: 'SOURCE MAP b.js' }129        emitter.emit('file_list_modified', { served: servedFiles })130        _.defer(() => {131          const ERROR = 'at http://localhost:123/base/b.js:2:6'132          expect(formatError(ERROR)).to.equal('at /original/b.js:4:8 <- b.js:2:6\n')133          done()134        })135      })136      it('should rewrite stack traces (when basePath is empty)', (done) => {137        formatError = m.createErrorFormatter({ basePath: '', hostname: 'localhost', port: 123 }, emitter, MockSourceMapConsumer)138        const servedFiles = [new File('/a.js'), new File('/b.js')]139        servedFiles[0].sourceMap = { content: 'SOURCE MAP a.js' }140        servedFiles[1].sourceMap = { content: 'SOURCE MAP b.js' }141        emitter.emit('file_list_modified', { served: servedFiles })142        _.defer(() => {143          const ERROR = 'at http://localhost:123/base/b.js:2:6'144          expect(formatError(ERROR)).to.equal('at /original/b.js:4:8 <- b.js:2:6\n')145          done()146        })147      })148      it('should rewrite stack traces to the first column when no column is given', (done) => {149        formatError = m.createErrorFormatter({ basePath: '/some/base', hostname: 'localhost', port: 123 }, emitter, MockSourceMapConsumer)150        const servedFiles = [new File('/some/base/a.js'), new File('/some/base/b.js')]151        servedFiles[0].sourceMap = { content: 'SOURCE MAP a.js' }152        servedFiles[1].sourceMap = { content: 'SOURCE MAP b.js' }153        emitter.emit('file_list_modified', { served: servedFiles })154        _.defer(() => {155          const ERROR = 'at http://localhost:123/base/b.js:2'156          expect(formatError(ERROR)).to.equal('at /original/b.js:4:3 <- b.js:2\n')157          done()158        })159      })160      it('should rewrite relative url stack traces', (done) => {161        formatError = m.createErrorFormatter({ basePath: '/some/base', hostname: 'localhost', port: 123 }, emitter, MockSourceMapConsumer)162        const servedFiles = [new File('/some/base/a.js'), new File('/some/base/b.js')]163        servedFiles[0].sourceMap = { content: 'SOURCE MAP a.js' }164        servedFiles[1].sourceMap = { content: 'SOURCE MAP b.js' }165        emitter.emit('file_list_modified', { served: servedFiles })166        _.defer(() => {167          const ERROR = 'at /base/b.js:2:6'168          expect(formatError(ERROR)).to.equal('at /original/b.js:4:8 <- b.js:2:6\n')169          done()170        })171      })172      it('should resolve relative urls from source maps', (done) => {173        sourceMappingPath = 'original/' // Note: relative path.174        formatError = m.createErrorFormatter({ basePath: '/some/base' }, emitter, MockSourceMapConsumer)175        const servedFiles = [new File('/some/base/path/a.js')]176        servedFiles[0].sourceMap = { content: 'SOURCE MAP a.fancyjs' }177        emitter.emit('file_list_modified', { served: servedFiles })178        _.defer(() => {179          const ERROR = 'at /base/path/a.js:2:6'180          expect(formatError(ERROR)).to.equal('at path/original/a.fancyjs:4:8 <- path/a.js:2:6\n')181          done()182        })183      })184      it('should fall back to non-source-map format if originalPositionFor throws', (done) => {185        formatError = m.createErrorFormatter({ basePath: '/some/base', hostname: 'localhost', port: 123 }, emitter, MockSourceMapConsumer)186        const servedFiles = [new File('/some/base/a.js'), new File('/some/base/b.js')]187        servedFiles[0].sourceMap = { content: 'SOURCE MAP a.js' }188        servedFiles[1].sourceMap = { content: 'SOURCE MAP b.js' }189        emitter.emit('file_list_modified', { served: servedFiles })190        _.defer(() => {191          const ERROR = 'at http://localhost:123/base/b.js:0:0'192          expect(formatError(ERROR)).to.equal('at b.js\n')193          done()194        })195      })196      it('should not try to use source maps when no line is given', (done) => {197        formatError = m.createErrorFormatter({ basePath: '/some/base', hostname: 'localhost', port: 123 }, emitter, MockSourceMapConsumer)198        const servedFiles = [new File('/some/base/a.js'), new File('/some/base/b.js')]199        servedFiles[0].sourceMap = { content: 'SOURCE MAP a.js' }200        servedFiles[1].sourceMap = { content: 'SOURCE MAP b.js' }201        emitter.emit('file_list_modified', { served: servedFiles })202        _.defer(() => {203          const ERROR = 'at http://localhost:123/base/b.js'204          expect(formatError(ERROR)).to.equal('at b.js\n')205          expect(originalPositionForCallCount).to.equal(0)206          done()207        })208      })209      it('should not try to match domains with spaces', (done) => {210        formatError = m.createErrorFormatter({ basePath: '/some/base', hostname: 'localhost', port: 9876 }, emitter, MockSourceMapConsumer)211        const servedFiles = [new File('/some/base/a.js'), new File('/some/base/b.js')]212        servedFiles[0].sourceMap = { content: 'SOURCE MAP a.js' }213        servedFiles[1].sourceMap = { content: 'SOURCE MAP b.js' }214        emitter.emit('file_list_modified', { served: servedFiles })215        _.defer(() => {216          const ERROR = '"http://localhost:9876"\n at /base/b.js:2:6'217          expect(formatError(ERROR)).to.equal('"http://localhost:9876"\n at /original/b.js:4:8 <- b.js:2:6\n')218          done()219        })220      })221      describe('Windows', () => {222        formatError = null223        let servedFiles = null224        beforeEach(() => {225          formatError = m.createErrorFormatter({ basePath: '/some/base', hostname: 'localhost', port: 123 }, emitter, MockSourceMapConsumer)226          servedFiles = [new File('C:/a/b/c.js')]227          servedFiles[0].sourceMap = { content: 'SOURCE MAP b.js' }228        })229        it('should correct rewrite stack traces without sha', (done) => {230          emitter.emit('file_list_modified', { served: servedFiles })231          _.defer(() => {232            const ERROR = 'at http://localhost:123/absoluteC:/a/b/c.js:2:6'233            expect(formatError(ERROR)).to.equal('at c:/original/b.js:4:8 <- C:/a/b/c.js:2:6\n')234            done()235          })236        })237        it('should correct rewrite stack traces with sha', (done) => {238          emitter.emit('file_list_modified', { served: servedFiles })239          _.defer(() => {240            const ERROR = 'at http://localhost:123/absoluteC:/a/b/c.js?da39a3ee5e6:2:6'241            expect(formatError(ERROR)).to.equal('at c:/original/b.js:4:8 <- C:/a/b/c.js:2:6\n')242            done()243          })244        })245      })246    })247  })...productionApp.js
Source:productionApp.js  
1const express = require("express");2const Web3 = require("web3");3const app = express();4app.use(express.json());5const ethNetwork = process.env.ETH_NETWORK;6const BankId = process.env.BANK_ID;7const GAS = process.env.GAS_VALUE;8const web3 = new Web3(new Web3.providers.HttpProvider(ethNetwork));9const Accounts = require("web3-eth-accounts");10const port = process.env.PORT || 3000;11app.listen(port, () => console.log("Server is running on port " + port));12/*****************************************************PRODUCTION ROUTES**************************************************************/13// Production Route - to get all details from bank14app.get("/getBankDetails", (req, res) => {15  // res.json({"Name":"Api is running on cypher server"})16  let TOKENNAME, TOKENSYMBOL, DECIMALUNITS, TOTALSUPPLY;17  contract.methods18    .name()19    .call()20    .then((result) => {21      //res.send(result);22      TOKENNAME = result;23      console.log("name= " + result);24    })25    .catch((err) => {26      TOKENNAME = err;27      console.log("ERROR :" + err);28      let formaterror = `{"errorcode" :"GBD1","message" : "${err}"}`;29      console.log(JSON.parse(formaterror));30      res.json(JSON.parse(formaterror));31    });32  contract.methods33    .symbol()34    .call()35    .then((result) => {36      //res.send(result);37      TOKENSYMBOL = result;38      console.log("Symbol= " + result);39    })40    .catch((err) => {41      TOKENSYMBOL = err;42      console.log("ERROR :" + err);43      let formaterror = `{"errorcode" :"GBD2","message" : "${err}"}`;44      console.log(JSON.parse(formaterror));45      res.json(JSON.parse(formaterror));46    });47  contract.methods48    .decimals()49    .call()50    .then((result) => {51      //res.send(result);52      DECIMALUNITS = result;53      console.log("decimals= " + result);54    })55    .catch((err) => {56      DECIMALUNITS = err;57      console.log("ERROR :" + err);58      let formaterror = `{"errorcode" :"GBD3","message" : "${err}"}`;59      console.log(JSON.parse(formaterror));60      res.json(JSON.parse(formaterror));61    });62  contract.methods63    .totalSupply()64    .call()65    .then((result) => {66      //res.send(result);67      TOTALSUPPLY = result;68      console.log("totalSupply= " + result);69    })70    .catch((err) => {71      TOTALSUPPLY = err;72      console.log("ERROR :" + err);73      let formaterror = `{"errorcode" :"GBD4","message" : "${err}"}`;74      console.log(JSON.parse(formaterror));75      res.json(JSON.parse(formaterror));76    });77  function formatjson() {78    let jsonResult = `{"TokenName" : "${TOKENNAME}","TokenSymbol" : "${TOKENSYMBOL}","DecimalUnits" : "${DECIMALUNITS}","BankID" :"${BankId}","TotalSupply" :"${TOTALSUPPLY}"}`;79    console.log(JSON.parse(jsonResult));80    res.json(JSON.parse(jsonResult));81  }82  setTimeout(formatjson, 5000);83});84// Production Route - to get user details85app.get("/getUserDetails/:USERID", (req, res) => {86  let USERID = req.params.USERID,87    BALANCEOF;88  console.log(USERID);89  contract.methods90    .balanceOf(USERID)91    .call()92    .then((result) => {93      BALANCEOF = result;94      console.log("result= " + result);95    })96    .catch((err) => {97      BALANCEOF = err;98      console.log("ERROR :" + err);99      let formaterror = `{"errorcode" :"GUD","message" : "${err}"}`;100      console.log(JSON.parse(formaterror));101      res.json(JSON.parse(formaterror));102    });103  function formatjson() {104    let jsonResult = `{"UserId" : "${USERID}","UserBalance" : "${BALANCEOF}"}`;105    console.log(JSON.parse(jsonResult));106    res.json(JSON.parse(jsonResult));107  }108  setTimeout(formatjson, 3000);109});110// Production Route - to get user Account111app.get("/createUser", (req, res) => {112  const accounts = new Accounts(ethNetwork);113  const userAccount = web3.eth.accounts.create();114  console.log(115    "user = " + userAccount.address + " private key =" + userAccount.privateKey116  );117  function formatjson() {118    let jsonResult = `{"Address" : "${userAccount.address}","PrivateKey" : "${userAccount.privateKey}"}`;119    console.log(JSON.parse(jsonResult));120    res.json(JSON.parse(jsonResult));121  }122  setTimeout(formatjson, 2000);123});124// Production Route - to post money from bank to user account125/*126Request127{128    "UserId" :"0x01B7Ca9BFf093C69A1F8dA64735A1DBf01B27207",129    "TransferAmmount":10130}131Response132{133    "status": "true",134    "UserId": "0x01B7Ca9BFf093C69A1F8dA64735A1DBf01B27207",135    "TransferAmmount": "10"136}137*/138app.post("/transferFromBank", (req, res) => {139  console.log(req.body.UserId, req.body.TransferAmmount);140  let STAT1, STAT2, UID, UTA;141  UTA = req.body.TransferAmmount;142  UID = req.body.UserId;143  contract.methods144    .transfer(UID, UTA)145    .send({ from: account, gas: GAS })146    .then((result) => {147      console.log(result.status);148      STAT1 = result.status;149      contract.methods150        .burn(UTA.toString())151        .send({ from: account, gas: GAS })152        .then((result) => {153          STAT2 = result.status;154          console.log("STATUS= " + STAT2);155          let jsonResult = `{"status1" : "${STAT1}","status2" : "${STAT2}","UserId":"${UID}","TransferAmmount":"${UTA}"}`;156          res.json(JSON.parse(jsonResult));157          console.log(JSON.parse(jsonResult));158        })159        .catch((err) => {160          console.log("burn :" + err);161          let formaterror = `{"errorcode" :"TFB2","message" : "${err}"}`;162          console.log(JSON.parse(formaterror));163          res.json(JSON.parse(formaterror));164        });165    })166    .catch((err) => {167      console.log("Bank Transfer Error:" + err);168      let formaterror = `{"errorcode" :"TFB1","message" : "${err}"}`;169      console.log(JSON.parse(formaterror));170      res.json(JSON.parse(formaterror));171      return;172    });173});174// Production Route - to post money from one User to Other account175/*176Request177{178    "FromUserId" :"0x01B7Ca9BFf093C69A1F8dA64735A1DBf01B27207",179    "ToUserId" :"0x01B7Ca9BFf093C69A1F8dA64735A1DBf01B27207",180    "TransferAmmount":10181}182Response183{184    "status": "true",185    "FromUserId": "0x01B7Ca9BFf093C69A1F8dA64735A1DBf01B27207",186    "ToUserId": "0x40E767878739529D5D244B3cbd4bC6a2e9438365",187    "TransferAmmount": "10"188}189*/190app.post("/transferBtwUsers", (req, res) => {191  contract.methods192    .transferFrom(193      req.body.FromUserId,194      req.body.ToUserId,195      req.body.TransferAmmount.toString()196    )197    .send({ from: account, gas: GAS })198    .then((result) => {199      console.log(result.status);200      let jsonResult = `{"status" : "${result.status}","FromUserId":"${201        req.body.FromUserId202      }","ToUserId":"${203        req.body.ToUserId204      }","TransferAmmount":"${req.body.TransferAmmount.toString()}"}`;205      res.json(JSON.parse(jsonResult));206    })207    .catch((err) => {208      console.log(" User Transfer Error:" + err);209      let formaterror = `{"errorcode" :"TBWUS","message" : "${err}"}`;210      console.log(JSON.parse(formaterror));211      res.json(JSON.parse(formaterror));212    });213});214// Production Route - to get all user money to bank and delete account215app.get("/DeleteUser/:USERID", (req, res) => {216  let USERID = req.params.USERID,217    BALANCEOF,218    STATUS;219  console.log(USERID);220  contract.methods221    .balanceOf(USERID)222    .call()223    .then((result) => {224      BALANCEOF = result;225      console.log("result= " + result);226    })227    .catch((err) => {228      BALANCEOF = err;229      console.log("ERROR :" + err);230      let formaterror = `{"errorcode" :"DELUSER1","message" : "${err}"}`;231      console.log(JSON.parse(formaterror));232      res.json(JSON.parse(formaterror));233    });234  function formatjson() {235    contract.methods236      .burnFrom(USERID, BALANCEOF)237      .send({ from: account, gas: GAS })238      .then((result) => {239        STATUS = result.status;240        console.log("STATUS= " + STATUS);241        let jsonResult = `{"UserId" : "${USERID}","Status" : "${STATUS}"}`;242        console.log(JSON.parse(jsonResult));243        res.json(JSON.parse(jsonResult));244      })245      .catch((err) => {246        console.log("burn from :" + err);247        let formaterror = `{"errorcode" :"DELUSER2","message" : "${err}"}`;248        console.log(JSON.parse(formaterror));249        res.json(JSON.parse(formaterror));250      });251  }252  setTimeout(formatjson, 3000);253});254//Production Route - to handle default requests255app.get("*", (req, res) => {256  let jsonResult = `{"errorcode" :"GETNOTFOUND","message" : "API IS NOT DEFINED FOR THIS GET ROUTE."}`;257  console.log(JSON.parse(jsonResult));258  res.json(JSON.parse(jsonResult));259});260app.post("*", (req, res) => {261  let jsonResult = `{"errorcode" :"POSTNOTFOUND","message" : "API IS NOT DEFINED FOR THIS POST ROUTE."}`;262  console.log(JSON.parse(jsonResult));263  res.json(JSON.parse(jsonResult));...validators.js
Source:validators.js  
1const { FormatError, ConflictError } = require('crowdaids-errors')23function validateId(id) {4    if (typeof id !== 'string') throw new TypeError('id is not a string')5    if (!id.trim().length) throw new FormatError('id is empty or blank')6    if (/\r?\n|\r|\t| /g.test(id)) throw new FormatError('blank spaces around id')7    if (id.length < 24) throw new FormatError('id has less than 24 characters')8}910function validateToken(token) {11    if (typeof token !== 'string') throw new TypeError('token is not a string')12    if (!/[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)$/.test(token)) throw new Error('invalid token')13}1415function validateUsername(username) {16    if (typeof username !== 'string') throw new TypeError('username is not a string')17    if (!username.trim().length) throw new FormatError('username is empty or blank')18    if (/\r?\n|\r|\t| /g.test(username)) throw new FormatError('username has blank spaces')19    if (username.length < 4) throw new FormatError('username has less than 4 characters')2021}2223function validatePassword(password) {24    if (typeof password !== 'string') throw new TypeError('password is not a string')25    if (!password.trim().length) throw new FormatError('password is empty or blank')26    if (/\r?\n|\r|\t| /g.test(password)) throw new FormatError('password has blank spaces')27    if (password.length < 8) throw new FormatError('password has less than 8 characters')28}2930function validateOldPassword(oldPassword) {31    if (typeof oldPassword !== 'string') throw new TypeError('old password is not a string')32    if (!oldPassword.trim().length) throw new FormatError('old password is empty or blank')33    if (/\r?\n|\r|\t| /g.test(oldPassword)) throw new FormatError('old password has blank spaces')34    if (oldPassword.length < 8) throw new FormatError('old password has less than 8 characters')35}3637function validateName(name) {38    if (typeof name !== 'string') throw new TypeError('name is not a string')39    if (!name.trim().length) throw new FormatError('name is empty or blank')40    if (name.trim() !== name) throw new FormatError('blank spaces around name')41}4243function validateEmail(email) {44    if (typeof email !== "string") throw new TypeError("email is not a string")45    if (!email.trim().length) throw new FormatError("email is empty or blank")46    if (!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(email)) throw new FormatError("is not an e-mail")47}4849function validateData(data) {50    if (typeof data !== 'object' || data.constructor.name !== 'Object') throw new TypeError('data is not an object')5152    const { name, username, email, password, oldPassword } = data5354    if (typeof name !== 'undefined') {55        validateName(name)56    }5758    if (typeof username !== 'undefined') {59        validateUsername(username)60    }6162    if (typeof email !== 'undefined') {63        validateEmail(email)64    }6566    if (typeof oldPassword === 'undefined' && typeof password !== 'undefined') throw new ConflictError('old password is not defined')67    if (typeof password === 'undefined' && typeof oldPassword !== 'undefined') throw new ConflictError('password is not defined')6869    if (typeof password !== 'undefined') {70        validatePassword(password)71    }7273    if (typeof oldPassword !== 'undefined') {74        validateOldPassword(oldPassword)75    }76}7778function validateCallback(callback) {79    if (typeof callback !== 'function') throw new TypeError('callback is not a function')80}8182function validateCreditCardNumber(number) {83    if (typeof number !== 'string') throw new TypeError('credit card number is not a string')84    if (!number.trim().length) throw new FormatError('credit card number is empty or blank')85    if (/\r?\n|\r|\t| /g.test(number)) throw new FormatError('credit card number has blank spaces')86    if (number.length !== 16) throw new FormatError('credit card number doesn\'t have 16 digits')87    if (isNaN(number)) throw new FormatError('credit card number is not numeric')88}8990function validateDate(date) {91    if (!(date instanceof Date)) throw new TypeError('date is not a date')92}9394function validateCreditCardCVV(cvv) {95    if (typeof cvv !== 'string') throw new TypeError('cvv is not a string')96    if (!cvv.trim().length) throw new FormatError('cvv is empty or blank')97    if (/\r?\n|\r|\t| /g.test(cvv)) throw new FormatError('cvv has blank spaces')98    if (cvv.length > 4 || cvv.length < 3) throw new FormatError('cvv doesn\'t have 3 or 4 digits')99    if (isNaN(cvv)) throw new FormatError('cvv is not numeric')100}101102module.exports = {103    validateId,104    validateToken,105    validateUsername,106    validatePassword,107    validateOldPassword,108    validateData,109    validateName,110    validateCallback,111    validateCreditCardNumber,112    validateDate,113    validateCreditCardCVV,114    validateEmail
...Using AI Code Generation
1const { formatError } = require('@playwright/test/lib/utils/stackTrace');2const { formatError } = require('@playwright/test/lib/utils/stackTrace');3const { formatError } = require('@playwright/test/lib/utils/stackTrace');4const { formatError } = require('@playwright/test/lib/utils/stackTrace');5const { formatError } = require('@playwright/test/lib/utils/stackTrace');6const { formatError } = require('@playwright/test/lib/utils/stackTrace');7const { formatError } = require('@playwright/test/lib/utils/stackTrace');8const { formatError } = require('@playwright/test/lib/utils/stackTrace');9const { formatError } = require('@playwright/test/lib/utils/stackTrace');10const { formatError } = require('@playwright/test/lib/utils/stackTrace');11const { formatError } = require('@playwright/test/lib/utils/stackTrace');12const { formatError } = require('@playwright/test/lib/utils/stackTrace');13const { formatError } = require('@playwright/test/lib/utils/stackTrace');14const { formatError } = require('@playwright/test/lib/utils/stackTrace');15const { formatError } = require('@playwright/test/lib/utils/stackTrace');16const { formatError } = require('@playwright/test/lib/utils/stackTrace');17const { formatError } = require('@playwright/test/lib/utils/stackTrace');Using AI Code Generation
1const { formatError } = require('playwright/lib/utils/stackTrace');2const { formatError } = require('playwright/lib/utils/stackTrace');3const { formatError } = require('playwright/lib/utils/stackTrace');4const { formatError } = require('playwright/lib/utils/stackTrace');5const { formatError } = require('playwright/lib/utils/stackTrace');6const { formatError } = require('playwright/lib/utils/stackTrace');7const { formatError } = require('playwright/lib/utils/stackTrace');8const { formatError } = require('playwright/lib/utils/stackTrace');9const { formatError } = require('playwright/lib/utils/stackTrace');10const { formatError } = require('playwright/lib/utils/stackTrace');11const { formatError } = require('playwright/lib/utils/stackTrace');Using AI Code Generation
1const { formatError } = require('playwright/lib/utils/stackTrace');2test('should fail', async ({ page }) => {3  try {4    await page.evaluate(() => {5      throw new Error('foo');6    });7  } catch (e) {8    console.log(formatError(e));9  }10});11    at ExecutionContext._evaluateInternal (/Users/kwonoj/oss/playwright/test.js:3:85)12    at runMicrotasks (<anonymous>)13    at processTicksAndRejections (internal/process/task_queues.js:93:5)Using AI Code Generation
1const { formatError } = require('@playwright/test/lib/utils/stackTrace');2const { test } = require('@playwright/test');3test('My test', async ({ page }) => {4  const error = new Error('My Error');5  console.log(formatError(error));6});7    at Object.<anonymous> (/home/username/Desktop/test.js:7:15)8    at Module._compile (internal/modules/cjs/loader.js:1137:30)9    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)10    at Module.load (internal/modules/cjs/loader.js:985:32)11    at Function.Module._load (internal/modules/cjs/loader.js:878:14)12    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)13const { test } = require('@playwright/test');14test('My test', async ({ page }) => {15  const error = new Error('My Error');16  const stack = error.stack.split('17');18  stack.splice(0, 1, error.message);19  console.log(stack.join('20'));21});22    at Object.<anonymous> (/home/username/Desktop/test.js:7:15)23    at Module._compile (internal/modules/cjs/loader.js:1137:30)24    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)25    at Module.load (internal/modules/cjs/loader.js:985:32)26    at Function.Module._load (internal/modules/cjs/loader.js:878:14)27    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)Using AI Code Generation
1const {InternalError} = require('playwright-core/lib/utils/error');2const err = new InternalError('test');3console.log(err.formatError());4    at Object.<anonymous> (/home/xxxx/playwright-test/test.js:5:13)5    at Module._compile (internal/modules/cjs/loader.js:1063:30)6    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)7    at Module.load (internal/modules/cjs/loader.js:928:32)8    at Function.Module._load (internal/modules/cjs/loader.js:769:14)9    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.
Get 100 minutes of automation test minutes FREE!!
