我正在尝试跟踪TDD,我有一个span,它应该在5秒后出现在屏幕上。我根本没有实现span,所以测试应该会失败,但是目前它通过了测试expect(messageSpan).toBeInTheDocument。
以下是我的两个测试:
it("doesn't show cta message at first", () => {
render(<FAB />);
const messageSpan = screen.queryByText(
"Considering a career in nursing? Join o
我在用玩笑来测试我的特快路线。
在运行yarn test时,我的所有测试用例都通过了,但是我得到了一个错误
Jest did not exit one second after the test run has completed.
This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with `--detectOpenHandles` to troubleshoot this issue.
我使用了asy
我在开玩笑的时候有以下的测试:
describe('On any platform', (): void => {
it('throws an error when trying to start with an invalid socket Path.', async(): Promise<void> => {
const factory = new BaseHttpServerFactory(handler, httpOptions);
expect((): void => {
我正在用jest测试我的vue.js应用程序。我意识到jest刚刚通过了所有这些测试,即使它应该失败。例如,这个测试应该是失败的,因为输入类型password为true,但我所有的测试代码都通过了true或false。。。 test('password input field type is password at the beginning', done => {
setTimeout(() => {
const pw = wrapper.find({ ref: 'pw' });
expect(pw.conta
我遇到的问题是Jest报告setResultsSpy被调用了0次,而实际上,我知道它被调用了。我知道这一点,因为我在代码中将console.log(results)放在const results = await getFileList(data.path);下,并且能够看到返回的结果。
我现在的猜测是try-catch块创建了一个本地作用域,这导致这些调用没有被注册。如果这是真的,我的问题是“我如何测试这些方法是否已被调用”?
// test_myFunction.js
test((`myFunction with valid path should return list of files