Skip to content

Commit 5ae2aab

Browse files
author
Maël Nison
committed
Enables a test on Linux
1 parent 8ae556d commit 5ae2aab

File tree

2 files changed

+39
-41
lines changed

2 files changed

+39
-41
lines changed

__tests__/integration.js

Lines changed: 38 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -75,59 +75,57 @@ test('--mutex network', async () => {
7575

7676
// Windows doesn't have the "echo" utility
7777
// Since this feature isn't platform-specific, running them on OSX and Linux only should be fine
78-
if (process.platform !== 'win32') {
79-
test('yarn run <script> --opt', async () => {
80-
const cwd = await makeTemp();
78+
test('yarn run <script> --opt', async () => {
79+
const cwd = await makeTemp();
8180

82-
await fs.writeFile(
83-
path.join(cwd, 'package.json'),
84-
JSON.stringify({
85-
scripts: {echo: 'echo'},
86-
}),
87-
);
81+
await fs.writeFile(
82+
path.join(cwd, 'package.json'),
83+
JSON.stringify({
84+
scripts: {echo: `echo`},
85+
}),
86+
);
8887

89-
const command = path.resolve(__dirname, '../bin/yarn');
90-
const options = {cwd, env: {YARN_SILENT: 1}};
88+
const command = path.resolve(__dirname, '../bin/yarn');
89+
const options = {cwd, env: {YARN_SILENT: 1}};
9190

92-
const {stderr: stderr, stdout: stdout} = execa(command, ['run', 'echo', '--opt'], options);
91+
const {stderr: stderr, stdout: stdout} = execa(command, ['run', 'echo', '--opt'], options);
9392

94-
const stdoutPromise = misc.consumeStream(stdout);
95-
const stderrPromise = misc.consumeStream(stderr);
93+
const stdoutPromise = misc.consumeStream(stdout);
94+
const stderrPromise = misc.consumeStream(stderr);
9695

97-
const [stdoutOutput, stderrOutput] = await Promise.all([stdoutPromise, stderrPromise]);
96+
const [stdoutOutput, stderrOutput] = await Promise.all([stdoutPromise, stderrPromise]);
9897

99-
expect(stdoutOutput.toString().trim()).toEqual('--opt');
100-
expect(stderrOutput.toString()).not.toMatch(
101-
/From Yarn 1\.0 onwards, scripts don't require "--" for options to be forwarded/,
102-
);
103-
});
98+
expect(stdoutOutput.toString().trim()).toEqual('--opt');
99+
expect(stderrOutput.toString()).not.toMatch(
100+
/From Yarn 1\.0 onwards, scripts don't require "--" for options to be forwarded/,
101+
);
102+
});
104103

105-
test('yarn run <script> -- --opt', async () => {
106-
const cwd = await makeTemp();
104+
test('yarn run <script> -- --opt', async () => {
105+
const cwd = await makeTemp();
107106

108-
await fs.writeFile(
109-
path.join(cwd, 'package.json'),
110-
JSON.stringify({
111-
scripts: {echo: 'echo'},
112-
}),
113-
);
107+
await fs.writeFile(
108+
path.join(cwd, 'package.json'),
109+
JSON.stringify({
110+
scripts: {echo: `echo`},
111+
}),
112+
);
114113

115-
const command = path.resolve(__dirname, '../bin/yarn');
116-
const options = {cwd, env: {YARN_SILENT: 1}};
114+
const command = path.resolve(__dirname, '../bin/yarn');
115+
const options = {cwd, env: {YARN_SILENT: 1}};
117116

118-
const {stderr: stderr, stdout: stdout} = execa(command, ['run', 'echo', '--', '--opt'], options);
117+
const {stderr: stderr, stdout: stdout} = execa(command, ['run', 'echo', '--', '--opt'], options);
119118

120-
const stdoutPromise = misc.consumeStream(stdout);
121-
const stderrPromise = misc.consumeStream(stderr);
119+
const stdoutPromise = misc.consumeStream(stdout);
120+
const stderrPromise = misc.consumeStream(stderr);
122121

123-
const [stdoutOutput, stderrOutput] = await Promise.all([stdoutPromise, stderrPromise]);
122+
const [stdoutOutput, stderrOutput] = await Promise.all([stdoutPromise, stderrPromise]);
124123

125-
expect(stdoutOutput.toString().trim()).toEqual('--opt');
126-
expect(stderrOutput.toString()).toMatch(
127-
/From Yarn 1\.0 onwards, scripts don't require "--" for options to be forwarded/,
128-
);
129-
});
130-
}
124+
expect(stdoutOutput.toString().trim()).toEqual('--opt');
125+
expect(stderrOutput.toString()).toMatch(
126+
/From Yarn 1\.0 onwards, scripts don't require "--" for options to be forwarded/,
127+
);
128+
});
131129

132130
test('cache folder fallback', async () => {
133131
const cwd = await makeTemp();

src/cli/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export function main({
111111
}
112112

113113
let warnAboutRunDashDash = false;
114-
// we using "yarn <script> -abc" or "yarn run <script> -abc", we want -abc to be script options, not yarn options
114+
// we are using "yarn <script> -abc" or "yarn run <script> -abc", we want -abc to be script options, not yarn options
115115
if (command === commands.run) {
116116
if (endArgs.length === 0) {
117117
endArgs = ['--', ...args.splice(1)];

0 commit comments

Comments
 (0)