Skip to content

Commit 2bee736

Browse files
committed
tests: Re-work to use fetch not removed preq, per rebase
1 parent 7461e27 commit 2bee736

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

lib/heapwatch.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ const cluster = require( 'cluster' );
55
class HeapWatch {
66
constructor( conf, logger, metrics ) {
77
if ( metrics !== null ) {
8-
const prometheusOptions = metrics.options.find( ( option ) =>
9-
option.type === 'prometheus' && option.collect_default === true
8+
const prometheusOptions = metrics.options.find(
9+
( option ) => option.type === 'prometheus' && option.collect_default === true
1010
);
1111
// When true, a noop dummy metric will be instantiated
1212
// and passed down to a PrometheusClient instance.

lib/worker.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ class Worker extends BaseService {
119119
// For 0.10: npm install heapdump
120120
process.on( 'SIGUSR2', this._dumpHeapHandler = () => {
121121
try {
122-
// eslint-disable-next-line n/no-missing-require
123122
const heapdump = require( 'heapdump' );
124123
const cwd = process.cwd();
125124
console.error( 'SIGUSR2 received! Writing snapshot.' );

test/features/tests.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,13 @@ describe( 'service-runner tests', () => {
105105
const server = new TestServer( `${ __dirname }/../utils/simple_config_no_workers_collect_default.yaml` );
106106
const response = { status: null, body: null };
107107
return server.start()
108-
.then( () => {
109-
preq.get( { uri: 'http://127.0.0.1:9000' } )
110-
.then( ( res ) => {
108+
.then( async () => {
109+
// eslint-disable-next-line n/no-unsupported-features/node-builtins
110+
await fetch( 'http://127.0.0.1:9000' )
111+
.then( async ( res ) => {
111112
response.status = res.status;
112-
response.body = res.body;
113+
// This is a ReadableStream of a Uint8Array, but we just want the string
114+
response.body = new TextDecoder().decode( await res.arrayBuffer() );
113115
} );
114116
} )
115117
.delay( 1000 )
@@ -123,8 +125,6 @@ describe( 'service-runner tests', () => {
123125
.finally( () => server.stop() );
124126
} );
125127

126-
// preq prevents the AssertionErrors from surfacing and failing the test
127-
// performing the test this way presents them correctly
128128
it( 'Must increment hitcount metrics when hit, no workers', () => {
129129
const server = new TestServer( `${ __dirname }/../utils/simple_config_no_workers.yaml` );
130130
const response = { status: null, body: null };

0 commit comments

Comments
 (0)