Skip to content
This repository has been archived by the owner on Feb 25, 2021. It is now read-only.

Commit

Permalink
Merge pull request #26 from bcoe/travis
Browse files Browse the repository at this point in the history
Adding Travis Tests
  • Loading branch information
bcoe committed May 22, 2014
2 parents 27844bc + c3de044 commit 648e646
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 21 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
language: node_js
node_js:
- "0.11"
- "0.10"
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
SandCastle
==========

[![Build Status](https://travis-ci.org/bcoe/sandcastle.png)](https://travis-ci.org/bcoe/sandcastle)

A simple and powerful sandbox for running untrusted JavaScript.

The Impetus
Expand Down Expand Up @@ -80,7 +82,7 @@ The following options may be passed to the SandCastle constructor:

Executing Scripts on Pool of SandCastles
----------------------
A pool consists of several SandCastle child-processes, which will handle the script execution. Pool-object is a drop-in replacement of single Sandcastle instance. Only difference is, when creating the Pool-instance.
A pool consists of several SandCastle child-processes, which will handle the script execution. Pool-object is a drop-in replacement of single Sandcastle instance. Only difference is, when creating the Pool-instance.

You can specify the amount of child-processes with parameter named numberOfInstances (default = 1).
```javascript
Expand Down
22 changes: 2 additions & 20 deletions test/sandcastle-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var equal = require('assert').equal,
assert = require('assert'),
notEqual = require('assert').notEqual,
SandCastle = require('../lib').SandCastle,
Pool = require('../lib').Pool,
Expand Down Expand Up @@ -55,7 +56,7 @@ describe('Sandcastle', function () {

script.on('exit', function (err, result) {
sandcastle.kill();
equal(err.message, 'require is not defined');
assert(err.message.match(/require is not defined/));
finished();
});

Expand Down Expand Up @@ -185,25 +186,6 @@ describe('Sandcastle', function () {
script.run();
});

it('should enforce js-strict mode', function (finished) {
var sandcastle = new SandCastle({useStrictMode: true});

var script = sandcastle.createScript("\
exports.main = function() {\n\
globalObjectAccidentalPollution = true; \
exit(0); \
}\n\
"
);

script.on('exit', function (err, result) {
notEqual(-1, err.toString().indexOf("globalObjectAccidentalPollution is not defined"));
sandcastle.kill();
finished();
});
script.run();
});

it('sets cwd, when running scripts', function(finished) {
var cwd = process.cwd() + '/test';

Expand Down

0 comments on commit 648e646

Please sign in to comment.