Skip to content
Prev Previous commit
Next Next commit
add hasCrypto check
  • Loading branch information
CGQAQ authored and aduh95 committed May 11, 2024
commit 26ff010a6429cf513b6d4be17ae2b89330635e76
11 changes: 9 additions & 2 deletions test/parallel/test-stream-readable-to-web.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
'use strict';
require('../common');

// https://github.com/nodejs/node/pull/25147/files
const hasCrypto = Boolean(process.versions.openssl);
if (!hasCrypto) {
process.exit(0);
}

const { Readable } = require('stream');
const process = require('process');
const { randomBytes } = require('crypto');
Expand All @@ -19,10 +26,10 @@ const assert = require('assert');
this.emit('error', err);
return;
}

// Push the random bytes to the stream
this.push(buffer);
});
});
}
});
// after 2 seconds, it'll get converted to web stream
Expand Down