index.js
function rewriteRequires (filename) {
    var basedir = path.dirname(filename)
    return wrapListener(
      function (nodePath) {
        if (nodePath.isLiteral() && !path.isAbsolute(nodePath.node.value)) {
          var match = nodePath.node.value.match(/^compile!(.+)$/)
          nodePath.node.value = match
            ? nodePath.node.value = requireCompiledResolve(filename, match[1])
            : nodePath.node.value = resolve.sync(nodePath.node.value, { basedir: basedir })
        }
      },
      'rewrite-require',
      {
        generated: true,
        require: true,
        import: true
      }
    )
  }
function rewriteRequires (filename) {
    var basedir = path.dirname(filename)
    return wrapListener(
      function (nodePath) {
        if (nodePath.isLiteral() && !path.isAbsolute(nodePath.node.value)) {
          var match = nodePath.node.value.match(/^compile!(.+)$/)
          nodePath.node.value = match
            ? nodePath.node.value = requireCompiledResolve(filename, match[1])
            : nodePath.node.value = resolve.sync(nodePath.node.value, { basedir: basedir })
        }
      },
      'rewrite-require',
      {
        generated: true,
        require: true,
        import: true
      }
    )
  }
function rewriteRequires ( filename ) { var basedir = path . dirname ( filename ) return wrapListener ( function ( nodePath ) { if ( nodePath . isLiteral ( ) && ! path . isAbsolute ( nodePath . node . value ) ) { var match = nodePath . node . value . match ( / ^compile!(.+)$ / ) nodePath . node . value = match ? nodePath . node . value = requireCompiledResolve ( filename , match [ 1 ] ) : nodePath . node . value = resolve . sync ( nodePath . node . value , { basedir : basedir } ) } } , 'rewrite-require' , { generated : true , require : true , import : true } ) }
Rewrite requires to use absolute paths. This way tests the compiled tests can still be ran from a different directory.
Rewrite requires to use absolute paths . This way tests the compiled tests can still be ran from a different directory .