Skip to content

Commit

Permalink
Check custom output instead of versions.
Browse files Browse the repository at this point in the history
Running fake binaries there was no way to get local versions of node or yarn. Am I missing something?
  • Loading branch information
Pablo Nunez Navarro committed Nov 5, 2018
1 parent ea5810e commit 6830dd3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/pkg-tests/pkg-tests-specs/sources/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ module.exports = (makeTemporaryEnv: PackageDriver) => {
test(
`it should run scripts using the same Node than the one used by Yarn`,
makeTemporaryEnv({scripts: {myScript: `node --version`}}, async ({path, run, source}) => {
await makeFakeBinary(`${path}/bin/node`, { exitCode: 0 });
await makeFakeBinary(`${path}/bin/node`, { exitCode: 0, output: `local node` });

await expect(run(`run`, `myScript`)).resolves.toMatchObject({
stdout: `${process.version}\n`,
stdout: `"local node"\n`,
});
}),
);

test(
`it should run scripts using the same package manager than the one running the scripts`,
makeTemporaryEnv({scripts: {myScript: `yarn --version`}}, async ({path, run, source}) => {
await makeFakeBinary(`${path}/bin/yarn`, { exitCode: 0 });
await makeFakeBinary(`${path}/bin/yarn`, { exitCode: 0, output: `local yarn` });

await expect(run(`run`, `myScript`)).resolves.toMatchObject({
stdout: (await run(`--version`)).stdout,
stdout: `"local yarn"\n`,
});
}),
);
Expand Down

0 comments on commit 6830dd3

Please sign in to comment.