Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
test: remove common.hasTracing
`common.hasTracing` is only used in one place. `common` is bloated so
let's move that to the one test that uses it.

`hasTracing` is undocumented so there's no need to remove it from the
README file as it's not there in the first place.

Similarly, it's not included in the .mjs version of the `common` file.
  • Loading branch information
Trott committed Aug 10, 2018
commit fd39bbb55dc944ac603b466de2b47cfd5b54d9e7
7 changes: 0 additions & 7 deletions test/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const os = require('os');
const { exec, execSync, spawn, spawnSync } = require('child_process');
const stream = require('stream');
const util = require('util');
const { hasTracing } = process.binding('config');
const { fixturesDir } = require('./fixtures');
const tmpdir = require('./tmpdir');

Expand Down Expand Up @@ -226,12 +225,6 @@ Object.defineProperty(exports, 'hasCrypto', {
}
});

Object.defineProperty(exports, 'hasTracing', {
get: function() {
return Boolean(hasTracing);
}
});

Object.defineProperty(exports, 'hasFipsCrypto', {
get: function() {
return exports.hasCrypto && require('crypto').fips;
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-trace-events-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

const common = require('../common');

if (!common.hasTracing)
if (!process.binding('config').hasTracing)
Copy link
Copy Markdown
Member

@jasnell jasnell Aug 10, 2018

Choose a reason for hiding this comment

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

This could likely be modified to simply attempt to require('trace_events'), which will throw if tracing is not enabled...

let trace_events;
try {
  trace_events = require('trace_events');
} catch (err) {
  common.skip('missing trace events');
}
// ...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't oppose such a modification, but if given the choice, I'd prefer to keep this a simple migrate-the-existing-thing-into-the-one-test-that-uses-it and have any modifications to the-existing-thing happen in a subsequent PR.

common.skip('missing trace events');
if (!common.isMainThread)
common.skip('process.chdir is not available in Workers');
Expand Down