-
Notifications
You must be signed in to change notification settings - Fork 33
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
getAccountAddress() broken - could be dependency issue #182
Comments
Having the same issue here as @sisyphusSmiling. Downgraded to |
@sisyphusSmiling Thanks for reporting. test("get account address", async () => {
const testAddress = await getAccountAddress("TestAddress")
// Expect Alice to be address of Alice's account
expect(isAddress(testAddress)).toBe(true)
}) Passes without error 🧐 Also I'm able to successfully run all tests from flow-nft |
@gregsantos This is what I get with it("should get the test account address", async () => {
await getAccountAddress("TestAddress");
});
|
@gregsantos Please note that the tests on flow-nft use To double check this, I upgraded the testing library on flow-nft and all the same errors come up. |
This is a strange issue ( though was fun to debug), I don't know javascript much. ( so my analysis can be wrong ) Problem is here: flow-js-testing/src/interaction.js Line 123 in 457886b
export const sendTransaction = async (...props) => {
let result = null,
err = null
const logs = await captureLogs(async () => {
try {
const extractor = extractParameters("tx")
const {code, args, signers, limit} = await extractor(props)
const serviceAuth = authorization() here somehow changing something like: export const sendTransaction = async (...props) => {
let result = null,
err = null
let propsOuter = props
const logs = await captureLogs(async () => {
try {
const extractor = extractParameters("tx")
const {code, args, signers, limit} = await extractor(propsOuter)
const serviceAuth = authorization() solves the problem. Maybe some JS bug, packer bug, or something else. If someone knows the answer I am curious too |
@bluesign is correct and this is yet another one of these strange microbundle issues related to async function arguments, very similar to previous occurances in @onflow/fcl. The bundled code looks like the following: const sendTransaction = function () {
try {
let result = null,
err = null;
return Promise.resolve(captureLogs(function () {
try {
const _arguments = arguments;
const _temp7 = _catch(function () {
const extractor = extractParameters$1("tx");
return Promise.resolve(extractor([].slice.call(_arguments))).then(function ({
code,
args,
signers,
limit
}) { Note that the arguments come from the inner function Using the internal build tool, @onflow/fcl-bundle, is not possible without a large amount of refactoring (see #152) because flow-js-testing has a lot of tricky circular dependencies. Microbundle is somehow able to ignore these, but fcl-bundle is not (my guess is something related to the use of the rollup babel plugin in fcl-bundle and this confuses the code transformations somehow). |
Javascript just never stops surprising us. And yes, all the tests within the example folder are passing. But when the library is bundled that doesn't seem to be the case anymore. |
@jribbink Good call on the scoping issue. Was able to patch it in this case. |
Looks like this issue could be popping up again in #191. Cross posting here for visibility |
Fixed via #190 |
Problem
Running
getAccountAddress()
results in error. Because this may be a dependency issue, I will also make an issue inflow-cadut
Steps to Reproduce
As an example, running the following in a test using
flow-js-testing
:Gets us the following output:
Alternatively, this can be reproduced with an existing repo -
flow-nft
's JS tests are no longer passing. Try pulling and running those and you should get something like the output quoted above.Acceptance Criteria
getAccountAddress()
runs without errorContext
Currently blocked from writing tests for the Execution Node versioning contract
The text was updated successfully, but these errors were encountered: