0

I am trying to use nock (https://github.com/node-nock/nock) in my tests.

If I write var nock = require('nock'); it won't find it as it is not loaded.

I have added the package in loaderOptions, and now I have to put var nock = require('nock/index');, because if I write the require('nock') it tries to load node_modules/nock/main, but it does not exists.

The library tries internally to load some modules nock brings with, but intern says Error: Attempt to require unloaded module lib/recorder.

I added nock into packages with: { name: 'nock', location: 'node_modules/nock' }

Any clue?

Thanks.

QuarK
  • 2,306
  • 1
  • 20
  • 24
  • @LinhNguyen The post does not explains how to do it with npm modules, but helped me to to solve that one thanks! <3 – QuarK Dec 05 '16 at 11:59

1 Answers1

0

The solution was to load the library using the Intern's dojo node loader:

var nock = require('intern/dojo/node!nock');

Cheers!

Luis.

QuarK
  • 2,306
  • 1
  • 20
  • 24