polendina 1.0.0 → 2.0.0-alpha

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.
Files changed (75) hide show
  1. package/.github/dependabot.yml +154 -0
  2. package/.github/workflows/test-and-release.yml +61 -0
  3. package/lib/log.js +8 -8
  4. package/lib/puppeteer.js +6 -5
  5. package/lib/webpack.config.js +15 -18
  6. package/lib/{wrap-loader.js → wrap-loader.cjs} +10 -7
  7. package/package.json +99 -18
  8. package/polendina-cli.js +7 -6
  9. package/polendina-node-cli.js +10 -6
  10. package/polendina.js +45 -19
  11. package/resources/bare-run.js +3 -3
  12. package/resources/bare.js +7 -5
  13. package/resources/common-run.js +23 -26
  14. package/resources/mocha-run.js +12 -12
  15. package/resources/tape-run.js +5 -5
  16. package/resources/test-registry.js +4 -1
  17. package/test/common.js +8 -8
  18. package/test/fixtures/bare-async/package.json +4 -1
  19. package/test/fixtures/bare-async/test-1.js +1 -1
  20. package/test/fixtures/bare-async/test-2.js +1 -1
  21. package/test/fixtures/bare-async-esm/index.js +3 -0
  22. package/test/fixtures/bare-async-esm/package.json +19 -0
  23. package/test/fixtures/bare-async-esm/test-1.js +16 -0
  24. package/test/fixtures/bare-async-esm/test-2.js +11 -0
  25. package/test/fixtures/bare-async-failure/package.json +4 -1
  26. package/test/fixtures/bare-async-failure/test-1.js +1 -1
  27. package/test/fixtures/bare-async-failure/test-2.js +2 -2
  28. package/test/fixtures/bare-async-failure-esm/index.js +3 -0
  29. package/test/fixtures/bare-async-failure-esm/package.json +19 -0
  30. package/test/fixtures/bare-async-failure-esm/test-1.js +16 -0
  31. package/test/fixtures/bare-async-failure-esm/test-2.js +11 -0
  32. package/test/fixtures/bare-sync/package.json +4 -1
  33. package/test/fixtures/bare-sync/test-1.js +1 -1
  34. package/test/fixtures/bare-sync/test-2.js +2 -1
  35. package/test/fixtures/bare-sync-esm/index.js +1 -0
  36. package/test/fixtures/bare-sync-esm/package.json +19 -0
  37. package/test/fixtures/bare-sync-esm/test-1.js +14 -0
  38. package/test/fixtures/bare-sync-esm/test-2.js +7 -0
  39. package/test/fixtures/bare-sync-failure/package.json +4 -1
  40. package/test/fixtures/bare-sync-failure/test-1.js +1 -1
  41. package/test/fixtures/bare-sync-failure/test-2.js +2 -2
  42. package/test/fixtures/bare-sync-failure-esm/index.js +1 -0
  43. package/test/fixtures/bare-sync-failure-esm/package.json +19 -0
  44. package/test/fixtures/bare-sync-failure-esm/test-1.js +14 -0
  45. package/test/fixtures/bare-sync-failure-esm/test-2.js +6 -0
  46. package/test/fixtures/mocha/package.json +2 -1
  47. package/test/fixtures/mocha/test-1.js +1 -1
  48. package/test/fixtures/mocha/test-2.js +1 -1
  49. package/test/fixtures/mocha/test-3.js +1 -1
  50. package/test/fixtures/mocha-esm/index.js +1 -0
  51. package/test/fixtures/mocha-esm/package.json +20 -0
  52. package/test/fixtures/mocha-esm/test-1.js +14 -0
  53. package/test/fixtures/mocha-esm/test-2.js +19 -0
  54. package/test/fixtures/mocha-esm/test-3.js +14 -0
  55. package/test/fixtures/mocha-failure/package.json +2 -1
  56. package/test/fixtures/mocha-failure/test.js +1 -1
  57. package/test/fixtures/mocha-failure-esm/package.json +20 -0
  58. package/test/fixtures/mocha-failure-esm/test.js +24 -0
  59. package/test/fixtures/tape/package.json +1 -1
  60. package/test/fixtures/tape-esm/index.js +1 -0
  61. package/test/fixtures/tape-esm/package.json +19 -0
  62. package/test/fixtures/tape-esm/test.js +47 -0
  63. package/test/fixtures/tape-failure/package.json +1 -1
  64. package/test/fixtures/tape-failure-esm/package.json +19 -0
  65. package/test/fixtures/tape-failure-esm/test.js +29 -0
  66. package/test/fixtures/webpack-merge/package.json +4 -1
  67. package/test/fixtures/webpack-merge/test.js +3 -4
  68. package/test/fixtures/webpack-merge/webpack.config.js +3 -3
  69. package/test/test-bare-async.js +92 -87
  70. package/test/test-bare-sync.js +92 -87
  71. package/test/test-mocha.js +101 -96
  72. package/test/test-polendina-node.js +44 -38
  73. package/test/test-tape.js +99 -94
  74. package/test/test-webpack-merge.js +11 -9
  75. package/.github/workflows/main.yml +0 -21
@@ -1,10 +1,10 @@
1
1
  // in-browser test runner for bare-sync and bare-async, at end of bundle
2
2
 
3
- const { registry, executionQueue, log, setup } = require('./common-run')
4
- const BareRunner = require('./bare')
3
+ import { registry, executionQueue, log, setup } from './common-run.js'
4
+ import { BareRunner } from './bare.js'
5
5
 
6
6
  setup().then(async () => {
7
7
  const runner = new BareRunner(log, registry.tests)
8
8
  const errors = await runner[registry.argv.runner === 'bare-sync' ? 'runBareSync' : 'runBareAsync']()
9
- executionQueue(() => global.polendinaEnd(errors ? 1 : 0))
9
+ executionQueue(() => globalThis.polendinaEnd(errors ? 1 : 0))
10
10
  })
package/resources/bare.js CHANGED
@@ -1,4 +1,4 @@
1
- class BareRunner {
1
+ export class BareRunner {
2
2
  constructor (log, tests) {
3
3
  this.log = log
4
4
  this.tests = tests
@@ -36,13 +36,17 @@ class BareRunner {
36
36
 
37
37
  async runBareAsync () {
38
38
  return this.runBare(async (mod) => {
39
- const exp = mod.load()
39
+ const exp = await mod.load()
40
40
  if (typeof exp === 'function') {
41
41
  return this.execBare(mod.name, exp)
42
42
  }
43
+ const expn = Object.keys(exp)
44
+ if (expn.length === 1 && expn[0] === 'default' && typeof exp.default === 'function') {
45
+ return this.execBare(mod.name, exp.default)
46
+ }
43
47
  await this.log.info(` ${mod.name}`)
44
48
  let found = false
45
- for (const name in exp) {
49
+ for (const name of expn) {
46
50
  const fn = exp[name]
47
51
  if (typeof fn === 'function') {
48
52
  found = true
@@ -55,5 +59,3 @@ class BareRunner {
55
59
  })
56
60
  }
57
61
  }
58
-
59
- module.exports = BareRunner
@@ -1,51 +1,53 @@
1
1
  /* globals WorkerGlobalScope ServiceWorkerGlobalScope clients */
2
2
 
3
- const registry = require('./test-registry')
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
- global instanceof ServiceWorkerGlobalScope
11
+ globalThis instanceof ServiceWorkerGlobalScope
11
12
  const inWorker = !inPage && !inServiceWorker &&
12
13
  typeof WorkerGlobalScope !== 'undefined' &&
13
- global instanceof WorkerGlobalScope
14
+ globalThis instanceof WorkerGlobalScope
14
15
  let _executionQueue = Promise.resolve()
15
16
 
16
- function executionQueue (fn) {
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(() => global.polendinaLog(['info'].concat(args)))
25
+ executionQueue(() => globalThis.polendinaLog(['info'].concat(args)))
24
26
  return executionQueue
25
27
  },
26
28
  // TODO
27
29
  warn: (...args) => {
28
- executionQueue(() => global.polendinaLog(['warn'].concat(args)))
30
+ executionQueue(() => globalThis.polendinaLog(['warn'].concat(args)))
29
31
  return executionQueue
30
32
  },
31
33
  // TODO
32
34
  error: (...args) => {
33
- executionQueue(() => global.polendinaLog(['error'].concat(args)))
35
+ executionQueue(() => globalThis.polendinaLog(['error'].concat(args)))
34
36
  return executionQueue
35
37
  }
36
38
  }
37
39
 
38
40
  function setupWorkerGlobals () {
39
- global.polendinaLog = async function (...args) {
40
- global.postMessage(['polendinaLog'].concat(args))
41
+ globalThis.polendinaLog = async function (...args) {
42
+ globalThis.postMessage(['polendinaLog'].concat(args))
41
43
  }
42
44
 
43
- global.polendinaWrite = async function (...args) {
44
- global.postMessage(['polendinaWrite'].concat(args))
45
+ globalThis.polendinaWrite = async function (...args) {
46
+ globalThis.postMessage(['polendinaWrite'].concat(args))
45
47
  }
46
48
 
47
- global.polendinaEnd = async function (...args) {
48
- global.postMessage(['polendinaEnd'].concat(args))
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
- global.polendinaLog = async function (...args) {
61
+ globalThis.polendinaLog = async function (...args) {
60
62
  _postMessage(['polendinaLog'].concat(args))
61
63
  }
62
64
 
63
- global.polendinaWrite = async function (...args) {
65
+ globalThis.polendinaWrite = async function (...args) {
64
66
  _postMessage(['polendinaWrite'].concat(args))
65
67
  }
66
68
 
67
- global.polendinaEnd = async function (...args) {
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(() => global.polendinaWrite(args))
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
- global.addEventListener('activate', (event) => {
98
- event.waitUntil(global.clients.claim())
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
@@ -1,31 +1,31 @@
1
- /* globals mocha Mocha */
2
-
3
1
  // in-browser setup and runner for Mocha, at end of bundle
4
2
 
5
- require('mocha/mocha.js')
6
- const { registry, executionQueue, log, setup } = require('./common-run')
3
+ import mochaExport from 'mocha/mocha-es2018.js'
4
+ import { registry, executionQueue, log, setup } from './common-run.js'
7
5
 
8
6
  function runMocha () {
9
- mocha.setup({ reporter: registry.argv.mochaReporter, ui: 'bdd' })
7
+ // mocha@8 exports what we want, mocha@7 sets a global
8
+ const mochaLocal = mochaExport
9
+ mochaLocal.setup({ reporter: registry.argv.mochaReporter, ui: 'bdd' })
10
10
  // mocha@7 deprecated useColors()
11
- if (typeof mocha.color === 'function') {
12
- mocha.color(true)
13
- } else if (typeof mocha.useColors === 'function') {
14
- mocha.useColors(true)
11
+ if (typeof mochaLocal.color === 'function') {
12
+ mochaLocal.color(true)
13
+ } else if (typeof mochaLocal.useColors === 'function') {
14
+ mochaLocal.useColors(true)
15
15
  }
16
16
 
17
17
  // the well-behaved reporters, like spec, are easy to intercept
18
- Mocha.reporters.Base.consoleLog = log.info
18
+ mochaLocal.constructor.reporters.Base.consoleLog = log.info
19
19
 
20
20
  for (const mod of registry.tests) {
21
21
  mod.load()
22
22
  }
23
23
 
24
24
  let errors = 0
25
- mocha
25
+ mochaLocal
26
26
  .run((_errors) => { errors = _errors })
27
27
  .on('end', (...args) => {
28
- executionQueue(() => global.polendinaEnd(errors))
28
+ executionQueue(() => globalThis.polendinaEnd(errors))
29
29
  })
30
30
  }
31
31
 
@@ -1,16 +1,16 @@
1
1
  // in-browser setup and runner for Tape, at end of bundle
2
2
 
3
- const tape = require('tape')
4
- const { registry, setup, executionQueue } = require('./common-run')
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
- global.polendinaWrite(chunk.toString())
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
- global.polendinaEnd(failures)
21
+ globalThis.polendinaEnd(failures)
22
22
  .catch(callback)
23
23
  .then(callback)
24
24
  })
@@ -1,3 +1,6 @@
1
1
  // see wrap-loader.js
2
2
 
3
- module.exports.tests = []
3
+ export const registry = {
4
+ argv: null,
5
+ tests: []
6
+ }
package/test/common.js CHANGED
@@ -1,13 +1,16 @@
1
- const path = require('path')
2
- const assert = require('assert')
3
- const { execFile } = require('child_process')
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
@@ -11,5 +11,8 @@
11
11
  "type": "git",
12
12
  "url": "https://github.com/rvagg/polendina.git"
13
13
  },
14
- "license": "Apache-2.0"
14
+ "license": "Apache-2.0",
15
+ "devDependencies": {
16
+ "chai": "^4.3.4"
17
+ }
15
18
  }
@@ -1,6 +1,6 @@
1
1
  /* globals WorkerGlobalScope ServiceWorkerGlobalScope */
2
2
 
3
- const assert = require('assert')
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('assert')
1
+ const { assert } = require('chai')
2
2
  const index = require('./')
3
3
 
4
4
  module.exports.test1 = async function () {
@@ -0,0 +1,3 @@
1
+ export default function test () {
2
+ return new Promise((resolve, reject) => setTimeout(() => resolve('bare test fixture'), 500))
3
+ }
@@ -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
+ }
@@ -11,5 +11,8 @@
11
11
  "type": "git",
12
12
  "url": "https://github.com/rvagg/polendina.git"
13
13
  },
14
- "license": "Apache-2.0"
14
+ "license": "Apache-2.0",
15
+ "devDependencies": {
16
+ "chai": "^4.3.4"
17
+ }
15
18
  }
@@ -1,6 +1,6 @@
1
1
  /* globals WorkerGlobalScope ServiceWorkerGlobalScope */
2
2
 
3
- const assert = require('assert')
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('assert')
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('nope', 'faily mcfailface')
10
+ assert.fail('faily mcfailface')
11
11
  }
@@ -0,0 +1,3 @@
1
+ export default function test () {
2
+ return new Promise((resolve, reject) => setTimeout(() => resolve('bare test fixture'), 500))
3
+ }
@@ -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
+ }
@@ -11,5 +11,8 @@
11
11
  "type": "git",
12
12
  "url": "https://github.com/rvagg/polendina.git"
13
13
  },
14
- "license": "Apache-2.0"
14
+ "license": "Apache-2.0",
15
+ "devDependencies": {
16
+ "chai": "^4.3.4"
17
+ }
15
18
  }
@@ -1,6 +1,6 @@
1
1
  /* globals WorkerGlobalScope ServiceWorkerGlobalScope */
2
2
 
3
- const assert = require('assert')
3
+ const { assert } = require('chai')
4
4
 
5
5
  if (typeof ServiceWorkerGlobalScope !== 'undefined' && global instanceof ServiceWorkerGlobalScope) {
6
6
  console.log('testing is in serviceworker')
@@ -1,4 +1,5 @@
1
- const assert = require('assert')
1
+
2
+ const { assert } = require('chai')
2
3
  const index = require('./')
3
4
 
4
5
  console.log('testing bare fixture')
@@ -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
+ }
@@ -0,0 +1,7 @@
1
+
2
+ import { assert } from 'chai'
3
+ import index from './index.js'
4
+
5
+ console.log('testing bare fixture')
6
+ assert.strictEqual(index, 'bare test fixture')
7
+ assert.ok(true, 'yep')
@@ -11,5 +11,8 @@
11
11
  "type": "git",
12
12
  "url": "https://github.com/rvagg/polendina.git"
13
13
  },
14
- "license": "Apache-2.0"
14
+ "license": "Apache-2.0",
15
+ "devDependencies": {
16
+ "chai": "^4.3.4"
17
+ }
15
18
  }
@@ -1,6 +1,6 @@
1
1
  /* globals WorkerGlobalScope ServiceWorkerGlobalScope */
2
2
 
3
- const assert = require('assert')
3
+ const { assert } = require('chai')
4
4
 
5
5
  if (typeof ServiceWorkerGlobalScope !== 'undefined' && global instanceof ServiceWorkerGlobalScope) {
6
6
  console.log('testing is in serviceworker')
@@ -1,6 +1,6 @@
1
- const assert = require('assert')
1
+ const { assert } = require('chai')
2
2
  const index = require('.')
3
3
 
4
4
  console.log('testing bare fixture')
5
5
  assert.strictEqual(index, 'bare test fixture')
6
- assert.fail('nope', 'faily mcfailface')
6
+ assert.fail('faily mcfailface')
@@ -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
+ }
@@ -0,0 +1,6 @@
1
+ import { assert } from 'chai'
2
+ import index from './index.js'
3
+
4
+ console.log('testing bare fixture')
5
+ assert.strictEqual(index, 'bare test fixture')
6
+ assert.fail('faily mcfailface')
@@ -13,6 +13,7 @@
13
13
  "url": "https://github.com/rvagg/polendina.git"
14
14
  },
15
15
  "devDependencies": {
16
- "mocha": "^7.0.0"
16
+ "chai": "^4.3.4",
17
+ "mocha": "~9.1.3"
17
18
  }
18
19
  }
@@ -1,7 +1,7 @@
1
1
  /* globals describe it */
2
2
 
3
3
  const fixture = require('./')
4
- const assert = require('assert')
4
+ const { assert } = require('chai')
5
5
 
6
6
  describe('test suite 1', () => {
7
7
  it('test case 1', () => {
@@ -1,6 +1,6 @@
1
1
  /* globals describe it WorkerGlobalScope ServiceWorkerGlobalScope */
2
2
 
3
- const assert = require('assert')
3
+ const { assert } = require('chai')
4
4
 
5
5
  describe('test suite 2 - worker', () => {
6
6
  if (typeof ServiceWorkerGlobalScope !== 'undefined' && global instanceof ServiceWorkerGlobalScope) {
@@ -1,7 +1,7 @@
1
1
  /* globals describe it */
2
2
 
3
3
  const fixture = require('./')
4
- const assert = require('assert')
4
+ const { assert } = require('chai')
5
5
 
6
6
  describe('test suite 3', () => {
7
7
  it('test case 1', () => {