{"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,"search_vec":"'0.2.0':28 'api':68,76 'ary.indexof':35 'assert':5,13,16,22,31,34,62,75,80,81,82 'compat':71 'configur':54 'current':24 'descript':15 'detail':39 'differenti':65 'e.g':33 'express':32 'includ':66 'interfac':23 'intermedi':43 'javascript':77 'key':64 'label':40 'librari':46 'messag':17 'minim':53 'monorepo':63 'node.js':21 'output':41 'overhead':69 'part':57 'plugin':3,9,87,90 'power':4,12,61,79 'power-assert':11,60,78 'provid':14 'rollup':2,6,49,86 'rollup-plugin':85 'rollup-plugin-power-assert':1 'show':42 'stabl':25 'standard':20 'support':47 'test':83,84 'transform':30 'two':37 'valu':44 'version':26 'vite':8,89 'vite-plugin':88 'vite/vitest':51 'vitest':73 'zero':36,67","created_at":"2026-04-27T17:03:46.991961+00:00","updated_at":"2026-04-27T17:03:46.991961+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/twada/power-assert-monorepo","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/rollup-plugin-power-assert","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-18","next_check":"2026-07-26","install_tag":null}}