polendina
Version:
Non-UI browser testing for JavaScript libraries from the command-line
17 lines (14 loc) • 662 B
JavaScript
/* globals WorkerGlobalScope ServiceWorkerGlobalScope */
import { assert } from 'chai'
export default async function () {
if (typeof ServiceWorkerGlobalScope !== 'undefined' && global instanceof ServiceWorkerGlobalScope) {
console.log('testing is in serviceworker')
assert.strictEqual(typeof ServiceWorkerGlobalScope, 'function')
} else if (typeof WorkerGlobalScope !== 'undefined' && global instanceof WorkerGlobalScope) {
console.log('testing is in worker')
assert.strictEqual(typeof WorkerGlobalScope, 'function')
} else {
console.log('testing is not in worker')
assert.strictEqual(typeof WorkerGlobalScope, 'undefined')
}
}