We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
0.3.0
Feature
Don't know how to test the server code
This issue is come from kyt-starter-universal repo:
I just export src/server/index.jss app, and write a dead simple test file to test server.
src/server/index.js
But failed like this after run kyt test:
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.
kyt dev
I also find KYT is defined in kyt/webpack.base.js, but do not know how to fix.
KYT
@delambo advice me to set package.json as below:
"jest": { "globals": { "KYT": true } }
Console still complain: ReferenceError: KYT is not defined
ReferenceError: KYT is not defined
Have any other idea I can try?
Thanks
The text was updated successfully, but these errors were encountered:
hey @HaveF, sorry for the delayed response! try adding it to the modifyJestConfig callback in kyt.config.js
modifyJestConfig
kyt.config.js
so, something like this:
modifyJestConfig(baseConfig) { return Object.assign(baseConfig, { globals: { KYT: {} // your KYT object mock goes here }, }) }
Sorry, something went wrong.
@jaredmcdonald thanks for your response. It could fixed with your advice, and I modify kyt.config.js like this
modifyJestConfig: (baseConfig) => { return Object.assign(baseConfig, { globals: { KYT: { PUBLIC_DIR: 'src/public', ASSETS_MANIFEST: '--PATH---TO----PROJECT/build/publicAssets.json' } // your KYT object mock goes here }, }) }
But PUBLIC_DIR, and ASSETS_MANIFEST are default value of KYT, kyt/index.js at master · NYTimes/kyt
Maybe you can consider to add them as default JestConfig option.
Thanks!
#335
No branches or pull requests
Versions of kyt, node, OS
0.3.0
Bug or Feature?
Feature
Current Behavior
Don't know how to test the server code
This issue is come from kyt-starter-universal repo:
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
:caused by this line in source code kyt-starter-universal/index.js
This line is total fine when I run
kyt dev
, but failed atkyt 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.@delambo advice me to set package.json as below:
Console still complain:
ReferenceError: KYT is not defined
Have any other idea I can try?
Thanks
The text was updated successfully, but these errors were encountered: