forked from stac-utils/stac-node-validator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* tests: Verify exit code when running without parameters Adds a lightweight testing framework, ospec. * feat: Add GitHub Actions pipeline with test job Runs on all non-deprecated GitHub runners for maximum portability guarantees. * docs: Explain how to test and how to disable testing * tests: Verify error message when running without parameters
- Loading branch information
Showing
4 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
strategy: | ||
matrix: | ||
runner: [ | ||
'macos-10.15', | ||
'macos-11', | ||
'macos-latest', | ||
'ubuntu-18.04', | ||
'ubuntu-20.04', | ||
'ubuntu-latest', | ||
'windows-2019', | ||
'windows-2022', | ||
'windows-latest', | ||
] | ||
node: [ '12', '14', '16', 'lts/*' ] | ||
runs-on: ${{ matrix.runner }} | ||
name: ${{ matrix.runner }} runner with Node.js ${{ matrix.node }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/[email protected] | ||
with: | ||
node-version: ${{ matrix.node }} | ||
- run: npm install | ||
- run: npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const o = require('ospec'); | ||
|
||
const app = require('..'); | ||
|
||
o.before(() => { | ||
originalConsoleError = console.error; | ||
originalExit = process.exit; | ||
}); | ||
|
||
o('Should return exit code 1 when run without parameters', () => { | ||
process.exit = o.spy(); | ||
app(); | ||
o(process.exit.args).deepEquals([1]); | ||
}); | ||
|
||
o('Should print error message when run without parameters', () => { | ||
console.error = o.spy(); | ||
app(); | ||
o(console.error.calls[0].args[0].message).equals('No path or URL specified.'); | ||
}); | ||
|
||
o.after(() => { | ||
console.error = originalConsoleError | ||
process.exit = originalExit; | ||
}); |