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
package/test/test-tape.js
CHANGED
|
@@ -1,27 +1,31 @@
|
|
|
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
|
|
16
|
-
ok 1 should be equal
|
|
20
|
+
ok 1 should be strictly equal
|
|
17
21
|
# test case 2
|
|
18
22
|
ok 2 all good
|
|
19
23
|
# test suite 2 - worker
|
|
20
24
|
# is WORKER
|
|
21
|
-
ok 3 should be equal
|
|
25
|
+
ok 3 should be strictly equal
|
|
22
26
|
# test suite 3
|
|
23
27
|
# test case 1
|
|
24
|
-
ok 4 should be equal
|
|
28
|
+
ok 4 should be strictly equal
|
|
25
29
|
# test case 2
|
|
26
30
|
ok 5 all good
|
|
27
31
|
|
|
@@ -32,55 +36,55 @@ 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
|
|
83
|
-
ok 1 should be equal
|
|
87
|
+
ok 1 should be strictly equal
|
|
84
88
|
# test suite 2 - failure
|
|
85
89
|
# test case 1
|
|
86
90
|
not ok 2 bork
|
|
@@ -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')
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
name: CI
|
|
2
|
-
|
|
3
|
-
on: [push, pull_request]
|
|
4
|
-
|
|
5
|
-
jobs:
|
|
6
|
-
build:
|
|
7
|
-
|
|
8
|
-
runs-on: ubuntu-latest
|
|
9
|
-
|
|
10
|
-
steps:
|
|
11
|
-
- name: Checkout
|
|
12
|
-
uses: actions/checkout@v1
|
|
13
|
-
with:
|
|
14
|
-
fetch-depth: 1
|
|
15
|
-
|
|
16
|
-
- name: Install and test
|
|
17
|
-
uses: actions/setup-node@v1
|
|
18
|
-
with:
|
|
19
|
-
node-version: '12.x'
|
|
20
|
-
- run: npm install
|
|
21
|
-
- run: npm test
|