Skip to content
New issue

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

Cannot get the tests to run (in Windows) #116

Closed
kr-eberle opened this issue Oct 2, 2018 · 10 comments
Closed

Cannot get the tests to run (in Windows) #116

kr-eberle opened this issue Oct 2, 2018 · 10 comments

Comments

@kr-eberle
Copy link

Hi,
I found a little bug in the typing.d.ts and wanted to fix it myself via pull request etc.
I have tried to get myself set up (on a Windows machine), and found

  • that many of the NPM scripts don't work (probably because they are not cross-platform)
  • that many of the tests fail.
    I was able to locally fix some (not all) of the NPM scripts, but don't know what to do with the test failures.

Find some of the test failures below.

If anybody knows how to get the process to work, that would be great :)

Thanks,
Krischan

d:\dev\imodeljs\js-client>npm run test

> ldclient-js@2.7.1 test d:\dev\imodeljs\js-client
> NODE_ENV=test jest

'NODE_ENV' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ldclient-js@2.7.1 test: `NODE_ENV=test jest`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ldclient-js@2.7.1 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Krischan.Eberle\AppData\Roaming\npm-cache\_logs\2018-10-02T07_17_06_304Z-debug.log

d:\dev\imodeljs\js-client>npm run test

> ldclient-js@2.7.1 test d:\dev\imodeljs\js-client
> SET NODE_ENV=test & jest

 FAIL  src\__tests__\Stream-test.js
  ● Test suite failed to run

    D:\dev\imodeljs\js-client\src\__tests__\Stream-test.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import EventSource, { sources } from './EventSource-mock';
                                                                                             ^^^^^^

    SyntaxError: Unexpected token import

      at ScriptTransformer._transformAndBuildScript (../node_modules/jest-runtime/build/script_transformer.js:316:17)

 FAIL  src\__tests__\EventSender-test.js
  ● Test suite failed to run

    D:\dev\imodeljs\js-client\src\__tests__\EventSender-test.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import Base64 from 'Base64';
                                                                                             ^^^^^^

    SyntaxError: Unexpected token import

      at ScriptTransformer._transformAndBuildScript (../node_modules/jest-runtime/build/script_transformer.js:316:17)
@kr-eberle
Copy link
Author

FWIW, the actual bug which I intended to fix is this: LDOptions in typings.d.ts has the property evaluationExplanations whereas in index.js the respective property is called evaluationReasons:

const requestor = Requestor(baseUrl, environment, options.useReport, options.evaluationReasons, sendLDHeaders);

I assume adjusting LDOptions in typings.d.ts is the less disruptive way to fix this.

@eli-darkly
Copy link
Contributor

Thanks for catching the wrong property name. That's certainly easy to fix. We're looking into the other cross-platform issues - as you can probably guess, we've been pretty Linux-focused in our development of this project so I'm not surprised we've missed a few things like this.

@eli-darkly
Copy link
Contributor

I'm having more trouble than I expected getting the tests to run in Windows at all. If you already have a branch with the changes you've made so far, could you link to it (or just a gist of what you've got in package.json)?

@kr-eberle
Copy link
Author

kr-eberle commented Oct 2, 2018 via email

@eli-darkly
Copy link
Contributor

Well, we would like to get the build working under Windows. But it sounds like you have had more luck so far than I've had. The environment variable issue is fairly easy to fix by changing it to use cross-env (as some of the other commands already do), but I can't get it to the point of actually running any tests; currently it is failing for me with "Module jest-localstorage-mock in the setupFiles option was not found."

So, if you have a version of package.json that works better than that, even if the tests don't pass yet, I would appreciate a chance to see it.

@kr-eberle
Copy link
Author

kr-eberle commented Oct 4, 2018 via email

@eli-darkly
Copy link
Contributor

Thanks. Hmm. Well, that is what I did too. My npm version is 6.4.1, maybe that makes a difference.

@kr-eberle
Copy link
Author

kr-eberle commented Oct 18, 2018 via email

@eli-darkly
Copy link
Contributor

What I said in my last comment was that I'm not able to run the tests.

However, we did do a release yesterday which fixes the TypeScript property name error.

eli-darkly pushed a commit that referenced this issue Nov 9, 2018
@eli-darkly eli-darkly changed the title Cannot get the tests to run Cannot get the tests to run (in Windows) Feb 11, 2019
@eli-darkly
Copy link
Contributor

Hi. I know this is pretty late, but since your original report we've made many changes to the build, including some for Windows compatibility. We are now successfully running one of our CI builds of this repository in Windows. So if you're still interested and haven't already tried this again, I recommend trying it again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants