我正在節(jié)點(diǎn)js中用jest進(jìn)行測(cè)試。我的文件索引.jsconst config = helper.config;const _ = helper.module._;它拋出錯(cuò)誤。helper is not defined.這里的幫助者是全局對(duì)象。我的玩笑測(cè)試 jsconst assign = require('xxxxxx/index');const body = {}describe("forgotPassword()", () => { it("should return true", () => { //Testing a boolean expect(assign(body)).toBeTruthy(); //Another way to test a boolean expect(assign(body)).toEqual(true); });});有什么辦法嗎?
Jest測(cè)試api創(chuàng)建自己的上下文節(jié)點(diǎn)js
猛跑小豬
2022-08-27 09:48:13