{"id":22174,"library":"rollup-plugin-power-assert","title":"rollup-plugin-power-assert","description":"Rollup and Vite plugin for power-assert, providing descriptive assertion messages through the standard Node.js assert interface. Current stable version is 0.2.0. It transforms assertion expressions (e.g., assert(ary.indexOf(zero) === two)) into detailed, labeled output showing intermediate values. The library supports both Rollup and Vite/Vitest with minimal configuration, and is part of the power-assert monorepo. Key differentiators include zero API overhead and compatibility with Vitest's assert API.","status":"active","version":"0.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/twada/power-assert-monorepo","tags":["javascript","power-assert","assert","assertion","test","testing","rollup-plugin","vite-plugin"],"install":[{"cmd":"npm install rollup-plugin-power-assert","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-power-assert","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-power-assert","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"required peer dependency for runtime assertion enhancement","package":"@power-assert/runtime","optional":false}],"imports":[{"note":"Must use named import; default import is not available.","wrong":"import powerAssert from 'rollup-plugin-power-assert'","symbol":"powerAssert","correct":"import { powerAssert } from 'rollup-plugin-power-assert'"},{"note":"CommonJS requires destructuring; the module exports an object with named exports.","wrong":"const powerAssert = require('rollup-plugin-power-assert')","symbol":"powerAssert (CommonJS)","correct":"const { powerAssert } = require('rollup-plugin-power-assert')"},{"note":"TypeScript types are included; use named type import for configuration options.","wrong":"","symbol":"type definition","correct":"import type { PowerAssertOptions } from 'rollup-plugin-power-assert'"}],"quickstart":{"code":"import { defineConfig } from 'vite';\nimport { powerAssert } from 'rollup-plugin-power-assert';\n\nconst testPattern = 'examples/**/__tests__/**/*.test.mts';\n\nexport default defineConfig({\n  plugins: [\n    powerAssert({\n      include: testPattern,\n    }),\n  ],\n  test: {\n    include: testPattern,\n  },\n});","lang":"typescript","description":"Configure Vite/Vitest with the powerAssert plugin to enable descriptive assertion messages in test files."},"warnings":[{"fix":"Use Node.js assert module or Vitest's assert API. For other libraries, consider alternative power-assert wrappers.","message":"The plugin transforms assert() calls only; it does not transform other assertion libraries like chai or expect.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Install the peer dependency: npm install --save-dev @power-assert/runtime","message":"The plugin requires the @power-assert/runtime package as a peer dependency. Failing to install it can result in runtime errors.","severity":"gotcha","affected_versions":">=0.2.0"},{"fix":"Monitor the repository for deprecation notices and plan migration to alternative assertion enhancement tools.","message":"The plugin may be deprecated in future versions of power-assert monorepo; check for migration notes.","severity":"deprecated","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"npm install --save-dev @power-assert/runtime","cause":"Missing peer dependency @power-assert/runtime","error":"Cannot find module '@power-assert/runtime'"},{"fix":"Change to: import { powerAssert } from 'rollup-plugin-power-assert'","cause":"Using default import instead of named import","error":"TypeError: (0 , _rollupPluginPowerAssert.powerAssert) is not a function"},{"fix":"Ensure the file path matches the include glob pattern in the plugin options.","cause":"The file is not included in the plugin's include pattern","error":"AssertionError: assert(...) expression not transformed"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}