Skip to content

Infinite Loop #1

@CCMigration

Description

@CCMigration

I am trying to make it work with Jest. Every time I require this into my simple test it goes into an infinite loop. While debugging I also saw that it is throwing an exception on line 70.

demandware-globals.js

#!javascript

try {
   // the line below is throwing exception TypeError: require is not a constructor
   global[pathArray[0]][pathArray[1]][pathArray[2]] = require("./"+classPath);
} catch(e){
  console.log("Could not require "+classPath+e);
}

My test:

#!javascript

'use strict'
require('dw-api-mock/demandware-globals');

describe('COBilling',() => {
    describe('SelectCreditCard',() => {
        it('should call the method on Cybersource to save the card', () => {
            expect(2).toBe(2);
        });
    });
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions