-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add splitTestsCompilation solidity setting: main PR
#8127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
94 commits
Select commit
Hold shift + click to select a range
8ada49c
Add spec
alcuadrado a99a5b9
Fix typos and cspell config
alcuadrado d72d7c1
Add config field to the builtin:solidity type extensions
alcuadrado dbaec84
Add config validation and resolution
alcuadrado be8bf71
Fix some tests that construct SolidityConfig objects manually
alcuadrado 8f5c52b
Throw in the disabled apis
alcuadrado b6c93bf
Update getRootFilePaths()
alcuadrado 7fd2e2b
Update emitArtifacts()
alcuadrado 35752f6
Update getArtifactsDirectory()
alcuadrado 6f75b54
Remove outdated assertion
alcuadrado 2e1a389
Fix existing build scope tests, as they were based on split mode
alcuadrado 1b26dd5
Add tests for the new behavior
alcuadrado 770b1be
Update the plan so that phase 4 fixes the tests that needed build to …
alcuadrado b3c2444
Reintroduced accidentally deleted descriptor
alcuadrado d863c0e
Reintroduced accidentally deleted jsdoc
alcuadrado 9b79ed8
Tiny optimization to getScope()
alcuadrado ed5c4c5
Make test portable
alcuadrado 832063f
Include the artifacts directory and if a root file emitted ts types o…
alcuadrado 69a4ed0
Address copilot feedback
alcuadrado 9518909
Add missing test
alcuadrado dff3b3d
Document expected failures after this phase
alcuadrado 47f513f
Update the spec to simplify how --no-contracts and --no-tests work wi…
alcuadrado aeeab09
Update build-cleanup-artifacts tests to run full builds
alcuadrado fe0400a
Update the build task
alcuadrado 4c56c96
Adds SolidityBuildSystem tests for splitTestCompilation:false behavior
alcuadrado 42170c7
Add cleanup artifacts tests for unified builds
alcuadrado 6a6bd2e
Add tests of the build task when using unified builds and update the …
alcuadrado 7ef6c6a
Make test portable
alcuadrado 3868caf
Add missing error descriptor
alcuadrado dee44f5
Fix return type of build task
alcuadrado 3e8e721
Update bulitin tasks: run, test, and console
alcuadrado a405dc4
Fix existing race condition
alcuadrado c3d1d31
Update the SPEC to reflect some DX improvements
alcuadrado 6db5c9c
Update test solidity task
alcuadrado e7eef17
Update the tests
alcuadrado cdcb497
Remove duplicated code
alcuadrado 7114817
Simplify and optimize code a bit
alcuadrado 768b800
Fix typos and cspell config
alcuadrado 0460272
Minor simplification
alcuadrado a1fa452
Disable spellcheck in the spec file
alcuadrado 8fee584
Improve type-safety
alcuadrado bda6aa6
spellcheck
alcuadrado 835dd6e
Get scopes in parallel
alcuadrado 43f99fb
Fix typo
alcuadrado a63341e
Fix test files resolution
alcuadrado 3dd4360
Validate that the provided test files exist
alcuadrado 3322ffd
Add integration tests for the ArtifactManager in unified build mode
alcuadrado 3ee06b2
Update the typechain plugin to filter out tests in unified mode
alcuadrado 3997e74
Add a test of an npm root
alcuadrado 5c3dedd
Remove duplicated test
alcuadrado a130e61
Sort FQNs when multiple candidates are found for a bare contract name
alcuadrado a78068c
Fix three path comparision bugs in the build system
alcuadrado 0eff216
Update how the typechain hook get the right contract paths in unified…
alcuadrado 972369b
Update the tests
alcuadrado b80aa4a
Improve comment
alcuadrado c43aaf5
Update hardhat-mocha
alcuadrado d78de32
Cleanup the tests
alcuadrado a551ab3
Simplify tests
alcuadrado c0f9741
Test noCompile with and without splitTestsCompilation
alcuadrado f14d975
Update hardhat-node-test-runner
alcuadrado 6695e09
Improve tests
alcuadrado 9641ac4
Update hardhat-ignition
alcuadrado 24ef213
Improve tests
alcuadrado 4f5a3c5
Add PLUGIN_MIGRATION_GUIDE.md
alcuadrado 3d2cb10
Add empty file to trigger the full CI
alcuadrado 1efe5e6
Remove code duplication in the SolidityBuildSystemImplementation
alcuadrado ce19625
Small type-safety improvement in build task
alcuadrado 3602f5c
Improve error descriptor
alcuadrado c1ef662
Update plugin migration guide
alcuadrado c90a604
Remove the spec
alcuadrado b6fdcac
Merge pull request #8128 from NomicFoundation/dont-split-compilations…
alcuadrado b7ed426
Add comment
alcuadrado ba2ab6a
Merge pull request #8129 from NomicFoundation/dont-split-compilations…
alcuadrado 5928034
Merge pull request #8130 from NomicFoundation/dont-split-compilations…
alcuadrado 2163afb
Improve type
alcuadrado 97a5215
Improve doc comment
alcuadrado 4409680
Rename function
alcuadrado 9777d1c
Merge pull request #8131 from NomicFoundation/dont-split-compilations…
alcuadrado 8b4f0b2
Merge pull request #8132 from NomicFoundation/dont-split-compilations…
alcuadrado 55586b7
Use the right type
alcuadrado c67029d
Add a comment
alcuadrado 5697e12
Merge pull request #8133 from NomicFoundation/dont-split-compilations…
alcuadrado 3b58254
Merge pull request #8134 from NomicFoundation/dont-split-compilations…
alcuadrado 021fe6e
Merge pull request #8135 from NomicFoundation/dont-split-compilations…
alcuadrado b61878e
Merge pull request #8136 from NomicFoundation/dont-split-compilations…
alcuadrado f94b313
Merge pull request #8137 from NomicFoundation/dont-split-compilations…
alcuadrado 32c5c1c
Update PLUGIN_MIGRATION_GUIDE.md
alcuadrado 2931710
Update PLUGIN_MIGRATION_GUIDE.md
alcuadrado fbe80d4
Merge pull request #8138 from NomicFoundation/dont-split-compilations…
alcuadrado 353cf86
Add hardhat changseet
alcuadrado 4fe12fe
Add plugins changesets
alcuadrado e3b5324
Add peer bumps
alcuadrado 7fb929e
Delete plugin migration guide
alcuadrado ff3109b
Delete empty file
alcuadrado File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,8 @@ | ||
| --- | ||
| "@nomicfoundation/hardhat-node-test-runner": patch | ||
| "@nomicfoundation/hardhat-typechain": patch | ||
| "@nomicfoundation/hardhat-ignition": patch | ||
| "@nomicfoundation/hardhat-mocha": patch | ||
| --- | ||
|
|
||
| Update to the new splitTestsCompilation setting |
This file contains hidden or 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,6 @@ | ||
| --- | ||
| "@nomicfoundation/hardhat-errors": patch | ||
| "hardhat": minor | ||
| --- | ||
|
|
||
| Make the split of contracts and solidity tests compilation optional, and controlled with a new `splitTestsCompilation` config field. | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,95 @@ | ||
| import path from "node:path"; | ||
| import { fileURLToPath, pathToFileURL } from "node:url"; | ||
|
|
||
| import { assert } from "chai"; | ||
| import { overrideTask } from "hardhat/config"; | ||
| import { createHardhatRuntimeEnvironment } from "hardhat/hre"; | ||
|
|
||
| import hardhatIgnitionPlugin from "../../src/index.js"; | ||
|
|
||
| describe("deploy - build invocation", function () { | ||
| function buildArgCaptor() { | ||
| const buildArgs: any[] = []; | ||
| const buildOverride = overrideTask("build") | ||
| .setAction(async () => ({ | ||
| default: async (args: any, _hre, runSuper) => { | ||
| buildArgs.push(args); | ||
| return runSuper(args); | ||
| }, | ||
| })) | ||
| .build(); | ||
| return { buildArgs, buildOverride }; | ||
| } | ||
|
|
||
| function getProjectConfig() { | ||
| const projectPath = path.join( | ||
| path.dirname(fileURLToPath(import.meta.url)), | ||
| "../fixture-projects", | ||
| "minimal", | ||
| ); | ||
|
|
||
| const configPath = path.join(projectPath, "hardhat.config.js"); | ||
|
|
||
| return { projectPath, configPath }; | ||
| } | ||
|
|
||
| it("should call build without noTests when splitTestsCompilation is false", async function () { | ||
| const { buildArgs, buildOverride } = buildArgCaptor(); | ||
| const { projectPath, configPath } = getProjectConfig(); | ||
|
|
||
| const { default: userConfig } = await import( | ||
| pathToFileURL(configPath).href | ||
| ); | ||
|
|
||
| const hre = await createHardhatRuntimeEnvironment( | ||
| { | ||
| ...userConfig, | ||
| plugins: [hardhatIgnitionPlugin], | ||
| tasks: [buildOverride], | ||
| }, | ||
| { config: configPath }, | ||
| projectPath, | ||
| ); | ||
|
|
||
| await hre.tasks.getTask(["ignition", "deploy"]).run({ | ||
| modulePath: path.join(projectPath, "ignition", "modules", "MyModule.js"), | ||
| }); | ||
|
|
||
| assert.equal(buildArgs.length, 1); | ||
| assert.equal(buildArgs[0].noTests, false); | ||
| assert.equal(buildArgs[0].defaultBuildProfile, "production"); | ||
| assert.equal(buildArgs[0].quiet, true); | ||
| }); | ||
|
|
||
| it("should call build with noTests when splitTestsCompilation is true", async function () { | ||
| const { buildArgs, buildOverride } = buildArgCaptor(); | ||
| const { projectPath, configPath } = getProjectConfig(); | ||
|
|
||
| const { default: userConfig } = await import( | ||
| pathToFileURL(configPath).href | ||
| ); | ||
|
|
||
| const hre = await createHardhatRuntimeEnvironment( | ||
| { | ||
| ...userConfig, | ||
| solidity: { | ||
| ...userConfig.solidity, | ||
| splitTestsCompilation: true, | ||
| }, | ||
| plugins: [hardhatIgnitionPlugin], | ||
| tasks: [buildOverride], | ||
| }, | ||
| { config: configPath }, | ||
| projectPath, | ||
| ); | ||
|
|
||
| await hre.tasks.getTask(["ignition", "deploy"]).run({ | ||
| modulePath: path.join(projectPath, "ignition", "modules", "MyModule.js"), | ||
| }); | ||
|
|
||
| assert.equal(buildArgs.length, 1); | ||
| assert.equal(buildArgs[0].noTests, true); | ||
| assert.equal(buildArgs[0].defaultBuildProfile, "production"); | ||
| assert.equal(buildArgs[0].quiet, true); | ||
| }); | ||
| }); |
This file contains hidden or 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,95 @@ | ||
| import path from "node:path"; | ||
| import { fileURLToPath, pathToFileURL } from "node:url"; | ||
|
|
||
| import { assert } from "chai"; | ||
| import { overrideTask } from "hardhat/config"; | ||
| import { createHardhatRuntimeEnvironment } from "hardhat/hre"; | ||
|
|
||
| import hardhatIgnitionPlugin from "../../src/index.js"; | ||
|
|
||
| describe("visualize - build invocation", function () { | ||
| function buildArgCaptor() { | ||
| const buildArgs: any[] = []; | ||
| const buildOverride = overrideTask("build") | ||
| .setAction(async () => ({ | ||
| default: async (args: any) => { | ||
| buildArgs.push(args); | ||
| return { contractRootPaths: [], testRootPaths: [] }; | ||
| }, | ||
| })) | ||
| .build(); | ||
| return { buildArgs, buildOverride }; | ||
| } | ||
|
|
||
| function getProjectConfig() { | ||
| const projectPath = path.join( | ||
| path.dirname(fileURLToPath(import.meta.url)), | ||
| "../fixture-projects", | ||
| "minimal", | ||
| ); | ||
|
|
||
| const configPath = path.join(projectPath, "hardhat.config.js"); | ||
|
|
||
| return { projectPath, configPath }; | ||
| } | ||
|
|
||
| it("should call build without noTests when splitTestsCompilation is false", async function () { | ||
| const { buildArgs, buildOverride } = buildArgCaptor(); | ||
| const { projectPath, configPath } = getProjectConfig(); | ||
|
|
||
| const { default: userConfig } = await import( | ||
| pathToFileURL(configPath).href | ||
| ); | ||
|
|
||
| const hre = await createHardhatRuntimeEnvironment( | ||
| { | ||
| ...userConfig, | ||
| plugins: [hardhatIgnitionPlugin], | ||
| tasks: [buildOverride], | ||
| }, | ||
| { config: configPath }, | ||
| projectPath, | ||
| ); | ||
|
|
||
| await hre.tasks.getTask(["ignition", "visualize"]).run({ | ||
| noOpen: true, | ||
| modulePath: path.join(projectPath, "ignition", "modules", "MyModule.js"), | ||
| }); | ||
|
|
||
| assert.equal(buildArgs.length, 1); | ||
| assert.equal(buildArgs[0].noTests, false); | ||
| assert.equal(buildArgs[0].quiet, true); | ||
| }); | ||
|
|
||
| it("should call build with noTests when splitTestsCompilation is true", async function () { | ||
| const { buildArgs, buildOverride } = buildArgCaptor(); | ||
| const { projectPath, configPath } = getProjectConfig(); | ||
|
|
||
| const { default: userConfig } = await import( | ||
| pathToFileURL(configPath).href | ||
| ); | ||
|
|
||
| const hre = await createHardhatRuntimeEnvironment( | ||
| { | ||
| ...userConfig, | ||
| solidity: { | ||
| ...userConfig.solidity, | ||
| splitTestsCompilation: true, | ||
| }, | ||
| plugins: [hardhatIgnitionPlugin], | ||
| tasks: [buildOverride], | ||
| }, | ||
| { config: configPath }, | ||
| projectPath, | ||
| ); | ||
|
|
||
| await hre.tasks.getTask(["ignition", "visualize"]).run({ | ||
| noOpen: true, | ||
| modulePath: path.join(projectPath, "ignition", "modules", "MyModule.js"), | ||
| }); | ||
|
|
||
| assert.equal(buildArgs.length, 1); | ||
| assert.equal(buildArgs[0].noTests, true); | ||
| assert.equal(buildArgs[0].quiet, true); | ||
| }); | ||
| }); |
This file contains hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
PR description says this PR “only introduces a spec file” and is “not meant to be reviewed”, but this changeset (and the diff overall) indicates the feature is being implemented and released (new config field, error descriptors, build-system behavior, multiple tests/fixtures). Please update the PR description to match the actual scope of changes, or split out the spec-only PR if that’s still the intent.