Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

raz

Package Overview
Dependencies
Maintainers
1
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

raz - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

test/razor.test.views/_viewStart.raz

2

core/errors/ParserError.js

@@ -136,3 +136,3 @@ const htmlEncode = require('js-htmlencode');

<h1>
An error occurred during the compilation of a 'jshtml' page required to process this request.
An error occurred during the compilation of a 'razor-syntax' page required to process this request.
</h1>

@@ -139,0 +139,0 @@ <div class="stack">${stack}</div>

@@ -8,3 +8,3 @@ require('./utils');

'use strict';
const ext = "jshtml", viewStartName = '_viewStart';
const ext = "raz", viewStartName = '_viewStart';
const _eol_ = require('os').EOL;

@@ -11,0 +11,0 @@

{
"name": "raz",
"description": "Razor-like syntax for templating views in Express framework by mixing HTML with JavaScript.",
"version": "0.0.4",
"version": "0.0.5",
"author": {

@@ -6,0 +6,0 @@ "name": "Sergey",

@@ -59,6 +59,6 @@ ////////////////////////////////////////////

describe("Testing 'Razor' module.", () => {
let nonExistView = "_nonExisting.jshtml";
let viewIndex = "index.jshtml";
let viewStart = "_viewStart.jshtml";
//let partial = "_partial.jshtml";
let nonExistView = "_nonExisting.raz";
let viewIndex = "index.raz";
let viewStart = "_viewStart.raz";
//let partial = "_partial.raz";

@@ -142,3 +142,3 @@

let method = Razor.prototype.findPartialSync.name;
let viewName = "partialViewNotFound.jshtml";
let viewName = "partialViewNotFound.raz";
it(`[#2.3 Razor.${method} | ${viewName} ]`, (done) => {

@@ -150,3 +150,3 @@ let viewPath = viewErrorPath(viewName);

expect(err).to.be.an.instanceOf(ParserError);
expect(err.message).to.have.string(`The view "${viewName}" cannot find the partial view "_partial.jshtml".`);
expect(err.message).to.have.string(`The view "${viewName}" cannot find the partial view "_partial.raz".`);
done();

@@ -159,4 +159,4 @@ });

let method = Razor.prototype.findPartialSync.name;
let viewName = "errorReadingView.jshtml";
let errorView = "_partial.jshtml";
let viewName = "errorReadingView.raz";
let errorView = "_partial.raz";
let errCode = "EACCES";

@@ -180,7 +180,7 @@ it(`[#2.3.1 Razor.${method} | ${viewName} ]`, (done) => {

expect(html).to.exist;
expect(html, "[#2.4.1]").to.have.string('<div>/home/partials/_partial.jshtml</div>');
expect(html, "[#2.4.2]").to.have.string('<div>/home/partials/_partial-2.jshtml</div>');
expect(html, "[#2.4.3]").to.have.string('<div>/home/partials/_partial.html.jshtml</div>');
expect(html, "[#2.4.4]").to.have.string('<div>/home/_partial.jshtml</div>');
expect(html, "[#2.4.5]").to.have.string('<div>/home/_partial-2.jshtml</div>');
expect(html, "[#2.4.1]").to.have.string('<div>/home/partials/_partial.raz</div>');
expect(html, "[#2.4.2]").to.have.string('<div>/home/partials/_partial-2.raz</div>');
expect(html, "[#2.4.3]").to.have.string('<div>/home/partials/_partial.html.raz</div>');
expect(html, "[#2.4.4]").to.have.string('<div>/home/_partial.raz</div>');
expect(html, "[#2.4.5]").to.have.string('<div>/home/_partial-2.raz</div>');
done();

@@ -193,3 +193,3 @@ });

let method = Razor.prototype.findPartial.name;
let viewName = "findPartial_partialViewNotFound.jshtml";
let viewName = "findPartial_partialViewNotFound.raz";
let layoutName = "_absentLayout";

@@ -200,3 +200,3 @@ it(`[#2.5 Razor.${method} | ${viewName} ]`, (done) => {

expect(html).not.to.exist;
expectPartialViewNotFound(err, viewName, `${layoutName}.jshtml`, null);
expectPartialViewNotFound(err, viewName, `${layoutName}.raz`, null);
done();

@@ -210,5 +210,5 @@ });

let method = Razor.prototype.findPartial.name;
let viewName = "findPartial_partialViewNotFound.jshtml";
let viewName = "findPartial_partialViewNotFound.raz";
let layoutName = "_absentLayout";
let errorView = `${layoutName}.jshtml`;
let errorView = `${layoutName}.raz`;
let errCode = "EACCES";

@@ -215,0 +215,0 @@ it(`[#2.5.1 Razor.${method} | ${viewName} ]`, (done) => {

@@ -14,5 +14,12 @@ //'use strict';

// ^ In real app you can just write this: +
// app.set('view engine', "jshtml");
// app.set('view engine', "raz");
// instead of those 3 lines above.
function initEngine() {
const ext = "raz";
app.engine(ext, razor.__express);
//expressApp.set('views', './views'); // specify the views directory
app.set('view engine', ext);
}
// Parser call..

@@ -19,0 +26,0 @@ var html = razor.compileSync({

@@ -141,4 +141,4 @@ console.log("STARTED: server.test.js");

expect(h1.length).to.be.equal(1);
expect(h1.text()).to.have.string("An error occurred during the compilation of a 'jshtml' page required to process this request.");
let layouts = $(`:contains(ParserError: The view "invalid.jshtml" cannot find the partial view)`);
expect(h1.text()).to.have.string("An error occurred during the compilation of a 'razor-syntax' page required to process this request.");
let layouts = $(`:contains(ParserError: The view "invalid.raz" cannot find the partial view)`);
expect(layouts, "error message").to.have.lengthOf.above(0);

@@ -145,0 +145,0 @@ console.log(`> testing rote "/invalid"...done`);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc