mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-15 06:02:57 +03:00
fix(inspector): skip stack trace playwright/src lines only under tests (#5594)
This commit is contained in:
parent
aa94dfbcb6
commit
070cfdcdb8
@ -41,7 +41,7 @@ const PW_LIB_DIRS = [
|
|||||||
'playwright-chromium',
|
'playwright-chromium',
|
||||||
'playwright-firefox',
|
'playwright-firefox',
|
||||||
'playwright-webkit',
|
'playwright-webkit',
|
||||||
].map(packageName => path.join(packageName, 'lib'));
|
].map(packageName => path.join('node_modules', packageName, 'lib'));
|
||||||
|
|
||||||
export function captureStackTrace(): { stack: string, frames: StackFrame[] } {
|
export function captureStackTrace(): { stack: string, frames: StackFrame[] } {
|
||||||
const stack = new Error().stack!;
|
const stack = new Error().stack!;
|
||||||
@ -56,7 +56,7 @@ export function captureStackTrace(): { stack: string, frames: StackFrame[] } {
|
|||||||
if (PW_LIB_DIRS.some(libDir => fileName.includes(libDir)))
|
if (PW_LIB_DIRS.some(libDir => fileName.includes(libDir)))
|
||||||
continue;
|
continue;
|
||||||
// for tests.
|
// for tests.
|
||||||
if (fileName.includes(path.join('playwright', 'src')))
|
if (isUnderTest() && fileName.includes(path.join('playwright', 'src')))
|
||||||
continue;
|
continue;
|
||||||
if (isUnderTest() && fileName.includes(path.join('playwright', 'test', 'coverage.js')))
|
if (isUnderTest() && fileName.includes(path.join('playwright', 'test', 'coverage.js')))
|
||||||
continue;
|
continue;
|
||||||
|
@ -19,6 +19,7 @@ import { folio, RemoteServer } from './remoteServer.fixture';
|
|||||||
import { execSync } from 'child_process';
|
import { execSync } from 'child_process';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import * as stackTrace from '../src/utils/stackTrace';
|
import * as stackTrace from '../src/utils/stackTrace';
|
||||||
|
import { setUnderTest } from '../src/utils/utils';
|
||||||
|
|
||||||
type FixturesFixtures = {
|
type FixturesFixtures = {
|
||||||
connectedRemoteServer: RemoteServer;
|
connectedRemoteServer: RemoteServer;
|
||||||
@ -129,6 +130,7 @@ describe('fixtures', (suite, { platform, headful }) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('caller file path', async ({}) => {
|
it('caller file path', async ({}) => {
|
||||||
|
setUnderTest();
|
||||||
const callme = require('./fixtures/callback');
|
const callme = require('./fixtures/callback');
|
||||||
const filePath = callme(() => {
|
const filePath = callme(() => {
|
||||||
return stackTrace.getCallerFilePath(path.join(__dirname, 'fixtures') + path.sep);
|
return stackTrace.getCallerFilePath(path.join(__dirname, 'fixtures') + path.sep);
|
||||||
|
Loading…
Reference in New Issue
Block a user