Skip to content

Commit

Permalink
only test workers
Browse files Browse the repository at this point in the history
  • Loading branch information
petebacondarwin committed Jun 10, 2024
1 parent e2aa8fb commit 726c9cb
Show file tree
Hide file tree
Showing 123 changed files with 3 additions and 7,834 deletions.
7 changes: 3 additions & 4 deletions packages/pg/lib/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,17 @@ module.exports.getSecureStream = function getSecureStream(options) {
* @returns true if the code is currently running inside a Cloudflare Worker.
*/
function computeIsCloudflareRuntime() {
process.env.TESTXXX && console.log('computeIsCloudflareRuntime')
console.error('computeIsCloudflareRuntime')
// Since 2022-03-21 the `global_navigator` compatibility flag is on for Cloudflare Workers
// which means that `navigator.userAgent` will be defined.
if (typeof navigator === 'object' && navigator !== null && typeof navigator.userAgent === 'string') {
process.env.TESTXXX && console.log('navigator.userAgent', navigator.userAgent)
console.error('navigator.userAgent', navigator.userAgent)
return navigator.userAgent === 'Cloudflare Workers'
}
// In case `navigator` or `navigator.userAgent` is not defined then try a more sneaky approach
if (typeof Response === 'function') {
const resp = new Response(null, { cf: { thing: true } })
process.env.TESTXXX &&
console.log('Response object', typeof resp.cf === 'object' && resp.cf !== null && resp.cf.thing)
console.error('Response object', typeof resp.cf === 'object' && resp.cf !== null && resp.cf.thing)
if (typeof resp.cf === 'object' && resp.cf !== null && resp.cf.thing) {
return true
}
Expand Down
259 changes: 0 additions & 259 deletions packages/pg/test/integration/client/api-tests.js

This file was deleted.

97 changes: 0 additions & 97 deletions packages/pg/test/integration/client/appname-tests.js

This file was deleted.

Loading

0 comments on commit 726c9cb

Please sign in to comment.