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.
- package/.github/dependabot.yml +154 -0
- package/.github/workflows/test-and-release.yml +61 -0
- package/lib/log.js +8 -8
- package/lib/puppeteer.js +6 -5
- package/lib/webpack.config.js +15 -18
- package/lib/{wrap-loader.js → wrap-loader.cjs} +10 -7
- package/package.json +99 -18
- package/polendina-cli.js +7 -6
- package/polendina-node-cli.js +10 -6
- package/polendina.js +45 -19
- 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 +12 -12
- 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/mocha-esm/package.json +20 -0
- package/test/fixtures/mocha-esm/test-1.js +14 -0
- package/test/fixtures/mocha-esm/test-2.js +19 -0
- package/test/fixtures/mocha-esm/test-3.js +14 -0
- 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 +99 -94
- package/test/test-webpack-merge.js +11 -9
- package/.github/workflows/main.yml +0 -21
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default 'polendina test'
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "fixture-mocha",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "test-fixture",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "mocha test-*.js"
|
|
9
|
+
},
|
|
10
|
+
"author": "Rod <rod@vagg.org> (http://r.va.gg/)",
|
|
11
|
+
"license": "Apache-2.0",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/rvagg/polendina.git"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"chai": "^4.3.4",
|
|
18
|
+
"mocha": "~9.1.3"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* globals describe it */
|
|
2
|
+
|
|
3
|
+
import fixture from './index.js'
|
|
4
|
+
import { assert } from 'chai'
|
|
5
|
+
|
|
6
|
+
describe('test suite 1', () => {
|
|
7
|
+
it('test case 1', () => {
|
|
8
|
+
assert.strictEqual(fixture, 'polendina test')
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
it('test case 2', () => {
|
|
12
|
+
assert.ok(true, 'all good')
|
|
13
|
+
})
|
|
14
|
+
})
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/* globals describe it WorkerGlobalScope ServiceWorkerGlobalScope */
|
|
2
|
+
|
|
3
|
+
import { assert } from 'chai'
|
|
4
|
+
|
|
5
|
+
describe('test suite 2 - worker', () => {
|
|
6
|
+
if (typeof ServiceWorkerGlobalScope !== 'undefined' && global instanceof ServiceWorkerGlobalScope) {
|
|
7
|
+
it('is in serviceworker', () => {
|
|
8
|
+
assert.strictEqual(typeof ServiceWorkerGlobalScope, 'function')
|
|
9
|
+
})
|
|
10
|
+
} else if (typeof WorkerGlobalScope !== 'undefined' && global instanceof WorkerGlobalScope) {
|
|
11
|
+
it('is in worker', () => {
|
|
12
|
+
assert.strictEqual(typeof WorkerGlobalScope, 'function')
|
|
13
|
+
})
|
|
14
|
+
} else {
|
|
15
|
+
it('is not in worker', () => {
|
|
16
|
+
assert.strictEqual(typeof WorkerGlobalScope, 'undefined')
|
|
17
|
+
})
|
|
18
|
+
}
|
|
19
|
+
})
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* globals describe it */
|
|
2
|
+
|
|
3
|
+
import fixture from './index.js'
|
|
4
|
+
import { assert } from 'chai'
|
|
5
|
+
|
|
6
|
+
describe('test suite 3', () => {
|
|
7
|
+
it('test case 1', () => {
|
|
8
|
+
assert.strictEqual(fixture, 'polendina test')
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
it('test case 2', () => {
|
|
12
|
+
assert.ok(true, 'all good')
|
|
13
|
+
})
|
|
14
|
+
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* globals describe it WorkerGlobalScope ServiceWorkerGlobalScope */
|
|
2
|
-
const assert = require('
|
|
2
|
+
const { assert } = require('chai')
|
|
3
3
|
|
|
4
4
|
describe('test suite 1 - worker', () => {
|
|
5
5
|
if (typeof ServiceWorkerGlobalScope !== 'undefined' && global instanceof ServiceWorkerGlobalScope) {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "fixture-mocha-failure",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "test fixture",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "mocha test-*.js"
|
|
9
|
+
},
|
|
10
|
+
"author": "Rod <rod@vagg.org> (http://r.va.gg/)",
|
|
11
|
+
"license": "Apache-2.0",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/rvagg/polendina.git"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"chai": "^4.3.4",
|
|
18
|
+
"mocha": "~9.1.3"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/* globals describe it WorkerGlobalScope ServiceWorkerGlobalScope */
|
|
2
|
+
import { assert } from 'chai'
|
|
3
|
+
|
|
4
|
+
describe('test suite 1 - worker', () => {
|
|
5
|
+
if (typeof ServiceWorkerGlobalScope !== 'undefined' && global instanceof ServiceWorkerGlobalScope) {
|
|
6
|
+
it('is in serviceworker', () => {
|
|
7
|
+
assert.strictEqual(typeof ServiceWorkerGlobalScope, 'function')
|
|
8
|
+
})
|
|
9
|
+
} else if (typeof WorkerGlobalScope !== 'undefined' && global instanceof WorkerGlobalScope) {
|
|
10
|
+
it('is in worker', () => {
|
|
11
|
+
assert.strictEqual(typeof WorkerGlobalScope, 'function')
|
|
12
|
+
})
|
|
13
|
+
} else {
|
|
14
|
+
it('is not in worker', () => {
|
|
15
|
+
assert.strictEqual(typeof WorkerGlobalScope, 'undefined')
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
describe('test suite 2 - failing', () => {
|
|
21
|
+
it('should fail', () => {
|
|
22
|
+
throw new Error('failing test')
|
|
23
|
+
})
|
|
24
|
+
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default 'polendina test'
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "fixture-tape",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "test fixture",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "tape test.js"
|
|
9
|
+
},
|
|
10
|
+
"author": "Rod <rod@vagg.org> (http://r.va.gg/)",
|
|
11
|
+
"license": "Apache-2.0",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/rvagg/polendina.git"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"tape": "~5.3.2"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/* globals WorkerGlobalScope ServiceWorkerGlobalScope */
|
|
2
|
+
|
|
3
|
+
import tape from 'tape'
|
|
4
|
+
import fixture from './index.js'
|
|
5
|
+
|
|
6
|
+
tape('test suite 1', (t) => {
|
|
7
|
+
t.test('test case 1', (t) => {
|
|
8
|
+
t.strictEqual(fixture, 'polendina test')
|
|
9
|
+
t.end()
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
t.test('test case 2', (t) => {
|
|
13
|
+
t.ok(true, 'all good')
|
|
14
|
+
t.end()
|
|
15
|
+
})
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
tape('test suite 2 - worker', (t) => {
|
|
19
|
+
if (typeof ServiceWorkerGlobalScope !== 'undefined' && global instanceof ServiceWorkerGlobalScope) {
|
|
20
|
+
t.test('is in serviceworker', (t) => {
|
|
21
|
+
t.strictEqual(typeof ServiceWorkerGlobalScope, 'function')
|
|
22
|
+
t.end()
|
|
23
|
+
})
|
|
24
|
+
} else if (typeof WorkerGlobalScope !== 'undefined' && global instanceof WorkerGlobalScope) {
|
|
25
|
+
t.test('is in worker', (t) => {
|
|
26
|
+
t.strictEqual(typeof WorkerGlobalScope, 'function')
|
|
27
|
+
t.end()
|
|
28
|
+
})
|
|
29
|
+
} else {
|
|
30
|
+
t.test('is not in worker', (t) => {
|
|
31
|
+
t.strictEqual(typeof WorkerGlobalScope, 'undefined')
|
|
32
|
+
t.end()
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
tape('test suite 3', (t) => {
|
|
38
|
+
t.test('test case 1', (t) => {
|
|
39
|
+
t.strictEqual(fixture, 'polendina test')
|
|
40
|
+
t.end()
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
t.test('test case 2', (t) => {
|
|
44
|
+
t.ok(true, 'all good')
|
|
45
|
+
t.end()
|
|
46
|
+
})
|
|
47
|
+
})
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "fixture-tape-failure",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "test fixture",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "tape test.js"
|
|
9
|
+
},
|
|
10
|
+
"author": "Rod <rod@vagg.org> (http://r.va.gg/)",
|
|
11
|
+
"license": "Apache-2.0",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/rvagg/polendina.git"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"tape": "~5.0.1"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/* globals WorkerGlobalScope ServiceWorkerGlobalScope */
|
|
2
|
+
|
|
3
|
+
import tape from 'tape'
|
|
4
|
+
|
|
5
|
+
tape('test suite 1 - worker', (t) => {
|
|
6
|
+
if (typeof ServiceWorkerGlobalScope !== 'undefined' && global instanceof ServiceWorkerGlobalScope) {
|
|
7
|
+
t.test('is in serviceworker', (t) => {
|
|
8
|
+
t.strictEqual(typeof ServiceWorkerGlobalScope, 'function')
|
|
9
|
+
t.end()
|
|
10
|
+
})
|
|
11
|
+
} else if (typeof WorkerGlobalScope !== 'undefined' && global instanceof WorkerGlobalScope) {
|
|
12
|
+
t.test('is in worker', (t) => {
|
|
13
|
+
t.strictEqual(typeof WorkerGlobalScope, 'function')
|
|
14
|
+
t.end()
|
|
15
|
+
})
|
|
16
|
+
} else {
|
|
17
|
+
t.test('is not in worker', (t) => {
|
|
18
|
+
t.strictEqual(typeof WorkerGlobalScope, 'undefined')
|
|
19
|
+
t.end()
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
tape('test suite 2 - failure', (t) => {
|
|
25
|
+
t.test('test case 1', (t) => {
|
|
26
|
+
t.fail('bork')
|
|
27
|
+
t.end()
|
|
28
|
+
})
|
|
29
|
+
})
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
const assert = require('
|
|
2
|
-
const qs = require('querystring')
|
|
1
|
+
const { assert } = require('chai')
|
|
3
2
|
|
|
4
3
|
assert.strictEqual(typeof assert.ok, 'function')
|
|
5
4
|
console.log('assert.ok() is a function')
|
|
6
|
-
assert.strictEqual(
|
|
7
|
-
console.log('
|
|
5
|
+
assert.strictEqual(WOOP, 'woop') // eslint-disable-line
|
|
6
|
+
console.log('WOOP is set')
|
package/test/test-bare-async.js
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
/* globals describe it */
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import assert from 'assert'
|
|
4
|
+
import path from 'path'
|
|
5
|
+
import { fileURLToPath } from 'url'
|
|
6
|
+
import { runCli } from './common.js'
|
|
6
7
|
|
|
7
|
-
const
|
|
8
|
-
const bareSyncFailureFixture = path.join(__dirname, 'fixtures/bare-async-failure')
|
|
8
|
+
const __dirname = fileURLToPath(path.dirname(import.meta.url))
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
10
|
+
for (const type of ['cjs', 'esm']) {
|
|
11
|
+
const bareAsyncFixture = path.join(__dirname, `fixtures/bare-async${type === 'esm' ? '-esm' : ''}`)
|
|
12
|
+
const bareAsyncFailureFixture = path.join(__dirname, `fixtures/bare-async-failure${type === 'esm' ? '-esm' : ''}`)
|
|
13
|
+
|
|
14
|
+
describe(`basic bare-async (${type})`, function () {
|
|
15
|
+
this.timeout(20000)
|
|
16
|
+
const expectedTemplate = `
|
|
13
17
|
testing is WORKER
|
|
14
18
|
✔ test-1.js
|
|
15
19
|
test-2.js
|
|
@@ -18,51 +22,51 @@ testing bare fixture
|
|
|
18
22
|
✔ test2
|
|
19
23
|
`
|
|
20
24
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
it('should run in page', async () => {
|
|
26
|
+
const { stdout, code } = await runCli(bareAsyncFixture, '--runner=bare-async')
|
|
27
|
+
assert.strictEqual(code, 0, 'exited with zero exit code')
|
|
28
|
+
const expected = expectedTemplate.replace(/WORKER/, 'not in worker')
|
|
29
|
+
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
30
|
+
assert.ok(stdout.includes('Running bare-async page tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
31
|
+
})
|
|
28
32
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
it('should run in worker', async () => {
|
|
34
|
+
const { stdout, code } = await runCli(bareAsyncFixture, '--runner=bare-async --worker --page=false')
|
|
35
|
+
assert.strictEqual(code, 0, 'exited with zero exit code')
|
|
36
|
+
const expected = expectedTemplate.replace(/WORKER/, 'in worker')
|
|
37
|
+
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
38
|
+
assert.ok(stdout.includes('Running bare-async worker tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
39
|
+
})
|
|
36
40
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
it('should run in serviceworker', async () => {
|
|
42
|
+
const { stdout, code } = await runCli(bareAsyncFixture, '--runner=bare-async --serviceworker --page=false')
|
|
43
|
+
assert.strictEqual(code, 0, 'exited with zero exit code')
|
|
44
|
+
const expected = expectedTemplate.replace(/WORKER/, 'in serviceworker')
|
|
45
|
+
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
46
|
+
assert.ok(stdout.includes('Running bare-async serviceworker tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
47
|
+
})
|
|
44
48
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
it('should run in page, worker and serviceworker', async () => {
|
|
50
|
+
const { stdout, code } = await runCli(bareAsyncFixture, '--runner=bare-async --worker --serviceworker')
|
|
51
|
+
assert.strictEqual(code, 0, 'exited with zero exit code')
|
|
48
52
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
53
|
+
let expected = expectedTemplate.replace(/WORKER/, 'not in worker')
|
|
54
|
+
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
55
|
+
assert.ok(stdout.includes('Running bare-async serviceworker tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
52
56
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
expected = expectedTemplate.replace(/WORKER/, 'in worker')
|
|
58
|
+
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
59
|
+
assert.ok(stdout.includes('Running bare-async serviceworker tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
56
60
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
expected = expectedTemplate.replace(/WORKER/, 'in serviceworker')
|
|
62
|
+
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
63
|
+
assert.ok(stdout.includes('Running bare-async serviceworker tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
64
|
+
})
|
|
60
65
|
})
|
|
61
|
-
})
|
|
62
66
|
|
|
63
|
-
describe(
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
describe(`failing bare-async (${type})`, function () {
|
|
68
|
+
this.timeout(20000)
|
|
69
|
+
const expectedTemplate = `
|
|
66
70
|
testing is WORKER
|
|
67
71
|
✔ test-1.js
|
|
68
72
|
test-2.js
|
|
@@ -70,49 +74,50 @@ testing bare fixture
|
|
|
70
74
|
✔ test1
|
|
71
75
|
✘ test2
|
|
72
76
|
`
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
it('should fail in page', async () => {
|
|
76
|
-
let { stdout, stderr, code } = await runCli(bareSyncFailureFixture, '--runner=bare-async')
|
|
77
|
-
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
78
|
-
stdout = stdout.replace(/^ +at .*\n/gm, '') // stack traces
|
|
79
|
-
const expected = expectedTemplate.replace(/WORKER/, 'not in worker')
|
|
80
|
-
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
81
|
-
assert.ok(stdout.includes('Running bare-async page tests with Puppeteer'), 'stdout contains expected output for running in worker')
|
|
82
|
-
assert.ok(stderr.includes(expectedStderr), 'stderr contains expected output')
|
|
83
|
-
})
|
|
77
|
+
const expectedStderr = 'AssertionError: faily mcfailface'
|
|
84
78
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
79
|
+
it('should fail in page', async () => {
|
|
80
|
+
let { stdout, stderr, code } = await runCli(bareAsyncFailureFixture, '--runner=bare-async')
|
|
81
|
+
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
82
|
+
stdout = stdout.replace(/^ +at .*\n/gm, '') // stack traces
|
|
83
|
+
const expected = expectedTemplate.replace(/WORKER/, 'not in worker')
|
|
84
|
+
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
85
|
+
assert.ok(stdout.includes('Running bare-async page tests with Puppeteer'), 'stdout contains expected output for running in worker')
|
|
86
|
+
assert.ok(stderr.includes(expectedStderr), 'stderr contains expected output')
|
|
87
|
+
})
|
|
94
88
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
89
|
+
it('should fail in worker', async () => {
|
|
90
|
+
let { stdout, stderr, code } = await runCli(bareAsyncFailureFixture, '--runner=bare-async --worker --page=false')
|
|
91
|
+
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
92
|
+
stdout = stdout.replace(/^ +at .*\n/gm, '') // stack traces
|
|
93
|
+
const expected = expectedTemplate.replace(/WORKER/, 'in worker')
|
|
94
|
+
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
95
|
+
assert.ok(stdout.includes('Running bare-async worker tests with Puppeteer'), 'stdout contains expected output for running in worker')
|
|
96
|
+
assert.ok(stderr.includes(expectedStderr), 'stderr contains expected output')
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
it('should fail in serviceworker', async () => {
|
|
100
|
+
let { stdout, stderr, code } = await runCli(bareAsyncFailureFixture, '--runner=bare-async --serviceworker --page=false')
|
|
101
|
+
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
102
|
+
stdout = stdout.replace(/^ +at .*\n/gm, '') // stack traces
|
|
103
|
+
const expected = expectedTemplate.replace(/WORKER/, 'in serviceworker')
|
|
104
|
+
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
105
|
+
assert.ok(stdout.includes('Running bare-async serviceworker tests with Puppeteer'), 'stdout contains expected output for running in worker')
|
|
106
|
+
assert.ok(stderr.includes(expectedStderr), 'stderr contains expected output')
|
|
107
|
+
})
|
|
104
108
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
109
|
+
it('should fail in page and not run in worker', async () => {
|
|
110
|
+
let { stdout, stderr, code } = await runCli(bareAsyncFailureFixture, '--runner=bare-async --worker')
|
|
111
|
+
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
112
|
+
stdout = stdout.replace(/^ +at .*\n/gm, '') // stack traces
|
|
113
|
+
const expected = expectedTemplate.replace(/WORKER/, 'not in worker')
|
|
114
|
+
let found = stdout.indexOf(expected)
|
|
115
|
+
assert.ok(found > -1, 'stdout contains expected test output')
|
|
116
|
+
found = stdout.indexOf(expected, found + 1)
|
|
117
|
+
assert.ok(found === -1, 'stdout doesn\'t contain second instance of expected test output')
|
|
118
|
+
assert.ok(stdout.includes('Running bare-async page tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
119
|
+
assert.ok(!stdout.includes('Running bare-async worker tests with Puppeteer'), 'stdout doesn\'t contain expected output for running in worker')
|
|
120
|
+
assert.ok(stderr.includes(expectedStderr), 'stderr contains expected output')
|
|
121
|
+
})
|
|
117
122
|
})
|
|
118
|
-
}
|
|
123
|
+
}
|