-
Notifications
You must be signed in to change notification settings - Fork 362
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: publish CJS modules alongside ESM
- Loading branch information
Showing
6 changed files
with
75 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
const { | ||
createRunner, | ||
PuppeteerRunnerExtension, | ||
} = require('../../lib/cjs/main.js'); | ||
const puppeteer = require('puppeteer'); | ||
|
||
async function main() { | ||
const browser = await puppeteer.launch({ | ||
headless: true, | ||
}); | ||
|
||
const page = await browser.newPage(); | ||
|
||
class Extension extends PuppeteerRunnerExtension { | ||
async beforeAllSteps(flow) { | ||
await super.beforeAllSteps(flow); | ||
console.log('starting'); | ||
} | ||
|
||
async beforeEachStep(step, flow) { | ||
await super.beforeEachStep(step, flow); | ||
console.log('before', step); | ||
} | ||
|
||
async afterEachStep(step, flow) { | ||
await super.afterEachStep(step, flow); | ||
console.log('after', step); | ||
} | ||
|
||
async afterAllSteps(flow) { | ||
await super.afterAllSteps(flow); | ||
console.log('done'); | ||
} | ||
} | ||
|
||
const runner = await createRunner( | ||
{ | ||
title: 'Test recording', | ||
steps: [ | ||
{ | ||
type: 'navigate', | ||
url: 'https://wikipedia.org', | ||
}, | ||
], | ||
}, | ||
new Extension(browser, page, 7000) | ||
); | ||
|
||
await runner.run(); | ||
|
||
await browser.close(); | ||
} | ||
|
||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"type": "commonjs" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "lib/cjs", | ||
"module": "CommonJS", | ||
} | ||
} |