-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Internal improvement: Move compile-solidity tests to a new separate package #5445
Conversation
e03d9ac
to
81fafbb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My main note here is that there are a bunch of places where assert
is used in a way that isn't the closest match to the intent, I would suggest changing those. A bunch of those are pre-existing so maybe that's not entirely necessary? But I thought it was worth pointing out at least.
@@ -129,8 +133,11 @@ describe("compileWithPragmaAnalysis", function () { | |||
options: config, | |||
paths: [path.join(sourceDirectory, "withImports", "C.sol")] | |||
}); | |||
if (!compilations) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're doing if (...) { assert.fail() }
, you're not using assertions properly. I think the right way to do this in chai would be assert.isDefined(compilations, "Compilations were not created")
.
packages/compile-solidity-tests/test/compilerSupplier/loadingStrategies/VersionRange.ts
Show resolved
Hide resolved
packages/compile-solidity-tests/test/compilerSupplier/loadingStrategies/VersionRange.ts
Show resolved
Hide resolved
Sounds good to me @haltman-at about the massaging of the chai assertions! |
@haltman-at it seems like chai has no preference for |
Yeah the latter generates much better error messages when it fails. |
Oh that's when it gives you the actual values of the things being tested on failure in the test report. That's always super helpful. |
packages/compile-solidity-tests/test/compileWithPragmaAnalysis.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Actually, just noticed a few asserts that could use assert.include
!)
9348218
to
ca728b0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, seems good to me, except package versions need to be updated again due to the release last week!
"test": "./scripts/test.sh" | ||
}, | ||
"devDependencies": { | ||
"@truffle/artifactor": "^4.0.167", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These need to be updated again.
in build script
ca728b0
to
87ee8bc
Compare
While bootstrapping Truffle, you will notice a warning printed by lerna about a circular dependency. The tests for @truffle/compile-solidity use @truffle/resolver (as it is required in the config for certain flows) and @truffle/resolver has a dependency on @truffle/compile-solidity. To eliminate this circular dependency, these tests have been moved to their own package (and converted to TypeScript for kicks!).
Note that this PR is against the
moreTS
branch which is the branch where @truffle/compile-solidity is fully converted (almost, not the tests) to TypeScript in this PR.