mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-13 17:14:02 +03:00
chore: add support private methods in TS (#12051)
This commit is contained in:
parent
aee844eaed
commit
96b5831a49
@ -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')],
|
||||
|
38
tests/playwright-test/babel.spec.ts
Normal file
38
tests/playwright-test/babel.spec.ts
Normal file
@ -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);
|
||||
});
|
Loading…
Reference in New Issue
Block a user