Skip to content

Commit

Permalink
Use localdev to run tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jkcdarunday committed Aug 29, 2024
1 parent a9d67e1 commit 66b5879
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions test/05-commands.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@ const harness = path.join(Helper.root, 'test', 'fixtures', 'harness')
const minimal = path.join(Helper.root, 'test', 'fixtures', 'minimal')

class Rig {
setup = async ({ comment }) => {
this.helper = new Helper()
setup = async ({ comment, timeout }) => {
timeout(180000)
this.platformDir = path.join(Helper.root, 'pear')
const helper = new Helper({ platformDir: this.platformDir })
this.helper = helper
comment('connecting local sidecar')
await this.helper.ready()
await this.helper.shutdown()
this.helper = new Helper()
await this.helper.ready()
comment('local sidecar connected')
await helper.ready()
}

cleanup = async ({ comment }) => {
Expand All @@ -37,7 +36,7 @@ test('pear stage --json <channel> <dir>', async function ({ plan, alike, is }) {

const argv = ['stage', '--json', 'test-' + testId, minimal]

const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true })
const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true, platformDir: rig.platformDir })

await running.inspector.evaluate(`
__PEAR_TEST__.command(${JSON.stringify(argv)})
Expand Down Expand Up @@ -239,7 +238,7 @@ test('pear shift <source> <destination>', async function ({ plan, is, teardown }

const testId1 = Math.floor(Math.random() * 100000)
const argvInit1 = ['stage', '--json', `test-${testId1}`, relativePath]
const stager1 = await Helper.open(harness, { tags: ['exit'] }, { lineout: true })
const stager1 = await Helper.open(harness, { tags: ['exit'] }, { lineout: true, platformDir: rig.platformDir })
await stager1.inspector.evaluate(`
__PEAR_TEST__.command(${JSON.stringify(argvInit1)})
`, { returnByValue: false })
Expand All @@ -257,7 +256,7 @@ test('pear shift <source> <destination>', async function ({ plan, is, teardown }

const testId2 = Math.floor(Math.random() * 100000)
const argvInit2 = ['stage', '--json', `test-${testId2}`, relativePath]
const stager2 = await Helper.open(harness, { tags: ['exit'] }, { lineout: true })
const stager2 = await Helper.open(harness, { tags: ['exit'] }, { lineout: true, platformDir: rig.platformDir })
await stager2.inspector.evaluate(`
__PEAR_TEST__.command(${JSON.stringify(argvInit2)})
`, { returnByValue: false })
Expand Down Expand Up @@ -287,7 +286,7 @@ test('pear shift <source> <destination>', async function ({ plan, is, teardown }
})

const argv = ['shift', staged1.link, staged2.link]
const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true })
const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true, platformDir: rig.platformDir })
await running.inspector.evaluate(`
__PEAR_TEST__.command(${JSON.stringify(argv)})
`, { returnByValue: false })
Expand Down Expand Up @@ -315,7 +314,7 @@ test('pear shift --json <source> <destination>', async function ({ plan, is, ali

const testId1 = Math.floor(Math.random() * 100000)
const argvInit1 = ['stage', '--json', `test-${testId1}`, relativePath]
const stager1 = await Helper.open(harness, { tags: ['exit'] }, { lineout: true })
const stager1 = await Helper.open(harness, { tags: ['exit'] }, { lineout: true, platformDir: rig.platformDir })
await stager1.inspector.evaluate(`
__PEAR_TEST__.command(${JSON.stringify(argvInit1)})
`, { returnByValue: false })
Expand All @@ -333,7 +332,7 @@ test('pear shift --json <source> <destination>', async function ({ plan, is, ali

const testId2 = Math.floor(Math.random() * 100000)
const argvInit2 = ['stage', '--json', `test-${testId2}`, relativePath]
const stager2 = await Helper.open(harness, { tags: ['exit'] }, { lineout: true })
const stager2 = await Helper.open(harness, { tags: ['exit'] }, { lineout: true, platformDir: rig.platformDir })
await stager2.inspector.evaluate(`
__PEAR_TEST__.command(${JSON.stringify(argvInit2)})
`, { returnByValue: false })
Expand Down Expand Up @@ -363,7 +362,7 @@ test('pear shift --json <source> <destination>', async function ({ plan, is, ali
})

const argv = ['shift', '--json', staged1.link, staged2.link]
const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true })
const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true, platformDir: rig.platformDir })
await running.inspector.evaluate(`
__PEAR_TEST__.command(${JSON.stringify(argv)})
`, { returnByValue: false })
Expand Down Expand Up @@ -393,7 +392,7 @@ test('pear shift --force <source> <destination>', async function ({ plan, is, te

const testId1 = Math.floor(Math.random() * 100000)
const argvInit1 = ['stage', '--json', `test-${testId1}`, relativePath]
const stager1 = await Helper.open(harness, { tags: ['exit'] }, { lineout: true })
const stager1 = await Helper.open(harness, { tags: ['exit'] }, { lineout: true, platformDir: rig.platformDir })
await stager1.inspector.evaluate(`
__PEAR_TEST__.command(${JSON.stringify(argvInit1)})
`, { returnByValue: false })
Expand All @@ -411,7 +410,7 @@ test('pear shift --force <source> <destination>', async function ({ plan, is, te

const testId2 = Math.floor(Math.random() * 100000)
const argvInit2 = ['stage', '--json', `test-${testId2}`, relativePath]
const stager2 = await Helper.open(harness, { tags: ['exit'] }, { lineout: true })
const stager2 = await Helper.open(harness, { tags: ['exit'] }, { lineout: true, platformDir: rig.platformDir })
await stager2.inspector.evaluate(`
__PEAR_TEST__.command(${JSON.stringify(argvInit2)})
`, { returnByValue: false })
Expand Down Expand Up @@ -443,7 +442,7 @@ test('pear shift --force <source> <destination>', async function ({ plan, is, te
})

const argv = ['shift', '--force', staged1.link, staged2.link]
const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true })
const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true, platformDir: rig.platformDir })
await running.inspector.evaluate(`
__PEAR_TEST__.command(${JSON.stringify(argv)})
`, { returnByValue: false })
Expand Down Expand Up @@ -472,7 +471,7 @@ test('pear shift --force --json <source> <destination>', async function ({ plan,

const testId1 = Math.floor(Math.random() * 100000)
const argvInit1 = ['stage', '--json', `test-${testId1}`, relativePath]
const stager1 = await Helper.open(harness, { tags: ['exit'] }, { lineout: true })
const stager1 = await Helper.open(harness, { tags: ['exit'] }, { lineout: true, platformDir: rig.platformDir })
await stager1.inspector.evaluate(`
__PEAR_TEST__.command(${JSON.stringify(argvInit1)})
`, { returnByValue: false })
Expand All @@ -490,7 +489,7 @@ test('pear shift --force --json <source> <destination>', async function ({ plan,

const testId2 = Math.floor(Math.random() * 100000)
const argvInit2 = ['stage', '--json', `test-${testId2}`, relativePath]
const stager2 = await Helper.open(harness, { tags: ['exit'] }, { lineout: true })
const stager2 = await Helper.open(harness, { tags: ['exit'] }, { lineout: true, platformDir: rig.platformDir })
await stager2.inspector.evaluate(`
__PEAR_TEST__.command(${JSON.stringify(argvInit2)})
`, { returnByValue: false })
Expand Down Expand Up @@ -522,7 +521,7 @@ test('pear shift --force --json <source> <destination>', async function ({ plan,
})

const argv = ['shift', '--force', '--json', staged1.link, staged2.link]
const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true })
const running = await Helper.open(harness, { tags: ['exit'] }, { lineout: true, platformDir: rig.platformDir })
await running.inspector.evaluate(`
__PEAR_TEST__.command(${JSON.stringify(argv)})
`, { returnByValue: false })
Expand Down

0 comments on commit 66b5879

Please sign in to comment.