Skip to main content
Version: 23.2.0

Coverage.startJSCoverage() 方法

¥Coverage.startJSCoverage() method

签名

¥Signature

class Coverage {
startJSCoverage(options?: JSCoverageOptions): Promise<void>;
}

参数

¥Parameters

范围

类型

描述

options

JSCoverageOptions

(可选的)覆盖范围的可配置选项集默认为 resetOnNavigation : true, reportAnonymousScripts : false, includeRawScriptCoverage : false, useBlockCoverage : true

Returns:

Promise<void>

Promise 在覆盖范围开始时解决。

¥Promise that resolves when coverage is started.

备注

¥Remarks

匿名脚本是没有关联 URL 的脚本。这些是使用 evalnew Function 在页面上动态创建的脚本。If reportAnonymousScripts is set to true, anonymous scripts URL will start with debugger://VM (unless a magic //# sourceURL comment is present, in which case that will the be URL).

¥Anonymous scripts are ones that don't have an associated url. These are scripts that are dynamically created on the page using eval or new Function. If reportAnonymousScripts is set to true, anonymous scripts URL will start with debugger://VM (unless a magic //# sourceURL comment is present, in which case that will the be URL).