-
-
Notifications
You must be signed in to change notification settings - Fork 22.1k
test: Made unit test passing with node-chakracore #3251
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
Conversation
dougwilson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on what the tests are actually trying to assert (that the error was passed to the callback), I don't think it's necessary at all to be validating the specific error message back. I'm sure there would be a way to just make a single conditional work on v8 and chakracore without checking the engine.
|
In addition to my comment above, it would be awesome (this is tangental; so really a different PR) if we could add chakracore to Travis CI so we can keep it green for chakra. |
| // nextTick to prevent cyclic | ||
| process.nextTick(function(){ | ||
| err.message.should.match(/Cannot read property '[^']+' of undefined/); | ||
| err.message.should.match(jsEngine.engineSpecificMessage({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could probably just be assert.ok(err)
| request(app) | ||
| .get('/') | ||
| .expect(/Cannot read property '[^']+' of undefined/, done); | ||
| .expect(jsEngine.engineSpecificMessage({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just replace the res.end(err.message) above with res.send('caught error: ' + err.message') and then the expect could just be .expect(/^caught error: /, done) since that would tell us we got the error in next(err)
| request(app) | ||
| .get('/') | ||
| .expect(/Cannot read property '[^']+' of undefined/, done); | ||
| .expect(jsEngine.engineSpecificMessage({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could just do the same thing the above did.
|
Thanks @dougwilson for the quick feedback. I was hesitant in adding |
Is this the right repo to open issue for CI for node-chakracore? |
In these three cases, the tests do not actually care what the message is, as can be seen in the test descriptions.
I'm not sure what you mean. Can you elaborate? |
I mean, is there a place where we can track this work item? How is your existing Travis CI for node-v8 set up? I can take a look into scripts, if you can point me to it. But if it is just as simple as downloading node binaries from nodejs.org then you can get |
|
I flagged this PR as "needs tests" since there are no tests for this--i.e. if I revert the code after merging the CI will not flag any failures, so we have no way to keep these working down the road after this first merge. Ideally if chakracore is a supported platform (which I see no reason not to get it there), but Express.js is made up of a lot of dependencies, a lot of which have entire test suites not represented here, so prior to marking Express.js as supporting chakracore, ideally at least all the Express.js project dependencies below it have their test suites running in chakracore as well so we can keep everything functioning in an ongoing manner.
Just make a PR with the setup or provide we the instructions for how any project can test against chakracore in Travis CI and I can help get it setup.
We just use the standard Node.js setup: https://docs.travis-ci.com/user/languages/javascript-with-nodejs/ You can find our Ideally we need to test on Windows as well (Travis CI is the Linux test platform). We use AppVeyor for that (and file is here: https://github.com/expressjs/express/blob/master/appveyor.yml)
I'm not familiar with how to do that in Travis CI / AppVeyor. Are there any instructions for how to do this? How do other Node.js projects test against chakracore? |
|
@dougwilson - Can you follow these instructions to enable |
|
Ping, @dougwilson , did you get chance to look into nvs? |
|
No, I have not had a chance, though I assume you should be able to update the PR to do that as well, right? Travis CI just uses whatever the contents of .travis.yml is on the given branch. |
b91b7c1 to
81e1116
Compare
|
@jasongin - FYI. |
|
@dougwilson - I added travis and appveyor support for node-chakracore. The last job ( |
|
Why download the files from GitHub at all? Looking at https://github.com/Microsoft/ChakraCore/releases it looks like the binaries are available on Azure, which I presume requires no GitHub token. |
@jasongin, any idea? |
|
NVS is not downloading ChakraCore releases, it is downloading Node-ChakraCore releases. The latter are not hosted on Azure. Additionally, NVS needs to query the GitHub releases API to find what releases are available and metadata about each release. |
|
@dougwilson - I was able to make |
|
Setting up a GitHub token is not going to work for this project, unfortunately. It would need protection so it needs to be encrypted, but that still has this problem: From https://docs.travis-ci.com/user/environment-variables/#Defining-encrypted-variables-in-.travis.yml encrypted variables are not available in builds in pull requests, and since pull requests are used even for the project collaborators, it means that it's effectively useless as all PRs will never be able to install ChakraCore. |
Now that nodejs.org started hosting chakracore-release, change the default remote for `chakracore` to https://nodejs.org/download/chakracore-release/. This will help using nvs for expressjs/express#3251 , expressjs/body-parser#233 and sass/node-sass#1777
Now that nodejs.org started hosting chakracore-release, change the default remote for `chakracore` to https://nodejs.org/download/chakracore-release/. This will help using nvs for expressjs/express#3251 , expressjs/body-parser#233 and sass/node-sass#1777
This supports downloading chakracore release binaries from nodejs.org instead of github
|
@dougwilson - should be good to go? |
|
Nice, great to see it all working now \m/ . Is there a way to pin the chakracore to a given minor version or move it to allowed failure? Just requiring a PR to pass with whatever the bleeding edge is is not good; it caused a lot of heart ache with Node.js, which is why the minors are pinned and any non-pinned thing is allowed to fail. |
|
The |
|
We pin them to the minor version. |
|
Sure, but my question was how do you specify what version is pinned? Is it done through |
|
Sorry, I didn't realize the question at first. Yes, you can see all the minor versions listed in both of those files for Node.js |
|
Also, I don't see the Node.js nightly running on Travis CI anymore after this change, if you can look into why that build got dropped from the matrix. |
Hhm, i am not sure |
* Allow nightly to run and allow_failure in travis * Pin the version of node-chakracore
|
@dougwilson - Pinned the chakracore version and made nightly run in travis. |
|
Let me know if anything else is needed to merge this PR. |
|
Looks pretty good to me. I did just recently find out from another module that the new npm 5 will incorrectly create a lockfile during the Which way do you want to proceed? |
|
I think if we want to add support for npm 5 in near future, let us add clean support instead of allowing it to fail initially and then cleaning it up. Will you be updating the same PR? I think different PR would make more sense in this case. Thoughts? |
|
Yep, separate from this PR makes sense to me as well. I'll go ahead and make that today. |
|
@dougwilson - Let me know if you need anything else to merge this PR. |
|
I never got to implementing the npm 5 support yet. So really it's just either (1) we are waiting for me to land that first or (2) change the pr to make the npm 5 runs allowed to fail. Since we agreed on option 1, just need to get that done before this can land. |
There were 4 unit test that were failing with node-chakracore because of error message difference between v8 and chakracore. Added engine specific check to validate the expected error message.
Ref: nodejs/node-chakracore#189