mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-18 00:24:47 +04:00
fix: Use JSON to parse npm pack output.
This commit is contained in:
parent
d2b61d0ef2
commit
24d595fc95
3 changed files with 56 additions and 4 deletions
|
|
@ -113,8 +113,8 @@ def test_installs_without_links_outside_env(tmpdir):
|
|||
assert cmd_output('foo')[1] == 'success!\n'
|
||||
|
||||
|
||||
def _make_hello_world(tmp_path):
|
||||
package_json = '''\
|
||||
def _make_hello_world(tmp_path, package_json=None):
|
||||
package_json = package_json or '''\
|
||||
{"name": "t", "version": "0.0.1", "bin": {"node-hello": "./bin/main.js"}}
|
||||
'''
|
||||
tmp_path.joinpath('package.json').write_text(package_json)
|
||||
|
|
@ -132,6 +132,20 @@ def test_node_hook_system(tmp_path):
|
|||
assert ret == (0, b'Hello World\n')
|
||||
|
||||
|
||||
def test_node_with_prepare_script(tmp_path):
|
||||
package_json = '''
|
||||
{
|
||||
"name": "t",
|
||||
"version": "0.0.1",
|
||||
"bin": {"node-hello": "./bin/main.js"},
|
||||
"scripts": {"prepare": "echo prepare"}
|
||||
}
|
||||
'''
|
||||
_make_hello_world(tmp_path, package_json)
|
||||
ret = run_language(tmp_path, node, 'node-hello')
|
||||
assert ret == (0, b'Hello World\n')
|
||||
|
||||
|
||||
def test_node_with_user_config_set(tmp_path):
|
||||
cfg = tmp_path.joinpath('cfg')
|
||||
cfg.write_text('cache=/dne\n')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue