Skip to content

Commit 34403ed

Browse files
authored
chore: use import instead of require in generated JS examples (#131)
1 parent 4cf6c05 commit 34403ed

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

assets/demo-todo-app.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// @ts-check
2-
const { test, expect } = require('@playwright/test');
2+
import { test, expect } from '@playwright/test';
33

44
test.beforeEach(async ({ page }) => {
55
await page.goto('https://demo.playwright.dev/todomvc');

assets/example.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// @ts-check
2-
const { test, expect } = require('@playwright/test');
2+
import { test, expect } from '@playwright/test';
33

44
test('has title', async ({ page }) => {
55
await page.goto('https://playwright.dev/');

assets/playwright-ct.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// @ts-check
2-
const { defineConfig, devices } = require('{{ctPackageName}}');
2+
import { defineConfig, devices } from '{{ctPackageName}}';
33

44
/**
55
* @see https://playwright.dev/docs/test-configuration

assets/playwright.config.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
// @ts-check
2-
const { defineConfig, devices } = require('@playwright/test');
2+
import { defineConfig, devices } from '@playwright/test';
33

44
/**
55
* Read environment variables from file.
66
* https://github.com/motdotla/dotenv
77
*/
8-
// require('dotenv').config({ path: path.resolve(__dirname, '.env') });
8+
// import dotenv from 'dotenv';
9+
// import path from 'path';
10+
// dotenv.config({ path: path.resolve(__dirname, '.env') });
911

1012
/**
1113
* @see https://playwright.dev/docs/test-configuration
1214
*/
13-
module.exports = defineConfig({
15+
export default defineConfig({
1416
testDir: './{{testDir}}',
1517
/* Run tests in files in parallel */
1618
fullyParallel: true,

0 commit comments

Comments
 (0)