def test_additional_node_dependencies_installed(tempdir_factory, store): path = make_repo(tempdir_factory, 'node_hooks_repo') config = make_config_from_repo(path) # Careful to choose a small package that's not depped by npm config['hooks'][0]['additional_dependencies'] = ['lodash'] hook = _get_hook(config, store, 'foo') with node.in_env(hook.prefix, hook.language_version): output = cmd_output('npm', 'ls', '-g')[1] assert 'lodash' in output
def test_additional_node_dependencies_installed( tempdir_factory, store, ): # pragma: no cover (non-windows) path = make_repo(tempdir_factory, 'node_hooks_repo') config = make_config_from_repo(path) # Careful to choose a small package that's not depped by npm config['hooks'][0]['additional_dependencies'] = ['lodash'] repo = Repository.create(config, store) repo.require_installed() with node.in_env(repo._cmd_runner, 'default'): cmd_output('npm', 'config', 'set', 'global', 'true') output = cmd_output('npm', 'ls')[1] assert 'lodash' in output
def test_additional_node_dependencies_installed( tempdir_factory, store, ): # pragma: no cover (non-windows) path = make_repo(tempdir_factory, 'node_hooks_repo') config = make_config_from_repo(path) # Careful to choose a small package that's not depped by npm config['hooks'][0]['additional_dependencies'] = ['lodash'] repo = Repository.create(config, store) repo.run_hook(repo.hooks[0][1], []) with node.in_env(repo.cmd_runner, 'default') as env: env.run('npm config set global true') output = env.run(('npm ls'))[1] assert 'lodash' in output
def test_additional_node_dependencies_installed( tempdir_factory, store, ): # pragma: no cover (non-windows) path = make_repo(tempdir_factory, 'node_hooks_repo') config = make_config_from_repo(path) # Careful to choose a small package that's not depped by npm config['hooks'][0]['additional_dependencies'] = ['lodash'] repo = Repository.create(config, store) repo.require_installed() (prefix, _, version, _), = repo._venvs() with node.in_env(prefix, version): output = cmd_output('npm', 'ls', '-g')[1] assert 'lodash' in output
def test_installs_without_links_outside_env(tmpdir): tmpdir.join('bin/main.js').ensure().write( '#!/usr/bin/env node\n' '_ = require("lodash"); console.log("success!")\n', ) tmpdir.join('package.json').write( json.dumps({ 'name': 'foo', 'version': '0.0.1', 'bin': {'foo': './bin/main.js'}, 'dependencies': {'lodash': '*'}, }), ) prefix = Prefix(str(tmpdir)) node.install_environment(prefix, 'system', ()) assert node.healthy(prefix, 'system') # this directory shouldn't exist, make sure we succeed without it existing cmd_output('rm', '-rf', str(tmpdir.join('node_modules'))) with node.in_env(prefix, 'system'): assert cmd_output('foo')[1] == 'success!\n'