Skip to content

Commit

Permalink
feature: redrun: coupole npm -s
Browse files Browse the repository at this point in the history
  • Loading branch information
coderaiser committed Mar 19, 2024
1 parent 3613e2b commit aa0f963
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/replace.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as regexp from './regexp.js';
const log = debug('redrun:replace');

export default async (result, fn) => {
result = result.replace('npm run -s', 'npm run');
result = result.replaceAll('npm run -s', 'npm run');

result = await replaceNpmRun(result, fn);
result = await replaceReserved(result, fn);
Expand Down
15 changes: 15 additions & 0 deletions test/redrun.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,21 @@ test('redrun: npm run -s', async (t) => {
t.end();
});

test('redrun: npm run -s: couple', async (t) => {
const cmd = '_mocha --reporter progress --timeout 4000 "tests/lib/**/*.js"';
const result = await redrun('test:*', {
'test:1': 'nyc npm run -s test_mocha',
'test:2': 'npm run -s lint',
'lint': 'putout .',
'test_mocha': cmd,
});

const expected = `nyc ${cmd} && putout .`;

t.equal(result, expected);
t.end();
});

test('args: no name', async (t) => {
const [e] = await tryToCatch(redrun);

Expand Down

0 comments on commit aa0f963

Please sign in to comment.