index.test.js 645 B

12345678910111213141516171819
  1. const pug = require('../../');
  2. // regression test for #2404
  3. test('extends not top level should throw an error', () => {
  4. expect(
  5. () => pug.compileFile(
  6. __dirname + '/index.pug'
  7. )
  8. ).toThrow('Declaration of template inheritance ("extends") should be the first thing in the file. There can only be one extends statement per file.');
  9. });
  10. test('duplicate extends should throw an error', () => {
  11. expect(
  12. () => pug.compileFile(
  13. __dirname + '/duplicate.pug'
  14. )
  15. ).toThrow('Declaration of template inheritance ("extends") should be the first thing in the file. There can only be one extends statement per file.');
  16. });