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

node-sass-middleware

Package Overview
Dependencies
Maintainers
4
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-sass-middleware - npm Package Compare versions

Comparing version 0.11.0 to 1.0.0

.eslintrc.json

67

middleware.js

@@ -1,2 +0,2 @@

"use strict";
'use strict';

@@ -8,3 +8,2 @@ var sass = require('node-sass'),

dirname = require('path').dirname,
mkdirp = require('mkdirp'),
join = require('path').join;

@@ -19,17 +18,21 @@

*
* all supportend options from node-sass project plus following:
* all supported options from node-sass project plus following:
*
* `src` Source directory used to find .scss files
* `dest` Destination directory used to output .css files when undefined defaults to `src`
* `root` A base path for both source and destination directories
* `prefix` It will tell the sass compiler that any request file will always be prefixed
* with <prefix> and this prefix should be ignored.
* `force` Always re-compile
* `debug` Output debugging information
* `response` True (default) to write output directly to response instead of to a file
* `error` A function to be called when something goes wrong
* `maxAge` MaxAge to be passed in Cache-Control header
* `log` function(severity, key, val), used to log data instead of the default `console.error`
* `src` - (String) Source directory used to find `.scss` or `.sass` files.
*
* optional configurations:
*
* `beepOnError` - Enable beep on error, false by default.
* `debug` - `[true | false]`, false by default. Output debugging information.
* `dest` - (String) Destination directory used to output `.css` files (when undefined defaults to `src`).
* `error` - A function to be called when something goes wrong.
* `force` - `[true | false]`, false by default. Always re-compile.
* `indentedSyntax` - `[true | false]`, false by default. Compiles files with the `.sass` extension instead of `.scss` in the `src` directory.
* `log` - `function(severity, key, val)`, used to log data instead of the default `console.error`
* `maxAge` - MaxAge to be passed in Cache-Control header.
* `prefix` - (String) It will tell the sass middleware that any request file will always be prefixed with `<prefix>` and this prefix should be ignored.
* `response` - `[true | false]`, true by default. To write output directly to response instead of to a file.
* `root` - (String) A base path for both source and destination directories.
*
*
* Examples:

@@ -62,3 +65,3 @@ *

// Accept single src/dest dir
if (typeof options == 'string') {
if (typeof options === 'string') {
options = { src: options };

@@ -68,5 +71,5 @@ }

// Source directory (required)
var src = options.src || function() {
var src = options.src || (function() {
throw new Error('sass.middleware() requires "src" directory.');
}();
}());
// Destination directory (source by default)

@@ -81,2 +84,4 @@ var dest = options.dest || src;

var debug = options.debug;
// Enable beep on error
var beep = options.beepOnError || false;

@@ -97,6 +102,6 @@ var sassExtension = (options.indentedSyntax === true) ? '.sass' : '.scss';

if (typeof (console[severity]) === 'function') {
console[severity]('[sass] \x1B[90m%s:\x1B[0m \x1B[36m%s %s\x1B[0m', key, val, text);
if (severity === 'error') {
console.error('[sass] \x1B[90m%s:\x1B[0m \x1B[36m%s %s\x1B[0m', key, val, text);
} else {
console.error('[sass] \x1B[90m%s:\x1B[0m \x1B[36m%s %s\x1B[0m', key, val, text);
console.log('[sass] \x1B[90m%s:\x1B[0m \x1B[36m%s %s\x1B[0m', key, val, text);
}

@@ -125,3 +130,3 @@ };

if (req.method != 'GET' && req.method != 'HEAD') {
if (req.method !== 'GET' && req.method !== 'HEAD') {
return next();

@@ -138,3 +143,3 @@ }

if (options.prefix) {
if (0 === path.indexOf(options.prefix)) {
if (path.indexOf(options.prefix) === 0) {
path = path.substring(options.prefix.length);

@@ -154,4 +159,4 @@ } else {

sassPath = join(root, src, path
.replace(new RegExp('^' + dest), '')
.replace(/\.css$/, sassExtension));
.replace(new RegExp('^' + dest), '')
.replace(/\.css$/, sassExtension));
sassDir = dirname(sassPath);

@@ -167,3 +172,3 @@ }

var file = sassPath;
if (err.file && err.file != 'stdin') {
if (err.file && err.file !== 'stdin') {
file = err.file;

@@ -173,3 +178,3 @@ }

var fileLineColumn = file + ':' + err.line + ':' + err.column;
var errorMessage = '\x07\x1B[31m' + err.message.replace(/^ +/, '') + '\n\nin ' + fileLineColumn + '\x1B[91m';
var errorMessage = (beep ? '\x07' : '') + '\x1B[31m' + err.message.replace(/^ +/, '') + '\n\nin ' + fileLineColumn + '\x1B[91m';

@@ -216,3 +221,3 @@ error(err, errorMessage);

mkdirp(dirname(cssPath), '0700', function(err) {
fs.mkdir(dirname(cssPath), { mode: '0700', recursive: true}, function(err) {
if (err) {

@@ -238,3 +243,3 @@ error(err);

var sourceMapPath = this.options.sourceMap;
mkdirp(dirname(sourceMapPath), '0700', function(err) {
fs.mkdir(dirname(sourceMapPath), { mode: '0700', recursive: true}, function(err) {
if (err) {

@@ -258,3 +263,3 @@ error(err);

}
}
};

@@ -305,3 +310,3 @@ // Compile to cssPath

if (err) {
if ('ENOENT' === err.code) { // CSS has not been compiled, compile it!
if (err.code === 'ENOENT') { // CSS has not been compiled, compile it!
log('debug', 'compile', cssPath, 'was not found');

@@ -331,3 +336,3 @@ return compile();

});
}
};
};

@@ -334,0 +339,0 @@

@@ -5,5 +5,6 @@ {

"description": "Connect middleware for node-sass",
"version": "0.11.0",
"version": "1.0.0",
"scripts": {
"test": "./node_modules/.bin/mocha"
"lint": "eslint .",
"test": "mocha"
},

@@ -31,15 +32,15 @@ "homepage": "https://github.com/sass/node-sass-middleware",

"engines": {
"node": ">=0.10.0"
"node": ">=12.0.0"
},
"dependencies": {
"mkdirp": "^0.5.1",
"node-sass": "^4.3.0"
"node-sass": "^7.0.1"
},
"devDependencies": {
"connect": "^3.5.0",
"express": "^4.14.0",
"mocha": "^3.2.0",
"should": "^11.1.2",
"supertest": "^2.0.1"
"connect": "^3.7.0",
"eslint": "^7.32.0",
"express": "^4.17.1",
"mocha": "^7.2.0",
"should": "^13.2.3",
"supertest": "^6.1.6"
}
}

@@ -1,2 +0,2 @@

#node-sass-middleware
# node-sass-middleware

@@ -22,5 +22,5 @@ Connect/Express middleware for [node-sass](https://github.com/sass/node-sass).

```javascript
var connect = require('connect')
var sassMiddleware = require('node-sass-middleware')
var server = connect.createServer(
const connect = require('connect')
const sassMiddleware = require('node-sass-middleware')
const server = connect.createServer(
sassMiddleware({

@@ -45,6 +45,6 @@ /* Options */

```javascript
var express = require('express');
var sassMiddleware = require('node-sass-middleware');
var path = require('path');
var app = express();
const express = require('express');
const sassMiddleware = require('node-sass-middleware');
const path = require('path');
const app = express();
app.use(sassMiddleware({

@@ -66,10 +66,10 @@ /* Options */

```javascript
var connect = require('connect');
var sassMiddleware = require('node-sass-middleware');
var postcssMiddleware = require('postcss-middleware');
var autoprefixer = require('autoprefixer');
var path = require('path');
var http = require('http');
var app = connect();
var destPath = __dirname + '/public';
const connect = require('connect');
const sassMiddleware = require('node-sass-middleware');
const postcssMiddleware = require('postcss-middleware');
const autoprefixer = require('autoprefixer');
const path = require('path');
const http = require('http');
const app = connect();
const destPath = __dirname + '/public';
app.use(sassMiddleware({

@@ -100,25 +100,28 @@ /* Options */

* `src` - (String) Source directory used to find `.scss` or `.sass` files.
* optional configurations:
* `dest` - (String) Destination directory used to output `.css` files (when undefined defaults to `src`).
* `root` - (String) A base path for both source and destination directories.
* `prefix` - (String) It will tell the sass middleware that any request file will always be prefixed with `<prefix>` and this prefix should be ignored.
* `force` - `[true | false]`, false by default. Always re-compile.
* `debug` - `[true | false]`, false by default. Output debugging information.
* `indentedSyntax` - `[true | false]`, false by default. Compiles files with the `.sass` extension instead of `.scss` in the `src` directory.
* `response` - `[true | false]`, true by default. To write output directly to response instead of to a file.
* `error` - A function to be called when something goes wrong.
* `maxAge` - MaxAge to be passed in Cache-Control header.
* `log` - `function(severity, key, val)`, used to log data instead of the default `console.error`
#### Optional configurations:
* `beepOnError` - Enable beep on error, false by default.
* `debug` - `[true | false]`, false by default. Output debugging information.
* `dest` - (String) Destination directory used to output `.css` files (when undefined defaults to `src`).
* `error` - A function to be called when something goes wrong.
* `force` - `[true | false]`, false by default. Always re-compile.
* `indentedSyntax` - `[true | false]`, false by default. If true compiles files with the `.sass` extension instead of `.scss` in the `src` directory.
* `log` - `function(severity, key, val, message)`, used to log data instead of the default `console.error`. "severity" matches [Winston](https://www.npmjs.com/package/winston) severity levels.
* `maxAge` - MaxAge to be passed in Cache-Control header.
* `prefix` - (String) It will tell the sass middleware that any request file will always be prefixed with `<prefix>` and this prefix should be ignored.
* `response` - `[true | false]`, true by default. To write output directly to response instead of to a file.
* `root` - (String) A base path for both source and destination directories.
For full list of options from original node-sass project go [here](https://github.com/sass/node-sass).
### Express example with custom log function
```javascript
var express = require('express');
var sassMiddleware = require('node-sass-middleware');
var path = require('path');
var winston = require('winston');
var app = express();
const express = require('express');
const sassMiddleware = require('node-sass-middleware');
const path = require('path');
const winston = require('winston');
const app = express();
winston.level = 'debug';

@@ -130,3 +133,3 @@ app.use(sassMiddleware({

debug: true,
log: function (severity, key, value) { winston.log(severity, 'node-saas-middleware %s : %s', key, value); }
log: function (severity, key, value) { winston.log(severity, 'node-sass-middleware %s : %s', key, value); }
}));

@@ -133,0 +136,0 @@ // Note: you must place sass-middleware *before* `express.static` or else it will

@@ -0,6 +1,6 @@

/*global describe it*/
'use strict';
var fs = require('fs'),
path = require('path'),
should = require('should'),
sass = require('node-sass'),
request = require('supertest'),

@@ -10,9 +10,5 @@ connect = require('connect'),

fixture = path.join.bind(null, __dirname, 'fixtures'),
test_cssFile = fixture('test.css'),
test_sassFile = fixture('test.sass'),
test_scssFile = fixture('test.scss'),
index_cssFile = fixture('index.css'),
index_sassFile = fixture('index.sass'),
index_scssFile = fixture('index.scss'),
index_sourceMap = fixture('index.css.map'),
testCssFile = fixture('test.css'),
indexCssFile = fixture('index.css'),
indexScssFile = fixture('index.scss'),
spawn = require('child_process').spawn,

@@ -22,3 +18,2 @@ http = require('http');

describe('Creating middleware', function() {
it('throws an error when omitting src', function() {

@@ -35,3 +30,2 @@ middleware.should.throw(/requires "src"/);

});
});

@@ -41,6 +35,6 @@

describe('Spawning example server', function() {
describe('Spawning test server', function() {
it('starts the server', function(done) {
var serverStartupTimeout = 950;
spawnedServer = spawn('node', [fixture('example-server.js')]);
spawnedServer = spawn('node', [fixture('test-server.js')]);

@@ -61,8 +55,8 @@ // exclude serverStartupTimeout from timeout and slow counters of test runs

it('should use the default logger when none provided', function(done) {
var expected = '[sass] \u001b[90msource:\u001b[0m \u001b[36m' + index_scssFile + ' \u001b[0m';
var expected = '[sass] \u001b[90msource:\u001b[0m \u001b[36m' + indexScssFile + ' \u001b[0m';
http.request({ method: 'GET', host: 'localhost', port: process.env.PORT || '8000', path: '/index.css' })
.end();
.end();
spawnedServer.stderr.once('data', function(data) {
spawnedServer.stdout.once('data', function(data) {
data.toString().should.startWith(expected);

@@ -89,3 +83,3 @@ done();

.expect(200, function() {
fs.unlink(index_cssFile);
fs.unlinkSync(indexCssFile);
loggerArguments[0].should.equal('debug');

@@ -150,474 +144,28 @@ done();

});
it('should produce beep ', function(done) {
this.timeout(this.timeout() + 55500);
// setup
var testScssFile = fixture('test2.scss');
var content = fs.readFileSync(fixture('test.scss')) + '\nbody { background;: red; }';
fs.writeFileSync(testScssFile, content, { flag: 'w' });
function setupBeforeEach() {
beforeEach(function(done) {
fs.exists(test_cssFile, function(exists) {
if (exists) {
fs.unlink(test_cssFile);
}
});
var expectedKey = '\x07\x1B';
fs.exists(index_cssFile, function(exists) {
if (exists) {
fs.unlink(index_cssFile);
}
});
http.request({ method: 'GET', host: 'localhost', port: process.env.PORT || '8000', path: '/test2.css' })
.end();
fs.exists(index_sourceMap, function(exists) {
if (exists) {
fs.unlink(index_sourceMap);
spawnedServer.stderr.on('data', function(data) {
// skip until we get the error
if (data.indexOf('[sass] \x1B[90merror:') !== 0) {
return;
}
});
done();
});
}
data.toString().should.containEql(expectedKey);
describe('Using middleware to compile .scss', function() {
var server = connect()
.use(middleware({
src: fixture(),
dest: fixture()
}))
.use(function(err, req, res, next) {
res.statusCode = 500;
res.end(err.message);
fs.unlinkSync(testScssFile);
done();
});
setupBeforeEach();
describe('successful file request', function() {
it('serves a file with 200 Content-Type css', function(done) {
request(server)
.get('/test.css')
.set('Accept', 'text/css')
.expect('Content-Type', /css/)
.expect(200, done);
});
it('serves the compiled contents of the relative scss file', function(done) {
var filesrc = fs.readFileSync(test_scssFile),
result = sass.renderSync({ data: filesrc.toString() });
request(server)
.get('/test.css')
.expect(result.css.toString())
.expect(200, done);
});
it('writes the compiled contents out to the expected file', function(done) {
var filesrc = fs.readFileSync(test_scssFile),
result = sass.renderSync({ data: filesrc.toString() });
request(server)
.get('/test.css')
.expect(result.css.toString())
.expect(200, function(err) {
if (err) {
done(err);
} else {
if (fs.existsSync(test_cssFile)) {
fs.readFileSync(test_cssFile).toString().should.equal(result.css.toString());
done();
} else {
done(new Error('file was not written before request ends'));
}
}
});
});
it('only writes the compiled contents out to the expected file without serving them', function(done) {
var filesrc = fs.readFileSync(test_scssFile),
result = sass.renderSync({ data: filesrc.toString() }),
anotherResponse = 'something else',
server = connect()
.use(middleware({
response: false,
src: fixture(),
dest: fixture()
}));
server.use(function(req, res) {
res.end(anotherResponse);
});
request(server)
.get('/test.css')
.expect(anotherResponse)
.expect(200, function(err) {
if (err) {
done(err);
} else {
fs.readFileSync(test_cssFile).toString().should.equal(result.css.toString());
done();
}
});
});
});
describe('unsucessful file request', function() {
it('moves to next middleware', function(done) {
request(server)
.get('/does-not-exist.css')
.expect('Cannot GET /does-not-exist.css\n')
.expect(404, done);
});
});
describe('compiling files with dependencies (source file contains includes)', function() {
it('serves the compiled contents of the relative scss file', function(done) {
var filesrc = fs.readFileSync(index_scssFile),
result = sass.renderSync({ data: filesrc.toString() });
request(server)
.get('/index.css')
.expect(result.css.toString())
.expect(200, done);
});
it('writes the compiled contents out to the expected file', function(done) {
var filesrc = fs.readFileSync(index_scssFile),
result = sass.renderSync({ data: filesrc.toString() });
request(server)
.get('/index.css')
.expect(result.css.toString())
.expect(200, function(err) {
if (err) {
done(err);
} else {
(function checkFile() {
if (fs.existsSync(index_cssFile)) {
fs.readFileSync(index_cssFile).toString().should.equal(result.css.toString());
done();
} else {
setTimeout(checkFile, 25);
}
}());
}
});
});
it('any change in a dependent file, force recompiling', function(done) {
request(server)
.get('/index.css')
.expect(200, function() {
(function checkInitialFile() {
fs.stat(index_cssFile, function(err, initialDate) {
if (initialDate != undefined) {
fs.appendFile(test_scssFile, '\nbody { background: red; }', function(err, data) {
if (err) throw err;
var filesrc = fs.readFileSync(index_scssFile),
result = sass.renderSync({ data: filesrc.toString() });
request(server)
.get('/index.css')
.expect(200, function() {
(function checkRecompiledFile() {
var cont = fs.readFileSync(index_cssFile).toString();
if (cont === result.css.toString()) {
done();
} else {
setTimeout(checkRecompiledFile, 10);
}
}());
});
});
} else {
setTimeout(checkInitialFile, 10);
}
});
}());
});
// clean
after(function() {
var reset = fs.readFileSync(test_scssFile).toString().replace('\nbody { background: red; }', '');
fs.writeFileSync(test_scssFile, reset, { flag: 'w' });
});
});
});
describe('generating source-map for compiled css', function() {
var server = connect()
.use(middleware({
src: fixture(),
dest: fixture(),
sourceMap: true
}))
.use(function(err, req, res, next) {
res.statusCode = 500;
res.end(err.message);
});
it('generates source-map with correct contents', function(done) {
request(server)
.get('/index.css')
.expect(200, function() {
var filesrc = fs.readFileSync(index_scssFile),
result = sass.renderSync({ file: index_scssFile, outFile: index_cssFile, sourceMap: true });
(function checkFile() {
fs.exists(index_sourceMap, function(exists) {
if (exists) {
var cont = fs.readFileSync(index_sourceMap).toString();
if (cont === result.map.toString()) {
done();
}
} else {
setTimeout(checkFile, 10);
}
});
}());
});
});
});
describe('compiling files with errors moves to next middleware with err', function() {
// alter
before(function() {
fs.appendFileSync(test_scssFile, '\nbody { background;: red; }');
});
it('if error is in the main file', function(done) {
request(server)
.get('/test.css')
.expect('property "background" must be followed by a \':\'')
.expect(500, done);
});
it('if error is in imported file', function(done) {
request(server)
.get('/index.css')
.expect('property "background" must be followed by a \':\'')
.expect(500, done);
});
// clean
after(function() {
var reset = fs.readFileSync(test_scssFile).toString().replace('\nbody { background;: red; }', '');
fs.writeFileSync(test_scssFile, reset, { flag: 'w' });
});
});
});
describe('Using middleware to compile .sass', function() {
var server = connect()
.use(middleware({
src: fixture(),
dest: fixture(),
indentedSyntax: true
}))
.use(function(err, req, res, next) {
res.statusCode = 500;
res.end(err.message);
});
setupBeforeEach();
describe('successful file request', function() {
it('serves a file with 200 Content-Type css', function(done) {
request(server)
.get('/test.css')
.set('Accept', 'text/css')
.expect('Content-Type', /css/)
.expect(200, done);
});
it('serves the compiled contents of the relative sass file', function(done) {
var filesrc = fs.readFileSync(test_sassFile),
result = sass.renderSync({ data: filesrc.toString(), indentedSyntax: true });
request(server)
.get('/test.css')
.expect(result.css.toString())
.expect(200, done);
});
it('writes the compiled contents out to the expected file', function(done) {
var filesrc = fs.readFileSync(test_sassFile),
result = sass.renderSync({ data: filesrc.toString(), indentedSyntax: true });
request(server)
.get('/test.css')
.expect(result.css.toString())
.expect(200, function(err) {
if (err) {
done(err);
} else {
(function checkFile() {
if (fs.existsSync(test_cssFile)) {
fs.readFileSync(test_cssFile).toString().should.equal(result.css.toString());
done();
} else {
setTimeout(checkFile, 25);
}
}());
}
});
});
});
describe('unsucessful file request', function() {
it('moves to next middleware', function(done) {
request(server)
.get('/does-not-exist.css')
.expect('Cannot GET /does-not-exist.css\n')
.expect(404, done);
});
});
describe('compiling files with dependencies (source file contains includes)', function() {
it('serves the compiled contents of the relative sass file', function(done) {
var filesrc = fs.readFileSync(index_sassFile),
result = sass.renderSync({ data: filesrc.toString(), indentedSyntax: true });
request(server)
.get('/index.css')
.expect(result.css.toString())
.expect(200, done);
});
it('writes the compiled contents out to the expected file', function(done) {
var filesrc = fs.readFileSync(index_sassFile),
result = sass.renderSync({ data: filesrc.toString(), indentedSyntax: true });
request(server)
.get('/index.css')
.expect(result.css.toString())
.expect(200, function(err) {
if (err) {
done(err);
} else {
(function checkFile() {
if (fs.existsSync(index_cssFile)) {
fs.readFileSync(index_cssFile).toString().should.equal(result.css.toString());
done();
} else {
setTimeout(checkFile, 25);
}
}());
}
});
});
it('any change in a dependent file, force recompiling', function(done) {
request(server)
.get('/index.css')
.expect(200, function() {
(function checkInitialFile() {
fs.stat(index_cssFile, function(err, initialDate) {
if (initialDate != undefined) {
fs.appendFile(test_sassFile, '\nbody\n\tbackground: red', function(err, data) {
if (err) throw err;
var filesrc = fs.readFileSync(index_sassFile),
result = sass.renderSync({ data: filesrc.toString(), indentedSyntax: true });
request(server)
.get('/index.css')
.expect(200, function() {
(function checkRecompiledFile() {
var cont = fs.readFileSync(index_cssFile).toString();
if (cont === result.css.toString()) {
done();
} else {
setTimeout(checkRecompiledFile, 10);
}
}());
});
});
} else {
setTimeout(checkInitialFile, 10);
}
});
}());
});
// clean
after(function() {
var reset = fs.readFileSync(test_sassFile).toString().replace('\nbody\n\tbackground: red', '');
fs.writeFileSync(test_sassFile, reset, { flag: 'w' });
});
});
});
describe('generating source-map for compiled css', function() {
var server = connect()
.use(middleware({
src: fixture(),
dest: fixture(),
indentedSyntax: true,
sourceMap: true
}))
.use(function(err, req, res, next) {
res.statusCode = 500;
res.end(err.message);
});
it('generates source-map with correct contents', function(done) {
request(server)
.get('/index.css')
.expect(200, function() {
var filesrc = fs.readFileSync(index_scssFile),
result = sass.renderSync({ file: index_sassFile, indentedSyntax: true, outFile: index_cssFile, sourceMap: true });
(function checkFile() {
fs.exists(index_sourceMap, function(exists) {
if (exists) {
var cont = fs.readFileSync(index_sourceMap).toString();
if (cont === result.map.toString()) {
return done();
}
}
setTimeout(checkFile, 10);
});
}());
});
});
});
describe('compiling files with errors moves to next middleware with err', function() {
// alter
before(function() {
fs.appendFileSync(test_sassFile, '\nbody\n\tbackground;: red');
});
it('if error is in the main file', function(done) {
request(server)
.get('/test.css')
.expect('property "background" must be followed by a \':\'')
.expect(500, done);
});
it('if error is in imported file', function(done) {
request(server)
.get('/index.css')
.expect('property "background" must be followed by a \':\'')
.expect(500, done);
});
// clean
after(function() {
var reset = fs.readFileSync(test_sassFile).toString().replace('\nbody\n\tbackground;: red', '');
fs.writeFileSync(test_sassFile, reset, { flag: 'w' });
});
});
});
describe('Checking for http headers', function() {

@@ -631,3 +179,3 @@ var oneDay = 60 * 60 * 24; // one day

}))
.use(function(err, req, res, next) {
.use(function(err, req, res) {
res.statusCode = 500;

@@ -639,19 +187,18 @@ res.end(err.message);

request(server)
.get('/test.css')
.set('Accept', 'text/css')
.expect('Cache-Control', 'max-age=' + oneDay)
.expect(200, function() {
// delete file
fs.exists(test_cssFile, function(exists) {
if (exists) {
fs.unlink(test_cssFile);
}
.get('/test.css')
.set('Accept', 'text/css')
.expect('Cache-Control', 'max-age=' + oneDay)
.expect(200, function() {
// delete file
fs.exists(testCssFile, function(exists) {
if (exists) {
fs.unlinkSync(testCssFile);
}
});
done();
});
done();
});
});
});
describe('Killing example server', function() {
describe('Killing test server', function() {
it('stops the server', function(done) {

@@ -658,0 +205,0 @@ spawnedServer.kill();

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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