mocha-pug-lint

raw JSON →
1.1.0 verified Fri May 01 auth: no javascript maintenance

Allows developers to run pug-lint as Mocha tests. This package integrates pug-lint (a linter for Pug/Jade templates) with the Mocha test framework, enabling linting as part of the test suite. Current stable version is 1.1.0. Last release was in 2017, with low maintenance cadence. Key differentiator: simplifies linting by treating it as a test, so failures break the build naturally. Alternatives: separate lint step in build pipeline. Supports Node >=6, uses CJS require.

error Error: Cannot find module 'mocha-pug-lint'
cause Package not installed or missing from node_modules
fix
Run npm install mocha-pug-lint --save-dev
error TypeError: mochaPugLint is not a function
cause Using wrong import syntax (ESM import) on a CJS module
fix
Use const mochaPugLint = require('mocha-pug-lint');
gotcha Must run in Mocha test context outside of a describe/it block
fix Call mochaPugLint() at the top level of your test file, not inside describe or it.
gotcha Glob patterns need to be relative to process.cwd() or absolute
fix Use path.resolve() or paths relative to project root.
deprecated Package uses Node >=6 engine, deprecated in modern Node environments
fix Upgrade Node to current LTS; package may still work but untested.
npm install mocha-pug-lint
yarn add mocha-pug-lint
pnpm add mocha-pug-lint

Shows typical usage: requiring the function, specifying glob patterns for .pug files, and passing pug-lint options.

const mochaPugLint = require('mocha-pug-lint');
const path = require('path');
const globPatterns = ['./test/files/**/*.pug'];
const options = {
  disallowAttributeConcatenation: true
};
mochaPugLint(globPatterns, options);