w3c / did-test-suite

W3C DID Test Suite and Implementation Report

Home Page:https://w3c.github.io/did-test-suite/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Test suite failing?

ntn-x2 opened this issue · comments

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?

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.

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

I have the same problem
image

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.

@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.

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

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

@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. 🤷🏻‍♂️

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

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

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.

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

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