This repository was archived by the owner on Jul 10, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
feat: replace jest with vitest #159
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
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
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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -10,39 +10,55 @@ import { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| waitForPXE, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Wallet, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } from '@aztec/aztec.js'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { getPXEServiceConfig } from '@aztec/pxe/config'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { getPXEServiceConfig, type PXEServiceConfig } from '@aztec/pxe/config'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { createPXEService } from '@aztec/pxe/server'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { createStore } from '@aztec/kv-store/lmdb'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { type L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { TokenContract, TokenContractArtifact } from '../../artifacts/Token.js'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { NFTContractArtifact } from '../../artifacts/NFT.js'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const logger = createLogger('aztec:aztec-standards'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const { NODE_URL = 'http://localhost:8080' } = process.env; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const node = createAztecNodeClient(NODE_URL); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const l1Contracts = await node.getL1ContractAddresses(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const config = getPXEServiceConfig(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const fullConfig = { ...config, l1Contracts }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fullConfig.proverEnabled = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let l1Contracts: L1ContractAddresses; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let fullConfig: PXEServiceConfig & { l1Contracts: L1ContractAddresses }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const initializeConfig = async () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!l1Contracts) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const node = createAztecNodeClient(NODE_URL); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| l1Contracts = await node.getL1ContractAddresses(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const config = getPXEServiceConfig(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fullConfig = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ...config, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| l1Contracts, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| proverEnabled: false, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return fullConfig; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+24
to
+39
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Consider error handling and test isolation for the lazy initialization pattern. The lazy initialization pattern is a good improvement over top-level async calls. However, consider these enhancements:
const initializeConfig = async () => {
if (!l1Contracts) {
- const node = createAztecNodeClient(NODE_URL);
- l1Contracts = await node.getL1ContractAddresses();
+ try {
+ const node = createAztecNodeClient(NODE_URL);
+ l1Contracts = await node.getL1ContractAddresses();
+ } catch (error) {
+ logger.error('Failed to initialize L1 contract addresses:', error);
+ throw error;
+ }
// ... rest of the function
}
return fullConfig;
};
📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const setupPXE = async () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const config = await initializeConfig(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const node = createAztecNodeClient(NODE_URL); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const store = await createStore('pxe', { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| dataDirectory: 'store', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| dataStoreMapSizeKB: 1e6, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const pxe = await createPXEService(node, fullConfig, { store }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const pxe = await createPXEService(node, config, { store }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await waitForPXE(pxe); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return { pxe, store }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // --- Token Utils --- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const expectUintNote = (note: UniqueNote, amount: bigint, owner: AztecAddress) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const expectUintNote = (expect: any, note: UniqueNote, amount: bigint, owner: AztecAddress) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(note.note.items[0]).toEqual(new Fr(owner.toBigInt())); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(note.note.items[2]).toEqual(new Fr(amount)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const expectTokenBalances = async ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect: any, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| token: TokenContract, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| address: AztecAddress, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| publicBalance: bigint, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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,11 @@ | ||
| import { defineConfig } from 'vitest/config'; | ||
|
|
||
| export default defineConfig({ | ||
| test: { | ||
| // aztec sandbox tests take quite some time | ||
| hookTimeout: 200000, | ||
| testTimeout: 200000, | ||
| // TODO: check why tests fail when we run them in parallel | ||
| fileParallelism: false, | ||
| }, | ||
| }); |
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.
What do we do about this test?
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.
TBF I would remove it. We only test a single flow (private transfer), I'd re add it once they're done changing the PXE's Notes interface oooor push to make them as extensive as the single PXE tests.
I commented it because I wasn't able to start the secondary PXE, I'll try again later.