polendina 3.0.0 → 3.2.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/workflows/test-and-release.yml +4 -4
- package/CHANGELOG.md +35 -0
- package/lib/log.js +33 -2
- package/lib/puppeteer.js +7 -4
- package/lib/webpack.config.js +3 -3
- package/lib/wrap-loader.cjs +3 -5
- package/package.json +8 -8
- package/polendina-node-cli.js +3 -3
- package/polendina.js +4 -5
- package/resources/common-run.js +4 -3
- package/test/common.js +2 -1
- package/test/fixtures/bare-async/package.json +1 -1
- package/test/fixtures/bare-async-esm/package.json +1 -1
- package/test/fixtures/bare-async-failure/package.json +1 -1
- package/test/fixtures/bare-async-failure-esm/package.json +1 -1
- package/test/fixtures/bare-sync/package.json +1 -1
- package/test/fixtures/bare-sync-esm/package.json +1 -1
- package/test/fixtures/bare-sync-failure/package.json +1 -1
- package/test/fixtures/bare-sync-failure-esm/package.json +1 -1
- package/test/fixtures/mocha/package.json +2 -2
- package/test/fixtures/mocha-esm/package.json +2 -2
- package/test/fixtures/mocha-failure/package.json +2 -2
- package/test/fixtures/mocha-failure-esm/package.json +2 -2
- package/test/fixtures/tape/package.json +1 -1
- package/test/fixtures/tape-esm/package.json +1 -1
- package/test/fixtures/tape-failure/package.json +1 -1
- package/test/fixtures/tape-failure-esm/package.json +1 -1
- package/test/fixtures/webpack-merge/package.json +1 -1
- package/test/test-bare-async.js +45 -6
- package/test/test-bare-sync.js +48 -6
- package/test/test-mocha.js +45 -6
- package/test/test-polendina-node.js +10 -4
- package/test/test-tape.js +45 -6
- package/test/test-webpack-merge.js +8 -2
|
@@ -5,14 +5,14 @@ jobs:
|
|
|
5
5
|
strategy:
|
|
6
6
|
fail-fast: false
|
|
7
7
|
matrix:
|
|
8
|
-
node: [
|
|
8
|
+
node: [lts/*, current]
|
|
9
9
|
os: [macos-latest, ubuntu-latest, windows-latest]
|
|
10
10
|
runs-on: ${{ matrix.os }}
|
|
11
11
|
steps:
|
|
12
12
|
- name: Checkout Repository
|
|
13
13
|
uses: actions/checkout@v3
|
|
14
14
|
- name: Use Node.js ${{ matrix.node }}
|
|
15
|
-
uses: actions/setup-node@v3.
|
|
15
|
+
uses: actions/setup-node@v3.5.1
|
|
16
16
|
with:
|
|
17
17
|
node-version: ${{ matrix.node }}
|
|
18
18
|
- name: Install Dependencies
|
|
@@ -33,9 +33,9 @@ jobs:
|
|
|
33
33
|
with:
|
|
34
34
|
fetch-depth: 0
|
|
35
35
|
- name: Setup Node.js
|
|
36
|
-
uses: actions/setup-node@v3.
|
|
36
|
+
uses: actions/setup-node@v3.5.1
|
|
37
37
|
with:
|
|
38
|
-
node-version:
|
|
38
|
+
node-version: lts/*
|
|
39
39
|
- name: Install dependencies
|
|
40
40
|
run: |
|
|
41
41
|
npm install --no-progress --no-package-lock --no-save
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
1
|
+
## [3.2.0](https://github.com/rvagg/polendina/compare/v3.1.0...v3.2.0) (2023-05-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* big 'ol dependency update & associated fixes ([7e7bfc1](https://github.com/rvagg/polendina/commit/7e7bfc148c97384cd7c5f05d4b1a2894d0eb90d1))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* ./ for registry loading, even on windows ([70d4c1f](https://github.com/rvagg/polendina/commit/70d4c1ff50616ad79def41c0d3b55f2668716d80))
|
|
12
|
+
* debug nonzero exit codes (windows, CI) ([362f6c5](https://github.com/rvagg/polendina/commit/362f6c55437dc11a164f821ef31f9f1fe130a10b))
|
|
13
|
+
* defer final console.log() ([b524822](https://github.com/rvagg/polendina/commit/b524822ea77ce72236190a2bffa2cf147a8f7c97))
|
|
14
|
+
* extend timeouts, add debugging (for CI) ([f71ad1a](https://github.com/rvagg/polendina/commit/f71ad1a0bb497898082a55823647061ab696e4ca))
|
|
15
|
+
* remove extraneous 'console' event ([02b884a](https://github.com/rvagg/polendina/commit/02b884a7504079ee1b9f27643f53653bafa0f017))
|
|
16
|
+
* sequence console.log() calls ([839fceb](https://github.com/rvagg/polendina/commit/839fceb045b60ef9b8e27e9a7b41ec26e37f898c))
|
|
17
|
+
* update node versions in CI ([aa2f616](https://github.com/rvagg/polendina/commit/aa2f616a1e2e92589b05c618e873758ab0aa6d46))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Trivial Changes
|
|
21
|
+
|
|
22
|
+
* **no-release:** bump actions/setup-node from 3.1.1 to 3.2.0 ([#58](https://github.com/rvagg/polendina/issues/58)) ([115db86](https://github.com/rvagg/polendina/commit/115db867ce096bae7dcb34c94eed86c94738409e))
|
|
23
|
+
* **no-release:** bump actions/setup-node from 3.2.0 to 3.3.0 ([#59](https://github.com/rvagg/polendina/issues/59)) ([313dffd](https://github.com/rvagg/polendina/commit/313dffd40fb58a19bc528d4a31b937e34cab7a1f))
|
|
24
|
+
* **no-release:** bump actions/setup-node from 3.3.0 to 3.4.0 ([#67](https://github.com/rvagg/polendina/issues/67)) ([6d1aa17](https://github.com/rvagg/polendina/commit/6d1aa176013ab76e9370df360a4a39ad87644bdd))
|
|
25
|
+
* **no-release:** bump actions/setup-node from 3.4.0 to 3.4.1 ([#70](https://github.com/rvagg/polendina/issues/70)) ([9de3e55](https://github.com/rvagg/polendina/commit/9de3e554bbc2eab075cd8bf6a31e2ad1838f17ab))
|
|
26
|
+
* **no-release:** bump actions/setup-node from 3.4.1 to 3.5.0 ([#85](https://github.com/rvagg/polendina/issues/85)) ([3bc465c](https://github.com/rvagg/polendina/commit/3bc465cc3c7853036020e70db170e4d76327d610))
|
|
27
|
+
* **no-release:** bump actions/setup-node from 3.5.0 to 3.5.1 ([#88](https://github.com/rvagg/polendina/issues/88)) ([113e5e4](https://github.com/rvagg/polendina/commit/113e5e4bf3cab293084f6ef6c3d2206b164da7cf))
|
|
28
|
+
|
|
29
|
+
## [3.1.0](https://github.com/rvagg/polendina/compare/v3.0.0...v3.1.0) (2022-05-10)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Features
|
|
33
|
+
|
|
34
|
+
* bump puppeteer from 13.7.0 to 14.0.0 ([#57](https://github.com/rvagg/polendina/issues/57)) ([8ab4886](https://github.com/rvagg/polendina/commit/8ab48869f24984025aa3d38e90502c02729a1008))
|
|
35
|
+
|
|
1
36
|
## [3.0.0](https://github.com/rvagg/polendina/compare/v2.0.15...v3.0.0) (2022-05-02)
|
|
2
37
|
|
|
3
38
|
|
package/lib/log.js
CHANGED
|
@@ -3,6 +3,8 @@ import colors from 'ansi-colors'
|
|
|
3
3
|
import stripAnsi from 'strip-ansi'
|
|
4
4
|
|
|
5
5
|
const tty = process.stdout.isTTY && process.stderr.isTTY
|
|
6
|
+
let logQueue = []
|
|
7
|
+
let logSeq = -1
|
|
6
8
|
|
|
7
9
|
function brand (error) {
|
|
8
10
|
const brand = 'polendina ☞'
|
|
@@ -20,11 +22,40 @@ export function error (msg) {
|
|
|
20
22
|
console.log(` ${brand(true)} ${tty ? colors.gray.italic(msg) : msg}`)
|
|
21
23
|
}
|
|
22
24
|
|
|
23
|
-
export function logRaw (type, args) {
|
|
25
|
+
export function logRaw (type, seq, args) {
|
|
24
26
|
if (!tty) {
|
|
25
27
|
args = args.map((a) => typeof a === 'string' ? stripAnsi(a) : a)
|
|
26
28
|
}
|
|
27
|
-
|
|
29
|
+
logQueue.push({
|
|
30
|
+
type: type === 'info' ? 'log' : type,
|
|
31
|
+
args,
|
|
32
|
+
seq
|
|
33
|
+
})
|
|
34
|
+
flushLogs(false)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function flushLogs (force) {
|
|
38
|
+
while (true) {
|
|
39
|
+
const lastLen = logQueue.length
|
|
40
|
+
logQueue = logQueue.filter((le) => {
|
|
41
|
+
const next = le.seq === -1 || le.seq === logSeq + 1
|
|
42
|
+
if (force || next) {
|
|
43
|
+
console[le.type].apply(null, le.args)
|
|
44
|
+
if (le.seq !== -1) {
|
|
45
|
+
logSeq++
|
|
46
|
+
}
|
|
47
|
+
} else if (le.seq < logSeq) {
|
|
48
|
+
throw new Error(`Unexpected log output sequencing (${le.seq}<${logSeq})`)
|
|
49
|
+
}
|
|
50
|
+
return !next
|
|
51
|
+
})
|
|
52
|
+
if (lastLen === logQueue.length) {
|
|
53
|
+
break
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (force) {
|
|
57
|
+
logSeq = -1
|
|
58
|
+
}
|
|
28
59
|
}
|
|
29
60
|
|
|
30
61
|
export function logWrite (args) {
|
package/lib/puppeteer.js
CHANGED
|
@@ -2,7 +2,7 @@ import puppeteer from 'puppeteer'
|
|
|
2
2
|
// TODO
|
|
3
3
|
// const pti = require('puppeteer-to-istanbul')
|
|
4
4
|
// const { copyFile } = require('fs').promises
|
|
5
|
-
import { log, error, logRaw, logWrite } from './log.js'
|
|
5
|
+
import { log, error, logRaw, logWrite, flushLogs } from './log.js'
|
|
6
6
|
|
|
7
7
|
// wrap our convoluted _run() function in a pure Promise that can handle
|
|
8
8
|
// both standard throws and the callback that ends it. _run() needs to handle
|
|
@@ -24,7 +24,7 @@ export function run (outputDir, port, timeout, mode, runner, coverage) {
|
|
|
24
24
|
async function _run (outputDir, port, timeout, mode, runner, coverage, callback) {
|
|
25
25
|
let executionQueue = Promise.resolve()
|
|
26
26
|
|
|
27
|
-
const browser = await puppeteer.launch({ args: ['--no-sandbox'] })
|
|
27
|
+
const browser = await puppeteer.launch({ args: ['--no-sandbox'], headless: 'new' })
|
|
28
28
|
const [page] = await browser.pages()
|
|
29
29
|
|
|
30
30
|
// this works as a debounce exit method, when process.stdout.write() is used
|
|
@@ -42,6 +42,7 @@ async function _run (outputDir, port, timeout, mode, runner, coverage, callback)
|
|
|
42
42
|
return
|
|
43
43
|
}
|
|
44
44
|
executionQueue.then(async () => {
|
|
45
|
+
flushLogs(true)
|
|
45
46
|
executionQueue = null
|
|
46
47
|
/* TODO
|
|
47
48
|
if (coverage) {
|
|
@@ -64,6 +65,7 @@ async function _run (outputDir, port, timeout, mode, runner, coverage, callback)
|
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
// this should be a rare, or impossible event since we intercept console.log
|
|
68
|
+
/*
|
|
67
69
|
page.on('console', (msg) => {
|
|
68
70
|
if (!executionQueue) {
|
|
69
71
|
error(`log after end: ${msg.text()}`)
|
|
@@ -71,13 +73,14 @@ async function _run (outputDir, port, timeout, mode, runner, coverage, callback)
|
|
|
71
73
|
}
|
|
72
74
|
const args = []
|
|
73
75
|
executionQueue = executionQueue.then(async () => {
|
|
74
|
-
logRaw('info', await Promise.all(args))
|
|
76
|
+
logRaw('info', -1, await Promise.all(args))
|
|
75
77
|
})
|
|
76
78
|
for (const arg of msg.args()) {
|
|
77
79
|
args.push(arg.evaluate(n => n))
|
|
78
80
|
}
|
|
79
81
|
maybeEnd()
|
|
80
82
|
})
|
|
83
|
+
*/
|
|
81
84
|
|
|
82
85
|
page.on('error', (error) => console.error(error))
|
|
83
86
|
page.on('pageerror', (error) => console.error(error))
|
|
@@ -86,7 +89,7 @@ async function _run (outputDir, port, timeout, mode, runner, coverage, callback)
|
|
|
86
89
|
end(errors)
|
|
87
90
|
})
|
|
88
91
|
await page.exposeFunction('polendinaLog', (args) => {
|
|
89
|
-
logRaw(args.shift(), args)
|
|
92
|
+
logRaw(args.shift(), args.shift(), args)
|
|
90
93
|
maybeEnd()
|
|
91
94
|
})
|
|
92
95
|
await page.exposeFunction('polendinaWrite', (args) => {
|
package/lib/webpack.config.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from 'path'
|
|
2
|
-
import glob from 'glob'
|
|
2
|
+
import { glob } from 'glob'
|
|
3
3
|
import { fileURLToPath } from 'url'
|
|
4
4
|
|
|
5
5
|
const __dirname = fileURLToPath(path.dirname(import.meta.url))
|
|
@@ -7,7 +7,7 @@ const __dirname = fileURLToPath(path.dirname(import.meta.url))
|
|
|
7
7
|
export function webpackConfig (env, options, runner) {
|
|
8
8
|
const bundleRun = path.normalize(path.resolve(options.outputDir, runner))
|
|
9
9
|
const testFiles = options._.reduce((p, c) => {
|
|
10
|
-
return p.concat(glob.sync(c, { absolute: true }))
|
|
10
|
+
return p.concat(glob.sync(c, { absolute: true }).sort())
|
|
11
11
|
}, []).map(path.normalize)
|
|
12
12
|
|
|
13
13
|
// our globs may be fruitless
|
|
@@ -50,7 +50,7 @@ export function webpackConfig (env, options, runner) {
|
|
|
50
50
|
type: 'javascript/auto', // needed so the wrap-loader can get a sync require() in
|
|
51
51
|
use: [{
|
|
52
52
|
loader: path.resolve(__dirname, 'wrap-loader.cjs'),
|
|
53
|
-
options
|
|
53
|
+
options
|
|
54
54
|
}]
|
|
55
55
|
}
|
|
56
56
|
]
|
package/lib/wrap-loader.cjs
CHANGED
|
@@ -17,17 +17,15 @@ wrapLoader.pitch = function pitch (remainingRequest) {
|
|
|
17
17
|
return
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
// wrap the test in a function that is only called when we want it called
|
|
21
|
-
// we get synchronous require() out of it, this needs the tests to be loaded with javascript/auto
|
|
22
|
-
// so webpack can auto-detect
|
|
20
|
+
// wrap the test in a function that is only called when we want it called
|
|
23
21
|
return `
|
|
24
|
-
|
|
22
|
+
import { registry } from ${JSON.stringify(`./${path.relative(process.cwd(), path.resolve(argv.outputDir, 'test-registry.js'))}`)}
|
|
25
23
|
registry.argv = JSON.parse(${JSON.stringify(JSON.stringify(argv))})
|
|
26
24
|
registry.tests.push({
|
|
27
25
|
name: JSON.parse('${JSON.stringify(path.normalize(path.relative(process.cwd(), remainingRequest))).replace(/\\/g, '/')}'),
|
|
28
26
|
load: () => { return require(${JSON.stringify(`!!${remainingRequest}`)}) }
|
|
29
27
|
})
|
|
30
|
-
|
|
28
|
+
export default {}
|
|
31
29
|
`
|
|
32
30
|
}
|
|
33
31
|
|
package/package.json
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "polendina",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "Non-UI browser testing for JavaScript libraries from the command-line",
|
|
5
5
|
"main": "polendina.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"ansi-colors": "^4.1.
|
|
9
|
-
"glob": "^
|
|
8
|
+
"ansi-colors": "^4.1.3",
|
|
9
|
+
"glob": "^10.2.3",
|
|
10
10
|
"path-browserify": "^1.0.1",
|
|
11
11
|
"process": "^0.11.10",
|
|
12
|
-
"puppeteer": "^
|
|
12
|
+
"puppeteer": "^20.2.0",
|
|
13
13
|
"raw-loader": "^4.0.2",
|
|
14
|
-
"readable-stream": "^
|
|
15
|
-
"rimraf": "^
|
|
14
|
+
"readable-stream": "^4.4.0",
|
|
15
|
+
"rimraf": "^5.0.0",
|
|
16
16
|
"st": "^3.0.0",
|
|
17
17
|
"stream-browserify": "^3.0.0",
|
|
18
18
|
"strip-ansi": "^7.0.1",
|
|
19
|
-
"webpack": "^5.
|
|
19
|
+
"webpack": "^5.82.1",
|
|
20
20
|
"webpack-merge": "^5.8.0",
|
|
21
|
-
"yargs": "^17.
|
|
21
|
+
"yargs": "^17.7.2"
|
|
22
22
|
},
|
|
23
23
|
"bin": {
|
|
24
24
|
"polendina": "./polendina-cli.js",
|
package/polendina-node-cli.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import process from 'process'
|
|
4
4
|
import path from 'path'
|
|
5
|
-
import glob from 'glob'
|
|
5
|
+
import { glob } from 'glob'
|
|
6
6
|
import stripAnsi from 'strip-ansi'
|
|
7
7
|
import yargs from 'yargs'
|
|
8
8
|
import { hideBin } from 'yargs/helpers'
|
|
@@ -35,7 +35,7 @@ function cleanLog (to) {
|
|
|
35
35
|
async function run () {
|
|
36
36
|
const mode = argv._[0]
|
|
37
37
|
const testFiles = argv.testfiles.reduce((p, c) => {
|
|
38
|
-
return p.concat(glob.sync(c, { absolute: true }))
|
|
38
|
+
return p.concat(glob.sync(c, { absolute: true }).sort())
|
|
39
39
|
}, [])
|
|
40
40
|
|
|
41
41
|
// our globs may be fruitless
|
|
@@ -76,5 +76,5 @@ run()
|
|
|
76
76
|
|
|
77
77
|
console.log(`Took ${time} second${time === 1 ? '' : 's'}`)
|
|
78
78
|
|
|
79
|
-
process.exit(errors)
|
|
79
|
+
process.exit(errors ? 1 : 0)
|
|
80
80
|
})
|
package/polendina.js
CHANGED
|
@@ -4,13 +4,12 @@ import fs from 'fs'
|
|
|
4
4
|
import http from 'http'
|
|
5
5
|
import { fileURLToPath } from 'url'
|
|
6
6
|
import st from 'st'
|
|
7
|
-
import
|
|
7
|
+
import { rimraf } from 'rimraf'
|
|
8
8
|
import _webpack from 'webpack'
|
|
9
9
|
import { merge } from 'webpack-merge'
|
|
10
10
|
import { run as puppeteer } from './lib/puppeteer.js'
|
|
11
11
|
import { webpackConfig } from './lib/webpack.config.js'
|
|
12
12
|
|
|
13
|
-
const rimraf = promisify(_rimraf)
|
|
14
13
|
const webpack = promisify(_webpack)
|
|
15
14
|
|
|
16
15
|
const __dirname = fileURLToPath(path.dirname(import.meta.url))
|
|
@@ -131,10 +130,10 @@ export class Polendina {
|
|
|
131
130
|
const port = server.address().port
|
|
132
131
|
puppeteer(this.outputDir, port, this._options.timeout, mode, this._options.runner, this._options.coverage)
|
|
133
132
|
.then((errors) => {
|
|
134
|
-
if (this._options.runner !== 'mocha') {
|
|
135
|
-
console.log() // whitespace pls
|
|
136
|
-
}
|
|
137
133
|
server.close(() => {
|
|
134
|
+
if (this._options.runner !== 'mocha') {
|
|
135
|
+
console.log() // whitespace pls
|
|
136
|
+
}
|
|
138
137
|
resolve(errors)
|
|
139
138
|
})
|
|
140
139
|
})
|
package/resources/common-run.js
CHANGED
|
@@ -13,6 +13,7 @@ const inWorker = !inPage && !inServiceWorker &&
|
|
|
13
13
|
typeof WorkerGlobalScope !== 'undefined' &&
|
|
14
14
|
globalThis instanceof WorkerGlobalScope
|
|
15
15
|
let _executionQueue = Promise.resolve()
|
|
16
|
+
let logSeq = 0
|
|
16
17
|
|
|
17
18
|
export { registry }
|
|
18
19
|
export function executionQueue (fn) {
|
|
@@ -22,17 +23,17 @@ export function executionQueue (fn) {
|
|
|
22
23
|
|
|
23
24
|
export const log = {
|
|
24
25
|
info: (...args) => {
|
|
25
|
-
executionQueue(() => globalThis.polendinaLog(['info'].concat(args)))
|
|
26
|
+
executionQueue(() => globalThis.polendinaLog(['info', logSeq++].concat(args)))
|
|
26
27
|
return executionQueue
|
|
27
28
|
},
|
|
28
29
|
// TODO
|
|
29
30
|
warn: (...args) => {
|
|
30
|
-
executionQueue(() => globalThis.polendinaLog(['warn'].concat(args)))
|
|
31
|
+
executionQueue(() => globalThis.polendinaLog(['warn', logSeq++].concat(args)))
|
|
31
32
|
return executionQueue
|
|
32
33
|
},
|
|
33
34
|
// TODO
|
|
34
35
|
error: (...args) => {
|
|
35
|
-
executionQueue(() => globalThis.polendinaLog(['error'].concat(args)))
|
|
36
|
+
executionQueue(() => globalThis.polendinaLog(['error', logSeq++].concat(args)))
|
|
36
37
|
return executionQueue
|
|
37
38
|
}
|
|
38
39
|
}
|
package/test/common.js
CHANGED
|
@@ -22,7 +22,8 @@ export async function runCommand (command, cwd) {
|
|
|
22
22
|
return reject(e)
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
const out = { stdout: stdout.toString(), stderr: stderr.toString(), code }
|
|
26
|
+
resolve(out)
|
|
26
27
|
})
|
|
27
28
|
})
|
|
28
29
|
}
|
package/test/test-bare-async.js
CHANGED
|
@@ -12,7 +12,7 @@ for (const type of ['cjs', 'esm']) {
|
|
|
12
12
|
const bareAsyncFailureFixture = path.join(__dirname, `fixtures/bare-async-failure${type === 'esm' ? '-esm' : ''}`)
|
|
13
13
|
|
|
14
14
|
describe(`basic bare-async (${type})`, function () {
|
|
15
|
-
this.timeout(
|
|
15
|
+
this.timeout(60000)
|
|
16
16
|
const expectedTemplate = `
|
|
17
17
|
testing is WORKER
|
|
18
18
|
✔ test-1.js
|
|
@@ -23,49 +23,79 @@ testing bare fixture
|
|
|
23
23
|
`
|
|
24
24
|
|
|
25
25
|
it('should run in page', async () => {
|
|
26
|
-
const { stdout, code } = await runCli(bareAsyncFixture, '--runner=bare-async')
|
|
26
|
+
const { stdout, stderr, code } = await runCli(bareAsyncFixture, '--runner=bare-async')
|
|
27
|
+
if (code !== 0) {
|
|
28
|
+
console.error(stderr)
|
|
29
|
+
}
|
|
27
30
|
assert.strictEqual(code, 0, 'exited with zero exit code')
|
|
28
31
|
const expected = expectedTemplate.replace(/WORKER/, 'not in worker')
|
|
32
|
+
if (!stdout.includes(expected)) {
|
|
33
|
+
console.error(stdout)
|
|
34
|
+
}
|
|
29
35
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
30
36
|
assert.ok(stdout.includes('Running bare-async page tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
31
37
|
})
|
|
32
38
|
|
|
33
39
|
it('should run in worker', async () => {
|
|
34
|
-
const { stdout, code } = await runCli(bareAsyncFixture, '--runner=bare-async --worker --page=false')
|
|
40
|
+
const { stdout, stderr, code } = await runCli(bareAsyncFixture, '--runner=bare-async --worker --page=false')
|
|
41
|
+
if (code !== 0) {
|
|
42
|
+
console.error(stderr)
|
|
43
|
+
}
|
|
35
44
|
assert.strictEqual(code, 0, 'exited with zero exit code')
|
|
36
45
|
const expected = expectedTemplate.replace(/WORKER/, 'in worker')
|
|
46
|
+
if (!stdout.includes(expected)) {
|
|
47
|
+
console.error(stdout)
|
|
48
|
+
}
|
|
37
49
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
38
50
|
assert.ok(stdout.includes('Running bare-async worker tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
39
51
|
})
|
|
40
52
|
|
|
41
53
|
it('should run in serviceworker', async () => {
|
|
42
|
-
const { stdout, code } = await runCli(bareAsyncFixture, '--runner=bare-async --serviceworker --page=false')
|
|
54
|
+
const { stdout, stderr, code } = await runCli(bareAsyncFixture, '--runner=bare-async --serviceworker --page=false')
|
|
55
|
+
if (code !== 0) {
|
|
56
|
+
console.error(stderr)
|
|
57
|
+
}
|
|
43
58
|
assert.strictEqual(code, 0, 'exited with zero exit code')
|
|
44
59
|
const expected = expectedTemplate.replace(/WORKER/, 'in serviceworker')
|
|
60
|
+
if (!stdout.includes(expected)) {
|
|
61
|
+
console.error(stdout)
|
|
62
|
+
}
|
|
45
63
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
46
64
|
assert.ok(stdout.includes('Running bare-async serviceworker tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
47
65
|
})
|
|
48
66
|
|
|
49
67
|
it('should run in page, worker and serviceworker', async () => {
|
|
50
|
-
const { stdout, code } = await runCli(bareAsyncFixture, '--runner=bare-async --worker --serviceworker')
|
|
68
|
+
const { stdout, stderr, code } = await runCli(bareAsyncFixture, '--runner=bare-async --worker --serviceworker')
|
|
69
|
+
if (code !== 0) {
|
|
70
|
+
console.error(stderr)
|
|
71
|
+
}
|
|
51
72
|
assert.strictEqual(code, 0, 'exited with zero exit code')
|
|
52
73
|
|
|
53
74
|
let expected = expectedTemplate.replace(/WORKER/, 'not in worker')
|
|
75
|
+
if (!stdout.includes(expected)) {
|
|
76
|
+
console.error(stdout)
|
|
77
|
+
}
|
|
54
78
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
55
79
|
assert.ok(stdout.includes('Running bare-async serviceworker tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
56
80
|
|
|
57
81
|
expected = expectedTemplate.replace(/WORKER/, 'in worker')
|
|
82
|
+
if (!stdout.includes(expected)) {
|
|
83
|
+
console.error(stdout)
|
|
84
|
+
}
|
|
58
85
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
59
86
|
assert.ok(stdout.includes('Running bare-async serviceworker tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
60
87
|
|
|
61
88
|
expected = expectedTemplate.replace(/WORKER/, 'in serviceworker')
|
|
89
|
+
if (!stdout.includes(expected)) {
|
|
90
|
+
console.error(stdout)
|
|
91
|
+
}
|
|
62
92
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
63
93
|
assert.ok(stdout.includes('Running bare-async serviceworker tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
64
94
|
})
|
|
65
95
|
})
|
|
66
96
|
|
|
67
97
|
describe(`failing bare-async (${type})`, function () {
|
|
68
|
-
this.timeout(
|
|
98
|
+
this.timeout(60000)
|
|
69
99
|
const expectedTemplate = `
|
|
70
100
|
testing is WORKER
|
|
71
101
|
✔ test-1.js
|
|
@@ -81,6 +111,9 @@ testing bare fixture
|
|
|
81
111
|
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
82
112
|
stdout = stdout.replace(/^ +at .*\n/gm, '') // stack traces
|
|
83
113
|
const expected = expectedTemplate.replace(/WORKER/, 'not in worker')
|
|
114
|
+
if (!stdout.includes(expected)) {
|
|
115
|
+
console.error(stdout)
|
|
116
|
+
}
|
|
84
117
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
85
118
|
assert.ok(stdout.includes('Running bare-async page tests with Puppeteer'), 'stdout contains expected output for running in worker')
|
|
86
119
|
assert.ok(stderr.includes(expectedStderr), 'stderr contains expected output')
|
|
@@ -91,6 +124,9 @@ testing bare fixture
|
|
|
91
124
|
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
92
125
|
stdout = stdout.replace(/^ +at .*\n/gm, '') // stack traces
|
|
93
126
|
const expected = expectedTemplate.replace(/WORKER/, 'in worker')
|
|
127
|
+
if (!stdout.includes(expected)) {
|
|
128
|
+
console.error(stdout)
|
|
129
|
+
}
|
|
94
130
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
95
131
|
assert.ok(stdout.includes('Running bare-async worker tests with Puppeteer'), 'stdout contains expected output for running in worker')
|
|
96
132
|
assert.ok(stderr.includes(expectedStderr), 'stderr contains expected output')
|
|
@@ -101,6 +137,9 @@ testing bare fixture
|
|
|
101
137
|
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
102
138
|
stdout = stdout.replace(/^ +at .*\n/gm, '') // stack traces
|
|
103
139
|
const expected = expectedTemplate.replace(/WORKER/, 'in serviceworker')
|
|
140
|
+
if (!stdout.includes(expected)) {
|
|
141
|
+
console.error(stdout)
|
|
142
|
+
}
|
|
104
143
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
105
144
|
assert.ok(stdout.includes('Running bare-async serviceworker tests with Puppeteer'), 'stdout contains expected output for running in worker')
|
|
106
145
|
assert.ok(stderr.includes(expectedStderr), 'stderr contains expected output')
|
package/test/test-bare-sync.js
CHANGED
|
@@ -12,7 +12,7 @@ for (const type of ['cjs', 'esm']) {
|
|
|
12
12
|
const bareSyncFailureFixture = path.join(__dirname, `fixtures/bare-sync-failure${type === 'esm' ? '-esm' : ''}`)
|
|
13
13
|
|
|
14
14
|
describe(`basic bare-sync (${type})`, function () {
|
|
15
|
-
this.timeout(
|
|
15
|
+
this.timeout(60000)
|
|
16
16
|
const expectedTemplate = `
|
|
17
17
|
testing is WORKER
|
|
18
18
|
✔ test-1.js
|
|
@@ -21,49 +21,79 @@ testing bare fixture
|
|
|
21
21
|
`
|
|
22
22
|
|
|
23
23
|
it('should run in page', async () => {
|
|
24
|
-
const { stdout, code } = await runCli(bareSyncFixture, '--runner=bare-sync')
|
|
24
|
+
const { stdout, stderr, code } = await runCli(bareSyncFixture, '--runner=bare-sync')
|
|
25
|
+
if (code !== 0) {
|
|
26
|
+
console.error(stderr)
|
|
27
|
+
}
|
|
25
28
|
assert.strictEqual(code, 0, 'exited with zero exit code')
|
|
26
29
|
const expected = expectedTemplate.replace(/WORKER/, 'not in worker')
|
|
30
|
+
if (!stdout.includes(expected)) {
|
|
31
|
+
console.error(stdout)
|
|
32
|
+
}
|
|
27
33
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
28
34
|
assert.ok(stdout.includes('Running bare-sync page tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
29
35
|
})
|
|
30
36
|
|
|
31
37
|
it('should run in worker', async () => {
|
|
32
|
-
const { stdout, code } = await runCli(bareSyncFixture, '--runner=bare-sync --worker --page=false')
|
|
38
|
+
const { stdout, stderr, code } = await runCli(bareSyncFixture, '--runner=bare-sync --worker --page=false')
|
|
39
|
+
if (code !== 0) {
|
|
40
|
+
console.error(stderr)
|
|
41
|
+
}
|
|
33
42
|
assert.strictEqual(code, 0, 'exited with zero exit code')
|
|
34
43
|
const expected = expectedTemplate.replace(/WORKER/, 'in worker')
|
|
44
|
+
if (!stdout.includes(expected)) {
|
|
45
|
+
console.error(stdout)
|
|
46
|
+
}
|
|
35
47
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
36
48
|
assert.ok(stdout.includes('Running bare-sync worker tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
37
49
|
})
|
|
38
50
|
|
|
39
51
|
it('should run in serviceworker', async () => {
|
|
40
|
-
const { stdout, code } = await runCli(bareSyncFixture, '--runner=bare-sync --serviceworker --page=false')
|
|
52
|
+
const { stdout, stderr, code } = await runCli(bareSyncFixture, '--runner=bare-sync --serviceworker --page=false')
|
|
53
|
+
if (code !== 0) {
|
|
54
|
+
console.error(stderr)
|
|
55
|
+
}
|
|
41
56
|
assert.strictEqual(code, 0, 'exited with zero exit code')
|
|
42
57
|
const expected = expectedTemplate.replace(/WORKER/, 'in serviceworker')
|
|
58
|
+
if (!stdout.includes(expected)) {
|
|
59
|
+
console.error(stdout)
|
|
60
|
+
}
|
|
43
61
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
44
62
|
assert.ok(stdout.includes('Running bare-sync serviceworker tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
45
63
|
})
|
|
46
64
|
|
|
47
65
|
it('should run in page, worker and serviceworker', async () => {
|
|
48
|
-
const { stdout, code } = await runCli(bareSyncFixture, '--runner=bare-sync --worker --serviceworker')
|
|
66
|
+
const { stdout, stderr, code } = await runCli(bareSyncFixture, '--runner=bare-sync --worker --serviceworker')
|
|
67
|
+
if (code !== 0) {
|
|
68
|
+
console.error(stderr)
|
|
69
|
+
}
|
|
49
70
|
assert.strictEqual(code, 0, 'exited with zero exit code')
|
|
50
71
|
|
|
51
72
|
let expected = expectedTemplate.replace(/WORKER/, 'not in worker')
|
|
73
|
+
if (!stdout.includes(expected)) {
|
|
74
|
+
console.error(stdout)
|
|
75
|
+
}
|
|
52
76
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
53
77
|
assert.ok(stdout.includes('Running bare-sync serviceworker tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
54
78
|
|
|
55
79
|
expected = expectedTemplate.replace(/WORKER/, 'in worker')
|
|
80
|
+
if (!stdout.includes(expected)) {
|
|
81
|
+
console.error(stdout)
|
|
82
|
+
}
|
|
56
83
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
57
84
|
assert.ok(stdout.includes('Running bare-sync serviceworker tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
58
85
|
|
|
59
86
|
expected = expectedTemplate.replace(/WORKER/, 'in serviceworker')
|
|
87
|
+
if (!stdout.includes(expected)) {
|
|
88
|
+
console.error(stdout)
|
|
89
|
+
}
|
|
60
90
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
61
91
|
assert.ok(stdout.includes('Running bare-sync serviceworker tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
62
92
|
})
|
|
63
93
|
})
|
|
64
94
|
|
|
65
95
|
describe(`failing bare-sync (${type})`, function () {
|
|
66
|
-
this.timeout(
|
|
96
|
+
this.timeout(60000)
|
|
67
97
|
const expectedTemplate = `
|
|
68
98
|
testing is WORKER
|
|
69
99
|
✔ test-1.js
|
|
@@ -77,6 +107,9 @@ testing bare fixture
|
|
|
77
107
|
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
78
108
|
stdout = stdout.replace(/^ +at .*\n/gm, '') // stack traces
|
|
79
109
|
const expected = expectedTemplate.replace(/WORKER/, 'not in worker')
|
|
110
|
+
if (!stdout.includes(expected)) {
|
|
111
|
+
console.error(stdout)
|
|
112
|
+
}
|
|
80
113
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
81
114
|
assert.ok(stdout.includes('Running bare-sync page tests with Puppeteer'), 'stdout contains expected output for running in worker')
|
|
82
115
|
assert.ok(stderr.includes(expectedStderr), 'stderr contains expected output')
|
|
@@ -87,6 +120,9 @@ testing bare fixture
|
|
|
87
120
|
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
88
121
|
stdout = stdout.replace(/^ +at .*\n/gm, '') // stack traces
|
|
89
122
|
const expected = expectedTemplate.replace(/WORKER/, 'in worker')
|
|
123
|
+
if (!stdout.includes(expected)) {
|
|
124
|
+
console.error(stdout)
|
|
125
|
+
}
|
|
90
126
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
91
127
|
assert.ok(stdout.includes('Running bare-sync worker tests with Puppeteer'), 'stdout contains expected output for running in worker')
|
|
92
128
|
assert.ok(stderr.includes(expectedStderr), 'stderr contains expected output')
|
|
@@ -97,6 +133,9 @@ testing bare fixture
|
|
|
97
133
|
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
98
134
|
stdout = stdout.replace(/^ +at .*\n/gm, '') // stack traces
|
|
99
135
|
const expected = expectedTemplate.replace(/WORKER/, 'in serviceworker')
|
|
136
|
+
if (!stdout.includes(expected)) {
|
|
137
|
+
console.error(stdout)
|
|
138
|
+
}
|
|
100
139
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
101
140
|
assert.ok(stdout.includes('Running bare-sync serviceworker tests with Puppeteer'), 'stdout contains expected output for running in worker')
|
|
102
141
|
assert.ok(stderr.includes(expectedStderr), 'stderr contains expected output')
|
|
@@ -108,6 +147,9 @@ testing bare fixture
|
|
|
108
147
|
stdout = stdout.replace(/^ +at .*\n/gm, '') // stack traces
|
|
109
148
|
const expected = expectedTemplate.replace(/WORKER/, 'not in worker')
|
|
110
149
|
let found = stdout.indexOf(expected)
|
|
150
|
+
if (found === -1) {
|
|
151
|
+
console.error(stdout)
|
|
152
|
+
}
|
|
111
153
|
assert.ok(found > -1, 'stdout contains expected test output')
|
|
112
154
|
found = stdout.indexOf(expected, found + 1)
|
|
113
155
|
assert.ok(found === -1, 'stdout doesn\'t contain second instance of expected test output')
|
package/test/test-mocha.js
CHANGED
|
@@ -16,7 +16,7 @@ for (const type of ['cjs', 'esm']) {
|
|
|
16
16
|
const mochaFailureFixture = path.join(__dirname, `fixtures/mocha-failure${type === 'esm' ? '-esm' : ''}`)
|
|
17
17
|
|
|
18
18
|
describe(`basic mocha (${type})`, function () {
|
|
19
|
-
this.timeout(
|
|
19
|
+
this.timeout(60000)
|
|
20
20
|
const expectedTemplate = `
|
|
21
21
|
test suite 1
|
|
22
22
|
✅ test case 1
|
|
@@ -31,49 +31,79 @@ for (const type of ['cjs', 'esm']) {
|
|
|
31
31
|
`
|
|
32
32
|
|
|
33
33
|
it('should run in page', async () => {
|
|
34
|
-
const { stdout, code } = await runCli(mochaFixture)
|
|
34
|
+
const { stdout, stderr, code } = await runCli(mochaFixture)
|
|
35
|
+
if (code !== 0) {
|
|
36
|
+
console.error(stderr)
|
|
37
|
+
}
|
|
35
38
|
assert.strictEqual(code, 0, 'exited with zero exit code')
|
|
36
39
|
const expected = expectedTemplate.replace(/WORKER/, 'not in worker')
|
|
40
|
+
if (!stdout.includes(expected)) {
|
|
41
|
+
console.error(stdout)
|
|
42
|
+
}
|
|
37
43
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
38
44
|
assert.ok(stdout.includes('Running mocha page tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
39
45
|
})
|
|
40
46
|
|
|
41
47
|
it('should run in worker', async () => {
|
|
42
|
-
const { stdout, code } = await runCli(mochaFixture, '--worker --page=false')
|
|
48
|
+
const { stdout, stderr, code } = await runCli(mochaFixture, '--worker --page=false')
|
|
49
|
+
if (code !== 0) {
|
|
50
|
+
console.error(stderr)
|
|
51
|
+
}
|
|
43
52
|
assert.strictEqual(code, 0, 'exited with zero exit code')
|
|
44
53
|
const expected = expectedTemplate.replace(/WORKER/, 'in worker')
|
|
54
|
+
if (!stdout.includes(expected)) {
|
|
55
|
+
console.error(stdout)
|
|
56
|
+
}
|
|
45
57
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
46
58
|
assert.ok(stdout.includes('Running mocha worker tests with Puppeteer'), 'stdout contains expected output for running in worker')
|
|
47
59
|
})
|
|
48
60
|
|
|
49
61
|
it('should run in serviceworker', async () => {
|
|
50
|
-
const { stdout, code } = await runCli(mochaFixture, '--serviceworker --page=false')
|
|
62
|
+
const { stdout, stderr, code } = await runCli(mochaFixture, '--serviceworker --page=false')
|
|
63
|
+
if (code !== 0) {
|
|
64
|
+
console.error(stderr)
|
|
65
|
+
}
|
|
51
66
|
assert.strictEqual(code, 0, 'exited with zero exit code')
|
|
52
67
|
const expected = expectedTemplate.replace(/WORKER/, 'in serviceworker')
|
|
68
|
+
if (!stdout.includes(expected)) {
|
|
69
|
+
console.error(stdout)
|
|
70
|
+
}
|
|
53
71
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
54
72
|
assert.ok(stdout.includes('Running mocha serviceworker tests with Puppeteer'), 'stdout contains expected output for running in worker')
|
|
55
73
|
})
|
|
56
74
|
|
|
57
75
|
it('should run in page, worker and serviceworker', async () => {
|
|
58
|
-
const { stdout, code } = await runCli(mochaFixture, '--worker --serviceworker')
|
|
76
|
+
const { stdout, stderr, code } = await runCli(mochaFixture, '--worker --serviceworker')
|
|
77
|
+
if (code !== 0) {
|
|
78
|
+
console.error(stderr)
|
|
79
|
+
}
|
|
59
80
|
assert.strictEqual(code, 0, 'exited with zero exit code')
|
|
60
81
|
|
|
61
82
|
let expected = expectedTemplate.replace(/WORKER/, 'not in worker')
|
|
83
|
+
if (!stdout.includes(expected)) {
|
|
84
|
+
console.error(stdout)
|
|
85
|
+
}
|
|
62
86
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
63
87
|
assert.ok(stdout.includes('Running mocha page tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
64
88
|
|
|
65
89
|
expected = expectedTemplate.replace(/WORKER/, 'in worker')
|
|
90
|
+
if (!stdout.includes(expected)) {
|
|
91
|
+
console.error(stdout)
|
|
92
|
+
}
|
|
66
93
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
67
94
|
assert.ok(stdout.includes('Running mocha worker tests with Puppeteer'), 'stdout contains expected output for running in worker')
|
|
68
95
|
|
|
69
96
|
expected = expectedTemplate.replace(/WORKER/, 'in serviceworker')
|
|
97
|
+
if (!stdout.includes(expected)) {
|
|
98
|
+
console.error(stdout)
|
|
99
|
+
}
|
|
70
100
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
71
101
|
assert.ok(stdout.includes('Running mocha serviceworker tests with Puppeteer'), 'stdout contains expected output for running in worker')
|
|
72
102
|
})
|
|
73
103
|
})
|
|
74
104
|
|
|
75
105
|
describe(`failing mocha (${type})`, function () {
|
|
76
|
-
this.timeout(
|
|
106
|
+
this.timeout(60000)
|
|
77
107
|
const expectedTemplate = `
|
|
78
108
|
test suite 1 - worker
|
|
79
109
|
✅ is WORKER
|
|
@@ -95,6 +125,9 @@ for (const type of ['cjs', 'esm']) {
|
|
|
95
125
|
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
96
126
|
stdout = removeTimings(stdout)
|
|
97
127
|
const expected = expectedTemplate.replace(/WORKER/, 'not in worker')
|
|
128
|
+
if (!stdout.includes(expected)) {
|
|
129
|
+
console.error(stdout)
|
|
130
|
+
}
|
|
98
131
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
99
132
|
assert.ok(stdout.includes('Running mocha page tests with Puppeteer'), 'stdout contains expected output for running in worker')
|
|
100
133
|
})
|
|
@@ -104,6 +137,9 @@ for (const type of ['cjs', 'esm']) {
|
|
|
104
137
|
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
105
138
|
stdout = removeTimings(stdout)
|
|
106
139
|
const expected = expectedTemplate.replace(/WORKER/, 'in worker')
|
|
140
|
+
if (!stdout.includes(expected)) {
|
|
141
|
+
console.error(stdout)
|
|
142
|
+
}
|
|
107
143
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
108
144
|
assert.ok(stdout.includes('Running mocha worker tests with Puppeteer'), 'stdout contains expected output for running in worker')
|
|
109
145
|
})
|
|
@@ -113,6 +149,9 @@ for (const type of ['cjs', 'esm']) {
|
|
|
113
149
|
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
114
150
|
stdout = removeTimings(stdout)
|
|
115
151
|
const expected = expectedTemplate.replace(/WORKER/, 'in serviceworker')
|
|
152
|
+
if (!stdout.includes(expected)) {
|
|
153
|
+
console.error(stdout)
|
|
154
|
+
}
|
|
116
155
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
117
156
|
assert.ok(stdout.includes('Running mocha serviceworker tests with Puppeteer'), 'stdout contains expected output for running in worker')
|
|
118
157
|
})
|
|
@@ -24,7 +24,7 @@ for (const type of ['cjs', 'esm']) {
|
|
|
24
24
|
const bareAsyncFailureFixture = path.join(__dirname, `fixtures/bare-async-failure${type === 'esm' ? '-esm' : ''}`)
|
|
25
25
|
|
|
26
26
|
describe(`polendina-node bare-sync (${type})`, function () {
|
|
27
|
-
this.timeout(
|
|
27
|
+
this.timeout(60000)
|
|
28
28
|
it('pass', async () => {
|
|
29
29
|
const expected =
|
|
30
30
|
`testing is not in worker
|
|
@@ -33,7 +33,10 @@ testing bare fixture
|
|
|
33
33
|
✔ test-2.js
|
|
34
34
|
Took X seconds
|
|
35
35
|
`
|
|
36
|
-
const { stdout, code } = await runCli('bare-sync', bareSyncFixture)
|
|
36
|
+
const { stdout, stderr, code } = await runCli('bare-sync', bareSyncFixture)
|
|
37
|
+
if (code !== 0) {
|
|
38
|
+
console.error(stderr)
|
|
39
|
+
}
|
|
37
40
|
assert.strictEqual(code, 0, 'exited with zero exit code')
|
|
38
41
|
assert.strictEqual(removeTiming(stdout), expected)
|
|
39
42
|
})
|
|
@@ -54,7 +57,7 @@ Took X seconds
|
|
|
54
57
|
})
|
|
55
58
|
|
|
56
59
|
describe(`polendina-node bare-async (${type})`, function () {
|
|
57
|
-
this.timeout(
|
|
60
|
+
this.timeout(60000)
|
|
58
61
|
it('pass', async () => {
|
|
59
62
|
const expected =
|
|
60
63
|
`testing is not in worker
|
|
@@ -65,7 +68,10 @@ testing bare fixture
|
|
|
65
68
|
✔ test2
|
|
66
69
|
Took X seconds
|
|
67
70
|
`
|
|
68
|
-
const { stdout, code } = await runCli('bare-async', bareAsyncFixture)
|
|
71
|
+
const { stdout, stderr, code } = await runCli('bare-async', bareAsyncFixture)
|
|
72
|
+
if (code !== 0) {
|
|
73
|
+
console.error(stderr)
|
|
74
|
+
}
|
|
69
75
|
assert.strictEqual(code, 0, 'exited with zero exit code')
|
|
70
76
|
assert.strictEqual(removeTiming(stdout), expected)
|
|
71
77
|
})
|
package/test/test-tape.js
CHANGED
|
@@ -12,7 +12,7 @@ for (const type of ['cjs', 'esm']) {
|
|
|
12
12
|
const tapeFailureFixture = path.join(__dirname, `fixtures/tape-failure${type === 'esm' ? '-esm' : ''}`)
|
|
13
13
|
|
|
14
14
|
describe(`basic tape (${type})`, function () {
|
|
15
|
-
this.timeout(
|
|
15
|
+
this.timeout(60000)
|
|
16
16
|
const expectedTemplate = `
|
|
17
17
|
TAP version 13
|
|
18
18
|
# test suite 1
|
|
@@ -37,49 +37,79 @@ ok 5 all good
|
|
|
37
37
|
`
|
|
38
38
|
|
|
39
39
|
it('should run in page', async () => {
|
|
40
|
-
const { stdout, code } = await runCli(tapeFixture, '--runner=tape')
|
|
40
|
+
const { stdout, stderr, code } = await runCli(tapeFixture, '--runner=tape')
|
|
41
|
+
if (code !== 0) {
|
|
42
|
+
console.error(stderr)
|
|
43
|
+
}
|
|
41
44
|
assert.strictEqual(code, 0, 'exited with zero exit code')
|
|
42
45
|
const expected = expectedTemplate.replace(/WORKER/, 'not in worker')
|
|
46
|
+
if (!stdout.includes(expected)) {
|
|
47
|
+
console.error(stdout)
|
|
48
|
+
}
|
|
43
49
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
44
50
|
assert.ok(stdout.includes('Running tape page tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
45
51
|
})
|
|
46
52
|
|
|
47
53
|
it('should run in worker', async () => {
|
|
48
|
-
const { stdout, code } = await runCli(tapeFixture, '--runner=tape --worker --page=false')
|
|
54
|
+
const { stdout, stderr, code } = await runCli(tapeFixture, '--runner=tape --worker --page=false')
|
|
55
|
+
if (code !== 0) {
|
|
56
|
+
console.error(stderr)
|
|
57
|
+
}
|
|
49
58
|
assert.strictEqual(code, 0, 'exited with zero exit code')
|
|
50
59
|
const expected = expectedTemplate.replace(/WORKER/, 'in worker')
|
|
60
|
+
if (!stdout.includes(expected)) {
|
|
61
|
+
console.error(stdout)
|
|
62
|
+
}
|
|
51
63
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
52
64
|
assert.ok(stdout.includes('Running tape worker tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
53
65
|
})
|
|
54
66
|
|
|
55
67
|
it('should run in serviceworker', async () => {
|
|
56
|
-
const { stdout, code } = await runCli(tapeFixture, '--runner=tape --serviceworker --page=false')
|
|
68
|
+
const { stdout, stderr, code } = await runCli(tapeFixture, '--runner=tape --serviceworker --page=false')
|
|
69
|
+
if (code !== 0) {
|
|
70
|
+
console.error(stderr)
|
|
71
|
+
}
|
|
57
72
|
assert.strictEqual(code, 0, 'exited with zero exit code')
|
|
58
73
|
const expected = expectedTemplate.replace(/WORKER/, 'in serviceworker')
|
|
74
|
+
if (!stdout.includes(expected)) {
|
|
75
|
+
console.error(stdout)
|
|
76
|
+
}
|
|
59
77
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
60
78
|
assert.ok(stdout.includes('Running tape serviceworker tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
61
79
|
})
|
|
62
80
|
|
|
63
81
|
it('should run in page, worker and serviceworker', async () => {
|
|
64
|
-
const { stdout, code } = await runCli(tapeFixture, '--runner=tape --worker --serviceworker')
|
|
82
|
+
const { stdout, stderr, code } = await runCli(tapeFixture, '--runner=tape --worker --serviceworker')
|
|
83
|
+
if (code !== 0) {
|
|
84
|
+
console.error(stderr)
|
|
85
|
+
}
|
|
65
86
|
assert.strictEqual(code, 0, 'exited with zero exit code')
|
|
66
87
|
|
|
67
88
|
let expected = expectedTemplate.replace(/WORKER/, 'not in worker')
|
|
89
|
+
if (!stdout.includes(expected)) {
|
|
90
|
+
console.error(stdout)
|
|
91
|
+
}
|
|
68
92
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
69
93
|
assert.ok(stdout.includes('Running tape serviceworker tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
70
94
|
|
|
71
95
|
expected = expectedTemplate.replace(/WORKER/, 'in worker')
|
|
96
|
+
if (!stdout.includes(expected)) {
|
|
97
|
+
console.error(stdout)
|
|
98
|
+
}
|
|
72
99
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
73
100
|
assert.ok(stdout.includes('Running tape serviceworker tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
74
101
|
|
|
75
102
|
expected = expectedTemplate.replace(/WORKER/, 'in serviceworker')
|
|
103
|
+
if (!stdout.includes(expected)) {
|
|
104
|
+
console.error(stdout)
|
|
105
|
+
}
|
|
76
106
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
77
107
|
assert.ok(stdout.includes('Running tape serviceworker tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
78
108
|
})
|
|
79
109
|
})
|
|
80
110
|
|
|
81
111
|
describe(`failing tape (${type})`, function () {
|
|
82
|
-
this.timeout(
|
|
112
|
+
this.timeout(60000)
|
|
83
113
|
const expectedTemplate = `
|
|
84
114
|
TAP version 13
|
|
85
115
|
# test suite 1 - worker
|
|
@@ -105,6 +135,9 @@ not ok 2 bork
|
|
|
105
135
|
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
106
136
|
stdout = stdout.replace(/^ +at .*\n/gm, '') // stack traces
|
|
107
137
|
const expected = expectedTemplate.replace(/WORKER/, 'not in worker')
|
|
138
|
+
if (!stdout.includes(expected)) {
|
|
139
|
+
console.error(stdout)
|
|
140
|
+
}
|
|
108
141
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
109
142
|
assert.ok(stdout.includes('Running tape page tests with Puppeteer'), 'stdout contains expected output for running in worker')
|
|
110
143
|
})
|
|
@@ -114,6 +147,9 @@ not ok 2 bork
|
|
|
114
147
|
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
115
148
|
stdout = stdout.replace(/^ +at .*\n/gm, '') // stack traces
|
|
116
149
|
const expected = expectedTemplate.replace(/WORKER/, 'in worker')
|
|
150
|
+
if (!stdout.includes(expected)) {
|
|
151
|
+
console.error(stdout)
|
|
152
|
+
}
|
|
117
153
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
118
154
|
assert.ok(stdout.includes('Running tape worker tests with Puppeteer'), 'stdout contains expected output for running in worker')
|
|
119
155
|
})
|
|
@@ -123,6 +159,9 @@ not ok 2 bork
|
|
|
123
159
|
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
124
160
|
stdout = stdout.replace(/^ +at .*\n/gm, '') // stack traces
|
|
125
161
|
const expected = expectedTemplate.replace(/WORKER/, 'in serviceworker')
|
|
162
|
+
if (!stdout.includes(expected)) {
|
|
163
|
+
console.error(stdout)
|
|
164
|
+
}
|
|
126
165
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
127
166
|
assert.ok(stdout.includes('Running tape serviceworker tests with Puppeteer'), 'stdout contains expected output for running in worker')
|
|
128
167
|
})
|
|
@@ -9,15 +9,21 @@ const __dirname = fileURLToPath(path.dirname(import.meta.url))
|
|
|
9
9
|
const webpackMergeFixture = path.join(__dirname, 'fixtures/webpack-merge')
|
|
10
10
|
|
|
11
11
|
describe('basic webpack-merge', function () {
|
|
12
|
-
this.timeout(
|
|
12
|
+
this.timeout(60000)
|
|
13
13
|
it('should run with a custom config', async () => {
|
|
14
14
|
const expected = `
|
|
15
15
|
assert.ok() is a function
|
|
16
16
|
WOOP is set
|
|
17
17
|
✔ test.js
|
|
18
18
|
`
|
|
19
|
-
const { stdout, code } = await runCli(webpackMergeFixture, '--runner=bare-sync --webpack-config webpack.config.js')
|
|
19
|
+
const { stdout, stderr, code } = await runCli(webpackMergeFixture, '--runner=bare-sync --webpack-config webpack.config.js')
|
|
20
|
+
if (code !== 0) {
|
|
21
|
+
console.error(stderr)
|
|
22
|
+
}
|
|
20
23
|
assert.strictEqual(code, 0, 'exited with zero exit code')
|
|
24
|
+
if (!stdout.includes(expected)) {
|
|
25
|
+
console.error(stdout)
|
|
26
|
+
}
|
|
21
27
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
22
28
|
assert.ok(stdout.includes('Running bare-sync page tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
23
29
|
})
|