为什么不需要开玩笑?
why is jest not required?
我有一个 React 应用程序,我不知道为什么我不需要 jest 模块。
import Task from './Task';
describe('class Task', () => {
it('inProgress()', () => {
var t = new Task("prova");
expect(t.isInProgress()).not.toBeTruthy();
});
});
create-react-app
运行s react-scripts test --env=jsdom
的 test
命令。
react-scripts test
的脚本需要 jest
on this line and after configuring everything it runs jest
on this line。
jest
然后找到您的测试文件,加载它们,然后 运行s 它们。
换句话说,你的测试没有加载,运行 jest
,jest
加载你的测试运行 =34=].
由于您的测试 运行 在 jest
中,他们可以利用 jest
提供的 globals, expect, environment 等,而不必 "require or import anything to use them"。
我有一个 React 应用程序,我不知道为什么我不需要 jest 模块。
import Task from './Task';
describe('class Task', () => {
it('inProgress()', () => {
var t = new Task("prova");
expect(t.isInProgress()).not.toBeTruthy();
});
});
create-react-app
运行s react-scripts test --env=jsdom
的 test
命令。
react-scripts test
的脚本需要 jest
on this line and after configuring everything it runs jest
on this line。
jest
然后找到您的测试文件,加载它们,然后 运行s 它们。
换句话说,你的测试没有加载,运行 jest
,jest
加载你的测试运行 =34=].
由于您的测试 运行 在 jest
中,他们可以利用 jest
提供的 globals, expect, environment 等,而不必 "require or import anything to use them"。