@serenity-js/playwright-test
Version:
Serenity/JS test runner adapter for Playwright Test, combining Playwright's developer experience with the advanced reporting and automation capabilities of Serenity/JS
18 lines • 632 B
JavaScript
import fs from 'node:fs';
import * as events from '@serenity-js/core/events';
export class WorkerEventStreamReader {
hasStream(pathToEventStreamFile) {
return fs.existsSync(pathToEventStreamFile);
}
read(pathToEventStreamFile, mapper = input => input) {
const content = fs.readFileSync(pathToEventStreamFile, 'utf8');
return content
.split('\n')
.filter(Boolean)
.map(line => {
const { type, value } = mapper(JSON.parse(line));
return events[type].fromJSON(value);
});
}
}
//# sourceMappingURL=WorkerEventStreamReader.js.map