pixsy/node_modules/pug-load/test/index.test.js

25 lines
641 B
JavaScript
Raw Normal View History

2017-12-22 17:22:08 +00:00
'use strict';
var fs = require('fs');
var path = require('path');
var assert = require('assert');
var walk = require('pug-walk');
var lex = require('pug-lexer');
var parse = require('pug-parser');
var load = require('../');
test('pug-load', () => {
var filename = __dirname + '/foo.pug';
var ast = load.file(filename, {
lex: lex,
parse: parse
});
ast = walk(ast, function (node) {
if (node.filename) node.filename = '<dirname>/' + path.basename(node.filename);
if (node.fullPath) node.fullPath = '<dirname>/' + path.basename(node.fullPath);
}, {includeDependencies: true});
expect(ast).toMatchSnapshot();
});