Skip to content

Commit

Permalink
fix e2e v2
Browse files Browse the repository at this point in the history
  • Loading branch information
dbale-altoros committed May 11, 2024
1 parent d86157f commit 8ace18a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Solhint changed how the exit codes are implemented:
#### Solhint QUIET mode
QUIET mode (-c quiet) option now works with the warnings and may exit with 1 if there are more than defined by user

Thanks to [@juanpcapurro](https://github.com/juanpcapurro) for providing the code

<br><br>
## [4.5.4] - 2024-04-10
Expand Down
30 changes: 22 additions & 8 deletions e2e/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,14 @@ describe('e2e', function () {
expect(stdout.trim()).to.equal('')
})

it('should show warning when using --init', function () {
it.only('should show warning when using --init', function () {
shell.exec(`pwd`)
shell.exec(`ls`)

const { code, stdout } = shell.exec(`${NODE}solhint --init`)

console.log("code: ", code)
console.log("stdout: ", stdout)

expect(code).to.equal(EXIT_CODES.BAD_OPTIONS)
expect(stdout.trim()).to.equal('Configuration file already exists')
Expand All @@ -96,14 +102,12 @@ describe('e2e', function () {
const PATH = '03-no-empty-blocks'
const { PREFIX, SUFFIX } = prepareContext(PATH)

describe('No contracts to lint', function () {
it('should fail with appropiate message', function () {
const { code, stderr } = shell.exec(`${NODE}solhint Foo.sol ${SUFFIX}`)

it('No contracts to lint should fail with appropiate message', function () {
const { code, stderr } = shell.exec(`${NODE}solhint Foo1.sol ${SUFFIX}`)

expect(code).to.equal(EXIT_CODES.BAD_OPTIONS)
expect(stderr).to.include('No files to lint!')
})
})

it('should end with REPORTED_ERRORS = 1 because report contains errors', function () {
const { code, stdout } = shell.exec(`${NODE}solhint ${PREFIX}Foo.sol ${SUFFIX}`)
Expand Down Expand Up @@ -154,7 +158,11 @@ describe('e2e', function () {
const errorFound =
'Error/s found on rules! [max-warnings] param is ignored. Fixing errors enables max-warnings'

it('should not display [warnings exceeded] for max 7 warnings', function () {
it.only('should not display [warnings exceeded] for max 7 warnings', function () {
console.log("==============================================");
shell.exec(`pwd`)
shell.exec(`ls`)
console.log("==============================================");
const { code, stdout } = shell.exec(
`${NODE}solhint ${PREFIX}contracts/Foo.sol --max-warnings 7 ${SUFFIX}`
)
Expand Down Expand Up @@ -211,10 +219,16 @@ describe('e2e', function () {
expect(stdout.trim()).to.contain('Code contains empty blocks')
})

it(`should raise error for wrongFunctionDefinitionName() only`, () => {
it.only(`should raise error for wrongFunctionDefinitionName() only`, () => {
const SUFFIX2 = `-c ${PREFIX}test/.solhint.json --disc`
shell.exec(`pwd`)
shell.exec(`ls`)
console.log('command :>> ', `${NODE}solhint ${PREFIX}test/FooTest.sol ${SUFFIX2}`)
const { code, stdout } = shell.exec(`${NODE}solhint ${PREFIX}test/FooTest.sol ${SUFFIX2}`)

console.log("code: ", code)
console.log("stdout: ", stdout)

expect(code).to.equal(EXIT_CODES.OK)
expect(stdout.trim()).to.contain(
'Function wrongFunctionDefinitionName() must match Foundry test naming convention '
Expand Down

0 comments on commit 8ace18a

Please sign in to comment.