What happened

Shareholders of iRobot (IRBT -3.73%) trounced the market this week as shares jumped 17% through 2:30 p.m. ET on Thursday. That's as compared to a 2.2% increase in the wider market, according to data provided by S&P Global Market Intelligence.

The rally removed only a small portion of recent losses, and the stock remains down significantly so far in 2022. But investors are becoming more optimistic ahead of the robotic cleaning device specialist's upcoming earnings report.

So what

The main factor driving iRobot's stock higher this week was a shift in overall investor sentiment. The tech-heavy Nasdaq index, which is home to iRobot and many other hard-hit growth stocks, rallied 10% higher as Wall Street contemplated the prospect that stocks have become oversold in recent weeks.

Netflix stock, for example, jumped after the company reported more-modest subscriber losses than expected and projected a quick return to growth in the third quarter.

Similarly, investors could be gaining confidence that iRobot's upcoming earnings report, set for early August, will beat low expectations. The company posted declining sales volumes in its last report, along with falling profitability. Yet selling prices rose, and iRobot could continue boosting its revenue if consumer spending remains strong.

Now what

We'll learn in early August whether the company returned to positive earnings territory in the third quarter. That's possible, especially since there has been a pause in Chinese tariffs imposed on its imported products.

For the stock price rally to extend deeper into 2022, though, investors will want to see iRobot boost sales volumes in addition to prices. That combination would imply a strong position in an attractive industry.

Yet the company's last few earnings updates have described a shakier demand environment. Given that iRobot is currently losing money, it's no surprise that investors remain cautious about the stock, notwithstanding this past week's rally.