From 25c2ad2e2a4aff71210eb332e2695d3991621001 Mon Sep 17 00:00:00 2001 From: dbale-altoros Date: Sat, 11 May 2024 18:31:36 -0300 Subject: [PATCH] fix e2e v2 --- CHANGELOG.md | 1 + e2e/test.js | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6792ed4..51ae795e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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

## [4.5.4] - 2024-04-10 diff --git a/e2e/test.js b/e2e/test.js index abef3aec..c6ebb2e6 100644 --- a/e2e/test.js +++ b/e2e/test.js @@ -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 -a`) + 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') @@ -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}`) @@ -211,11 +215,12 @@ 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` + const { code, stdout } = shell.exec(`${NODE}solhint ${PREFIX}test/FooTest.sol ${SUFFIX2}`) - expect(code).to.equal(EXIT_CODES.OK) + expect(code).to.equal(EXIT_CODES.REPORTED_ERRORS) expect(stdout.trim()).to.contain( 'Function wrongFunctionDefinitionName() must match Foundry test naming convention ' )