diff --git a/test/05-commands.test.js b/test/05-commands.test.js index 38157d954..f872dde26 100644 --- a/test/05-commands.test.js +++ b/test/05-commands.test.js @@ -16,12 +16,34 @@ class Rig { comment('local sidecar connected') } + getOrCreateInfoInstance = async () => { + if (this.pearInfoInstance) return this.pearInfoInstance + + const testId = Math.floor(Math.random() * 100000) + const relativePath = path.relative(harness, minimal) + const argvInit = ['stage', '--json', 'test-' + testId, relativePath] + const stager = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + await stager.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argvInit)}) + `, { returnByValue: false }) + + for await (const line of stager.lineout) { + const result = JSON.parse(line) + if (result.tag === 'addendum') this.pearInfoInstance = result.data + if (result.tag === 'final') break + } + + await stager.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await stager.inspector.close() + await stager.until.exit + + return this.pearInfoInstance + } + cleanup = async ({ comment }) => { comment('shutting down local sidecar') - setTimeout(async () => { - await this.helper.shutdown() - comment('local sidecar shut down') - }, 5000) + await this.helper.shutdown() + comment('local sidecar shut down') } } @@ -29,15 +51,523 @@ const rig = new Rig() test('commands setup', rig.setup) -test('pear stage --json ', async function ({ plan, alike, is }) { +test.todo('pear stage ') +test.todo('pear stage ') +test.todo('pear stage (package.json pear.config.stage.entrypoints )') +test.todo('pear stage (package.json pear.config.stage.ignore )') +test.todo('pear stage --json ') +test.todo('pear stage --dry-run ') +test.todo('pear stage --dry-run --json ') +test.todo('pear stage --bare ') +test.todo('pear stage --bare --json ') +test.todo('pear stage --ignore ') +test.todo('pear stage --ignore --json ') +test.todo('pear stage --truncate ') +test.todo('pear stage --truncate --json ') +test.todo('pear stage --name ') +test.todo('pear stage --name --json ') +test.todo('pear stage --ignore --name ') +test.todo('pear stage --ignore --name --json ') +test.todo('pear stage --dry-run --bare --ignore --truncate --name ') +test.todo('pear stage --dry-run --bare --ignore --truncate --name --json ') +test.todo('pear stage pear://') +test.todo('pear stage --json pear://') +test.todo('pear stage --dry-run pear://') +test.todo('pear stage --dry-run --json pear://') +test.todo('pear stage --bare pear://') +test.todo('pear stage --bare --json pear://') +test.todo('pear stage --ignore pear://') +test.todo('pear stage --ignore --json pear://') +test.todo('pear stage --truncate pear://') +test.todo('pear stage --truncate --json pear://') +test.todo('pear stage --name pear://') +test.todo('pear stage --name --json pear://') +test.todo('pear stage --ignore --name pear://') +test.todo('pear stage --ignore --name --json pear://') +test.todo('pear stage --dry-run --bare --ignore --truncate --name pear://') +test.todo('pear stage --dry-run --bare --ignore --truncate --name --json pear://') + +test.todo('pear seed ') +test.todo('pear seed ') +test.todo('pear seed --json ') +test.todo('pear seed --seeders ') +test.todo('pear seed --seeders --json ') +test.todo('pear seed --name ') +test.todo('pear seed --name --json ') +test.todo('pear seed pear://') +test.todo('pear seed --json pear://') +test.todo('pear seed --seeders pear://') +test.todo('pear seed --seeders --json pear://') +test.todo('pear seed --name pear://') +test.todo('pear seed --name --json pear://') + +test.todo('pear run ') +test.todo('pear run ') +test.todo('pear run --tmp-store') +test.todo('pear run --store ') +test.todo('pear run --store ') +test.todo('pear run --unsafe-clear-app-storage') +test.todo('pear run --unsafe-clear-preferences') +test.todo('pear run file:///') +test.todo('pear run pear://') +test.todo('pear run pear:///') +test.todo('pear run pear:// --store ') +test.todo('pear run pear:// --tmp-store') +test.todo('pear run pear:// --unsafe-clear-app-storage') +test.todo('pear run pear:// --unsafe-clear-preferences') + +test.todo('pear run (package.json pear.config.previewFor )') +test.todo('pear run (package.json pear.config.links )') +test.todo('pear run (package.json pear.config.links )') +test.todo('pear run (package.json pear.config.type )') +test.todo('pear run --updates-diff') +test.todo('pear run --no-updates') +test.todo('pear run --link ') +// test.skip('pear run --updates-diff --no-updates') // TODO: after task Paparam flag relationships +// test.skip('pear run --tmp-store --store ') // TODO: after task Paparam flag relationships +test.todo('pear run pear:// --updates-diff') +test.todo('pear run pear:// --no-updates') +test.todo('pear run pear:// --link ') +test.todo('pear run pear:// --checkout ') +test.todo('pear run pear:// --checkout release') +test.todo('pear run pear:// --checkout staged') +test.todo('pear run pear:// --checkout --unsafe-clear-app-storage --unsafe-clear-preferences') + +test.todo('pear release ') +test.todo('pear release ') +test.todo('pear release --json ') +test.todo('pear release pear://') +test.todo('pear release --json pear://') +test.todo('pear release --checkout pear://') +test.todo('pear release --checkout --json pear://') +test.todo('pear release --checkout staged pear://') +test.todo('pear release --checkout staged --json pear://') +test.todo('pear release --checkout release pear://') +test.todo('pear release --checkout release --json pear://') + +test('pear info', async function ({ plan, is }) { + plan(4) + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info'] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + let changelogPrinted = false + let metadataPrinted = false + let keyPrinted = false + for await (const line of running.lineout) { + if (line.includes('changelog')) changelogPrinted = true + if (line.includes('info')) metadataPrinted = true + if (line.includes('pear://')) keyPrinted = true + if (line.endsWith('Success')) break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + is(changelogPrinted, true, 'should output the changelog') + is(metadataPrinted, true, 'should output the metadata') + is(keyPrinted, true, 'should output the key as link') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --json', async function ({ plan, alike, is }) { + plan(2) + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--json'] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + const seen = new Set() + const tags = [] + for await (const line of running.lineout) { + const result = JSON.parse(line) + if (seen.has(result.tag)) continue + seen.add(result.tag) + tags.push(result.tag) + if (result.tag === 'final') break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + alike(tags, ['retrieving', 'keys', 'info', 'final'], 'should output correct tags') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info ', async function ({ plan, is }) { + plan(4) + const { channel, link } = await rig.getOrCreateInfoInstance() + const relativePath = path.relative(harness, minimal) + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', channel, relativePath] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + let changelogPrinted = false + let metadataPrinted = false + let keyPrinted = false + for await (const line of running.lineout) { + if (line.includes('changelog')) changelogPrinted = true + if (line.includes('info')) metadataPrinted = true + if (line.includes(link)) keyPrinted = true + if (line.endsWith('Success')) break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + is(changelogPrinted, true, 'should output the changelog') + is(metadataPrinted, true, 'should output the metadata') + is(keyPrinted, true, 'should output the key as link') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --json ', async function ({ plan, alike, is }) { + plan(2) + const { channel } = await rig.getOrCreateInfoInstance() + const relativePath = path.relative(harness, minimal) + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--json', channel, relativePath] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + const seen = new Set() + const tags = [] + for await (const line of running.lineout) { + const result = JSON.parse(line) + if (seen.has(result.tag)) continue + seen.add(result.tag) + tags.push(result.tag) + if (result.tag === 'final') break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + alike(tags, ['retrieving', 'keys', 'info', 'changelog', 'final'], 'should output correct tags') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --changelog ', async function ({ plan, is }) { + plan(4) + const { channel, link } = await rig.getOrCreateInfoInstance() + const relativePath = path.relative(harness, minimal) + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--changelog', channel, relativePath] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + let changelogPrinted = false + let metadataPrinted = false + let keyPrinted = false + for await (const line of running.lineout) { + if (line.includes('changelog')) changelogPrinted = true + if (line.includes('info')) metadataPrinted = true + if (line.includes(link)) keyPrinted = true + if (line.endsWith('Success')) break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + is(changelogPrinted, true, 'should output the changelog') + is(metadataPrinted, false, 'should not output the metadata') + is(keyPrinted, false, 'should not output the key as link') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --changelog --json ', async function ({ plan, alike, is }) { + plan(2) + const { channel } = await rig.getOrCreateInfoInstance() + const relativePath = path.relative(harness, minimal) + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--changelog', '--json', channel, relativePath] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + const seen = new Set() + const tags = [] + for await (const line of running.lineout) { + const result = JSON.parse(line) + if (seen.has(result.tag)) continue + seen.add(result.tag) + tags.push(result.tag) + if (result.tag === 'final') break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + alike(tags, ['changelog', 'final'], 'should output correct tags') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --changelog --metadata ', async function ({ plan, is }) { + plan(4) + const { channel, link } = await rig.getOrCreateInfoInstance() + const relativePath = path.relative(harness, minimal) + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--changelog', '--metadata', channel, relativePath] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + let changelogPrinted = false + let metadataPrinted = false + let keyPrinted = false + for await (const line of running.lineout) { + if (line.includes('changelog')) changelogPrinted = true + if (line.includes('info')) metadataPrinted = true + if (line.includes(link)) keyPrinted = true + if (line.endsWith('Success')) break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + is(changelogPrinted, true, 'should output the changelog') + is(metadataPrinted, true, 'should output the metadata') + is(keyPrinted, false, 'should not output the key as link') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --changelog --metadata --json ', async function ({ plan, alike, is }) { + plan(2) + const { channel } = await rig.getOrCreateInfoInstance() + const relativePath = path.relative(harness, minimal) + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--changelog', '--metadata', '--json', channel, relativePath] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + const seen = new Set() + const tags = [] + for await (const line of running.lineout) { + const result = JSON.parse(line) + if (seen.has(result.tag)) continue + seen.add(result.tag) + tags.push(result.tag) + if (result.tag === 'final') break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + alike(tags, ['keys', 'info', 'changelog', 'final'], 'should output correct tags') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --changelog --key ', async function ({ plan, is }) { + plan(4) + const { channel, link } = await rig.getOrCreateInfoInstance() + const relativePath = path.relative(harness, minimal) + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--changelog', '--key', channel, relativePath] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + let changelogPrinted = false + let metadataPrinted = false + let keyPrinted = false + for await (const line of running.lineout) { + if (line.includes('changelog')) changelogPrinted = true + if (line.includes('info')) metadataPrinted = true + if (line.includes(link)) keyPrinted = true + if (line.endsWith('Success')) break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + is(changelogPrinted, true, 'should output the changelog') + is(metadataPrinted, false, 'should not output the metadata') + is(keyPrinted, true, 'should output the key as link') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --changelog --key --json ', async function ({ plan, alike, is }) { + plan(2) + const { channel } = await rig.getOrCreateInfoInstance() + const relativePath = path.relative(harness, minimal) + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--changelog', '--key', '--json', channel, relativePath] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + const seen = new Set() + const tags = [] + for await (const line of running.lineout) { + const result = JSON.parse(line) + if (seen.has(result.tag)) continue + seen.add(result.tag) + tags.push(result.tag) + if (result.tag === 'final') break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + alike(tags, ['retrieving', 'changelog', 'final'], 'should output correct tags') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --changelog --metadata --key ', async function ({ plan, is }) { + plan(4) + const { channel, link } = await rig.getOrCreateInfoInstance() + const relativePath = path.relative(harness, minimal) + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--changelog', '--metadata', '--key', channel, relativePath] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + let changelogPrinted = false + let metadataPrinted = false + let keyPrinted = false + for await (const line of running.lineout) { + if (line.includes('changelog')) changelogPrinted = true + if (line.includes('info')) metadataPrinted = true + if (line.includes(link)) keyPrinted = true + if (line.endsWith('Success')) break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + is(changelogPrinted, true, 'should output the changelog') + is(metadataPrinted, true, 'should output the metadata') + is(keyPrinted, true, 'should output the key as link') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --changelog --metadata --key --json ', async function ({ plan, alike, is }) { plan(2) + const { channel } = await rig.getOrCreateInfoInstance() + const relativePath = path.relative(harness, minimal) + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--changelog', '--metadata', '--key', '--json', channel, relativePath] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + const seen = new Set() + const tags = [] + for await (const line of running.lineout) { + const result = JSON.parse(line) + if (seen.has(result.tag)) continue + seen.add(result.tag) + tags.push(result.tag) + if (result.tag === 'final') break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + alike(tags, ['retrieving', 'keys', 'info', 'changelog', 'final'], 'should output correct tags') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --full-changelog ', async function ({ plan, is }) { + plan(4) + const { channel, link } = await rig.getOrCreateInfoInstance() + const relativePath = path.relative(harness, minimal) + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--full-changelog', channel, relativePath] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + let changelogPrinted = false + let metadataPrinted = false + let keyPrinted = false + for await (const line of running.lineout) { + if (line.includes('changelog')) changelogPrinted = true + if (line.includes('info')) metadataPrinted = true + if (line.includes(link)) keyPrinted = true + if (line.endsWith('Success')) break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() - const testId = Math.floor(Math.random() * 100000) + is(changelogPrinted, true, 'should output the changelog') + is(metadataPrinted, false, 'should not output the metadata') + is(keyPrinted, false, 'should not output the key as link') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) - const argv = ['stage', '--json', 'test-' + testId, minimal] +test('pear info --full-changelog --metadata ', async function ({ plan, is }) { + plan(4) + const { channel, link } = await rig.getOrCreateInfoInstance() + const relativePath = path.relative(harness, minimal) const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--full-changelog', '--metadata', channel, relativePath] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + let changelogPrinted = false + let metadataPrinted = false + let keyPrinted = false + for await (const line of running.lineout) { + if (line.includes('changelog')) changelogPrinted = true + if (line.includes('info')) metadataPrinted = true + if (line.includes(link)) keyPrinted = true + if (line.endsWith('Success')) break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + is(changelogPrinted, true, 'should output the changelog') + is(metadataPrinted, true, 'should output the metadata') + is(keyPrinted, false, 'should not output the key as link') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --full-changelog --metadata --json ', async function ({ plan, alike, is }) { + plan(2) + const { channel } = await rig.getOrCreateInfoInstance() + const relativePath = path.relative(harness, minimal) + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--full-changelog', '--metadata', '--json', channel, relativePath] await running.inspector.evaluate(` __PEAR_TEST__.command(${JSON.stringify(argv)}) `, { returnByValue: false }) @@ -51,11 +581,859 @@ test('pear stage --json ', async function ({ plan, alike, is }) { tags.push(result.tag) if (result.tag === 'final') break } - await running.inspector.evaluate('__PEAR_TEST__.ipc.close()', { returnByValue: false }) + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) await running.inspector.close() - alike(tags, ['staging', 'byte-diff', 'summary', 'skipping', 'complete', 'addendum', 'final']) + + alike(tags, ['keys', 'info', 'changelog', 'final'], 'should output correct tags') const { code } = await running.until.exit - is(code, 0) + is(code, 0, 'should have exit code 0') }) +test('pear info --full-changelog --metadata --key ', async function ({ plan, is }) { + plan(4) + const { channel, link } = await rig.getOrCreateInfoInstance() + const relativePath = path.relative(harness, minimal) + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--full-changelog', '--metadata', '--key', channel, relativePath] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + let changelogPrinted = false + let metadataPrinted = false + let keyPrinted = false + for await (const line of running.lineout) { + if (line.includes('changelog')) changelogPrinted = true + if (line.includes('info')) metadataPrinted = true + if (line.includes(link)) keyPrinted = true + if (line.endsWith('Success')) break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + is(changelogPrinted, true, 'should output the changelog') + is(metadataPrinted, true, 'should output the metadata') + is(keyPrinted, true, 'should output the key as link') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --full-changelog --metadata --key --json ', async function ({ plan, alike, is }) { + plan(2) + const { channel } = await rig.getOrCreateInfoInstance() + const relativePath = path.relative(harness, minimal) + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--full-changelog', '--metadata', '--key', '--json', channel, relativePath] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + const seen = new Set() + const tags = [] + for await (const line of running.lineout) { + const result = JSON.parse(line) + if (seen.has(result.tag)) continue + seen.add(result.tag) + tags.push(result.tag) + if (result.tag === 'final') break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + alike(tags, ['retrieving', 'keys', 'info', 'changelog', 'final'], 'should output correct tags') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +// test.skip('pear info --full-changelog --changelog') // TODO: after task Paparam flag relationships + +test('pear info --metadata ', async function ({ plan, is }) { + plan(4) + const { channel, link } = await rig.getOrCreateInfoInstance() + const relativePath = path.relative(harness, minimal) + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--metadata', channel, relativePath] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + let changelogPrinted = false + let metadataPrinted = false + let keyPrinted = false + for await (const line of running.lineout) { + if (line.includes('changelog')) changelogPrinted = true + if (line.includes('info')) metadataPrinted = true + if (line.includes(link)) keyPrinted = true + if (line.endsWith('Success')) break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + is(changelogPrinted, false, 'should not output the changelog') + is(metadataPrinted, true, 'should output the metadata') + is(keyPrinted, false, 'should not output the key as link') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --metadata --key ', async function ({ plan, is }) { + plan(4) + const { channel, link } = await rig.getOrCreateInfoInstance() + const relativePath = path.relative(harness, minimal) + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--metadata', '--key', channel, relativePath] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + let changelogPrinted = false + let metadataPrinted = false + let keyPrinted = false + for await (const line of running.lineout) { + if (line.includes('changelog')) changelogPrinted = true + if (line.includes('info')) metadataPrinted = true + if (line.includes(link)) keyPrinted = true + if (line.endsWith('Success')) break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + is(changelogPrinted, false, 'should not output the changelog') + is(metadataPrinted, true, 'should output the metadata') + is(keyPrinted, true, 'should output the key as link') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --metadata --key --json ', async function ({ plan, alike, is }) { + plan(2) + const { channel } = await rig.getOrCreateInfoInstance() + const relativePath = path.relative(harness, minimal) + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--metadata', '--key', '--json', channel, relativePath] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + const seen = new Set() + const tags = [] + for await (const line of running.lineout) { + const result = JSON.parse(line) + if (seen.has(result.tag)) continue + seen.add(result.tag) + tags.push(result.tag) + if (result.tag === 'final') break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + alike(tags, ['retrieving', 'keys', 'info', 'final'], 'should output correct tags') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --key ', async function ({ plan, is }) { + plan(4) + const { channel, link } = await rig.getOrCreateInfoInstance() + const relativePath = path.relative(harness, minimal) + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--key', channel, relativePath] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + let changelogPrinted = false + let metadataPrinted = false + let keyPrinted = false + for await (const line of running.lineout) { + if (line.includes('changelog')) changelogPrinted = true + if (line.includes('info')) metadataPrinted = true + if (line.includes(link)) keyPrinted = true + if (line.endsWith('Success')) break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + is(changelogPrinted, false, 'should not output the changelog') + is(metadataPrinted, false, 'should not output the metadata') + is(keyPrinted, true, 'should output the key as link') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --key --json ', async function ({ plan, alike, is }) { + plan(2) + const { channel } = await rig.getOrCreateInfoInstance() + const relativePath = path.relative(harness, minimal) + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--key', '--json', channel, relativePath] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + const seen = new Set() + const tags = [] + for await (const line of running.lineout) { + const result = JSON.parse(line) + if (seen.has(result.tag)) continue + seen.add(result.tag) + tags.push(result.tag) + if (result.tag === 'final') break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + alike(tags, ['retrieving', 'final'], 'should output correct tags') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info pear://', async function ({ plan, is }) { + plan(4) + const { link } = await rig.getOrCreateInfoInstance() + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', link] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + let changelogPrinted = false + let metadataPrinted = false + let keyPrinted = false + for await (const line of running.lineout) { + if (line.includes('changelog')) changelogPrinted = true + if (line.includes('info')) metadataPrinted = true + if (line.includes(link)) keyPrinted = true + if (line.endsWith('Success')) break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + is(changelogPrinted, true, 'should output the changelog') + is(metadataPrinted, true, 'should output the metadata') + is(keyPrinted, true, 'should output the key as link') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --json pear://', async function ({ plan, alike, is }) { + plan(2) + const { link } = await rig.getOrCreateInfoInstance() + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--json', link] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + const seen = new Set() + const tags = [] + for await (const line of running.lineout) { + const result = JSON.parse(line) + if (seen.has(result.tag)) continue + seen.add(result.tag) + tags.push(result.tag) + if (result.tag === 'final') break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + alike(tags, ['retrieving', 'keys', 'info', 'changelog', 'final'], 'should output correct tags') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --changelog pear://', async function ({ plan, is }) { + plan(4) + const { link } = await rig.getOrCreateInfoInstance() + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--changelog', link] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + let changelogPrinted = false + let metadataPrinted = false + let keyPrinted = false + for await (const line of running.lineout) { + if (line.includes('changelog')) changelogPrinted = true + if (line.includes('info')) metadataPrinted = true + if (line.includes(link)) keyPrinted = true + if (line.endsWith('Success')) break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + is(changelogPrinted, true, 'should output the changelog') + is(metadataPrinted, false, 'should not output the metadata') + is(keyPrinted, false, 'should not output the key as link') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --changelog --json pear://', async function ({ plan, alike, is }) { + plan(2) + const { link } = await rig.getOrCreateInfoInstance() + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--changelog', '--json', link] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + const seen = new Set() + const tags = [] + for await (const line of running.lineout) { + const result = JSON.parse(line) + if (seen.has(result.tag)) continue + seen.add(result.tag) + tags.push(result.tag) + if (result.tag === 'final') break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + alike(tags, ['changelog', 'final'], 'should output correct tags') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --changelog --metadata pear://', async function ({ plan, is }) { + plan(4) + const { link } = await rig.getOrCreateInfoInstance() + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--changelog', '--metadata', link] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + let changelogPrinted = false + let metadataPrinted = false + let keyPrinted = false + for await (const line of running.lineout) { + if (line.includes('changelog')) changelogPrinted = true + if (line.includes('info')) metadataPrinted = true + if (line.includes(link)) keyPrinted = true + if (line.endsWith('Success')) break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + is(changelogPrinted, true, 'should output the changelog') + is(metadataPrinted, true, 'should output the metadata') + is(keyPrinted, false, 'should not output the key as link') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --changelog --metadata --json pear://', async function ({ plan, alike, is }) { + plan(2) + const { link } = await rig.getOrCreateInfoInstance() + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--changelog', '--metadata', '--json', link] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + const seen = new Set() + const tags = [] + for await (const line of running.lineout) { + const result = JSON.parse(line) + if (seen.has(result.tag)) continue + seen.add(result.tag) + tags.push(result.tag) + if (result.tag === 'final') break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + alike(tags, ['keys', 'info', 'changelog', 'final'], 'should output correct tags') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --changelog --key pear://', async function ({ plan, is }) { + plan(4) + const { link } = await rig.getOrCreateInfoInstance() + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--changelog', '--key', link] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + let changelogPrinted = false + let metadataPrinted = false + let keyPrinted = false + for await (const line of running.lineout) { + if (line.includes('changelog')) changelogPrinted = true + if (line.includes('info')) metadataPrinted = true + if (line.includes(link)) keyPrinted = true + if (line.endsWith('Success')) break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + is(changelogPrinted, true, 'should output the changelog') + is(metadataPrinted, false, 'should not output the metadata') + is(keyPrinted, true, 'should output the key as link') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --changelog --key --json pear://', async function ({ plan, alike, is }) { + plan(2) + const { link } = await rig.getOrCreateInfoInstance() + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--changelog', '--key', '--json', link] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + const seen = new Set() + const tags = [] + for await (const line of running.lineout) { + const result = JSON.parse(line) + if (seen.has(result.tag)) continue + seen.add(result.tag) + tags.push(result.tag) + if (result.tag === 'final') break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + alike(tags, ['retrieving', 'changelog', 'final'], 'should output correct tags') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --changelog --metadata --key pear://', async function ({ plan, is }) { + plan(4) + const { link } = await rig.getOrCreateInfoInstance() + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--changelog', '--metadata', '--key', link] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + let changelogPrinted = false + let metadataPrinted = false + let keyPrinted = false + for await (const line of running.lineout) { + if (line.includes('changelog')) changelogPrinted = true + if (line.includes('info')) metadataPrinted = true + if (line.includes(link)) keyPrinted = true + if (line.endsWith('Success')) break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + is(changelogPrinted, true, 'should output the changelog') + is(metadataPrinted, true, 'should output the metadata') + is(keyPrinted, true, 'should output the key as link') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --changelog --metadata --key --json pear://', async function ({ plan, alike, is }) { + plan(2) + const { link } = await rig.getOrCreateInfoInstance() + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--changelog', '--metadata', '--key', '--json', link] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + const seen = new Set() + const tags = [] + for await (const line of running.lineout) { + const result = JSON.parse(line) + if (seen.has(result.tag)) continue + seen.add(result.tag) + tags.push(result.tag) + if (result.tag === 'final') break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + alike(tags, ['retrieving', 'keys', 'info', 'changelog', 'final'], 'should output correct tags') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --full-changelog pear://', async function ({ plan, is }) { + plan(4) + const { link } = await rig.getOrCreateInfoInstance() + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--full-changelog', link] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + let changelogPrinted = false + let metadataPrinted = false + let keyPrinted = false + for await (const line of running.lineout) { + if (line.includes('changelog')) changelogPrinted = true + if (line.includes('info')) metadataPrinted = true + if (line.includes(link)) keyPrinted = true + if (line.endsWith('Success')) break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + is(changelogPrinted, true, 'should output the changelog') + is(metadataPrinted, false, 'should not output the metadata') + is(keyPrinted, false, 'should not output the key as link') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --full-changelog --metadata pear://', async function ({ plan, is }) { + plan(4) + const { link } = await rig.getOrCreateInfoInstance() + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--full-changelog', '--metadata', link] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + let changelogPrinted = false + let metadataPrinted = false + let keyPrinted = false + for await (const line of running.lineout) { + if (line.includes('changelog')) changelogPrinted = true + if (line.includes('info')) metadataPrinted = true + if (line.includes(link)) keyPrinted = true + if (line.endsWith('Success')) break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + is(changelogPrinted, true, 'should output the changelog') + is(metadataPrinted, true, 'should output the metadata') + is(keyPrinted, false, 'should not output the key as link') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --full-changelog --metadata --json pear://', async function ({ plan, alike, is }) { + plan(2) + const { link } = await rig.getOrCreateInfoInstance() + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--full-changelog', '--metadata', '--json', link] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + const seen = new Set() + const tags = [] + for await (const line of running.lineout) { + const result = JSON.parse(line) + if (seen.has(result.tag)) continue + seen.add(result.tag) + tags.push(result.tag) + if (result.tag === 'final') break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + alike(tags, ['keys', 'info', 'changelog', 'final'], 'should output correct tags') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --full-changelog --metadata --key pear://', async function ({ plan, is }) { + plan(4) + const { link } = await rig.getOrCreateInfoInstance() + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--full-changelog', '--metadata', '--key', link] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + let changelogPrinted = false + let metadataPrinted = false + let keyPrinted = false + for await (const line of running.lineout) { + if (line.includes('changelog')) changelogPrinted = true + if (line.includes('info')) metadataPrinted = true + if (line.includes(link)) keyPrinted = true + if (line.endsWith('Success')) break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + is(changelogPrinted, true, 'should output the changelog') + is(metadataPrinted, true, 'should output the metadata') + is(keyPrinted, true, 'should output the key as link') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --full-changelog --metadata --key --json pear://', async function ({ plan, alike, is }) { + plan(2) + const { link } = await rig.getOrCreateInfoInstance() + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--full-changelog', '--metadata', '--key', '--json', link] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + const seen = new Set() + const tags = [] + for await (const line of running.lineout) { + const result = JSON.parse(line) + if (seen.has(result.tag)) continue + seen.add(result.tag) + tags.push(result.tag) + if (result.tag === 'final') break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + alike(tags, ['retrieving', 'keys', 'info', 'changelog', 'final'], 'should output correct tags') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --metadata pear://', async function ({ plan, is }) { + plan(4) + const { link } = await rig.getOrCreateInfoInstance() + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--metadata', link] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + let changelogPrinted = false + let metadataPrinted = false + let keyPrinted = false + for await (const line of running.lineout) { + if (line.includes('changelog')) changelogPrinted = true + if (line.includes('info')) metadataPrinted = true + if (line.includes(link)) keyPrinted = true + if (line.endsWith('Success')) break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + is(changelogPrinted, false, 'should not output the changelog') + is(metadataPrinted, true, 'should output the metadata') + is(keyPrinted, false, 'should not output the key as link') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --metadata --key pear://', async function ({ plan, is }) { + plan(4) + const { link } = await rig.getOrCreateInfoInstance() + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--metadata', '--key', link] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + let changelogPrinted = false + let metadataPrinted = false + let keyPrinted = false + for await (const line of running.lineout) { + if (line.includes('changelog')) changelogPrinted = true + if (line.includes('info')) metadataPrinted = true + if (line.includes(link)) keyPrinted = true + if (line.endsWith('Success')) break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + is(changelogPrinted, false, 'should not output the changelog') + is(metadataPrinted, true, 'should output the metadata') + is(keyPrinted, true, 'should output the key as link') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --metadata --key --json pear://', async function ({ plan, alike, is }) { + plan(2) + const { link } = await rig.getOrCreateInfoInstance() + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--metadata', '--key', '--json', link] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + const seen = new Set() + const tags = [] + for await (const line of running.lineout) { + const result = JSON.parse(line) + if (seen.has(result.tag)) continue + seen.add(result.tag) + tags.push(result.tag) + if (result.tag === 'final') break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + alike(tags, ['retrieving', 'keys', 'info', 'final'], 'should output correct tags') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --key pear://', async function ({ plan, is }) { + plan(4) + const { link } = await rig.getOrCreateInfoInstance() + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--key', link] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + let changelogPrinted = false + let metadataPrinted = false + let keyPrinted = false + for await (const line of running.lineout) { + if (line.includes('changelog')) changelogPrinted = true + if (line.includes('info')) metadataPrinted = true + if (line.includes(link)) keyPrinted = true + if (line.endsWith('Success')) break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + is(changelogPrinted, false, 'should not output the changelog') + is(metadataPrinted, false, 'should not output the metadata') + is(keyPrinted, true, 'should output the key as link') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +test('pear info --key --json pear://', async function ({ plan, alike, is }) { + plan(2) + const { link } = await rig.getOrCreateInfoInstance() + + const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true }) + const argv = ['info', '--key', '--json', link] + await running.inspector.evaluate(` + __PEAR_TEST__.command(${JSON.stringify(argv)}) + `, { returnByValue: false }) + + const seen = new Set() + const tags = [] + for await (const line of running.lineout) { + const result = JSON.parse(line) + if (seen.has(result.tag)) continue + seen.add(result.tag) + tags.push(result.tag) + if (result.tag === 'final') break + } + + await running.inspector.evaluate('__PEAR_TEST__.ipc.destroy()', { returnByValue: false }) + await running.inspector.close() + + alike(tags, ['retrieving', 'final'], 'should output correct tags') + const { code } = await running.until.exit + is(code, 0, 'should have exit code 0') +}) + +// TODO: Implement the following tests when --no-* flags work +test.todo('pear info --no-changelog ') +test.todo('pear info --no-changelog --json ') +test.todo('pear info --no-metadata ') +test.todo('pear info --no-metadata --json ') +test.todo('pear info --no-key ') +test.todo('pear info --no-key --json ') +test.todo('pear info --no-changelog --no-metadata ') +test.todo('pear info --no-changelog --no-metadata --json ') +test.todo('pear info --no-changelog --no-key ') +test.todo('pear info --no-changelog --no-key --json ') +test.todo('pear info --no-key --no-metadata ') +test.todo('pear info --no-key --no-metadata --json ') +test.todo('pear info --no-changelog --no-metadata --no-key ') +test.todo('pear info --no-changelog --no-metadata --no-key --json ') +test.todo('pear info --no-changelog pear://') +test.todo('pear info --no-changelog --json pear://') +test.todo('pear info --no-metadata pear://') +test.todo('pear info --no-metadata --json pear://') +test.todo('pear info --no-key pear://') +test.todo('pear info --no-key --json pear://') +test.todo('pear info --no-changelog --no-metadata pear://') +test.todo('pear info --no-changelog --no-metadata --json pear://') +test.todo('pear info --no-changelog --no-key pear://') +test.todo('pear info --no-changelog --no-key --json pear://') +test.todo('pear info --no-key --no-metadata pear://') +test.todo('pear info --no-key --no-metadata --json pear://') +test.todo('pear info --no-changelog --no-metadata --no-key pear://') +test.todo('pear info --no-changelog --no-metadata --no-key --json pear://') + +test.todo('pear dump pear:// ') +test.todo('pear dump pear:// ') +test.todo('pear dump --checkout pear:// ') +test.todo('pear dump --checkout staged pear:// ') +test.todo('pear dump --checkout release pear:// ') +test.todo('pear dump --json pear:// ') + +test.todo('pear shift ') +test.todo('pear shift --json ') +test.todo('pear shift --force ') +test.todo('pear shift --force --json ') + +test.todo('pear gc releases') +test.todo('pear gc releases --json') +test.todo('pear gc sidecars') +test.todo('pear gc sidecars --json') + +test.todo('pear versions') +test.todo('pear versions --json') +test.todo('pear -v') + test('commands cleanup', rig.cleanup) diff --git a/test/index.js b/test/index.js index a00674c27..8aa5cc718 100644 --- a/test/index.js +++ b/test/index.js @@ -11,7 +11,7 @@ async function runTests () { await import('./02-shutdown.test.js') await import('./03-teardown.test.js') await import('./04-updates.test.js') - // await import('./05-commands.test.js') + await import('./05-commands.test.js') await import('./06-worker.test.js') test.resume()