Registry / testing / wallaby-vue-compiler

wallaby-vue-compiler

JSON →
library1.0.6jsnpmunverified

Wallaby.js compiler for Vue single-file components enabling code coverage display. v1.0.6 stable, low update frequency. Requires vue-template-compiler as peer dep and accepts a separate compiler (e.g., Babel) for script section compilation. Different from other Vue compilers by integrating directly with Wallaby's coverage instrumentation pipeline.

npm install wallaby-vue-compiler
INSTALL
IMPORT
SIG · WALLABY-VUE-COMPIL
W
wallaby-vue-compiler
testingjavascriptv1.0.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
✓ const compiler = require('wallaby-vue-compiler')(wallaby.compilers.babel({}));
✗ import compiler from 'wallaby-vue-compiler';
The module exports a function that must be invoked with a compiler argument immediately. ESM import will not work due to its CommonJS nature.
default (module.exports)
✓ const wallabyVueCompiler = require('wallaby-vue-compiler');
✗ const { wallabyVueCompiler } = require('wallaby-vue-compiler');
No named exports exist; destructuring will result in undefined.
default (ESM attempt)
✓ import wallabyVueCompiler from 'wallaby-vue-compiler';
The package is CommonJS only. ESM import may fail in some environments; use require() or dynamic import.

Configures Wallaby.js to compile .vue files with the Vue compiler, using Babel for script sections.

// wallaby.js module.exports = function (wallaby) { return { files: ['src/**/*.vue', 'src/**/*.js'], tests: ['test/**/*.spec.js'], compilers: { '**/*.js': wallaby.compilers.babel({}), '**/*.vue': require('wallaby-vue-compiler')(wallaby.compilers.babel({})) }, env: { type: 'node' } }; };
Debug
Known issues
deprecatedPackage relies on vue-template-compiler which is deprecated since Vue 2.7.
fix
Consider using @vue/compiler-sfc for Vue 3 or Vue 2.7+ projects.
affects: >=1.0.0
gotchaThe compiler must be invoked immediately with a script compiler argument; forgetting this will cause a runtime error.
fix
Always call require('wallaby-vue-compiler')(scriptCompiler) in the compilers config.
affects: >=1.0.0
gotchaThe module exports a function, not a class or object; using it as a normal compiler will fail.
fix
Invoke the default export as a factory: const vueCompiler = require('wallaby-vue-compiler')(wallaby.compilers.babel({}));
affects: >=1.0.0
gotchaOnly works with Vue 2 due to vue-template-compiler peer dependency.
fix
For Vue 3 projects, use a different coverage tool or Wallaby's native Vue 3 support.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'vue-template-compiler'
Missing peer dependency vue-template-compiler.
fix
Run npm install vue-template-compiler@^2.6.10 --save-dev
TypeError: wallabyVueCompiler is not a function
Importing the module but forgetting to call it as a function with a compiler argument.
fix
Use require('wallaby-vue-compiler')(wallaby.compilers.babel({})) instead of just require('wallaby-vue-compiler')
Error: Compiler is not set or is not a valid Wallaby compiler
The argument passed to the factory is not a valid Wallaby compiler object.
fix
Pass wallaby.compilers.something({}) as the first argument.
Upgrade
Version history
1.0.6latest on npm
Audit
Dependencies
vue-template-compilerrequiredCompiles Vue template strings from .vue files; required as peer dependency.
Agent activity
17 hits · last 30 days
node
16
Resources
wallaby-vue-compiler — npm install wallaby-vue-compiler · libregistry