Socket
Socket
Sign inDemoInstall

isolated

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

isolated - npm Package Compare versions

Comparing version 0.1.2 to 0.2.0

circle.yml

7

Gruntfile.js

@@ -7,3 +7,8 @@ 'use strict';

analyse: {
server: [ '**/*.js', '!node_modules/**/*.js' ]
server: [ '**/*.js', '!node_modules/**/*.js', '!coverage/**/*.js' ],
options: {
server: {
language: 'es5'
}
}
},

@@ -10,0 +15,0 @@ test: {

27

lib/isolated.js

@@ -5,3 +5,3 @@ 'use strict';

var _ = require('underscore'),
var _ = require('lodash'),
async = require('async'),

@@ -17,5 +17,5 @@ fs = require('fs-extra'),

temp.mkdir(null, function (err, directory) {
if (err) {
return callback(err);
temp.mkdir(null, function (errMkdir, directory) {
if (errMkdir) {
return callback(errMkdir);
}

@@ -29,13 +29,16 @@

async.each(files, function (fileWithPath, callback) {
async.each(files, function (fileWithPath, done) {
var fileWithoutPath = path.basename(fileWithPath);
fs.copy(fileWithPath, path.join(directory, fileWithoutPath), function (err) {
if (err) {
return callback(err);
fs.copy(fileWithPath, path.join(directory, fileWithoutPath), {
preserveTimestamps: true
}, function (errCopy) {
if (errCopy) {
return done(errCopy);
}
callback(null);
done(null);
});
}, function (err) {
if (err) {
return callback(err);
}, function (errEach) {
if (errEach) {
return callback(errEach);
}

@@ -42,0 +45,0 @@ callback(null, directory);

{
"name": "isolated",
"version": "0.1.2",
"version": "0.2.0",
"description": "isolated provides one-time folders for unit tests.",

@@ -13,11 +13,11 @@ "contributors": [

"dependencies": {
"async": "0.9.0",
"fs-extra": "0.9.1",
"temp": "0.8.0",
"underscore": "1.6.0"
"async": "1.3.0",
"fs-extra": "0.21.0",
"lodash": "3.10.0",
"temp": "0.8.3"
},
"devDependencies": {
"assertthat": "0.6.0",
"grunt": "0.4.5",
"node-assertthat": "0.2.0",
"tourism": "0.1.0"
"tourism": "0.20.1"
},

@@ -28,3 +28,8 @@ "repository": {

},
"keywords": [
"mocha",
"tdd",
"test"
],
"license": "MIT"
}

@@ -56,3 +56,3 @@ # isolated

The MIT License (MIT)
Copyright (c) 2013-2014 the native web.
Copyright (c) 2013-2015 the native web.

@@ -59,0 +59,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

@@ -6,3 +6,3 @@ 'use strict';

var assert = require('node-assertthat');
var assert = require('assertthat');

@@ -17,8 +17,10 @@ var isolated = require('../lib/isolated');

suite('isolated', function () {
/*eslint-disable handle-callback-err*/
/* eslint-disable handle-callback-err */
test('returns an empty directory.', function (done) {
isolated(function (err, directory) {
isolated(function (errIsolated, directory) {
assert.that(errIsolated).is.null();
fs.readdir(directory, function (err, files) {
assert.that(err, is.null());
assert.that(files.length, is.equalTo(0));
assert.that(err).is.null();
assert.that(files.length).is.equalTo(0);
done();

@@ -30,7 +32,9 @@ });

test('copies the specified file to the isolated directory.', function (done) {
isolated(foo, function (err, directory) {
isolated(foo, function (errIsolated, directory) {
assert.that(errIsolated).is.null();
fs.readdir(directory, function (err, files) {
assert.that(err, is.null());
assert.that(files.length, is.equalTo(1));
assert.that(files[0], is.equalTo('foo.txt'));
assert.that(err).is.null();
assert.that(files.length).is.equalTo(1);
assert.that(files[0]).is.equalTo('foo.txt');
done();

@@ -42,8 +46,10 @@ });

test('copies the specified files to the isolated directory.', function (done) {
isolated([ foo, bar ], function (err, directory) {
isolated([ foo, bar ], function (errIsolated, directory) {
assert.that(errIsolated).is.null();
fs.readdir(directory, function (err, files) {
assert.that(err, is.null());
assert.that(files.length, is.equalTo(2));
assert.that(files.indexOf('foo.txt'), is.not.equalTo(-1));
assert.that(files.indexOf('bar.txt'), is.not.equalTo(-1));
assert.that(err).is.null();
assert.that(files.length).is.equalTo(2);
assert.that(files.indexOf('foo.txt')).is.not.equalTo(-1);
assert.that(files.indexOf('bar.txt')).is.not.equalTo(-1);
done();

@@ -55,7 +61,9 @@ });

test('copies the specified directory to the isolated directory.', function (done) {
isolated(data, function (err, directory) {
isolated(data, function (errIsolated, directory) {
assert.that(errIsolated).is.null();
fs.readdir(directory, function (err, files) {
assert.that(err, is.null());
assert.that(files.length, is.equalTo(1));
assert.that(files[0], is.equalTo('data'));
assert.that(err).is.null();
assert.that(files.length).is.equalTo(1);
assert.that(files[0]).is.equalTo('data');
done();

@@ -65,3 +73,3 @@ });

});
/*eslint-enable handle-callback-err*/
/* eslint-enable handle-callback-err */
});

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