@ephesoft/webpack.istanbul.loader

中文文档
2.2.0发布于 2022/10/22MITTypeScript近 30 天下载 1.5万

Istanbul loader for webpack to instrument files for code coverage.

原始使用文档
文档目录5 节
  1. Usage
  2. Example with Typescript
  3. Setup
  4. NPM run targets
  5. Available Commands

README

Istanbul loader for webpack to instrument files for code coverage. Can be used with serverless offline to get code coverage results for integration tests.

Usage

To use the loader add it to your webpack.config.js file. You will only want to load for development / test build and not production.

Example with Typescript

const loaders = [
    {
        loader: '@ephesoft/webpack.istanbul.loader' // Must be first loader
    },
    {
        loader: 'ts-loader',
        options: {
            transpileOnly: true
        }
    }
]

module.exports = {
    ...
    module: {
        rules: [
            {
                // Add instrumentation for test coverage on development builds
                use: getMode() === 'development' ? loaders : loaders.slice(1, 2)
            }
        ]
    }
}

Setup

Ensure that project has the prerequisites:

npm ci

NPM run targets

Run NPM commands as

npm run command

Available Commands

CommandDescription
auditExecutes a dependency audit using the default NPM registry
audit:fixAttempts an automatic fix of any audit failures.
buildCleans the dist folder and transpiles/webpacks the code
cleanDeletes the working folders like dist and docs
clean:docsDeletes the docs folder
docsCreate API documentation for the package in a "docs" folder
docs:bitbucketCreates API documentation in Bitbucket markdown format in a "docs" folder
lintPerforms static analysis on the TypeScript files.
lint:fixPerforms static analysis on the TypeScript files and attempts to automatically fix errors.
lint:reportPerforms static analysis on the TypeScript files using the default validation rules and logs results to a JSON file.
packCreates a local tarball package
prebuildAutomatically ran during build.
postbuildAutomatically ran during build.
postprepareAutomatically ran during package install to setup tooling.
startInstructs the TypeScript compiler to compile the ts files every time a change is detected.
testRuns all tests.
test:unitRuns the unit tests.
validate:gaValidates the package version is valid for GA release.
validate:betaValidates the package version is valid for a Beta release.

版本与发布记录

@ephesoft/webpack.istanbul.loader 共发布 9 个版本,首次发布于 2022/09/22;过去 12 个月发布了 0 个版本。

版本发布日期距今
2.2.0latest2022/10/224 年前
2.1.02022/10/064 年前
2.1.0-beta.2beta2022/10/054 年前
2.1.0-beta.12022/10/054 年前
2.0.02022/09/274 年前
2.0.0-beta.12022/09/274 年前

关于 @ephesoft/webpack.istanbul.loader 的常见问题

@ephesoft/webpack.istanbul.loader 是什么?

Istanbul loader for webpack to instrument files for code coverage.

如何安装 @ephesoft/webpack.istanbul.loader?

在项目目录运行 npm install @ephesoft/webpack.istanbul.loader,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:webpack(>=5.74.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@ephesoft/webpack.istanbul.loader 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@ephesoft/webpack.istanbul.loader 可以商用吗?

@ephesoft/webpack.istanbul.loader 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@ephesoft/webpack.istanbul.loader 的下载量有多少?

根据 npm 官方下载统计,@ephesoft/webpack.istanbul.loader 在 2026/10/14 – 2026/11/12 这 30 天内被下载 14,927 次,日均约 498 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@ephesoft/webpack.istanbul.loader 还在维护吗?

最新版本 2.2.0 发布于 2022/10/22(4 年前);至今共发布 9 个版本,其中过去 12 个月发布了 0 个;首次发布于 2022/09/22。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。