kyt-starter-universal icon indicating copy to clipboard operation
kyt-starter-universal copied to clipboard

test the server code fail

Open HaveF opened this issue 8 years ago • 3 comments

I just export src/server/index.jss 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 avatar Nov 07 '16 06:11 HaveF

@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 avatar Nov 10 '16 17:11 delambo

@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?

HaveF avatar Nov 11 '16 00:11 HaveF

Would you mind opening this in the main kyt repository? I don't have a good idea but hopefully someone else will.

delambo avatar Nov 19 '16 19:11 delambo