-
-
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.
fix: Valibot schema logic & better test coverage (#34)
- Loading branch information
Showing
11 changed files
with
528 additions
and
271 deletions.
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,5 @@ | ||
--- | ||
"secco": patch | ||
--- | ||
|
||
After updating `valibot` to the latest version, the validation for environment variables wasn't behaving correctly. The custom validation is fixed now. |
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,34 @@ | ||
import { join } from 'node:path' | ||
import { SeccoCLI } from '../helpers/invoke-cli' | ||
|
||
const missingSourcePackagesLocation = join(__dirname, '..', 'fixtures', 'missing-source-packages') | ||
|
||
describe('missing .seccorc', () => { | ||
it('should display error when no .seccorc or env var is found', () => { | ||
const [exitCode, logs] = SeccoCLI().setCwd('empty').invoke(['']) | ||
|
||
logs.should.contain('No `.seccorc` file found in') | ||
logs.should.contain('Please run `secco init` to create a new `.seccorc` file.') | ||
expect(exitCode).toBe(0) | ||
}) | ||
}) | ||
|
||
describe('missing package.json', () => { | ||
it('should display error when no package.json is found', () => { | ||
const [exitCode, logs] = SeccoCLI().setCwd('existing-config-file').invoke(['']) | ||
|
||
logs.should.contain('No `package.json` found in') | ||
logs.should.contain('Current directory must contain a `package.json` file.') | ||
expect(exitCode).toBe(0) | ||
}) | ||
}) | ||
|
||
describe('missing source packages', () => { | ||
it('should display error when no source package is found in package.json', () => { | ||
const [exitCode, logs] = SeccoCLI().setCwd('missing-source-packages').setEnv({ SECCO_SOURCE_PATH: missingSourcePackagesLocation }).invoke(['']) | ||
|
||
logs.should.contain(`You haven't got any source dependencies in your current \`package.json\`.`) | ||
logs.should.contain(`If you only want to use \`secco\` you'll need to add the dependencies to your \`package.json\`.`) | ||
expect(exitCode).toBe(0) | ||
}) | ||
}) |
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,9 @@ | ||
{ | ||
"name": "missing-source-packages", | ||
"version": "1.0.0", | ||
"private": true, | ||
"packageManager": "npm@9.6.7", | ||
"dependencies": { | ||
"say-hello-world": "^1.0.0" | ||
} | ||
} |
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
Oops, something went wrong.