Skip to content

Commit cb64b92

Browse files
authored
test(cmd): add test for caret char (shelljs#1017)
No change to logic. This adds a test case to make sure the caret character ('^') is passed through to the command. This is to make sure the character is not treated specially on Windows, where it's an escape character in the shell. Fixes shelljs#1015
1 parent 355bc75 commit cb64b92

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

test/cmd.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,14 @@ test('does not expand windows-style variables', t => {
132132
t.is(result.stdout, '!FOO!\n');
133133
});
134134

135+
test('caret character is passed through to the command', t => {
136+
// '^' is a special character on Windows, see issue #1015
137+
const result = shell.cmd('shx', 'echo', 'shelljs@^0.8.4');
138+
t.falsy(shell.error());
139+
t.is(result.code, 0);
140+
t.is(result.stdout, 'shelljs@^0.8.4\n');
141+
});
142+
135143
test('cannot inject multiple commands', t => {
136144
const injection = '; echo semicolon && echo and || echo or';
137145
const result = shell.cmd('shx', 'echo', `hi${injection}`);

0 commit comments

Comments
 (0)