Skip to content
This repository was archived by the owner on Apr 3, 2024. It is now read-only.

Inspector only enabled when specified#343

Merged
gaofanmichael merged 9 commits intogoogleapis:masterfrom
gaofanmichael:use-inspector
Oct 20, 2017
Merged

Inspector only enabled when specified#343
gaofanmichael merged 9 commits intogoogleapis:masterfrom
gaofanmichael:use-inspector

Conversation

@gaofanmichael
Copy link
Copy Markdown
Contributor

This PR ensures that inspector protocol will only be enabled if
environmental variable GCLOUD_USE_INSPECTOR is set.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Oct 18, 2017
const inspectorapi = require('./inspector-debugapi');
debugApiConstructor = inspectorapi.InspectorDebugApi;
} else {
if (process.env.GCLOUD_USE_INSPECTOR) {

This comment was marked as spam.

This comment was marked as spam.

bin/run-test.sh Outdated
# Run test/coverage
run build/test

node_version_major=$(node -v | sed 's/v\([0-9]*\)\.[0-9]*.[0-9]*/\1/')

This comment was marked as spam.

This comment was marked as spam.

test_windows.js Outdated
const nodeVersion = /v(\d+\.\d+\.\d+)/.exec(process.version);
if (!nodeVersion || nodeVersion.length < 2) {
console.error('unable to get node version');
} else if (semver.satisfies(nodeVersion[1], '>=8')) {

This comment was marked as spam.

This comment was marked as spam.

test_windows.js Outdated
var mocha = new Mocha();
var testDir = 'build/test';
fs.readdirSync(testDir).filter(function(file) {
return file.substr(-3) === '.js';

This comment was marked as spam.

This comment was marked as spam.

test_windows.js Outdated


var mocha = new Mocha();
var testDir = 'build/test';

This comment was marked as spam.

This comment was marked as spam.

test_windows.js Outdated

process.env.GCLOUD_PROJECT = 0
process.env.CLOUD_DEBUG_ASSERTIONS = 1

This comment was marked as spam.

This comment was marked as spam.

COULD_NOT_FIND_OUTPUT_FILE:
'Could not determine the output file associated with the transpiled input file'
'Could not determine the output file associated with the transpiled input file',
INSPECTOR_NOT_AVAILABLE: 'Inspector protocol only works for node 8+'

This comment was marked as spam.

This comment was marked as spam.

bin/run-test.sh Outdated
@@ -32,6 +32,14 @@ function run {
# Run test/coverage
run build/test

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

bin/run-test.sh Outdated
node_version_major=$(node -p "require('semver').major(process.version)")
if test $node_version_major -ge 8
then
echo 'Test with v8 Inspector'

This comment was marked as spam.

});
const logger = new common.logger({ levelLevel: config.logLevel } as any as LoggerOptions);

it('Verify the correct debugapi was constructed', (done) => {

This comment was marked as spam.

This comment was marked as spam.

});
const logger = new common.logger({ levelLevel: config.logLevel } as any as LoggerOptions);

it('Verify the correct debugapi was constructed', (done) => {

This comment was marked as spam.

This comment was marked as spam.

api = debugapi.create(logger, config, jsStats, mapper as SourceMapper.SourceMapper) as DebugApi;
if (process.env.GCLOUD_USE_INSPECTOR && semver.satisfies(process.version, '>=8')) {
const inspectorapi = require('../src/agent/v8/inspector-debugapi');
assert.ok(api instanceof inspectorapi.InspectorDebugApi);

This comment was marked as spam.

This comment was marked as spam.

test_windows.js Outdated
@@ -0,0 +1,19 @@
const spawn = require('child_process').spawn;

This comment was marked as spam.

This comment was marked as spam.

test_windows.js Outdated

process.env.GCLOUD_PROJECT = 0
process.env.CLOUD_DEBUG_ASSERTIONS = 1
spawn(path.join('node_modules', '.bin', 'mocha.cmd'),

This comment was marked as spam.

This comment was marked as spam.

test_windows.js Outdated
spawn(path.join('node_modules', '.bin', 'mocha.cmd'),
[ path.join('build', 'test'), '--timeout 4000', '--R' ], {
stdio : 'inherit'
}).on('close', function() {

This comment was marked as spam.

test_windows.js Outdated
console.log('Run test with Inspector');
spawn(path.join('node_modules', '.bin', 'mocha.cmd'),
[ path.join('build', 'test'), '--timeout 4000', '--R' ], {
stdio : 'inherit'

This comment was marked as spam.

@gaofanmichael gaofanmichael force-pushed the use-inspector branch 2 times, most recently from a3269ae to 8f660c0 Compare October 19, 2017 23:44
# run tests
- npm run build
- node_modules/.bin/mocha build/test --timeout 4000 --R
- SET GCLOUD_USE_INSPECTOR=1

This comment was marked as spam.

@gaofanmichael gaofanmichael force-pushed the use-inspector branch 2 times, most recently from 45f70c9 to 28a449f Compare October 20, 2017 17:21
const logger = new common.logger({ levelLevel: config.logLevel } as any as LoggerOptions);
let warnIsCalled = false;
logger.warn = function(_s: string) {
warnIsCalled = true;

This comment was marked as spam.

appveyor.yml Outdated
matrix:
# node.js
- nodejs_version: "4"

This comment was marked as spam.

This PR ensures that inspector protocol will only be enabled if
environmental variable GCLOUD_USE_INSPECTOR is set.
@gaofanmichael gaofanmichael force-pushed the use-inspector branch 2 times, most recently from 8196ec3 to 18b09ef Compare October 20, 2017 22:07
Copy link
Copy Markdown
Contributor

@kjin kjin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM w/ minor comments. We should add a note about this in the README... though it's fine to leave that for the next PR.

bin/run-test.sh Outdated
@@ -32,6 +32,14 @@ function run {
# Run test/coverage
run build/test

This comment was marked as spam.

const dummyapi = require('./dummy-debugapi');
debugApiConstructor = dummyapi.DummyDebugApi;
} else if (semver.satisfies(nodeVersion[1], '>=8')) {
if (semver.satisfies(process.version, '>=8') &&

This comment was marked as spam.

This comment was marked as spam.

@gaofanmichael gaofanmichael merged commit c15872d into googleapis:master Oct 20, 2017
@gaofanmichael gaofanmichael deleted the use-inspector branch October 20, 2017 23:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants