polendina 1.1.1 → 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 +3 -0
- package/lib/log.js +8 -8
- package/lib/puppeteer.js +3 -5
- package/lib/webpack.config.js +8 -12
- package/lib/{wrap-loader.js → wrap-loader.cjs} +8 -5
- package/package.json +17 -13
- package/polendina-cli.js +7 -6
- package/polendina-node-cli.js +10 -6
- package/polendina.js +39 -18
- package/resources/bare-run.js +3 -3
- package/resources/bare.js +7 -5
- package/resources/common-run.js +23 -26
- package/resources/mocha-run.js +4 -5
- package/resources/tape-run.js +5 -5
- package/resources/test-registry.js +4 -1
- package/test/common.js +8 -8
- package/test/fixtures/bare-async/package.json +4 -1
- package/test/fixtures/bare-async/test-1.js +1 -1
- package/test/fixtures/bare-async/test-2.js +1 -1
- package/test/fixtures/bare-async-esm/index.js +3 -0
- package/test/fixtures/bare-async-esm/package.json +19 -0
- package/test/fixtures/bare-async-esm/test-1.js +16 -0
- package/test/fixtures/bare-async-esm/test-2.js +11 -0
- package/test/fixtures/bare-async-failure/package.json +4 -1
- package/test/fixtures/bare-async-failure/test-1.js +1 -1
- package/test/fixtures/bare-async-failure/test-2.js +2 -2
- package/test/fixtures/bare-async-failure-esm/index.js +3 -0
- package/test/fixtures/bare-async-failure-esm/package.json +19 -0
- package/test/fixtures/bare-async-failure-esm/test-1.js +16 -0
- package/test/fixtures/bare-async-failure-esm/test-2.js +11 -0
- package/test/fixtures/bare-sync/package.json +4 -1
- package/test/fixtures/bare-sync/test-1.js +1 -1
- package/test/fixtures/bare-sync/test-2.js +2 -1
- package/test/fixtures/bare-sync-esm/index.js +1 -0
- package/test/fixtures/bare-sync-esm/package.json +19 -0
- package/test/fixtures/bare-sync-esm/test-1.js +14 -0
- package/test/fixtures/bare-sync-esm/test-2.js +7 -0
- package/test/fixtures/bare-sync-failure/package.json +4 -1
- package/test/fixtures/bare-sync-failure/test-1.js +1 -1
- package/test/fixtures/bare-sync-failure/test-2.js +2 -2
- package/test/fixtures/bare-sync-failure-esm/index.js +1 -0
- package/test/fixtures/bare-sync-failure-esm/package.json +19 -0
- package/test/fixtures/bare-sync-failure-esm/test-1.js +14 -0
- package/test/fixtures/bare-sync-failure-esm/test-2.js +6 -0
- package/test/fixtures/mocha/package.json +2 -1
- package/test/fixtures/mocha/test-1.js +1 -1
- package/test/fixtures/mocha/test-2.js +1 -1
- package/test/fixtures/mocha/test-3.js +1 -1
- package/test/fixtures/mocha-esm/index.js +1 -0
- package/test/fixtures/{mocha8 → mocha-esm}/package.json +4 -2
- package/test/fixtures/{mocha8 → mocha-esm}/test-1.js +2 -2
- package/test/fixtures/{mocha8 → mocha-esm}/test-2.js +1 -1
- package/test/fixtures/{mocha8 → mocha-esm}/test-3.js +2 -2
- package/test/fixtures/mocha-failure/package.json +2 -1
- package/test/fixtures/mocha-failure/test.js +1 -1
- package/test/fixtures/mocha-failure-esm/package.json +20 -0
- package/test/fixtures/mocha-failure-esm/test.js +24 -0
- package/test/fixtures/tape/package.json +1 -1
- package/test/fixtures/tape-esm/index.js +1 -0
- package/test/fixtures/tape-esm/package.json +19 -0
- package/test/fixtures/tape-esm/test.js +47 -0
- package/test/fixtures/tape-failure/package.json +1 -1
- package/test/fixtures/tape-failure-esm/package.json +19 -0
- package/test/fixtures/tape-failure-esm/test.js +29 -0
- package/test/fixtures/webpack-merge/package.json +4 -1
- package/test/fixtures/webpack-merge/test.js +3 -4
- package/test/fixtures/webpack-merge/webpack.config.js +3 -3
- package/test/test-bare-async.js +92 -87
- package/test/test-bare-sync.js +92 -87
- package/test/test-mocha.js +101 -96
- package/test/test-polendina-node.js +44 -38
- package/test/test-tape.js +95 -90
- package/test/test-webpack-merge.js +11 -9
- package/CHANGELOG.md +0 -11
- package/test/fixtures/mocha8/index.js +0 -1
package/test/test-mocha.js
CHANGED
|
@@ -1,78 +1,82 @@
|
|
|
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 mochaFailureFixture = path.join(__dirname, 'fixtures/mocha-failure')
|
|
8
|
+
const __dirname = fileURLToPath(path.dirname(import.meta.url))
|
|
9
9
|
|
|
10
10
|
function removeTimings (stdout) {
|
|
11
11
|
return stdout.replace(/\(\d+ms\)/g, '(Xms)')
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
14
|
+
for (const type of ['cjs', 'esm']) {
|
|
15
|
+
const mochaFixture = path.join(__dirname, `fixtures/mocha${type === 'esm' ? '-esm' : ''}`)
|
|
16
|
+
const mochaFailureFixture = path.join(__dirname, `fixtures/mocha-failure${type === 'esm' ? '-esm' : ''}`)
|
|
17
|
+
|
|
18
|
+
describe(`basic mocha (${type})`, function () {
|
|
19
|
+
this.timeout(20000)
|
|
20
|
+
const expectedTemplate = `
|
|
17
21
|
test suite 1
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
✅ test case 1
|
|
23
|
+
✅ test case 2
|
|
20
24
|
|
|
21
25
|
test suite 2 - worker
|
|
22
|
-
|
|
26
|
+
✅ is WORKER
|
|
23
27
|
|
|
24
28
|
test suite 3
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
✅ test case 1
|
|
30
|
+
✅ test case 2
|
|
27
31
|
`
|
|
28
32
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
33
|
+
it('should run in page', async () => {
|
|
34
|
+
const { stdout, code } = await runCli(mochaFixture)
|
|
35
|
+
assert.strictEqual(code, 0, 'exited with zero exit code')
|
|
36
|
+
const expected = expectedTemplate.replace(/WORKER/, 'not in worker')
|
|
37
|
+
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
38
|
+
assert.ok(stdout.includes('Running mocha page tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
it('should run in worker', async () => {
|
|
42
|
+
const { stdout, code } = await runCli(mochaFixture, '--worker --page=false')
|
|
43
|
+
assert.strictEqual(code, 0, 'exited with zero exit code')
|
|
44
|
+
const expected = expectedTemplate.replace(/WORKER/, 'in worker')
|
|
45
|
+
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
46
|
+
assert.ok(stdout.includes('Running mocha worker tests with Puppeteer'), 'stdout contains expected output for running in worker')
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
it('should run in serviceworker', async () => {
|
|
50
|
+
const { stdout, code } = await runCli(mochaFixture, '--serviceworker --page=false')
|
|
51
|
+
assert.strictEqual(code, 0, 'exited with zero exit code')
|
|
52
|
+
const expected = expectedTemplate.replace(/WORKER/, 'in serviceworker')
|
|
53
|
+
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
54
|
+
assert.ok(stdout.includes('Running mocha serviceworker tests with Puppeteer'), 'stdout contains expected output for running in worker')
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
it('should run in page, worker and serviceworker', async () => {
|
|
58
|
+
const { stdout, code } = await runCli(mochaFixture, '--worker --serviceworker')
|
|
59
|
+
assert.strictEqual(code, 0, 'exited with zero exit code')
|
|
60
|
+
|
|
61
|
+
let expected = expectedTemplate.replace(/WORKER/, 'not in worker')
|
|
62
|
+
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
63
|
+
assert.ok(stdout.includes('Running mocha page tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
64
|
+
|
|
65
|
+
expected = expectedTemplate.replace(/WORKER/, 'in worker')
|
|
66
|
+
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
67
|
+
assert.ok(stdout.includes('Running mocha worker tests with Puppeteer'), 'stdout contains expected output for running in worker')
|
|
68
|
+
|
|
69
|
+
expected = expectedTemplate.replace(/WORKER/, 'in serviceworker')
|
|
70
|
+
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
71
|
+
assert.ok(stdout.includes('Running mocha serviceworker tests with Puppeteer'), 'stdout contains expected output for running in worker')
|
|
72
|
+
})
|
|
51
73
|
})
|
|
52
74
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
let expected = expectedTemplate.replace(/WORKER/, 'not in worker')
|
|
58
|
-
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
59
|
-
assert.ok(stdout.includes('Running mocha page tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
60
|
-
|
|
61
|
-
expected = expectedTemplate.replace(/WORKER/, 'in worker')
|
|
62
|
-
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
63
|
-
assert.ok(stdout.includes('Running mocha worker tests with Puppeteer'), 'stdout contains expected output for running in worker')
|
|
64
|
-
|
|
65
|
-
expected = expectedTemplate.replace(/WORKER/, 'in serviceworker')
|
|
66
|
-
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
67
|
-
assert.ok(stdout.includes('Running mocha serviceworker tests with Puppeteer'), 'stdout contains expected output for running in worker')
|
|
68
|
-
})
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
describe('failing mocha', function () {
|
|
72
|
-
this.timeout(20000)
|
|
73
|
-
const expectedTemplate = `
|
|
75
|
+
describe(`failing mocha (${type})`, function () {
|
|
76
|
+
this.timeout(20000)
|
|
77
|
+
const expectedTemplate = `
|
|
74
78
|
test suite 1 - worker
|
|
75
|
-
|
|
79
|
+
✅ is WORKER
|
|
76
80
|
|
|
77
81
|
test suite 2 - failing
|
|
78
82
|
1) should fail
|
|
@@ -86,43 +90,44 @@ describe('failing mocha', function () {
|
|
|
86
90
|
Error: failing test
|
|
87
91
|
`
|
|
88
92
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
93
|
+
it('should fail in page', async () => {
|
|
94
|
+
let { stdout, code } = await runCli(mochaFailureFixture)
|
|
95
|
+
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
96
|
+
stdout = removeTimings(stdout)
|
|
97
|
+
const expected = expectedTemplate.replace(/WORKER/, 'not in worker')
|
|
98
|
+
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
99
|
+
assert.ok(stdout.includes('Running mocha page tests with Puppeteer'), 'stdout contains expected output for running in worker')
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
it('should fail in worker', async () => {
|
|
103
|
+
let { stdout, code } = await runCli(mochaFailureFixture, '--worker --page=false')
|
|
104
|
+
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
105
|
+
stdout = removeTimings(stdout)
|
|
106
|
+
const expected = expectedTemplate.replace(/WORKER/, 'in worker')
|
|
107
|
+
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
108
|
+
assert.ok(stdout.includes('Running mocha worker tests with Puppeteer'), 'stdout contains expected output for running in worker')
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
it('should fail in serviceworker', async () => {
|
|
112
|
+
let { stdout, code } = await runCli(mochaFailureFixture, '--serviceworker --page=false')
|
|
113
|
+
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
114
|
+
stdout = removeTimings(stdout)
|
|
115
|
+
const expected = expectedTemplate.replace(/WORKER/, 'in serviceworker')
|
|
116
|
+
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
117
|
+
assert.ok(stdout.includes('Running mocha serviceworker tests with Puppeteer'), 'stdout contains expected output for running in worker')
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
it('should fail in page and not run in worker', async () => {
|
|
121
|
+
let { stdout, code } = await runCli(mochaFailureFixture, '--worker')
|
|
122
|
+
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
123
|
+
stdout = removeTimings(stdout)
|
|
124
|
+
const expected = expectedTemplate.replace(/WORKER/, 'not in worker')
|
|
125
|
+
let found = stdout.indexOf(expected)
|
|
126
|
+
assert.ok(found > -1, 'stdout contains expected test output')
|
|
127
|
+
found = stdout.indexOf(expected, found + 1)
|
|
128
|
+
assert.ok(found === -1, 'stdout doesn\'t contain second instance of expected test output')
|
|
129
|
+
assert.ok(stdout.includes('Running mocha page tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
130
|
+
assert.ok(!stdout.includes('Running mocha worker tests with Puppeteer'), 'stdout doesn\'t contain expected output for running in worker')
|
|
131
|
+
})
|
|
127
132
|
})
|
|
128
|
-
}
|
|
133
|
+
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/* globals describe it */
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import assert from 'assert'
|
|
4
|
+
import path from 'path'
|
|
5
|
+
import { fileURLToPath } from 'url'
|
|
6
|
+
import { runCommand } from './common.js'
|
|
7
|
+
|
|
8
|
+
const __dirname = fileURLToPath(path.dirname(import.meta.url))
|
|
7
9
|
|
|
8
|
-
const
|
|
9
|
-
const bareSyncFailureFixture = path.join(__dirname, 'fixtures/bare-sync-failure')
|
|
10
|
-
const bareAsyncFixture = path.join(__dirname, 'fixtures/bare-async')
|
|
11
|
-
const bareAsyncFailureFixture = path.join(__dirname, 'fixtures/bare-async-failure')
|
|
10
|
+
const cli = path.join(__dirname, '../polendina-node-cli.js')
|
|
12
11
|
|
|
13
12
|
function runCli (mode, cwd) {
|
|
14
13
|
return runCommand(`${cli} ${mode} test*.js`, cwd)
|
|
@@ -18,40 +17,46 @@ function removeTiming (stdout) {
|
|
|
18
17
|
return stdout.replace(/Took [\d.]+ seconds/, 'Took X seconds')
|
|
19
18
|
}
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
for (const type of ['cjs', 'esm']) {
|
|
21
|
+
const bareSyncFixture = path.join(__dirname, `fixtures/bare-sync${type === 'esm' ? '-esm' : ''}`)
|
|
22
|
+
const bareSyncFailureFixture = path.join(__dirname, `fixtures/bare-sync-failure${type === 'esm' ? '-esm' : ''}`)
|
|
23
|
+
const bareAsyncFixture = path.join(__dirname, `fixtures/bare-async${type === 'esm' ? '-esm' : ''}`)
|
|
24
|
+
const bareAsyncFailureFixture = path.join(__dirname, `fixtures/bare-async-failure${type === 'esm' ? '-esm' : ''}`)
|
|
25
|
+
|
|
26
|
+
describe(`polendina-node bare-sync (${type})`, function () {
|
|
27
|
+
this.timeout(20000)
|
|
28
|
+
it('pass', async () => {
|
|
29
|
+
const expected =
|
|
25
30
|
`testing is not in worker
|
|
26
31
|
✔ test-1.js
|
|
27
32
|
testing bare fixture
|
|
28
33
|
✔ test-2.js
|
|
29
34
|
Took X seconds
|
|
30
35
|
`
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
const { stdout, code } = await runCli('bare-sync', bareSyncFixture)
|
|
37
|
+
assert.strictEqual(code, 0, 'exited with zero exit code')
|
|
38
|
+
assert.strictEqual(removeTiming(stdout), expected)
|
|
39
|
+
})
|
|
35
40
|
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
it('failure', async () => {
|
|
42
|
+
const expected =
|
|
38
43
|
`testing is not in worker
|
|
39
44
|
✔ test-1.js
|
|
40
45
|
testing bare fixture
|
|
41
46
|
✘ test-2.js
|
|
42
47
|
Took X seconds
|
|
43
48
|
`
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
const { stdout, stderr, code } = await runCli('bare-sync', bareSyncFailureFixture)
|
|
50
|
+
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
51
|
+
assert.strictEqual(removeTiming(stdout), expected)
|
|
52
|
+
assert.ok(stderr.includes('AssertionError: faily mcfailface'), 'stderr contains expected output')
|
|
53
|
+
})
|
|
48
54
|
})
|
|
49
|
-
})
|
|
50
55
|
|
|
51
|
-
describe(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
describe(`polendina-node bare-async (${type})`, function () {
|
|
57
|
+
this.timeout(20000)
|
|
58
|
+
it('pass', async () => {
|
|
59
|
+
const expected =
|
|
55
60
|
`testing is not in worker
|
|
56
61
|
✔ test-1.js
|
|
57
62
|
test-2.js
|
|
@@ -60,13 +65,13 @@ testing bare fixture
|
|
|
60
65
|
✔ test2
|
|
61
66
|
Took X seconds
|
|
62
67
|
`
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
const { stdout, code } = await runCli('bare-async', bareAsyncFixture)
|
|
69
|
+
assert.strictEqual(code, 0, 'exited with zero exit code')
|
|
70
|
+
assert.strictEqual(removeTiming(stdout), expected)
|
|
71
|
+
})
|
|
67
72
|
|
|
68
|
-
|
|
69
|
-
|
|
73
|
+
it('failure', async () => {
|
|
74
|
+
const expected =
|
|
70
75
|
`testing is not in worker
|
|
71
76
|
✔ test-1.js
|
|
72
77
|
test-2.js
|
|
@@ -75,9 +80,10 @@ testing bare fixture
|
|
|
75
80
|
✘ test2
|
|
76
81
|
Took X seconds
|
|
77
82
|
`
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
83
|
+
const { stdout, stderr, code } = await runCli('bare-async', bareAsyncFailureFixture)
|
|
84
|
+
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
85
|
+
assert.strictEqual(removeTiming(stdout), expected)
|
|
86
|
+
assert.ok(stderr.includes('AssertionError: faily mcfailface'), 'stderr contains expected output')
|
|
87
|
+
})
|
|
82
88
|
})
|
|
83
|
-
}
|
|
89
|
+
}
|
package/test/test-tape.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 tapeFailureFixture = path.join(__dirname, 'fixtures/tape-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 tapeFixture = path.join(__dirname, `fixtures/tape${type === 'esm' ? '-esm' : ''}`)
|
|
12
|
+
const tapeFailureFixture = path.join(__dirname, `fixtures/tape-failure${type === 'esm' ? '-esm' : ''}`)
|
|
13
|
+
|
|
14
|
+
describe(`basic tape (${type})`, function () {
|
|
15
|
+
this.timeout(20000)
|
|
16
|
+
const expectedTemplate = `
|
|
13
17
|
TAP version 13
|
|
14
18
|
# test suite 1
|
|
15
19
|
# test case 1
|
|
@@ -32,51 +36,51 @@ ok 5 all good
|
|
|
32
36
|
# ok
|
|
33
37
|
`
|
|
34
38
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
39
|
+
it('should run in page', async () => {
|
|
40
|
+
const { stdout, code } = await runCli(tapeFixture, '--runner=tape')
|
|
41
|
+
assert.strictEqual(code, 0, 'exited with zero exit code')
|
|
42
|
+
const expected = expectedTemplate.replace(/WORKER/, 'not in worker')
|
|
43
|
+
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
44
|
+
assert.ok(stdout.includes('Running tape page tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
it('should run in worker', async () => {
|
|
48
|
+
const { stdout, code } = await runCli(tapeFixture, '--runner=tape --worker --page=false')
|
|
49
|
+
assert.strictEqual(code, 0, 'exited with zero exit code')
|
|
50
|
+
const expected = expectedTemplate.replace(/WORKER/, 'in worker')
|
|
51
|
+
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
52
|
+
assert.ok(stdout.includes('Running tape worker tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
it('should run in serviceworker', async () => {
|
|
56
|
+
const { stdout, code } = await runCli(tapeFixture, '--runner=tape --serviceworker --page=false')
|
|
57
|
+
assert.strictEqual(code, 0, 'exited with zero exit code')
|
|
58
|
+
const expected = expectedTemplate.replace(/WORKER/, 'in serviceworker')
|
|
59
|
+
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
60
|
+
assert.ok(stdout.includes('Running tape serviceworker tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
it('should run in page, worker and serviceworker', async () => {
|
|
64
|
+
const { stdout, code } = await runCli(tapeFixture, '--runner=tape --worker --serviceworker')
|
|
65
|
+
assert.strictEqual(code, 0, 'exited with zero exit code')
|
|
66
|
+
|
|
67
|
+
let expected = expectedTemplate.replace(/WORKER/, 'not in worker')
|
|
68
|
+
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
69
|
+
assert.ok(stdout.includes('Running tape serviceworker tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
70
|
+
|
|
71
|
+
expected = expectedTemplate.replace(/WORKER/, 'in worker')
|
|
72
|
+
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
73
|
+
assert.ok(stdout.includes('Running tape serviceworker tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
74
|
+
|
|
75
|
+
expected = expectedTemplate.replace(/WORKER/, 'in serviceworker')
|
|
76
|
+
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
77
|
+
assert.ok(stdout.includes('Running tape serviceworker tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
78
|
+
})
|
|
74
79
|
})
|
|
75
|
-
})
|
|
76
80
|
|
|
77
|
-
describe(
|
|
78
|
-
|
|
79
|
-
|
|
81
|
+
describe(`failing tape (${type})`, function () {
|
|
82
|
+
this.timeout(20000)
|
|
83
|
+
const expectedTemplate = `
|
|
80
84
|
TAP version 13
|
|
81
85
|
# test suite 1 - worker
|
|
82
86
|
# is WORKER
|
|
@@ -96,43 +100,44 @@ not ok 2 bork
|
|
|
96
100
|
# fail 1
|
|
97
101
|
`
|
|
98
102
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
103
|
+
it('should fail in page', async () => {
|
|
104
|
+
let { stdout, code } = await runCli(tapeFailureFixture, '--runner=tape')
|
|
105
|
+
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
106
|
+
stdout = stdout.replace(/^ +at .*\n/gm, '') // stack traces
|
|
107
|
+
const expected = expectedTemplate.replace(/WORKER/, 'not in worker')
|
|
108
|
+
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
109
|
+
assert.ok(stdout.includes('Running tape page tests with Puppeteer'), 'stdout contains expected output for running in worker')
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
it('should fail in worker', async () => {
|
|
113
|
+
let { stdout, code } = await runCli(tapeFailureFixture, '--runner=tape --worker --page=false')
|
|
114
|
+
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
115
|
+
stdout = stdout.replace(/^ +at .*\n/gm, '') // stack traces
|
|
116
|
+
const expected = expectedTemplate.replace(/WORKER/, 'in worker')
|
|
117
|
+
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
118
|
+
assert.ok(stdout.includes('Running tape worker tests with Puppeteer'), 'stdout contains expected output for running in worker')
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
it('should fail in serviceworker', async () => {
|
|
122
|
+
let { stdout, code } = await runCli(tapeFailureFixture, '--runner=tape --serviceworker --page=false')
|
|
123
|
+
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
124
|
+
stdout = stdout.replace(/^ +at .*\n/gm, '') // stack traces
|
|
125
|
+
const expected = expectedTemplate.replace(/WORKER/, 'in serviceworker')
|
|
126
|
+
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
127
|
+
assert.ok(stdout.includes('Running tape serviceworker tests with Puppeteer'), 'stdout contains expected output for running in worker')
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
it('should fail in page and not run in worker', async () => {
|
|
131
|
+
let { stdout, code } = await runCli(tapeFailureFixture, '--runner=tape --worker')
|
|
132
|
+
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
133
|
+
stdout = stdout.replace(/^ +at .*\n/gm, '') // stack traces
|
|
134
|
+
const expected = expectedTemplate.replace(/WORKER/, 'not in worker')
|
|
135
|
+
let found = stdout.indexOf(expected)
|
|
136
|
+
assert.ok(found > -1, 'stdout contains expected test output')
|
|
137
|
+
found = stdout.indexOf(expected, found + 1)
|
|
138
|
+
assert.ok(found === -1, 'stdout doesn\'t contain second instance of expected test output')
|
|
139
|
+
assert.ok(stdout.includes('Running tape page tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
140
|
+
assert.ok(!stdout.includes('Running tape worker tests with Puppeteer'), 'stdout doesn\'t contain expected output for running in worker')
|
|
141
|
+
})
|
|
137
142
|
})
|
|
138
|
-
}
|
|
143
|
+
}
|
|
@@ -1,33 +1,35 @@
|
|
|
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
|
|
|
8
|
+
const __dirname = fileURLToPath(path.dirname(import.meta.url))
|
|
7
9
|
const webpackMergeFixture = path.join(__dirname, 'fixtures/webpack-merge')
|
|
8
10
|
|
|
9
11
|
describe('basic webpack-merge', function () {
|
|
10
12
|
this.timeout(20000)
|
|
11
|
-
it('should run
|
|
13
|
+
it('should run with a custom config', async () => {
|
|
12
14
|
const expected = `
|
|
13
15
|
assert.ok() is a function
|
|
14
|
-
|
|
16
|
+
WOOP is set
|
|
15
17
|
✔ test.js
|
|
16
18
|
`
|
|
17
|
-
const { stdout, code } = await runCli(webpackMergeFixture, '--runner=bare-sync')
|
|
19
|
+
const { stdout, code } = await runCli(webpackMergeFixture, '--runner=bare-sync --webpack-config webpack.config.js')
|
|
18
20
|
assert.strictEqual(code, 0, 'exited with zero exit code')
|
|
19
21
|
assert.ok(stdout.includes(expected), 'stdout contains expected test output')
|
|
20
22
|
assert.ok(stdout.includes('Running bare-sync page tests with Puppeteer'), 'stdout contains expected output for running in page')
|
|
21
23
|
})
|
|
22
24
|
|
|
23
|
-
it('should fail
|
|
25
|
+
it('should fail without a custom config', async () => {
|
|
24
26
|
const expectedStdout = `
|
|
25
27
|
assert.ok() is a function
|
|
26
28
|
✘ test.js
|
|
27
29
|
`
|
|
28
|
-
const expectedStderr = '
|
|
30
|
+
const expectedStderr = 'WOOP is not defined'
|
|
29
31
|
|
|
30
|
-
const { stdout, stderr, code } = await runCli(webpackMergeFixture, '--runner=bare-sync
|
|
32
|
+
const { stdout, stderr, code } = await runCli(webpackMergeFixture, '--runner=bare-sync')
|
|
31
33
|
assert.strictEqual(code, 1, 'exited with zero exit code')
|
|
32
34
|
assert.ok(stdout.includes(expectedStdout), 'stdout contains expected test output')
|
|
33
35
|
assert.ok(stderr.includes(expectedStderr), 'stderr contains expected test output')
|
package/CHANGELOG.md
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
### [1.1.1](https://github.com/rvagg/polendina/compare/v1.1.0...v1.1.1) (2021-12-07)
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
### Bug Fixes
|
|
5
|
-
|
|
6
|
-
* no build step for release ([b91faf0](https://github.com/rvagg/polendina/commit/b91faf08395e6f8bc44b21d02d94c2136bcac942))
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
### Trivial Changes
|
|
10
|
-
|
|
11
|
-
* add auto-releases ([#17](https://github.com/rvagg/polendina/issues/17)) ([9e71246](https://github.com/rvagg/polendina/commit/9e71246667ba96d8253aa180271728b35e700b45))
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = 'polendina test'
|