mirror of https://github.com/grpc/grpc-node.git
Merge pull request #27 from murgatroid99/gulp_test_from_clean_repo
Create a short command to run working tests from a clean repo
This commit is contained in:
commit
b70045b465
35
gulpfile.js
35
gulpfile.js
|
@ -9,21 +9,42 @@ require('./packages/grpc-js-core/gulpfile');
|
|||
require('./packages/grpc-native-core/gulpfile');
|
||||
require('./test/gulpfile');
|
||||
|
||||
const root = __dirname;
|
||||
|
||||
gulp.task('install.all', 'Install dependencies for all subdirectory packages',
|
||||
['js.core.install', 'native.core.install', 'health-check.install']);
|
||||
|
||||
gulp.task('lint', 'Emit linting errors in source and test files',
|
||||
['js.core.lint', 'native.core.lint']);
|
||||
|
||||
gulp.task('link', 'Link local packages together',
|
||||
['health-check.link', 'internal.test.link']);
|
||||
gulp.task('build', 'Build packages', ['js.core.compile', 'native.core.build']);
|
||||
|
||||
gulp.task('build', 'Build packages',
|
||||
['js.core.compile', 'native.core.build', 'link']);
|
||||
gulp.task('link.create', 'Initialize npm links to packages',
|
||||
['native.core.link.create']);
|
||||
|
||||
gulp.task('link.only', 'Link packages together without rebuilding anything',
|
||||
['health-check.link.add', 'internal.test.link.add']);
|
||||
|
||||
gulp.task('link', 'Link local packages together after building',
|
||||
['link.create'], () => {
|
||||
gulp.start('link.only');
|
||||
});
|
||||
|
||||
gulp.task('setup', 'One-time setup for a clean repository', ['install.all', 'link']);
|
||||
|
||||
gulp.task('clean', 'Delete generated files', ['js.core.clean']);
|
||||
|
||||
gulp.task('test.only', 'Run tests without rebuilding anything',
|
||||
['js.core.test', 'native.core.test', 'internal.test.test', 'health-check.test']);
|
||||
gulp.task('native.test.only', 'Run tests of native code without rebuilding anything',
|
||||
['native.core.test', 'internal.test.test', 'health-check.test']);
|
||||
|
||||
gulp.task('test', 'Run all tests', ['build', 'link'], () => {
|
||||
gulp.task('native.test', 'Run tests of native code', ['build'], () => {
|
||||
gulp.start('native.test.only');
|
||||
});
|
||||
|
||||
gulp.task('test.only', 'Run tests without rebuilding anything',
|
||||
['js.core.test', 'native.test.only']);
|
||||
|
||||
gulp.task('test', 'Run all tests', ['build'], () => {
|
||||
gulp.start('test.only');
|
||||
});
|
||||
|
||||
|
|
30
package.json
30
package.json
|
@ -8,27 +8,35 @@
|
|||
"name": "Google Inc."
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"devDependencies": {
|
||||
"dependencies": {
|
||||
"async": "^2.5.0",
|
||||
"body-parser": "^1.18.0",
|
||||
"execa": "^0.8.0",
|
||||
"express": "^4.15.4",
|
||||
"google-auth-library": "^0.11.0",
|
||||
"grpc": "^1.6.0",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-help": "^1.6.1",
|
||||
"lodash": "^4.17.4",
|
||||
"poisson-process": "^0.2.2"
|
||||
},
|
||||
"scripts": {
|
||||
"install": "cd packages/grpc-js-core && npm install"
|
||||
"devDependencies": {
|
||||
"del": "^3.0.0",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-help": "^1.6.1",
|
||||
"gulp-jshint": "^2.0.4",
|
||||
"gulp-mocha": "^4.3.1",
|
||||
"gulp-sourcemaps": "^2.6.1",
|
||||
"gulp-tslint": "^8.1.1",
|
||||
"gulp-typescript": "^3.2.2",
|
||||
"gulp-util": "^3.0.8",
|
||||
"jshint": "^2.9.5",
|
||||
"merge2": "^1.1.0",
|
||||
"mocha": "^3.5.3",
|
||||
"through2": "^2.0.3",
|
||||
"tslint": "^5.5.0",
|
||||
"typescript": "^2.5.1"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Google Inc."
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"gulp-mocha": "^4.3.1",
|
||||
"mocha": "^3.5.3"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,20 +1,24 @@
|
|||
const _gulp = require('gulp');
|
||||
const help = require('gulp-help');
|
||||
const mocha = require('gulp-mocha');
|
||||
const exec = require('child_process').exec;
|
||||
const execa = require('execa');
|
||||
const path = require('path');
|
||||
|
||||
const gulp = help(_gulp);
|
||||
|
||||
const hcCoreDir = __dirname;
|
||||
const baseDir = path.resolve(hcCoreDir, '..', '..');
|
||||
const testDir = path.resolve(hcCoreDir, 'test');
|
||||
const healthCheckDir = __dirname;
|
||||
const baseDir = path.resolve(healthCheckDir, '..', '..');
|
||||
const testDir = path.resolve(healthCheckDir, 'test');
|
||||
|
||||
gulp.task('health-check.link', 'Link local copy of grpc', (cb) => {
|
||||
return exec(`cd ${hcCoreDir} && npm link ${baseDir}/packages/grpc-native-core`, cb);
|
||||
gulp.task('health-check.install', 'Install health check dependencies', () => {
|
||||
return execa('npm', ['install'], {cwd: healthCheckDir, stdio: 'inherit'});
|
||||
});
|
||||
|
||||
gulp.task('health-check.test', 'Run health check tests', ['health-check.link'],
|
||||
gulp.task('health-check.link.add', 'Link local copy of grpc', ['health-check.install'], () => {
|
||||
return execa('npm', ['link', 'grpc'], {cwd: healthCheckDir, stdio: 'inherit'});
|
||||
});
|
||||
|
||||
gulp.task('health-check.test', 'Run health check tests',
|
||||
() => {
|
||||
return gulp.src(`${testDir}/*.js`).pipe(mocha());
|
||||
});
|
||||
|
|
|
@ -13,6 +13,7 @@ const util = require('gulp-util');
|
|||
const merge2 = require('merge2');
|
||||
const path = require('path');
|
||||
const through = require('through2');
|
||||
const execa = require('execa');
|
||||
|
||||
Error.stackTraceLimit = Infinity;
|
||||
|
||||
|
@ -75,6 +76,10 @@ function makeCompileFn(globs) {
|
|||
};
|
||||
}
|
||||
|
||||
gulp.task('js.core.install', 'Install native core dependencies', () => {
|
||||
return execa('npm', ['install'], {cwd: jsCoreDir, stdio: 'inherit'});
|
||||
});
|
||||
|
||||
/**
|
||||
* Runs tslint on files in src/, with linting rules defined in tslint.json.
|
||||
*/
|
||||
|
|
|
@ -18,16 +18,7 @@
|
|||
"@types/mocha": "^2.2.42",
|
||||
"@types/node": "^8.0.25",
|
||||
"clang-format": "^1.0.53",
|
||||
"del": "^3.0.0",
|
||||
"google-ts-style": "^0.2.0",
|
||||
"gulp-sourcemaps": "^2.6.1",
|
||||
"gulp-tslint": "^8.1.1",
|
||||
"gulp-typescript": "^3.2.2",
|
||||
"gulp-util": "^3.0.8",
|
||||
"merge2": "^1.1.0",
|
||||
"through2": "^2.0.3",
|
||||
"tslint": "^5.5.0",
|
||||
"typescript": "^2.5.1"
|
||||
"google-ts-style": "^0.2.0"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
|
|
|
@ -6,7 +6,7 @@ const gulp = help(_gulp);
|
|||
|
||||
const jshint = require('gulp-jshint');
|
||||
const mocha = require('gulp-mocha');
|
||||
const exec = require('child_process').exec;
|
||||
const execa = require('execa');
|
||||
const path = require('path');
|
||||
|
||||
const nativeCoreDir = __dirname;
|
||||
|
@ -16,14 +16,23 @@ const testDir = path.resolve(nativeCoreDir, 'test');
|
|||
const pkg = require('./package');
|
||||
const jshintConfig = pkg.jshintConfig;
|
||||
|
||||
gulp.task('native.core.install', 'Install native core dependencies', () => {
|
||||
return execa('npm', ['install', '--build-from-source'],
|
||||
{cwd: nativeCoreDir, stdio: 'inherit'});
|
||||
});
|
||||
|
||||
gulp.task('native.core.link.create', 'Create npm link', ['native.core.install'], () => {
|
||||
return execa('npm', ['link'], {cwd: nativeCoreDir, stdio: 'inherit'});
|
||||
});
|
||||
|
||||
gulp.task('native.core.lint', 'Emits linting errors', () => {
|
||||
return gulp.src([`${nativeCoreDir}/index.js`, `${srcDir}/*.js`, `${testDir}/*.js`])
|
||||
.pipe(jshint(pkg.jshintConfig))
|
||||
.pipe(jshint.reporter('default'));
|
||||
});
|
||||
|
||||
gulp.task('native.core.build', 'Build native package', (cb) => {
|
||||
return exec(`cd ${nativeCoreDir} && ${nativeCoreDir}/node_modules/.bin/node-pre-gyp build`, cb);
|
||||
gulp.task('native.core.build', 'Build native package', () => {
|
||||
return execa('node-pre-gyp', ['build'], {cwd: nativeCoreDir, stdio: 'inherit'});
|
||||
});
|
||||
|
||||
gulp.task('native.core.test', 'Run all tests', ['native.core.build'], () => {
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
],
|
||||
"dependencies": {
|
||||
"arguejs": "^0.2.3",
|
||||
"gulp-jshint": "^2.0.4",
|
||||
"lodash": "^4.15.0",
|
||||
"nan": "^2.0.0",
|
||||
"node-pre-gyp": "^0.6.35",
|
||||
|
@ -46,7 +45,6 @@
|
|||
"google-protobuf": "^3.0.0",
|
||||
"istanbul": "^0.4.4",
|
||||
"jsdoc": "^3.3.2",
|
||||
"jshint": "^2.5.0",
|
||||
"minimist": "^1.1.0",
|
||||
"mocha-jenkins-reporter": "^0.2.3",
|
||||
"poisson-process": "^0.2.1"
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
var assert = require('assert');
|
||||
var _ = require('lodash');
|
||||
|
||||
var ProtoBuf = require('protobufjs');
|
||||
|
||||
var grpc = require('grpc');
|
||||
|
||||
var MathClient = grpc.load(
|
||||
|
@ -283,9 +281,7 @@ describe('Echo service', function() {
|
|||
var server;
|
||||
var client;
|
||||
before(function() {
|
||||
var test_proto = ProtoBuf.loadProtoFile(__dirname + '/echo_service.proto');
|
||||
var echo_service = test_proto.lookup('EchoService');
|
||||
var Client = grpc.loadObject(echo_service);
|
||||
var Client = grpc.load(__dirname + '/echo_service.proto').EchoService;
|
||||
server = new grpc.Server();
|
||||
server.addService(Client.service, {
|
||||
echo: function(call, callback) {
|
||||
|
@ -413,9 +409,7 @@ describe('Echo metadata', function() {
|
|||
var server;
|
||||
var metadata;
|
||||
before(function() {
|
||||
var test_proto = ProtoBuf.loadProtoFile(__dirname + '/test_service.proto');
|
||||
var test_service = test_proto.lookup('TestService');
|
||||
var Client = grpc.loadObject(test_service);
|
||||
var Client = grpc.load(__dirname + '/test_service.proto').TestService;
|
||||
server = new grpc.Server();
|
||||
server.addService(Client.service, {
|
||||
unary: function(call, cb) {
|
||||
|
@ -514,8 +508,7 @@ describe('Client malformed response handling', function() {
|
|||
var client;
|
||||
var badArg = new Buffer([0xFF]);
|
||||
before(function() {
|
||||
var test_proto = ProtoBuf.loadProtoFile(__dirname + '/test_service.proto');
|
||||
var test_service = test_proto.lookup('TestService');
|
||||
var Client = grpc.load(__dirname + '/test_service.proto').TestService;
|
||||
var malformed_test_service = {
|
||||
unary: {
|
||||
path: '/TestService/Unary',
|
||||
|
@ -572,7 +565,6 @@ describe('Client malformed response handling', function() {
|
|||
}
|
||||
});
|
||||
var port = server.bind('localhost:0', server_insecure_creds);
|
||||
var Client = grpc.loadObject(test_service);
|
||||
client = new Client('localhost:' + port, grpc.credentials.createInsecure());
|
||||
server.start();
|
||||
});
|
||||
|
@ -621,8 +613,7 @@ describe('Server serialization failure handling', function() {
|
|||
var client;
|
||||
var server;
|
||||
before(function() {
|
||||
var test_proto = ProtoBuf.loadProtoFile(__dirname + '/test_service.proto');
|
||||
var test_service = test_proto.lookup('TestService');
|
||||
var Client = grpc.load(__dirname + '/test_service.proto').TestService;
|
||||
var malformed_test_service = {
|
||||
unary: {
|
||||
path: '/TestService/Unary',
|
||||
|
@ -679,7 +670,6 @@ describe('Server serialization failure handling', function() {
|
|||
}
|
||||
});
|
||||
var port = server.bind('localhost:0', server_insecure_creds);
|
||||
var Client = grpc.loadObject(test_service);
|
||||
client = new Client('localhost:' + port, grpc.credentials.createInsecure());
|
||||
server.start();
|
||||
});
|
||||
|
@ -727,9 +717,7 @@ describe('Other conditions', function() {
|
|||
var server;
|
||||
var port;
|
||||
before(function() {
|
||||
var test_proto = ProtoBuf.loadProtoFile(__dirname + '/test_service.proto');
|
||||
var test_service = test_proto.lookup('TestService');
|
||||
Client = grpc.loadObject(test_service);
|
||||
Client = grpc.load(__dirname + '/test_service.proto').TestService;
|
||||
server = new grpc.Server();
|
||||
var trailer_metadata = new grpc.Metadata();
|
||||
trailer_metadata.add('trailer-present', 'yes');
|
||||
|
@ -1084,10 +1072,8 @@ describe('Call propagation', function() {
|
|||
var client;
|
||||
var server;
|
||||
before(function() {
|
||||
var test_proto = ProtoBuf.loadProtoFile(__dirname + '/test_service.proto');
|
||||
var test_service = test_proto.lookup('TestService');
|
||||
Client = grpc.load(__dirname + '/test_service.proto').TestService;
|
||||
server = new grpc.Server();
|
||||
Client = grpc.loadObject(test_service);
|
||||
server.addService(Client.service, {
|
||||
unary: function(call) {},
|
||||
clientStream: function(stream) {},
|
||||
|
@ -1336,9 +1322,7 @@ describe('Client reconnect', function() {
|
|||
var client;
|
||||
var port;
|
||||
beforeEach(function() {
|
||||
var test_proto = ProtoBuf.loadProtoFile(__dirname + '/echo_service.proto');
|
||||
var echo_service = test_proto.lookup('EchoService');
|
||||
Client = grpc.loadObject(echo_service);
|
||||
Client = grpc.load(__dirname + '/echo_service.proto').EchoService;
|
||||
server = new grpc.Server();
|
||||
server.addService(Client.service, {
|
||||
echo: function(call, callback) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const _gulp = require('gulp');
|
||||
const help = require('gulp-help');
|
||||
const mocha = require('gulp-mocha');
|
||||
const exec = require('child_process').exec;
|
||||
const execa = require('execa');
|
||||
const path = require('path');
|
||||
|
||||
// gulp-help monkeypatches tasks to have an additional description parameter
|
||||
|
@ -10,10 +10,10 @@ const gulp = help(_gulp);
|
|||
const testDir = __dirname;
|
||||
const apiTestDir = path.resolve(testDir, 'api');
|
||||
|
||||
gulp.task('internal.test.link', 'Link local copies of grpc packages', (cb) => {
|
||||
return exec(`npm link ${testDir}/../packages/grpc-native-core`, cb);
|
||||
gulp.task('internal.test.link.add', 'Link local copies of grpc packages', () => {
|
||||
return execa('npm', ['link', 'grpc'], {cwd: testDir, stdio: 'inherit'});
|
||||
});
|
||||
|
||||
gulp.task('internal.test.test', 'Run API-level tests', ['internal.test.link'], () => {
|
||||
gulp.task('internal.test.test', 'Run API-level tests', () => {
|
||||
return gulp.src(`${apiTestDir}/*.js`).pipe(mocha());
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue