Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
chore: add support private methods in TS (#12051)
Pavel Feldman96b5831a4942
diff --git a/packages/playwright-test/src/transform.ts b/packages/playwright-test/src/transform.tsindex fa34e19568..3d31df012d 100644--- a/packages/playwright-test/src/transform.ts+++ b/packages/playwright-test/src/transform.ts@@ -158,6 +158,7 @@ export function transformHook(code: string, filename: string, isModule = false):[require.resolve('@babel/plugin-proposal-logical-assignment-operators')],[require.resolve('@babel/plugin-proposal-nullish-coalescing-operator')],[require.resolve('@babel/plugin-proposal-optional-chaining')],+ [require.resolve('@babel/plugin-proposal-private-methods')],[require.resolve('@babel/plugin-syntax-json-strings')],[require.resolve('@babel/plugin-syntax-optional-catch-binding')],[require.resolve('@babel/plugin-syntax-async-generators')],diff --git a/tests/playwright-test/babel.spec.ts b/tests/playwright-test/babel.spec.tsnew file mode 100644index 0000000000..22fdea561a--- /dev/null+++ b/tests/playwright-test/babel.spec.ts@@ -0,0 +1,38 @@+/**+ * Copyright (c) Microsoft Corporation.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++import { test, expect } from './playwright-test-fixtures';++test('should succeed', async ({ runInlineTest }) => {+ const result = await runInlineTest({+ 'one-success.spec.ts': `+ const { test } = pwt;++ class Foo {+ #logger = 2;+ get #log() { return this.#logger; }+ value() { return this.#log; };+ }++ test('succeeds', () => {+ expect(new Foo().value()).toBe(2);+ });+ `+ });+ expect(result.exitCode).toBe(0);+ expect(result.passed).toBe(1);+ expect(result.failed).toBe(0);+});