Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/e2e/tests/app-dev-server.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ test.describe('App dev server', () => {
packageManager: 'npm',
orgId: env.orgId,
})
expect(initResult.exitCode).toBe(0)
expect(initResult.exitCode, `createApp failed:\nstdout: ${initResult.stdout}\nstderr: ${initResult.stderr}`).toBe(
0,
)
const appDir = initResult.appDir

// Step 2: Start dev server via PTY
Expand All @@ -42,7 +44,7 @@ test.describe('App dev server', () => {

// Step 6: Wait for clean exit
const exitCode = await dev.waitForExit(CLI_TIMEOUT.short)
expect(exitCode).toBe(0)
expect(exitCode, `dev exited with non-zero code. Output:\n${dev.getOutput()}`).toBe(0)
} finally {
fs.rmSync(parentDir, {recursive: true, force: true})
await teardownApp({browserPage, appName, email: process.env.E2E_ACCOUNT_EMAIL, orgId: env.orgId})
Expand Down
27 changes: 21 additions & 6 deletions packages/e2e/tests/app-scaffold.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ test.describe('App scaffold', () => {
packageManager: 'npm',
orgId: env.orgId,
})
expect(initResult.exitCode).toBe(0)
expect(initResult.exitCode, `createApp failed:\nstdout: ${initResult.stdout}\nstderr: ${initResult.stderr}`).toBe(
0,
)
const initOutput = initResult.stdout + initResult.stderr
expect(initOutput).toContain('is ready for you to build!')
const appDir = initResult.appDir
Expand All @@ -37,7 +39,10 @@ test.describe('App scaffold', () => {

// Step 3: Build the app
const buildResult = await buildApp({cli, appDir})
expect(buildResult.exitCode, `build failed:\nstderr: ${buildResult.stderr}`).toBe(0)
expect(
buildResult.exitCode,
`buildApp failed:\nstdout: ${buildResult.stdout}\nstderr: ${buildResult.stderr}`,
).toBe(0)
} finally {
fs.rmSync(parentDir, {recursive: true, force: true})
await teardownApp({browserPage, appName, email: process.env.E2E_ACCOUNT_EMAIL, orgId: env.orgId})
Expand All @@ -60,7 +65,9 @@ test.describe('App scaffold', () => {
packageManager: 'npm',
orgId: env.orgId,
})
expect(initResult.exitCode).toBe(0)
expect(initResult.exitCode, `createApp failed:\nstdout: ${initResult.stdout}\nstderr: ${initResult.stderr}`).toBe(
0,
)
expect(fs.existsSync(initResult.appDir)).toBe(true)
expect(fs.existsSync(path.join(initResult.appDir, 'shopify.app.toml'))).toBe(true)
} finally {
Expand Down Expand Up @@ -89,7 +96,9 @@ test.describe('App scaffold', () => {
packageManager: 'npm',
orgId: env.orgId,
})
expect(initResult.exitCode).toBe(0)
expect(initResult.exitCode, `createApp failed:\nstdout: ${initResult.stdout}\nstderr: ${initResult.stderr}`).toBe(
0,
)
const appDir = initResult.appDir

const extensionConfigs = [
Expand All @@ -100,11 +109,17 @@ test.describe('App scaffold', () => {
for (const ext of extensionConfigs) {
// eslint-disable-next-line no-await-in-loop
const result = await generateExtension({cli, appDir, ...ext})
expect(result.exitCode, `generate "${ext.name}" failed:\nstderr: ${result.stderr}`).toBe(0)
expect(
result.exitCode,
`generateExtension "${ext.name}" failed:\nstdout: ${result.stdout}\nstderr: ${result.stderr}`,
).toBe(0)
}

const buildResult = await buildApp({cli, appDir})
expect(buildResult.exitCode, `build failed:\nstderr: ${buildResult.stderr}`).toBe(0)
expect(
buildResult.exitCode,
`buildApp failed:\nstdout: ${buildResult.stdout}\nstderr: ${buildResult.stderr}`,
).toBe(0)
} finally {
fs.rmSync(parentDir, {recursive: true, force: true})
await teardownApp({browserPage, appName, email: process.env.E2E_ACCOUNT_EMAIL, orgId: env.orgId})
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e/tests/commands.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const normalize = (value: string) => value.replace(/\r\n/g, '\n').trimEnd()
test.describe('Command snapshot', () => {
test('shopify commands --tree matches snapshot', async ({cli}) => {
const result = await cli.exec(['commands', '--tree'])
expect(result.exitCode).toBe(0)
expect(result.exitCode, `commands --tree failed:\nstdout: ${result.stdout}\nstderr: ${result.stderr}`).toBe(0)

const snapshot = await fs.readFile(snapshotPath, {encoding: 'utf8'})
expect(normalize(result.stdout), errorMessage).toBe(normalize(snapshot))
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e/tests/smoke-pty.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ test.describe('PTY smoke test', () => {
const proc = await cli.spawn(['version'])
await proc.waitForOutput('3.')
const code = await proc.waitForExit()
expect(code).toBe(0)
expect(code, `shopify version (PTY) failed. Output:\n${proc.getOutput()}`).toBe(0)
expect(proc.getOutput()).toMatch(/\d+\.\d+\.\d+/)
})
})
2 changes: 1 addition & 1 deletion packages/e2e/tests/smoke.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {expect} from '@playwright/test'
test.describe('Smoke test', () => {
test('shopify version runs successfully', async ({cli}) => {
const result = await cli.exec(['version'])
expect(result.exitCode).toBe(0)
expect(result.exitCode, `shopify version failed:\nstdout: ${result.stdout}\nstderr: ${result.stderr}`).toBe(0)
expect(result.stdout).toMatch(/\d+\.\d+\.\d+/)
})
})
Loading