kyt-starter-universal
kyt-starter-universal copied to clipboard
test the server code fail
I just export src/server/index.js
s app, and write a dead simple test file to test server.
But failed like this after run kyt test
:
● Test suite failed to run
ReferenceError: KYT is not defined
at Object.<anonymous> (server/server.js:13:28)
caused by this line in source code kyt-starter-universal/index.js
const clientAssets = require(KYT.ASSETS_MANIFEST); // eslint-disable-line import/no-dynamic-require
This line is total fine when I run kyt dev
, but failed at kyt test
, I thought it must be kyt/test.js does not pass right env like kyt/dev.js does.
I also find KYT
is defined in kyt/webpack.base.js, but do not know how to fix.
Have any idea? Thanks
@HaveF - sorry for the late reply - can you try to set a KYT
jest global: https://facebook.github.io/jest/docs/configuration.html#globals-object
@delambo Thanks for your reply:grin:. No, it does not work. I just set package.json as below:
"jest": {
"globals": {
"KYT": true
}
}
Console still complain: ReferenceError: KYT is not defined
Have any other idea I can try?
Would you mind opening this in the main kyt repository? I don't have a good idea but hopefully someone else will.