diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1728a22 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +/bin/cli.js text eol=lf diff --git a/.gitignore b/.gitignore index 2717fb1..443c406 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,4 @@ Thumbs.db # Node / npm .npm /node_modules/ -/package-lock.json \ No newline at end of file +/package-lock.json diff --git a/bin/cli.js b/bin/cli.js index f085038..642c81e 100755 --- a/bin/cli.js +++ b/bin/cli.js @@ -1,2 +1,2 @@ #!/usr/bin/env node -require('../index.js')() \ No newline at end of file +require('../index.js')() diff --git a/index.js b/index.js index 115b0f2..9881e5f 100644 --- a/index.js +++ b/index.js @@ -409,4 +409,4 @@ async function loadSchema(schemaId) { module.exports = async config => { await run(config); -}; \ No newline at end of file +}; diff --git a/tests/api/collections.json b/tests/api/collections.json index a61247d..fffb949 100644 --- a/tests/api/collections.json +++ b/tests/api/collections.json @@ -78,4 +78,4 @@ } ], "links": [] -} \ No newline at end of file +} diff --git a/tests/api/items.json b/tests/api/items.json index ca4b4a8..0f06968 100644 --- a/tests/api/items.json +++ b/tests/api/items.json @@ -80,4 +80,4 @@ ], "links": [] -} \ No newline at end of file +} diff --git a/tests/cli.test.js b/tests/cli.test.js index 9a99f26..7a21677 100644 --- a/tests/cli.test.js +++ b/tests/cli.test.js @@ -1,6 +1,7 @@ const app = require('../index'); const { version } = require('../package.json'); const fs = require('fs/promises'); +const { exec } = require("child_process"); let consoleErrSpy, consoleWarnSpy, consoleInfSpy, consoleLogSpy, mockExit; const initString = `STAC Node Validator v${version}`; @@ -20,6 +21,15 @@ beforeEach(() => { consoleErrSpy = jest.spyOn(console, 'error').mockImplementation(); }); +it('Should be executable via shell', done => { + exec("node ./bin/cli.js --version", (error, stdout, stderr) => { + expect(error).toBe(null); + expect(stderr).toBe(""); + expect(stdout).toContain(version); + done(); + }); +}); + it('Should print init string', async () => { await app(); diff --git a/tests/example-config.json b/tests/example-config.json index 9050da7..f3c04fd 100644 --- a/tests/example-config.json +++ b/tests/example-config.json @@ -1,4 +1,4 @@ { "files": ["tests/examples/catalog.json"], "verbose": true -} \ No newline at end of file +} diff --git a/tests/examples/catalog.json b/tests/examples/catalog.json index 3283c29..4228591 100644 --- a/tests/examples/catalog.json +++ b/tests/examples/catalog.json @@ -5,4 +5,4 @@ "title": "Example Catalog", "description": "A minimal example for tests", "links": [] -} \ No newline at end of file +} diff --git a/tests/examples/invalid-catalog.json b/tests/examples/invalid-catalog.json index a66802e..0850432 100644 --- a/tests/examples/invalid-catalog.json +++ b/tests/examples/invalid-catalog.json @@ -4,4 +4,4 @@ "type": "Catalog", "title": "Example Catalog", "description": "A minimal example for tests" -} \ No newline at end of file +}