def get_new_command(command):
    misspelled_script = re.findall(
        r'.*missing script: (.*)\n', command.output)[0]
    return replace_command(command, misspelled_script, get_scripts())
Example #2
0
def match(command):
    return ('Usage: npm <command>' in command.output and
            not any(part.startswith('ru') for part in command.script_parts)
            and command.script_parts[1] in get_scripts())
Example #3
0
def test_get_scripts(mocker):
    patch = mocker.patch('thefuck.specific.npm.Popen')
    patch.return_value.stdout = BytesIO(run_script_stdout)
    assert get_scripts() == ['build', 'develop', 'watch-test']
Example #4
0
def test_get_scripts(mocker):
    patch = mocker.patch("thefuck.specific.npm.Popen")
    patch.return_value.stdout = BytesIO(run_script_stdout)
    assert get_scripts() == ["build", "develop", "watch-test"]
Example #5
0
def match(command):
    return ('Usage: npm <command>' in command.stdout
            and not any(part.startswith('ru') for part in command.script_parts)
            and command.script_parts[1] in get_scripts())