Skip to content

Commit

Permalink
Avoid using shx
Browse files Browse the repository at this point in the history
  • Loading branch information
lukastaegert committed Jan 1, 2020
1 parent 2ae5484 commit 278c5ff
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 17 deletions.
13 changes: 4 additions & 9 deletions test/cli/index.js
Expand Up @@ -23,15 +23,10 @@ runTestSuiteWithSamples(
done => {
process.chdir(config.cwd || dir);

const command = config.command
.replace(
/(^| )rollup($| )/g,
`node ${path.resolve(__dirname, '../../dist/bin')}${path.sep}rollup `
)
.replace(
/(^| )shx /g,
`node ${path.resolve(__dirname, '../../node_modules/.bin')}${path.sep}shx `
);
const command = config.command.replace(
/(^| )rollup($| )/g,
`node ${path.resolve(__dirname, '../../dist/bin')}${path.sep}rollup `
);

const childProcess = exec(
command,
Expand Down
2 changes: 1 addition & 1 deletion test/cli/samples/stdin/config-file/_config.js
@@ -1,5 +1,5 @@
module.exports = {
description:
'does not replace input with stdin but allows referencing it when using a config file',
command: `shx echo "import {PRINT as p} from './a'; import C from './b'; 0 && fail() || p(C); export {C as value, p as print}" | rollup -c`
command: `echo "import {PRINT as p} from './a'; import C from './b'; 0 && fail() || p(C); export {C as value, p as print}" | rollup -c`
};
2 changes: 1 addition & 1 deletion test/cli/samples/stdin/force-stdin-config-file/_config.js
@@ -1,4 +1,4 @@
module.exports = {
description: 'allows forcing inputs to be replaced with stdin in config files',
command: `shx echo "console.log('STDIN');" | rollup -c --stdin`
command: `echo "console.log('STDIN');" | rollup -c --stdin`
};
2 changes: 1 addition & 1 deletion test/cli/samples/stdin/force-stdin-tty/_config.js
@@ -1,4 +1,4 @@
module.exports = {
description: 'allows forcing stdin input on TTY interfaces via option',
command: `shx echo "console.log('PASS');" | ./wrapper.js -f es --stdin`
command: `echo "console.log('PASS');" | ./wrapper.js -f es --stdin`
};
2 changes: 1 addition & 1 deletion test/cli/samples/stdin/no-dash/_config.js
@@ -1,4 +1,4 @@
module.exports = {
description: 'uses stdin input when piping into Rollup without an input',
command: `shx mkdir -p _actual && shx echo "0 && fail() || console.log('PASS');" | rollup > _actual/out.js`
command: `echo "0 && fail() || console.log('PASS');" | rollup`
};
File renamed without changes.
2 changes: 1 addition & 1 deletion test/cli/samples/stdin/no-stdin-config-file/_config.js
@@ -1,4 +1,4 @@
module.exports = {
description: 'allows using "-" as a regular file name via flag',
command: `shx echo "console.log('IGNORED');" | rollup -c --no-stdin`
command: `echo "console.log('IGNORED');" | rollup -c --no-stdin`
};
2 changes: 1 addition & 1 deletion test/cli/samples/stdin/no-stdin-tty/_config.js
Expand Up @@ -2,7 +2,7 @@ const { assertStderrIncludes } = require('../../../../utils.js');

module.exports = {
description: 'does not use input as stdin on TTY interfaces',
command: `shx echo "console.log('PASS');" | ./wrapper.js -f es`,
command: `echo "console.log('PASS');" | ./wrapper.js -f es`,
error(err) {
assertStderrIncludes(err.message, 'You must supply options.input to rollup');
}
Expand Down
2 changes: 1 addition & 1 deletion test/cli/samples/stdin/self-import/_config.js
@@ -1,4 +1,4 @@
module.exports = {
description: 'stdin input of code that imports a copy of itself',
command: `shx mkdir -p _actual && shx cat input.txt | rollup -f cjs --silent > _actual/out.js`
command: `shx mkdir -p _actual && shx cat input.txt | rollup -f cjs --silent`
};
2 changes: 1 addition & 1 deletion test/cli/samples/stdin/with-dash/_config.js
@@ -1,4 +1,4 @@
module.exports = {
description: 'stdin input with dash on CLI',
command: `shx mkdir -p _actual && shx echo "0 && fail() || console.log('PASS');" | rollup - > _actual/out.js`
command: `echo "0 && fail() || console.log('PASS');" | rollup -`
};

0 comments on commit 278c5ff

Please sign in to comment.