-1

I have playwright test which I need to run in Azure function. It runs fine locally but when deployed to Azure function it fails with error below. The only reporter configured is list and it shall not write to test-results or read from there. reporter: [['list']]

All my logging going to AppInsights, how do I overcome this issue, I really don't need any sort of persistence locally for any of playwright reporters.

{"success":false,"message":"Failed to run Playwright tests","error":"Command failed: node ./node_modules/@playwright/test/cli.js test\nError in reporter Error: EROFS: read-only file system, open '/home/site/wwwroot/test-results/.last-run.json'\n    at async open (node:internal/fs/promises:641:25)\n    at async Object.writeFile (node:internal/fs/promises:1215:14)\n    at async LastRunReporter.onEnd (/home/site/wwwroot/node_modules/playwright/lib/runner/lastRun.js:71:5)\n    at async wrapAsync (/home/site/wwwroot/node_modules/playwright/lib/reporters/multiplexer.js:89:12)\n    at async Multiplexer.onEnd (/home/site/wwwroot/node_modules/playwright/lib/reporters/multiplexer.js:57:25)\n    at async InternalReporter.onEnd (/home/site/wwwroot/node_modules/playwright/lib/reporters/internalReporter.js:77:12)\n    at async finishTaskRun (/home/site/wwwroot/node_modules/playwright/lib/runner/tasks.js:94:26)\n    at async runTasks (/home/site/wwwroot/node_modules/playwright/lib/runner/tasks.js:81:10)\n    at async runAllTestsWithConfig (/home/site/wwwroot/node_modules/playwright/lib/runner/testRunner.js:379:18)\n    at async runTests (/home/site/wwwroot/node_modules/playwright/lib/program.js:242:18) {\n  errno: -30,\n  code: 'EROFS',\n  syscall: 'open',\n  path: '/home/site/wwwroot/test-results/.last-run.json'\n}\n","output":"\nError: EROFS: read-only file system, rmdir '/home/site/wwwroot/test-results'\n\n\n","errors":"Error in reporter Error: EROFS: read-only file system, open '/home/site/wwwroot/test-results/.last-run.json'\n    at async open (node:internal/fs/promises:641:25)\n    at async Object.writeFile (node:internal/fs/promises:1215:14)\n    at async LastRunReporter.onEnd (/home/site/wwwroot/node_modules/playwright/lib/runner/lastRun.js:71:5)\n    at async wrapAsync (/home/site/wwwroot/node_modules/playwright/lib/reporters/multiplexer.js:89:12)\n    at async Multiplexer.onEnd (/home/site/wwwroot/node_modules/playwright/lib/reporters/multiplexer.js:57:25)\n    at async InternalReporter.onEnd (/home/site/wwwroot/node_modules/playwright/lib/reporters/internalReporter.js:77:12)\n    at async finishTaskRun (/home/site/wwwroot/node_modules/playwright/lib/runner/tasks.js:94:26)\n    at async runTasks (/home/site/wwwroot/node_modules/playwright/lib/runner/tasks.js:81:10)\n    at async runAllTestsWithConfig (/home/site/wwwroot/node_modules/playwright/lib/runner/testRunner.js:379:18)\n    at async runTests (/home/site/wwwroot/node_modules/playwright/lib/program.js:242:18) {\n  errno: -30,\n  code: 'EROFS',\n  syscall: 'open',\n  path: '/home/site/wwwroot/test-results/.last-run.json'\n}\n"}

1 Answer 1

1

According to your error message:

Error in reporter Error: EROFS: read-only file system, open '/home/site/wwwroot/test-results/.last-run.json...

The failure is coming from Playwright’s internal LastRunReporter, which creates the last-run file, not from the list reporter. By default, playwright always writes this file into its output directory, and in your environment that directory is read-only (/home/site/wwwroot). Since the LastRunReporter cannot be disabled, you can fix the issue by pointing the output directory to a writable location (for example /tmp/test-results).

Update your playwright.config.ts:

export default {
  reporter: 'list',
  outputDir: '/tmp/test-results'
};

or use the CLI:

npx playwright test --reporter=list --output=/tmp/test-results

Note: /home/site/wwwroot is read-only in Azure Functions when deployed from a package, so Playwright cannot write .last-run.json there, which is why you do not see the same error when running the tests locally.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.