Instead of manually checking for the operating system, this uses the well known package cross-spawn (142M downloads per month) to spawn the process across operating systems.
How did you implement it:
Replaced the call to child_process.spawn with cross-spawn.spawn. Also added jest-os-detection that will only test the spawn calls the way that they should be expected on that native os rather than defining a property on the process object
How can we verify it:
Run sls offline. It will spawn on any operating system. Run npm test on mac, linux or windows. You'll see that 8 tests are skipped on any OS (each OS has 4 tests)
Todos:
Note: Run npm run test:ci to run all validation checks on proposed changes
[x] Ensure there are no lint errors. Validate via npm run lint Note: Some reported issues can be automatically fixed by running npm run lint:fix
[x] Write tests and confirm existing functionality is not broken. Validate via npm test
[x] Write documentation
[x] Provide verification config / commands / resources
[x] Enable "Allow edits from maintainers" for this PR
[x] Update the messages below
Is this ready for review?: YES
Is it a breaking change?: NO
What did you implement:
Instead of manually checking for the operating system, this uses the well known package
cross-spawn
(142M downloads per month) to spawn the process across operating systems.How did you implement it:
Replaced the call to
child_process.spawn
withcross-spawn.spawn
. Also addedjest-os-detection
that will only test the spawn calls the way that they should be expected on that native os rather than defining a property on theprocess
objectHow can we verify it:
Run
sls offline
. It will spawn on any operating system. Runnpm test
on mac, linux or windows. You'll see that 8 tests are skipped on any OS (each OS has 4 tests)Todos:
Note: Run
npm run test:ci
to run all validation checks on proposed changesValidate via
npm run lint
Note: Some reported issues can be automatically fixed by running
npm run lint:fix
Validate via
npm test
Is this ready for review?: YES Is it a breaking change?: NO