Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
XmiliaH committed Apr 11, 2023
1 parent e5cfcdc commit 7b4eeab
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion test/nodevm.js
Expand Up @@ -7,7 +7,7 @@ const fs = require('fs');
const path = require('path');
const assert = require('assert');
const {EventEmitter} = require('events');
const {NodeVM, VMScript} = require('..');
const {NodeVM, VMScript, makeResolverFromLegacyOptions} = require('..');
// const NODE_VERSION = parseInt(process.versions.node.split('.')[0]);

global.isHost = true;
Expand Down Expand Up @@ -601,6 +601,19 @@ function getStack(error) {
});
});

describe('resolver', () => {
it('use resolver', () => {
const resolver = makeResolverFromLegacyOptions({
external: true
});
const vm = new NodeVM({
require: resolver
});

vm.run("require('mocha')", __filename);
});
});

describe('source extensions', () => {
it('does not find a TS module with the default settings', () => {
const vm = new NodeVM({
Expand Down

0 comments on commit 7b4eeab

Please sign in to comment.