polendina 3.3.1 → 3.3.3
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 +1 -130
- package/.github/workflows/test-and-release.yml +1 -3
- package/AGENTS.md +400 -0
- package/CHANGELOG.md +16 -0
- package/CLAUDE.md +1 -0
- package/lib/webpack.config.js +5 -2
- package/package.json +3 -4
- package/polendina.js +7 -3
- package/test/common.js +27 -10
- package/test/consumer/package.json +11 -0
- package/test/fixtures/bare-async/package.json +1 -14
- package/test/fixtures/bare-async-esm/package.json +2 -15
- package/test/fixtures/bare-async-failure/package.json +1 -14
- package/test/fixtures/bare-async-failure-esm/package.json +2 -15
- package/test/fixtures/bare-sync/package.json +1 -14
- package/test/fixtures/bare-sync-esm/package.json +2 -15
- package/test/fixtures/bare-sync-failure/package.json +1 -14
- package/test/fixtures/bare-sync-failure-esm/package.json +2 -15
- package/test/fixtures/mocha/package.json +1 -15
- package/test/fixtures/mocha-esm/package.json +2 -16
- package/test/fixtures/mocha-failure/package.json +1 -15
- package/test/fixtures/mocha-failure-esm/package.json +2 -16
- package/test/fixtures/tape/package.json +1 -14
- package/test/fixtures/tape-esm/package.json +2 -15
- package/test/fixtures/tape-failure/package.json +1 -14
- package/test/fixtures/tape-failure-esm/package.json +2 -15
- package/test/fixtures/webpack-merge/package.json +1 -14
- package/test/setup.js +96 -0
- package/test/test-bare-async.js +10 -14
- package/test/test-bare-sync.js +10 -14
- package/test/test-mocha.js +23 -23
- package/test/test-packed-install.js +47 -0
- package/test/test-polendina-node.js +9 -19
- package/test/test-tape.js +10 -14
- package/test/test-webpack-merge.js +3 -7
package/test/test-bare-sync.js
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
/* globals describe it */
|
|
2
2
|
|
|
3
3
|
import assert from 'assert'
|
|
4
|
-
import path from 'path'
|
|
5
|
-
import { fileURLToPath } from 'url'
|
|
6
4
|
import { runCli } from './common.js'
|
|
7
5
|
|
|
8
|
-
const __dirname = fileURLToPath(path.dirname(import.meta.url))
|
|
9
|
-
|
|
10
6
|
for (const type of ['cjs', 'esm']) {
|
|
11
|
-
const bareSyncFixture =
|
|
12
|
-
const bareSyncFailureFixture =
|
|
7
|
+
const bareSyncFixture = `bare-sync${type === 'esm' ? '-esm' : ''}`
|
|
8
|
+
const bareSyncFailureFixture = `bare-sync-failure${type === 'esm' ? '-esm' : ''}`
|
|
13
9
|
|
|
14
10
|
describe(`basic bare-sync (${type})`, function () {
|
|
15
11
|
this.timeout(60000)
|
|
@@ -23,7 +19,7 @@ testing bare fixture subdir
|
|
|
23
19
|
`
|
|
24
20
|
|
|
25
21
|
it('should run in page', async () => {
|
|
26
|
-
const { stdout, stderr, code } = await runCli(bareSyncFixture, '--runner=bare-sync')
|
|
22
|
+
const { stdout, stderr, code } = await runCli('bare', bareSyncFixture, ['--runner=bare-sync'])
|
|
27
23
|
if (code !== 0) {
|
|
28
24
|
console.error(stderr)
|
|
29
25
|
}
|
|
@@ -37,7 +33,7 @@ testing bare fixture subdir
|
|
|
37
33
|
})
|
|
38
34
|
|
|
39
35
|
it('should run in worker', async () => {
|
|
40
|
-
const { stdout, stderr, code } = await runCli(bareSyncFixture, '--runner=bare-sync --worker --page=false')
|
|
36
|
+
const { stdout, stderr, code } = await runCli('bare', bareSyncFixture, ['--runner=bare-sync', '--worker', '--page=false'])
|
|
41
37
|
if (code !== 0) {
|
|
42
38
|
console.error(stderr)
|
|
43
39
|
}
|
|
@@ -51,7 +47,7 @@ testing bare fixture subdir
|
|
|
51
47
|
})
|
|
52
48
|
|
|
53
49
|
it('should run in serviceworker', async () => {
|
|
54
|
-
const { stdout, stderr, code } = await runCli(bareSyncFixture, '--runner=bare-sync --serviceworker --page=false')
|
|
50
|
+
const { stdout, stderr, code } = await runCli('bare', bareSyncFixture, ['--runner=bare-sync', '--serviceworker', '--page=false'])
|
|
55
51
|
if (code !== 0) {
|
|
56
52
|
console.error(stderr)
|
|
57
53
|
}
|
|
@@ -65,7 +61,7 @@ testing bare fixture subdir
|
|
|
65
61
|
})
|
|
66
62
|
|
|
67
63
|
it('should run in page, worker and serviceworker', async () => {
|
|
68
|
-
const { stdout, stderr, code } = await runCli(bareSyncFixture, '--runner=bare-sync --worker --serviceworker')
|
|
64
|
+
const { stdout, stderr, code } = await runCli('bare', bareSyncFixture, ['--runner=bare-sync', '--worker', '--serviceworker'])
|
|
69
65
|
if (code !== 0) {
|
|
70
66
|
console.error(stderr)
|
|
71
67
|
}
|
|
@@ -105,7 +101,7 @@ testing bare fixture
|
|
|
105
101
|
const expectedStderr = 'AssertionError: faily mcfailface'
|
|
106
102
|
|
|
107
103
|
it('should fail in page', async () => {
|
|
108
|
-
let { stdout, stderr, code } = await runCli(bareSyncFailureFixture, '--runner=bare-sync')
|
|
104
|
+
let { stdout, stderr, code } = await runCli('bare', bareSyncFailureFixture, ['--runner=bare-sync'])
|
|
109
105
|
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
110
106
|
stdout = stdout.replace(/^ +at .*\n/gm, '') // stack traces
|
|
111
107
|
const expected = expectedTemplate.replace(/WORKER/, 'not in worker')
|
|
@@ -118,7 +114,7 @@ testing bare fixture
|
|
|
118
114
|
})
|
|
119
115
|
|
|
120
116
|
it('should fail in worker', async () => {
|
|
121
|
-
let { stdout, stderr, code } = await runCli(bareSyncFailureFixture, '--runner=bare-sync --worker --page=false')
|
|
117
|
+
let { stdout, stderr, code } = await runCli('bare', bareSyncFailureFixture, ['--runner=bare-sync', '--worker', '--page=false'])
|
|
122
118
|
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
123
119
|
stdout = stdout.replace(/^ +at .*\n/gm, '') // stack traces
|
|
124
120
|
const expected = expectedTemplate.replace(/WORKER/, 'in worker')
|
|
@@ -131,7 +127,7 @@ testing bare fixture
|
|
|
131
127
|
})
|
|
132
128
|
|
|
133
129
|
it('should fail in serviceworker', async () => {
|
|
134
|
-
let { stdout, stderr, code } = await runCli(bareSyncFailureFixture, '--runner=bare-sync --serviceworker --page=false')
|
|
130
|
+
let { stdout, stderr, code } = await runCli('bare', bareSyncFailureFixture, ['--runner=bare-sync', '--serviceworker', '--page=false'])
|
|
135
131
|
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
136
132
|
stdout = stdout.replace(/^ +at .*\n/gm, '') // stack traces
|
|
137
133
|
const expected = expectedTemplate.replace(/WORKER/, 'in serviceworker')
|
|
@@ -144,7 +140,7 @@ testing bare fixture
|
|
|
144
140
|
})
|
|
145
141
|
|
|
146
142
|
it('should fail in page and not run in worker', async () => {
|
|
147
|
-
let { stdout, stderr, code } = await runCli(bareSyncFailureFixture, '--runner=bare-sync --worker')
|
|
143
|
+
let { stdout, stderr, code } = await runCli('bare', bareSyncFailureFixture, ['--runner=bare-sync', '--worker'])
|
|
148
144
|
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
149
145
|
stdout = stdout.replace(/^ +at .*\n/gm, '') // stack traces
|
|
150
146
|
const expected = expectedTemplate.replace(/WORKER/, 'not in worker')
|
package/test/test-mocha.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
/* globals describe it */
|
|
2
2
|
|
|
3
3
|
import assert from 'assert'
|
|
4
|
-
import path from 'path'
|
|
5
|
-
import { fileURLToPath } from 'url'
|
|
6
4
|
import { runCli } from './common.js'
|
|
7
5
|
|
|
8
|
-
const __dirname = fileURLToPath(path.dirname(import.meta.url))
|
|
9
|
-
|
|
10
6
|
function removeTimings (stdout) {
|
|
11
7
|
return stdout.replace(/\(\d+ms\)/g, '(Xms)')
|
|
12
8
|
}
|
|
13
9
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
// the consumers to run against, with the spec reporter's pass symbol, which
|
|
11
|
+
// differs by major in the browser bundle
|
|
12
|
+
const ticks = { mocha: '\u2714', mocha11: '\u2705' }
|
|
13
|
+
|
|
14
|
+
for (const [consumerName, type] of Object.keys(ticks).flatMap((c) => ['cjs', 'esm'].map((t) => [c, t]))) {
|
|
15
|
+
const mochaFixture = `mocha${type === 'esm' ? '-esm' : ''}`
|
|
16
|
+
const mochaFailureFixture = `mocha-failure${type === 'esm' ? '-esm' : ''}`
|
|
17
17
|
|
|
18
|
-
describe(`basic mocha (${type})`, function () {
|
|
18
|
+
describe(`basic mocha (${type}, ${consumerName})`, function () {
|
|
19
19
|
this.timeout(60000)
|
|
20
20
|
const expectedTemplate = `
|
|
21
21
|
test suite 1
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
${ticks[consumerName]} test case 1
|
|
23
|
+
${ticks[consumerName]} test case 2
|
|
24
24
|
|
|
25
25
|
test suite 2 - worker
|
|
26
|
-
|
|
26
|
+
${ticks[consumerName]} is WORKER
|
|
27
27
|
|
|
28
28
|
test suite 3
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
${ticks[consumerName]} test case 1
|
|
30
|
+
${ticks[consumerName]} test case 2
|
|
31
31
|
`
|
|
32
32
|
|
|
33
33
|
it('should run in page', async () => {
|
|
34
|
-
const { stdout, stderr, code } = await runCli(mochaFixture)
|
|
34
|
+
const { stdout, stderr, code } = await runCli(consumerName, mochaFixture, [])
|
|
35
35
|
if (code !== 0) {
|
|
36
36
|
console.error(stderr)
|
|
37
37
|
}
|
|
@@ -45,7 +45,7 @@ for (const type of ['cjs', 'esm']) {
|
|
|
45
45
|
})
|
|
46
46
|
|
|
47
47
|
it('should run in worker', async () => {
|
|
48
|
-
const { stdout, stderr, code } = await runCli(mochaFixture, '--worker --page=false')
|
|
48
|
+
const { stdout, stderr, code } = await runCli(consumerName, mochaFixture, ['--worker', '--page=false'])
|
|
49
49
|
if (code !== 0) {
|
|
50
50
|
console.error(stderr)
|
|
51
51
|
}
|
|
@@ -59,7 +59,7 @@ for (const type of ['cjs', 'esm']) {
|
|
|
59
59
|
})
|
|
60
60
|
|
|
61
61
|
it('should run in serviceworker', async () => {
|
|
62
|
-
const { stdout, stderr, code } = await runCli(mochaFixture, '--serviceworker --page=false')
|
|
62
|
+
const { stdout, stderr, code } = await runCli(consumerName, mochaFixture, ['--serviceworker', '--page=false'])
|
|
63
63
|
if (code !== 0) {
|
|
64
64
|
console.error(stderr)
|
|
65
65
|
}
|
|
@@ -73,7 +73,7 @@ for (const type of ['cjs', 'esm']) {
|
|
|
73
73
|
})
|
|
74
74
|
|
|
75
75
|
it('should run in page, worker and serviceworker', async () => {
|
|
76
|
-
const { stdout, stderr, code } = await runCli(mochaFixture, '--worker --serviceworker')
|
|
76
|
+
const { stdout, stderr, code } = await runCli(consumerName, mochaFixture, ['--worker', '--serviceworker'])
|
|
77
77
|
if (code !== 0) {
|
|
78
78
|
console.error(stderr)
|
|
79
79
|
}
|
|
@@ -102,11 +102,11 @@ for (const type of ['cjs', 'esm']) {
|
|
|
102
102
|
})
|
|
103
103
|
})
|
|
104
104
|
|
|
105
|
-
describe(`failing mocha (${type})`, function () {
|
|
105
|
+
describe(`failing mocha (${type}, ${consumerName})`, function () {
|
|
106
106
|
this.timeout(60000)
|
|
107
107
|
const expectedTemplate = `
|
|
108
108
|
test suite 1 - worker
|
|
109
|
-
|
|
109
|
+
${ticks[consumerName]} is WORKER
|
|
110
110
|
|
|
111
111
|
test suite 2 - failing
|
|
112
112
|
1) should fail
|
|
@@ -121,7 +121,7 @@ for (const type of ['cjs', 'esm']) {
|
|
|
121
121
|
`
|
|
122
122
|
|
|
123
123
|
it('should fail in page', async () => {
|
|
124
|
-
let { stdout, code } = await runCli(mochaFailureFixture)
|
|
124
|
+
let { stdout, code } = await runCli(consumerName, mochaFailureFixture, [])
|
|
125
125
|
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
126
126
|
stdout = removeTimings(stdout)
|
|
127
127
|
const expected = expectedTemplate.replace(/WORKER/, 'not in worker')
|
|
@@ -133,7 +133,7 @@ for (const type of ['cjs', 'esm']) {
|
|
|
133
133
|
})
|
|
134
134
|
|
|
135
135
|
it('should fail in worker', async () => {
|
|
136
|
-
let { stdout, code } = await runCli(mochaFailureFixture, '--worker --page=false')
|
|
136
|
+
let { stdout, code } = await runCli(consumerName, mochaFailureFixture, ['--worker', '--page=false'])
|
|
137
137
|
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
138
138
|
stdout = removeTimings(stdout)
|
|
139
139
|
const expected = expectedTemplate.replace(/WORKER/, 'in worker')
|
|
@@ -145,7 +145,7 @@ for (const type of ['cjs', 'esm']) {
|
|
|
145
145
|
})
|
|
146
146
|
|
|
147
147
|
it('should fail in serviceworker', async () => {
|
|
148
|
-
let { stdout, code } = await runCli(mochaFailureFixture, '--serviceworker --page=false')
|
|
148
|
+
let { stdout, code } = await runCli(consumerName, mochaFailureFixture, ['--serviceworker', '--page=false'])
|
|
149
149
|
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
150
150
|
stdout = removeTimings(stdout)
|
|
151
151
|
const expected = expectedTemplate.replace(/WORKER/, 'in serviceworker')
|
|
@@ -157,7 +157,7 @@ for (const type of ['cjs', 'esm']) {
|
|
|
157
157
|
})
|
|
158
158
|
|
|
159
159
|
it('should fail in page and not run in worker', async () => {
|
|
160
|
-
let { stdout, code } = await runCli(mochaFailureFixture, '--worker')
|
|
160
|
+
let { stdout, code } = await runCli(consumerName, mochaFailureFixture, ['--worker'])
|
|
161
161
|
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
162
162
|
stdout = removeTimings(stdout)
|
|
163
163
|
const expected = expectedTemplate.replace(/WORKER/, 'not in worker')
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/* globals describe it */
|
|
2
|
+
|
|
3
|
+
// setup.js installs polendina from a packed tarball into consumers outside
|
|
4
|
+
// this repository; check that layout is the hoisted one a real install has
|
|
5
|
+
// and that each consumer carries only its own runner
|
|
6
|
+
|
|
7
|
+
import assert from 'assert'
|
|
8
|
+
import fs from 'fs'
|
|
9
|
+
import path from 'path'
|
|
10
|
+
import { consumers } from './common.js'
|
|
11
|
+
|
|
12
|
+
const present = (dir, ...segments) => fs.promises.access(path.join(dir, ...segments))
|
|
13
|
+
const absent = (dir, ...segments) => assert.rejects(present(dir, ...segments))
|
|
14
|
+
|
|
15
|
+
describe('packed install', function () {
|
|
16
|
+
it('hoists polendina dependencies into every consumer tree', async () => {
|
|
17
|
+
for (const dir of Object.values(consumers())) {
|
|
18
|
+
await absent(dir, 'node_modules/polendina/node_modules/stream-browserify')
|
|
19
|
+
await present(dir, 'node_modules/stream-browserify')
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
it('installs each runner only in its own consumer', async () => {
|
|
24
|
+
const { mocha, mocha11, tape, bare } = consumers()
|
|
25
|
+
await present(mocha, 'node_modules/mocha')
|
|
26
|
+
await present(mocha11, 'node_modules/mocha')
|
|
27
|
+
await present(tape, 'node_modules/tape')
|
|
28
|
+
await absent(mocha, 'node_modules/tape')
|
|
29
|
+
await absent(tape, 'node_modules/mocha')
|
|
30
|
+
await absent(bare, 'node_modules/mocha')
|
|
31
|
+
await absent(bare, 'node_modules/tape')
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
it('installs the previous mocha major in its consumer', async () => {
|
|
35
|
+
const { mocha, mocha11 } = consumers()
|
|
36
|
+
const major = (dir) => JSON.parse(fs.readFileSync(path.join(dir, 'node_modules/mocha/package.json'))).version.split('.')[0]
|
|
37
|
+
assert.strictEqual(major(mocha11), '11')
|
|
38
|
+
assert.notStrictEqual(major(mocha), '11')
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
it('does not install mocha or tape in polendina itself', async () => {
|
|
42
|
+
for (const dir of Object.values(consumers())) {
|
|
43
|
+
await absent(dir, 'node_modules/polendina/node_modules/mocha')
|
|
44
|
+
await absent(dir, 'node_modules/polendina/node_modules/tape')
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
})
|
|
@@ -1,27 +1,17 @@
|
|
|
1
1
|
/* globals describe it */
|
|
2
2
|
|
|
3
3
|
import assert from 'assert'
|
|
4
|
-
import
|
|
5
|
-
import { fileURLToPath } from 'url'
|
|
6
|
-
import { runCommand } from './common.js'
|
|
7
|
-
|
|
8
|
-
const __dirname = fileURLToPath(path.dirname(import.meta.url))
|
|
9
|
-
|
|
10
|
-
const cli = path.join(__dirname, '../polendina-node-cli.js')
|
|
11
|
-
|
|
12
|
-
function runCli (mode, cwd) {
|
|
13
|
-
return runCommand(`${cli} ${mode} test*.js`, cwd)
|
|
14
|
-
}
|
|
4
|
+
import { runNodeCli } from './common.js'
|
|
15
5
|
|
|
16
6
|
function removeTiming (stdout) {
|
|
17
7
|
return stdout.replace(/Took [\d.]+ seconds/, 'Took X seconds')
|
|
18
8
|
}
|
|
19
9
|
|
|
20
10
|
for (const type of ['cjs', 'esm']) {
|
|
21
|
-
const bareSyncFixture =
|
|
22
|
-
const bareSyncFailureFixture =
|
|
23
|
-
const bareAsyncFixture =
|
|
24
|
-
const bareAsyncFailureFixture =
|
|
11
|
+
const bareSyncFixture = `bare-sync${type === 'esm' ? '-esm' : ''}`
|
|
12
|
+
const bareSyncFailureFixture = `bare-sync-failure${type === 'esm' ? '-esm' : ''}`
|
|
13
|
+
const bareAsyncFixture = `bare-async${type === 'esm' ? '-esm' : ''}`
|
|
14
|
+
const bareAsyncFailureFixture = `bare-async-failure${type === 'esm' ? '-esm' : ''}`
|
|
25
15
|
|
|
26
16
|
describe(`polendina-node bare-sync (${type})`, function () {
|
|
27
17
|
this.timeout(60000)
|
|
@@ -33,7 +23,7 @@ testing bare fixture
|
|
|
33
23
|
✔ test-2.js
|
|
34
24
|
Took X seconds
|
|
35
25
|
`
|
|
36
|
-
const { stdout, stderr, code } = await
|
|
26
|
+
const { stdout, stderr, code } = await runNodeCli('bare', bareSyncFixture, 'bare-sync')
|
|
37
27
|
if (code !== 0) {
|
|
38
28
|
console.error(stderr)
|
|
39
29
|
}
|
|
@@ -49,7 +39,7 @@ testing bare fixture
|
|
|
49
39
|
✘ test-2.js
|
|
50
40
|
Took X seconds
|
|
51
41
|
`
|
|
52
|
-
const { stdout, stderr, code } = await
|
|
42
|
+
const { stdout, stderr, code } = await runNodeCli('bare', bareSyncFailureFixture, 'bare-sync')
|
|
53
43
|
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
54
44
|
assert.strictEqual(removeTiming(stdout), expected)
|
|
55
45
|
assert.ok(stderr.includes('AssertionError: faily mcfailface'), 'stderr contains expected output')
|
|
@@ -68,7 +58,7 @@ testing bare fixture
|
|
|
68
58
|
✔ test2
|
|
69
59
|
Took X seconds
|
|
70
60
|
`
|
|
71
|
-
const { stdout, stderr, code } = await
|
|
61
|
+
const { stdout, stderr, code } = await runNodeCli('bare', bareAsyncFixture, 'bare-async')
|
|
72
62
|
if (code !== 0) {
|
|
73
63
|
console.error(stderr)
|
|
74
64
|
}
|
|
@@ -86,7 +76,7 @@ testing bare fixture
|
|
|
86
76
|
✘ test2
|
|
87
77
|
Took X seconds
|
|
88
78
|
`
|
|
89
|
-
const { stdout, stderr, code } = await
|
|
79
|
+
const { stdout, stderr, code } = await runNodeCli('bare', bareAsyncFailureFixture, 'bare-async')
|
|
90
80
|
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
91
81
|
assert.strictEqual(removeTiming(stdout), expected)
|
|
92
82
|
assert.ok(stderr.includes('AssertionError: faily mcfailface'), 'stderr contains expected output')
|
package/test/test-tape.js
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
/* globals describe it */
|
|
2
2
|
|
|
3
3
|
import assert from 'assert'
|
|
4
|
-
import path from 'path'
|
|
5
|
-
import { fileURLToPath } from 'url'
|
|
6
4
|
import { runCli } from './common.js'
|
|
7
5
|
|
|
8
|
-
const __dirname = fileURLToPath(path.dirname(import.meta.url))
|
|
9
|
-
|
|
10
6
|
for (const type of ['cjs', 'esm']) {
|
|
11
|
-
const tapeFixture =
|
|
12
|
-
const tapeFailureFixture =
|
|
7
|
+
const tapeFixture = `tape${type === 'esm' ? '-esm' : ''}`
|
|
8
|
+
const tapeFailureFixture = `tape-failure${type === 'esm' ? '-esm' : ''}`
|
|
13
9
|
|
|
14
10
|
describe(`basic tape (${type})`, function () {
|
|
15
11
|
this.timeout(60000)
|
|
@@ -37,7 +33,7 @@ ok 5 all good
|
|
|
37
33
|
`
|
|
38
34
|
|
|
39
35
|
it('should run in page', async () => {
|
|
40
|
-
const { stdout, stderr, code } = await runCli(tapeFixture, '--runner=tape')
|
|
36
|
+
const { stdout, stderr, code } = await runCli('tape', tapeFixture, ['--runner=tape'])
|
|
41
37
|
if (code !== 0) {
|
|
42
38
|
console.error(stderr)
|
|
43
39
|
}
|
|
@@ -51,7 +47,7 @@ ok 5 all good
|
|
|
51
47
|
})
|
|
52
48
|
|
|
53
49
|
it('should run in worker', async () => {
|
|
54
|
-
const { stdout, stderr, code } = await runCli(tapeFixture, '--runner=tape --worker --page=false')
|
|
50
|
+
const { stdout, stderr, code } = await runCli('tape', tapeFixture, ['--runner=tape', '--worker', '--page=false'])
|
|
55
51
|
if (code !== 0) {
|
|
56
52
|
console.error(stderr)
|
|
57
53
|
}
|
|
@@ -65,7 +61,7 @@ ok 5 all good
|
|
|
65
61
|
})
|
|
66
62
|
|
|
67
63
|
it('should run in serviceworker', async () => {
|
|
68
|
-
const { stdout, stderr, code } = await runCli(tapeFixture, '--runner=tape --serviceworker --page=false')
|
|
64
|
+
const { stdout, stderr, code } = await runCli('tape', tapeFixture, ['--runner=tape', '--serviceworker', '--page=false'])
|
|
69
65
|
if (code !== 0) {
|
|
70
66
|
console.error(stderr)
|
|
71
67
|
}
|
|
@@ -79,7 +75,7 @@ ok 5 all good
|
|
|
79
75
|
})
|
|
80
76
|
|
|
81
77
|
it('should run in page, worker and serviceworker', async () => {
|
|
82
|
-
const { stdout, stderr, code } = await runCli(tapeFixture, '--runner=tape --worker --serviceworker')
|
|
78
|
+
const { stdout, stderr, code } = await runCli('tape', tapeFixture, ['--runner=tape', '--worker', '--serviceworker'])
|
|
83
79
|
if (code !== 0) {
|
|
84
80
|
console.error(stderr)
|
|
85
81
|
}
|
|
@@ -131,7 +127,7 @@ not ok 2 bork
|
|
|
131
127
|
`
|
|
132
128
|
|
|
133
129
|
it('should fail in page', async () => {
|
|
134
|
-
let { stdout, code } = await runCli(tapeFailureFixture, '--runner=tape')
|
|
130
|
+
let { stdout, code } = await runCli('tape', tapeFailureFixture, ['--runner=tape'])
|
|
135
131
|
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
136
132
|
stdout = stdout.replace(/^ +at .*\n/gm, '') // stack traces
|
|
137
133
|
const expected = expectedTemplate.replace(/WORKER/, 'not in worker')
|
|
@@ -143,7 +139,7 @@ not ok 2 bork
|
|
|
143
139
|
})
|
|
144
140
|
|
|
145
141
|
it('should fail in worker', async () => {
|
|
146
|
-
let { stdout, code } = await runCli(tapeFailureFixture, '--runner=tape --worker --page=false')
|
|
142
|
+
let { stdout, code } = await runCli('tape', tapeFailureFixture, ['--runner=tape', '--worker', '--page=false'])
|
|
147
143
|
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
148
144
|
stdout = stdout.replace(/^ +at .*\n/gm, '') // stack traces
|
|
149
145
|
const expected = expectedTemplate.replace(/WORKER/, 'in worker')
|
|
@@ -155,7 +151,7 @@ not ok 2 bork
|
|
|
155
151
|
})
|
|
156
152
|
|
|
157
153
|
it('should fail in serviceworker', async () => {
|
|
158
|
-
let { stdout, code } = await runCli(tapeFailureFixture, '--runner=tape --serviceworker --page=false')
|
|
154
|
+
let { stdout, code } = await runCli('tape', tapeFailureFixture, ['--runner=tape', '--serviceworker', '--page=false'])
|
|
159
155
|
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
160
156
|
stdout = stdout.replace(/^ +at .*\n/gm, '') // stack traces
|
|
161
157
|
const expected = expectedTemplate.replace(/WORKER/, 'in serviceworker')
|
|
@@ -167,7 +163,7 @@ not ok 2 bork
|
|
|
167
163
|
})
|
|
168
164
|
|
|
169
165
|
it('should fail in page and not run in worker', async () => {
|
|
170
|
-
let { stdout, code } = await runCli(tapeFailureFixture, '--runner=tape --worker')
|
|
166
|
+
let { stdout, code } = await runCli('tape', tapeFailureFixture, ['--runner=tape', '--worker'])
|
|
171
167
|
assert.strictEqual(code, 1, 'exited with non-zero exit code')
|
|
172
168
|
stdout = stdout.replace(/^ +at .*\n/gm, '') // stack traces
|
|
173
169
|
const expected = expectedTemplate.replace(/WORKER/, 'not in worker')
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
/* globals describe it */
|
|
2
2
|
|
|
3
3
|
import assert from 'assert'
|
|
4
|
-
import path from 'path'
|
|
5
|
-
import { fileURLToPath } from 'url'
|
|
6
4
|
import { runCli } from './common.js'
|
|
7
|
-
|
|
8
|
-
const __dirname = fileURLToPath(path.dirname(import.meta.url))
|
|
9
|
-
const webpackMergeFixture = path.join(__dirname, 'fixtures/webpack-merge')
|
|
5
|
+
const webpackMergeFixture = 'webpack-merge'
|
|
10
6
|
|
|
11
7
|
describe('basic webpack-merge', function () {
|
|
12
8
|
this.timeout(60000)
|
|
@@ -16,7 +12,7 @@ assert.ok() is a function
|
|
|
16
12
|
WOOP is set
|
|
17
13
|
✔ test.js
|
|
18
14
|
`
|
|
19
|
-
const { stdout, stderr, code } = await runCli(webpackMergeFixture, '--runner=bare-sync --webpack-config webpack.config.js')
|
|
15
|
+
const { stdout, stderr, code } = await runCli('bare', webpackMergeFixture, ['--runner=bare-sync', '--webpack-config', 'webpack.config.js'])
|
|
20
16
|
if (code !== 0) {
|
|
21
17
|
console.error(stderr)
|
|
22
18
|
}
|
|
@@ -35,7 +31,7 @@ assert.ok() is a function
|
|
|
35
31
|
`
|
|
36
32
|
const expectedStderr = 'WOOP is not defined'
|
|
37
33
|
|
|
38
|
-
const { stdout, stderr, code } = await runCli(webpackMergeFixture, '--runner=bare-sync')
|
|
34
|
+
const { stdout, stderr, code } = await runCli('bare', webpackMergeFixture, ['--runner=bare-sync'])
|
|
39
35
|
assert.strictEqual(code, 1, 'exited with zero exit code')
|
|
40
36
|
assert.ok(stdout.includes(expectedStdout), 'stdout contains expected test output')
|
|
41
37
|
assert.ok(stderr.includes(expectedStderr), 'stderr contains expected test output')
|