polendina 1.1.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/dependabot.yml +154 -0
- package/CHANGELOG.md +18 -0
- package/lib/log.js +8 -8
- package/lib/puppeteer.js +3 -5
- package/lib/webpack.config.js +8 -12
- package/lib/{wrap-loader.js → wrap-loader.cjs} +9 -6
- package/package.json +17 -13
- package/polendina-cli.js +7 -6
- package/polendina-node-cli.js +10 -6
- package/polendina.js +43 -21
- package/resources/bare-run.js +3 -3
- package/resources/bare.js +7 -5
- package/resources/common-run.js +23 -26
- package/resources/mocha-run.js +4 -5
- package/resources/tape-run.js +5 -5
- package/resources/test-registry.js +4 -1
- package/test/common.js +8 -8
- package/test/fixtures/bare-async/package.json +4 -1
- package/test/fixtures/bare-async/test-1.js +1 -1
- package/test/fixtures/bare-async/test-2.js +1 -1
- package/test/fixtures/bare-async-esm/index.js +3 -0
- package/test/fixtures/bare-async-esm/package.json +19 -0
- package/test/fixtures/bare-async-esm/test-1.js +16 -0
- package/test/fixtures/bare-async-esm/test-2.js +11 -0
- package/test/fixtures/bare-async-failure/package.json +4 -1
- package/test/fixtures/bare-async-failure/test-1.js +1 -1
- package/test/fixtures/bare-async-failure/test-2.js +2 -2
- package/test/fixtures/bare-async-failure-esm/index.js +3 -0
- package/test/fixtures/bare-async-failure-esm/package.json +19 -0
- package/test/fixtures/bare-async-failure-esm/test-1.js +16 -0
- package/test/fixtures/bare-async-failure-esm/test-2.js +11 -0
- package/test/fixtures/bare-sync/package.json +4 -1
- package/test/fixtures/bare-sync/test-1.js +1 -1
- package/test/fixtures/bare-sync/test-2.js +2 -1
- package/test/fixtures/bare-sync-esm/index.js +1 -0
- package/test/fixtures/bare-sync-esm/package.json +19 -0
- package/test/fixtures/bare-sync-esm/test-1.js +14 -0
- package/test/fixtures/bare-sync-esm/test-2.js +7 -0
- package/test/fixtures/bare-sync-failure/package.json +4 -1
- package/test/fixtures/bare-sync-failure/test-1.js +1 -1
- package/test/fixtures/bare-sync-failure/test-2.js +2 -2
- package/test/fixtures/bare-sync-failure-esm/index.js +1 -0
- package/test/fixtures/bare-sync-failure-esm/package.json +19 -0
- package/test/fixtures/bare-sync-failure-esm/test-1.js +14 -0
- package/test/fixtures/bare-sync-failure-esm/test-2.js +6 -0
- package/test/fixtures/mocha/package.json +2 -1
- package/test/fixtures/mocha/test-1.js +1 -1
- package/test/fixtures/mocha/test-2.js +1 -1
- package/test/fixtures/mocha/test-3.js +1 -1
- package/test/fixtures/mocha-esm/index.js +1 -0
- package/test/fixtures/{mocha8 → mocha-esm}/package.json +4 -2
- package/test/fixtures/{mocha8 → mocha-esm}/test-1.js +2 -2
- package/test/fixtures/{mocha8 → mocha-esm}/test-2.js +1 -1
- package/test/fixtures/{mocha8 → mocha-esm}/test-3.js +2 -2
- package/test/fixtures/mocha-failure/package.json +2 -1
- package/test/fixtures/mocha-failure/test.js +1 -1
- package/test/fixtures/mocha-failure-esm/package.json +20 -0
- package/test/fixtures/mocha-failure-esm/test.js +24 -0
- package/test/fixtures/tape/package.json +1 -1
- package/test/fixtures/tape-esm/index.js +1 -0
- package/test/fixtures/tape-esm/package.json +19 -0
- package/test/fixtures/tape-esm/test.js +47 -0
- package/test/fixtures/tape-failure/package.json +1 -1
- package/test/fixtures/tape-failure-esm/package.json +19 -0
- package/test/fixtures/tape-failure-esm/test.js +29 -0
- package/test/fixtures/webpack-merge/package.json +4 -1
- package/test/fixtures/webpack-merge/test.js +3 -4
- package/test/fixtures/webpack-merge/webpack.config.js +3 -3
- package/test/test-bare-async.js +92 -87
- package/test/test-bare-sync.js +92 -87
- package/test/test-mocha.js +101 -96
- package/test/test-polendina-node.js +44 -38
- package/test/test-tape.js +95 -90
- package/test/test-webpack-merge.js +11 -9
- package/test/fixtures/mocha8/index.js +0 -1
package/resources/common-run.js
CHANGED
|
@@ -1,51 +1,53 @@
|
|
|
1
1
|
/* globals WorkerGlobalScope ServiceWorkerGlobalScope clients */
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { registry } from './test-registry.js'
|
|
4
|
+
|
|
4
5
|
const inPage =
|
|
5
6
|
typeof window !== 'undefined' &&
|
|
6
7
|
window.location &&
|
|
7
8
|
typeof WorkerGlobalScope === 'undefined'
|
|
8
9
|
const inServiceWorker = !inPage &&
|
|
9
10
|
typeof ServiceWorkerGlobalScope !== 'undefined' &&
|
|
10
|
-
|
|
11
|
+
globalThis instanceof ServiceWorkerGlobalScope
|
|
11
12
|
const inWorker = !inPage && !inServiceWorker &&
|
|
12
13
|
typeof WorkerGlobalScope !== 'undefined' &&
|
|
13
|
-
|
|
14
|
+
globalThis instanceof WorkerGlobalScope
|
|
14
15
|
let _executionQueue = Promise.resolve()
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
export { registry }
|
|
18
|
+
export function executionQueue (fn) {
|
|
17
19
|
_executionQueue = _executionQueue.then(fn)
|
|
18
20
|
return _executionQueue
|
|
19
21
|
}
|
|
20
22
|
|
|
21
|
-
const log = {
|
|
23
|
+
export const log = {
|
|
22
24
|
info: (...args) => {
|
|
23
|
-
executionQueue(() =>
|
|
25
|
+
executionQueue(() => globalThis.polendinaLog(['info'].concat(args)))
|
|
24
26
|
return executionQueue
|
|
25
27
|
},
|
|
26
28
|
// TODO
|
|
27
29
|
warn: (...args) => {
|
|
28
|
-
executionQueue(() =>
|
|
30
|
+
executionQueue(() => globalThis.polendinaLog(['warn'].concat(args)))
|
|
29
31
|
return executionQueue
|
|
30
32
|
},
|
|
31
33
|
// TODO
|
|
32
34
|
error: (...args) => {
|
|
33
|
-
executionQueue(() =>
|
|
35
|
+
executionQueue(() => globalThis.polendinaLog(['error'].concat(args)))
|
|
34
36
|
return executionQueue
|
|
35
37
|
}
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
function setupWorkerGlobals () {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
globalThis.polendinaLog = async function (...args) {
|
|
42
|
+
globalThis.postMessage(['polendinaLog'].concat(args))
|
|
41
43
|
}
|
|
42
44
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
globalThis.polendinaWrite = async function (...args) {
|
|
46
|
+
globalThis.postMessage(['polendinaWrite'].concat(args))
|
|
45
47
|
}
|
|
46
48
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
globalThis.polendinaEnd = async function (...args) {
|
|
50
|
+
globalThis.postMessage(['polendinaEnd'].concat(args))
|
|
49
51
|
}
|
|
50
52
|
}
|
|
51
53
|
|
|
@@ -56,15 +58,15 @@ function setupServiceWorkerGlobals () {
|
|
|
56
58
|
}
|
|
57
59
|
}
|
|
58
60
|
|
|
59
|
-
|
|
61
|
+
globalThis.polendinaLog = async function (...args) {
|
|
60
62
|
_postMessage(['polendinaLog'].concat(args))
|
|
61
63
|
}
|
|
62
64
|
|
|
63
|
-
|
|
65
|
+
globalThis.polendinaWrite = async function (...args) {
|
|
64
66
|
_postMessage(['polendinaWrite'].concat(args))
|
|
65
67
|
}
|
|
66
68
|
|
|
67
|
-
|
|
69
|
+
globalThis.polendinaEnd = async function (...args) {
|
|
68
70
|
_postMessage(['polendinaEnd'].concat(args))
|
|
69
71
|
}
|
|
70
72
|
}
|
|
@@ -77,7 +79,7 @@ function setupLogging () {
|
|
|
77
79
|
// process.stdout.write() to console.log()
|
|
78
80
|
// so we strip out the extra \n that necessarily inserts
|
|
79
81
|
// args[0] = args[0].replace(/\n$/, '')
|
|
80
|
-
executionQueue(() =>
|
|
82
|
+
executionQueue(() => globalThis.polendinaWrite(args))
|
|
81
83
|
return
|
|
82
84
|
}
|
|
83
85
|
} catch (err) {}
|
|
@@ -89,13 +91,13 @@ function setupLogging () {
|
|
|
89
91
|
console.error = log.error
|
|
90
92
|
}
|
|
91
93
|
|
|
92
|
-
async function setup () {
|
|
94
|
+
export async function setup () {
|
|
93
95
|
if (inWorker) {
|
|
94
96
|
setupWorkerGlobals()
|
|
95
97
|
} else if (inServiceWorker) {
|
|
96
98
|
await new Promise((resolve, reject) => {
|
|
97
|
-
|
|
98
|
-
event.waitUntil(
|
|
99
|
+
globalThis.addEventListener('activate', (event) => {
|
|
100
|
+
event.waitUntil(globalThis.clients.claim())
|
|
99
101
|
setupServiceWorkerGlobals()
|
|
100
102
|
resolve()
|
|
101
103
|
})
|
|
@@ -104,8 +106,3 @@ async function setup () {
|
|
|
104
106
|
|
|
105
107
|
setupLogging()
|
|
106
108
|
}
|
|
107
|
-
|
|
108
|
-
module.exports.executionQueue = executionQueue
|
|
109
|
-
module.exports.registry = registry
|
|
110
|
-
module.exports.log = log
|
|
111
|
-
module.exports.setup = setup
|
package/resources/mocha-run.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
// in-browser setup and runner for Mocha, at end of bundle
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import mochaExport from 'mocha/mocha-es2018.js'
|
|
4
|
+
import { registry, executionQueue, log, setup } from './common-run.js'
|
|
5
5
|
|
|
6
6
|
function runMocha () {
|
|
7
7
|
// mocha@8 exports what we want, mocha@7 sets a global
|
|
8
|
-
const mochaLocal =
|
|
9
|
-
global._mocha = mochaLocal
|
|
8
|
+
const mochaLocal = mochaExport
|
|
10
9
|
mochaLocal.setup({ reporter: registry.argv.mochaReporter, ui: 'bdd' })
|
|
11
10
|
// mocha@7 deprecated useColors()
|
|
12
11
|
if (typeof mochaLocal.color === 'function') {
|
|
@@ -26,7 +25,7 @@ function runMocha () {
|
|
|
26
25
|
mochaLocal
|
|
27
26
|
.run((_errors) => { errors = _errors })
|
|
28
27
|
.on('end', (...args) => {
|
|
29
|
-
executionQueue(() =>
|
|
28
|
+
executionQueue(() => globalThis.polendinaEnd(errors))
|
|
30
29
|
})
|
|
31
30
|
}
|
|
32
31
|
|
package/resources/tape-run.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// in-browser setup and runner for Tape, at end of bundle
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import tape from 'tape'
|
|
4
|
+
import { registry, setup, executionQueue } from './common-run.js'
|
|
5
|
+
import { Transform } from 'stream'
|
|
5
6
|
|
|
6
7
|
function runTape () {
|
|
7
|
-
const { Transform } = require('stream')
|
|
8
8
|
let failures = 0
|
|
9
9
|
|
|
10
10
|
const stream = new Transform({
|
|
11
11
|
transform (chunk, encoding, callback) {
|
|
12
12
|
executionQueue(() => {
|
|
13
|
-
|
|
13
|
+
globalThis.polendinaWrite(chunk.toString())
|
|
14
14
|
.catch(callback)
|
|
15
15
|
.then(callback)
|
|
16
16
|
})
|
|
@@ -18,7 +18,7 @@ function runTape () {
|
|
|
18
18
|
|
|
19
19
|
flush (callback) {
|
|
20
20
|
executionQueue(() => {
|
|
21
|
-
|
|
21
|
+
globalThis.polendinaEnd(failures)
|
|
22
22
|
.catch(callback)
|
|
23
23
|
.then(callback)
|
|
24
24
|
})
|
package/test/common.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import path from 'path'
|
|
2
|
+
import assert from 'assert'
|
|
3
|
+
import { execFile } from 'child_process'
|
|
4
|
+
import { fileURLToPath } from 'url'
|
|
5
|
+
|
|
6
|
+
const __dirname = fileURLToPath(path.dirname(import.meta.url))
|
|
4
7
|
const cli = path.join(__dirname, '../polendina-cli.js')
|
|
5
8
|
|
|
6
|
-
async function runCli (cwd, args) {
|
|
9
|
+
export async function runCli (cwd, args) {
|
|
7
10
|
return runCommand(`${cli} test*.js --cleanup ${args || ''}`, cwd)
|
|
8
11
|
}
|
|
9
12
|
|
|
10
|
-
async function runCommand (command, cwd) {
|
|
13
|
+
export async function runCommand (command, cwd) {
|
|
11
14
|
return new Promise((resolve, reject) => {
|
|
12
15
|
const args = command.split(' ').filter(Boolean)
|
|
13
16
|
execFile(process.execPath, args, { cwd }, (err, stdout, stderr) => {
|
|
@@ -23,6 +26,3 @@ async function runCommand (command, cwd) {
|
|
|
23
26
|
})
|
|
24
27
|
})
|
|
25
28
|
}
|
|
26
|
-
|
|
27
|
-
module.exports.runCli = runCli
|
|
28
|
-
module.exports.runCommand = runCommand
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* globals WorkerGlobalScope ServiceWorkerGlobalScope */
|
|
2
2
|
|
|
3
|
-
const assert = require('
|
|
3
|
+
const { assert } = require('chai')
|
|
4
4
|
|
|
5
5
|
module.exports = async function () {
|
|
6
6
|
if (typeof ServiceWorkerGlobalScope !== 'undefined' && global instanceof ServiceWorkerGlobalScope) {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "fixture-bare-async",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "test fixture",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "node test-1.js && node test-2.js"
|
|
9
|
+
},
|
|
10
|
+
"author": "Rod <rod@vagg.org> (http://r.va.gg/)",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/rvagg/polendina.git"
|
|
14
|
+
},
|
|
15
|
+
"license": "Apache-2.0",
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"chai": "^4.3.4"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* globals WorkerGlobalScope ServiceWorkerGlobalScope */
|
|
2
|
+
|
|
3
|
+
import { assert } from 'chai'
|
|
4
|
+
|
|
5
|
+
export default async function () {
|
|
6
|
+
if (typeof ServiceWorkerGlobalScope !== 'undefined' && global instanceof ServiceWorkerGlobalScope) {
|
|
7
|
+
console.log('testing is in serviceworker')
|
|
8
|
+
assert.strictEqual(typeof ServiceWorkerGlobalScope, 'function')
|
|
9
|
+
} else if (typeof WorkerGlobalScope !== 'undefined' && global instanceof WorkerGlobalScope) {
|
|
10
|
+
console.log('testing is in worker')
|
|
11
|
+
assert.strictEqual(typeof WorkerGlobalScope, 'function')
|
|
12
|
+
} else {
|
|
13
|
+
console.log('testing is not in worker')
|
|
14
|
+
assert.strictEqual(typeof WorkerGlobalScope, 'undefined')
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { assert } from 'chai'
|
|
2
|
+
import index from './index.js'
|
|
3
|
+
|
|
4
|
+
export async function test1 () {
|
|
5
|
+
console.log('testing bare fixture')
|
|
6
|
+
assert.strictEqual(await index(), 'bare test fixture')
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export async function test2 () {
|
|
10
|
+
assert.ok(true, 'yep')
|
|
11
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* globals WorkerGlobalScope ServiceWorkerGlobalScope */
|
|
2
2
|
|
|
3
|
-
const assert = require('
|
|
3
|
+
const { assert } = require('chai')
|
|
4
4
|
|
|
5
5
|
module.exports = async function () {
|
|
6
6
|
if (typeof ServiceWorkerGlobalScope !== 'undefined' && global instanceof ServiceWorkerGlobalScope) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const assert = require('
|
|
1
|
+
const { assert } = require('chai')
|
|
2
2
|
const index = require('./')
|
|
3
3
|
|
|
4
4
|
module.exports.test1 = async function () {
|
|
@@ -7,5 +7,5 @@ module.exports.test1 = async function () {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
module.exports.test2 = async function () {
|
|
10
|
-
assert.fail('
|
|
10
|
+
assert.fail('faily mcfailface')
|
|
11
11
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "fixture-bare-async-failure",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "test fixture",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "node test-1.js && node test-2.js"
|
|
9
|
+
},
|
|
10
|
+
"author": "Rod <rod@vagg.org> (http://r.va.gg/)",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/rvagg/polendina.git"
|
|
14
|
+
},
|
|
15
|
+
"license": "Apache-2.0",
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"chai": "^4.3.4"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* globals WorkerGlobalScope ServiceWorkerGlobalScope */
|
|
2
|
+
|
|
3
|
+
import { assert } from 'chai'
|
|
4
|
+
|
|
5
|
+
export default async function () {
|
|
6
|
+
if (typeof ServiceWorkerGlobalScope !== 'undefined' && global instanceof ServiceWorkerGlobalScope) {
|
|
7
|
+
console.log('testing is in serviceworker')
|
|
8
|
+
assert.strictEqual(typeof ServiceWorkerGlobalScope, 'function')
|
|
9
|
+
} else if (typeof WorkerGlobalScope !== 'undefined' && global instanceof WorkerGlobalScope) {
|
|
10
|
+
console.log('testing is in worker')
|
|
11
|
+
assert.strictEqual(typeof WorkerGlobalScope, 'function')
|
|
12
|
+
} else {
|
|
13
|
+
console.log('testing is not in worker')
|
|
14
|
+
assert.strictEqual(typeof WorkerGlobalScope, 'undefined')
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { assert } from 'chai'
|
|
2
|
+
import index from './index.js'
|
|
3
|
+
|
|
4
|
+
export async function test1 () {
|
|
5
|
+
console.log('testing bare fixture')
|
|
6
|
+
assert.strictEqual(await index(), 'bare test fixture')
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export async function test2 () {
|
|
10
|
+
assert.fail('faily mcfailface')
|
|
11
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* globals WorkerGlobalScope ServiceWorkerGlobalScope */
|
|
2
2
|
|
|
3
|
-
const assert = require('
|
|
3
|
+
const { assert } = require('chai')
|
|
4
4
|
|
|
5
5
|
if (typeof ServiceWorkerGlobalScope !== 'undefined' && global instanceof ServiceWorkerGlobalScope) {
|
|
6
6
|
console.log('testing is in serviceworker')
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default 'bare test fixture'
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "fixture-bare-sync",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "test fixture",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "node test-1.js && node test-2.js"
|
|
9
|
+
},
|
|
10
|
+
"author": "Rod <rod@vagg.org> (http://r.va.gg/)",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/rvagg/polendina.git"
|
|
14
|
+
},
|
|
15
|
+
"license": "Apache-2.0",
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"chai": "^4.3.4"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* globals WorkerGlobalScope ServiceWorkerGlobalScope */
|
|
2
|
+
|
|
3
|
+
import { assert } from 'chai'
|
|
4
|
+
|
|
5
|
+
if (typeof ServiceWorkerGlobalScope !== 'undefined' && global instanceof ServiceWorkerGlobalScope) {
|
|
6
|
+
console.log('testing is in serviceworker')
|
|
7
|
+
assert.strictEqual(typeof ServiceWorkerGlobalScope, 'function')
|
|
8
|
+
} else if (typeof WorkerGlobalScope !== 'undefined' && global instanceof WorkerGlobalScope) {
|
|
9
|
+
console.log('testing is in worker')
|
|
10
|
+
assert.strictEqual(typeof WorkerGlobalScope, 'function')
|
|
11
|
+
} else {
|
|
12
|
+
console.log('testing is not in worker')
|
|
13
|
+
assert.strictEqual(typeof WorkerGlobalScope, 'undefined')
|
|
14
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* globals WorkerGlobalScope ServiceWorkerGlobalScope */
|
|
2
2
|
|
|
3
|
-
const assert = require('
|
|
3
|
+
const { assert } = require('chai')
|
|
4
4
|
|
|
5
5
|
if (typeof ServiceWorkerGlobalScope !== 'undefined' && global instanceof ServiceWorkerGlobalScope) {
|
|
6
6
|
console.log('testing is in serviceworker')
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default 'bare test fixture'
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "fixture-bare-sync-failure",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "test fixture",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "node test-1.js && node test-2.js"
|
|
9
|
+
},
|
|
10
|
+
"author": "Rod <rod@vagg.org> (http://r.va.gg/)",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/rvagg/polendina.git"
|
|
14
|
+
},
|
|
15
|
+
"license": "Apache-2.0",
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"chai": "^4.3.4"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* globals WorkerGlobalScope ServiceWorkerGlobalScope */
|
|
2
|
+
|
|
3
|
+
import { assert } from 'chai'
|
|
4
|
+
|
|
5
|
+
if (typeof ServiceWorkerGlobalScope !== 'undefined' && global instanceof ServiceWorkerGlobalScope) {
|
|
6
|
+
console.log('testing is in serviceworker')
|
|
7
|
+
assert.strictEqual(typeof ServiceWorkerGlobalScope, 'function')
|
|
8
|
+
} else if (typeof WorkerGlobalScope !== 'undefined' && global instanceof WorkerGlobalScope) {
|
|
9
|
+
console.log('testing is in worker')
|
|
10
|
+
assert.strictEqual(typeof WorkerGlobalScope, 'function')
|
|
11
|
+
} else {
|
|
12
|
+
console.log('testing is not in worker')
|
|
13
|
+
assert.strictEqual(typeof WorkerGlobalScope, 'undefined')
|
|
14
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* globals describe it WorkerGlobalScope ServiceWorkerGlobalScope */
|
|
2
2
|
|
|
3
|
-
const assert = require('
|
|
3
|
+
const { assert } = require('chai')
|
|
4
4
|
|
|
5
5
|
describe('test suite 2 - worker', () => {
|
|
6
6
|
if (typeof ServiceWorkerGlobalScope !== 'undefined' && global instanceof ServiceWorkerGlobalScope) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default 'polendina test'
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "fixture-
|
|
2
|
+
"name": "fixture-mocha",
|
|
3
3
|
"version": "1.0.0",
|
|
4
4
|
"description": "test-fixture",
|
|
5
5
|
"main": "index.js",
|
|
6
|
+
"type": "module",
|
|
6
7
|
"scripts": {
|
|
7
8
|
"test": "mocha test-*.js"
|
|
8
9
|
},
|
|
@@ -13,6 +14,7 @@
|
|
|
13
14
|
"url": "https://github.com/rvagg/polendina.git"
|
|
14
15
|
},
|
|
15
16
|
"devDependencies": {
|
|
16
|
-
"
|
|
17
|
+
"chai": "^4.3.4",
|
|
18
|
+
"mocha": "~9.1.3"
|
|
17
19
|
}
|
|
18
20
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* globals describe it WorkerGlobalScope ServiceWorkerGlobalScope */
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { assert } from 'chai'
|
|
4
4
|
|
|
5
5
|
describe('test suite 2 - worker', () => {
|
|
6
6
|
if (typeof ServiceWorkerGlobalScope !== 'undefined' && global instanceof ServiceWorkerGlobalScope) {
|