-
Notifications
You must be signed in to change notification settings - Fork 151
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
Add support for testing native modules and Windows #230
Conversation
This adds support for multiple test cases for single module. It allows to test single module with various configurations, e. g. node-gyp and node-pre-gyp
When install step fails all output is lost unless logging was set to verbose. This changes this behavior, so that when install step fails output will be logged just like test errors.
This adds testing if node-gyp was called by npm. It uses npm_config_node_gyp environment variable to inject our version of node-gyp script to detect if it was called with either 'build' or 'rebuild' parameter.
This moves script option from 'context.options' to 'context.module' where it should be. It also fixes script test, which expected a 'example-test-script-passing.sh' script to fail.
This adds support for lookup to override test command. Provided command will be executed by shell in the package temp directory. This allows for creating workarounds for packages that relay on bash shell or ones that do not support node-dir npm parameter. It can also be used to disable running tests.
Adds support for extra parameters passed to 'npm install'.
This adds support for defining minimal node version required to run specific test case.
This adds citgm, bufferutil, utf-8-validate, kerberos, weak, hiredis, iconv, contextify, thread-sleep, sqlite3, v8-profiler and v8-debug to lookup.json
This adds separate test for node-sass to test it with modules built locally.
This adds workarounds for calling tests on Windows. Also, failing modules are initially marked as flaky.
@bzoz Is there a reason to do all of this in one PR? A lot of these changes look really useful, but I think it'll be a mammoth effort to get all these commits in at the same time. I would try to review each commit, but I think it's going to get a bit messy if we have 10 conversations going on at the same time. |
@GeorgeAdams95 this @gibfahn this PR makes sense as a whole – it adds new modules to |
@bzoz I (personally) think splitting up the PR makes sense, not least because I think it'll make a big difference to how quickly things get merged. For example I think commit 2 is a small and useful change which should be easy to review/approve/merge, whereas commit 8 is adding a bunch of modules, which might need more time to be discussed (and have more requested changes). I think @thealphanerd is quite keen on people raising issues to discuss new features, so we can discuss before actually implementing. Obviously no need to raise them now 😄 Having a test-command for windows is really something that should be supported by the modules themselves if possible. If we have to maintain custom test commands then we run the risk of being out of date. What is the benefit for Node core in testing a module (e.g. What are the reasons for adding those modules? I think going forwards the aim is to have a clear justification for each module added (link). Instead of |
@bzoz thanks for all the hard work you have put in here. So I'm going to agree with the sentiment in this thread that there are just too many moving parts going on here. Each of the individual features are going to need their own PR so that we can assess them and land them on their own merit. They are also going to need to come with tests, which it does not appear there are at the moment. The entire repo has around 95% code coverage. The tool is currently broken due to a bug in the reporter stack, but I should hopefully get something in this week that can repair that. I change as big as this should not lower the overall coverage of the repo. I understand that some of these are building on each other, and it is frustrating to have to move through this slower process. Hopefully you can understand why we need to approach each of these features individually /cc @jasnell for his opinion |
Sure, I see your point. I will split this PR in separate PRs that I will open later today. |
This PR adds testing of native modules built locally to the smoke tests. It includes all necessary changes to the CITGM and adds modules to
package.json
:It also fixes problem with
script
key inpackage.json
(details in 4th commit description), adds CITGM itself to smoke tests and makes CITGM ready for use under Windows.The PR is splitted in 10 commits for easier review.
npm install
failed its console output was lost unless running in verbose.npm
callednode-gyp
with eitherbuild
orrebuild
. It is done by settingnpm_config_node_gyp
(see this npm commit).script
key in lookup. Right now it is wrongly added tooptions
and notmodule
. Also, script withexample-test-script-passing.sh
filename is expected to fail by the test. Besides fixing those two errors, this commit makes alsotest-npm-test.js
run under Windows.test-command
key in lookup. It works similar toscript
- a user provided command is used instead ofnpm test
when testing.install
parameter to lookup. This allows for extra parameters to be passed tonpm install
- e.g.--build-from-source
.node-version
to lookup. It can be used to specify minimal node version needed to run given test incitgm-all
.lookup.json
lookup.json
, so that both downloaded and build binaries will be testedtest-command