ReferenceError:描述未定义 [英] ReferenceError: describe is not defined
问题描述
我正在尝试使用gest( gest )对graphql端点进行测试.下面是我的代码
I am trying to run test for graphql endpoint using gest(gest). Below is my code
const Gest = require('graphicli')
const schema = require('./path/schema.js')
const gest = Gest(schema, {
baseURL: 'http://localhost:7770/graphql',
headers: {
Accept: 'application/json'
}
})
describe('GraphQL', () => {
test('{getAllNominator{firstName}}', () => {
return gest('{getAllNominator{firstName}}').then(({ data, errors }) => {
expect(errors).toBeUndefined()
expect(data).toEqual('Adam')
})
})
})
但是我遇到了以下错误
ReferenceError:描述未定义
ReferenceError: describe is not defined
根据解决方案中的解决方案链接,我使用摩卡咖啡.但这又给了另一个错误
As per the solution give in Solution Link i ran the file using mocha. But it the gives another error
ReferenceError:未定义测试
ReferenceError: test is not defined
我被困在这里.我该如何解决这个问题.还有一个问题. gest和摩卡咖啡有关系吗? 请有人帮助我
I am stuck here. How can I solve this issue. And also one more question. Is gest and mocha related? Please some one help me out of this
推荐答案
describe
功能是由mocha设置的.
describe
function is setup by mocha.
如果在本地安装了mocha
,请使用
If you have installed mocha
locally, run test with
./node_modules/.bin/mocha path/to/test.js
或
mocha path/to/test.js
此外,您可能希望将test(...)
调用替换为it(...)
Also, you might want to replace test(...)
call with it(...)
这篇关于ReferenceError:描述未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!