Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repository doesn't seem to work as expected #1

Open
williamjulianvicary opened this issue Jun 29, 2020 · 2 comments
Open

Repository doesn't seem to work as expected #1

williamjulianvicary opened this issue Jun 29, 2020 · 2 comments

Comments

@williamjulianvicary
Copy link

At the moment it seems that Mocha is avoiding the sandboxing in VM2 altogether.

To test, run a code snippet with:

process.exit();

And you'll see it doesn't fail as you would expect it to do, I was also able to require any of the supposedly sandboxed builtins etc as well.

@tansaku
Copy link

tansaku commented Oct 20, 2021

I was at least able to run some tests in a node console in the root of the project checked out locally:

❯ node
Welcome to Node.js v16.3.0.
Type ".help" for more information.
> const { run } = require('../mocha-vm');
undefined
> code =  "describe('tripler', function(){\n  it('triples 2', function(){\n    expect(1).to.eql(1)\n  })\n})"
"describe('tripler', function(){\n" +
  "  it('triples 2', function(){\n" +
  '    expect(1).to.eql(1)\n' +
  '  })\n' +
  '})'
> run(code).then(obj => console.log(obj));


Promise { <pending> }
>   tripler
    ✓ triples 2


  1 passing (5ms)

{
  summary: {
    passed: 1,
    failed: 0,
    tests: 1,
    suites: 1,
    depth: 0,
    duration: '3ms'
  },
  data: [ { depth: 0, suite: 'tripler', tests: [Array], duration: '2ms' } ]
}

@tansaku
Copy link

tansaku commented Oct 20, 2021

but I can't seem to require it into other projects - I wonder what it would take to get it fixed up as an npm module again ...?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants