Skip to content
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

Test suite failing? #99

Closed
ntn-x2 opened this issue May 11, 2021 · 13 comments
Closed

Test suite failing? #99

ntn-x2 opened this issue May 11, 2021 · 13 comments
Assignees

Comments

@ntn-x2
Copy link
Contributor

ntn-x2 commented May 11, 2021

I don't know if it's just a problem I have, but I tried cloning the repo, installing the dependencies, and running the test suite that comes with the repo, and the tests are failing.

The error is the following:

    TypeError: require(...).didCorePropertiesTests is not a function

      10 |     `5.x Core Properties - ${didMethod} - ${implementation} - ${implementer}`;
      11 |   describe(suiteName, () => {
    > 12 |     require('./did-core-properties').didCorePropertiesTests(
         |                                      ^
      13 |       didMethodSuiteConfig);
      14 |   });
      15 |

      at Suite.<anonymous> (suites/did-core-properties/did-core-properties.spec.js:12:38)
      at forEach (suites/did-core-properties/did-core-properties.spec.js:11:3)
          at Array.forEach (<anonymous>)
      at Object.<anonymous> (suites/did-core-properties/did-core-properties.spec.js:7:24)

which happens with each DID method in the Core Properties test suite. I am running npm run test from within did-core-test-server as instructed in the test README.

Is there any solution to this?

@sondreb
Copy link
Contributor

sondreb commented May 11, 2021

Did you simply run "npm install", or did you run "npm run install:ci"?

I did the following:

Removed --since origin/master from the install:ci script in package.json. I made a fork of the repo, and think this was needed.

Then ran install:ci, which performs some lerna link and setup that is needed.

Then simply ran:

npm run test

I ran this on Windows from "cmd" in Windows Terminal, Node.js v14.15.4 and npm v6.14.10.

There is also docker setup that can be used to run the tests.

@ntn-x2
Copy link
Contributor Author

ntn-x2 commented May 12, 2021

@sondreb thanks for your answer! Unfortunately, it did not solve the problem.

@MajdT51
Copy link
Contributor

MajdT51 commented May 19, 2021

I have the same problem
image

@sondreb
Copy link
Contributor

sondreb commented May 19, 2021

Based on the errors, I think you have not fully installed the dependencies with lerna.

Make sure you go to root folder, edit the package.json by removing the "--since origin/master" from the "install:ci" script.

Then run

npm run install:ci

Please notice that this is custom script, "install:ci". It is not enough to simply run "npm install".

You should be able to run the test suite from root of repo, and it appears to work fine from within the "did-core-test-server" folder as well.

@ntn-x2
Copy link
Contributor Author

ntn-x2 commented May 19, 2021

@sondreb by following those very same instructions, the problem still persists (just tried again). My suspicion is that it depends on some local version of some tools/packages I have, but I cannot figure out what. It seems to be that the require syntax is working for all the other documents (i.e., they can be imported as objects) but not the ./did-core-properties, no idea why, as it produces a {} empty document, hence the error generated.

@msporny
Copy link
Member

msporny commented May 20, 2021

@Diiaablo95 I'm unable to reproduce the errors, I will try again this weekend with your branch to see if there are any errors.

@BernhardFuchs
Copy link
Contributor

@Diiaablo95 For me the Dockerfile was a good reference.
After running lerna bootstrap and lerna run build I had no issues.

@ntn-x2
Copy link
Contributor Author

ntn-x2 commented May 21, 2021

@BernhardFuchs it is getting more and more weird. I seem to be having the same issue, no matter what. It is just weird that require('./did-core-properties') returns an empty object {} instead of the content of the file.

EDIT: and I have the exact same problem if I just run the tests from the main branch. 🤷🏻‍♂️

@MajdT51
Copy link
Contributor

MajdT51 commented May 21, 2021

update: I have also the exact same problem if I just run the tests from the main branch

@kdenhartog
Copy link
Member

I was able to fix once I updated to Node 14.16.1 and ran lerna bootstrap and lerna run build

@ntn-x2
Copy link
Contributor Author

ntn-x2 commented Jun 3, 2021

Ok thanks @kdenhartog, I can confirm that with Node 14(.17.0) the tests are now passing without failing. I was previously running them with Node 12. Perhaps this could be specified somewhere in the README file.

kdenhartog added a commit that referenced this issue Jun 5, 2021
This is useful to prevent people from encountering the same issues as what @Diiaablo95 found in issue #99
@kdenhartog
Copy link
Member

@Diiaablo95 the packages.json should trigger a warning if something below Node 14 is used once PR #160 is merged

@kdenhartog kdenhartog self-assigned this Jun 5, 2021
msporny pushed a commit that referenced this issue Jun 5, 2021
This is useful to prevent people from encountering the same issues 
as what @Diiaablo95 found in issue #99.
@kdenhartog
Copy link
Member

This has been addressed now and is merged. Closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants