Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
557 views
in Technique[技术] by (71.8m points)

Getting error TypeError: Object has no member 'forEach' in javascript while returning array from setup method in k6

When I am trying to return an array from setup method and try to use it in VU method, I am getting the below error

TypeError: Object has no member 'forEach' in javascript

Please find below my code;

export function setup(){
    var listOfResponseMapStubs = getResponseMapStub();
    return listOfResponseMapStubs;
}

export default function (listOfResponseMapStubs) {
    
if(!listOfResponseMapStubs){
    console.error("No data found for test");
    return;
}
listOfResponseMapStubs.forEach(rowMapData => {
    var rowData = mapToObj(rowMapData);
    sleep(0.1) ;
});

Appreciate your help

question from:https://stackoverflow.com/questions/65886583/getting-error-typeerror-object-has-no-member-foreach-in-javascript-while-retu

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...