When building the project locally, I'm getting the...
# troubleshoot
b
When building the project locally, I'm getting the a test failed error. Just wondering how I can fix this? is it a node.js issue? which version of node.js is supported to build the project?
g
Hey @bland-teacher-17190 - it could be a version issue. Could you try cd into
datahub-web-react
and running
yarn install
/
yarn test
from there?
also, would you mind moving the stacktrace into this thread to keep the main channel conversation a bit clearer?
b
I've tried to run
yarn install
/`yarn test` under
datahub-web-react
, but this time the tests all pass. I did have to install
yarn 1.22.15
, though, because I didn't have yarn installed on my system before.
Again, the original stack trace is below:
Copy code
> Task :datahub-web-react:yarnTest
FAIL src/app/entity/tag/__tests__/TagProfile.test.tsx (18.245 s)
  ● TagProfile › renders stats

    TestingLibraryElementError: Unable to find an element by: [data-testid="stats-DATASET"]

    <body>
      <div>
        <div
          class="ant-message"
        >
          <div />
        </div>
      </div>
      <div>
        <div
          class="sc-dlnjwi ccElLy"
        >
          <div
            class="ant-card ant-card-bordered"
          >
            <div
              class="ant-card-head"
            >
              <div
                class="ant-card-head-wrapper"
              >
                <div
                  class="ant-card-head-title"
                >
                  <div
                    class="sc-fujyAs kMqbjE"
                  >
                    <div>
                      <div>
                        <span
                          class="ant-typography sc-eCApnc gByhvf"
                        >
                          Tag
                        </span>
                        <h1
                          class="ant-typography sc-iCoGMd hGIgQS"
                        >
                          abc-sample-tag
                        </h1>
                      </div>
                      <div>
                        <div>
                          <span
                            class="ant-typography sc-jSFjdj jiTnqi"
                          >
                            Created by
                          </span>
                        </div>
                      </div>
                    </div>
                    <div
                      class="sc-pNWdM cVEqqs"
                    >
                      <span
                        class="ant-typography sc-gKAaRy bVdZDq"
                      >
                        Applied to
                      </span>
                      <div>
                        <span
                          class="ant-typography sc-kEqXSa hBaExz"
                        >
                          Loading...
                        </span>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <div
              class="ant-card-body"
            >
              <div
                class="ant-typography"
                style="color: rgb(140, 140, 140); font-size: 13px;"
              >
                <strong>
                  Description
                </strong>
              </div>
              <span
                class="ant-typography"
              >
                sample tag description
              </span>
            </div>
          </div>
        </div>
      </div>
    </body>

      59 |         await waitFor(() => expect(queryByText('Loading')).not.toBeInTheDocument());
      60 |
    > 61 |         expect(getByTestId('stats-DATASET')).toBeInTheDocument();
         |                ^
      62 |         expect(getByTestId('stats-CORP_USER')).toBeInTheDocument();
      63 |         expect(queryByText('1 Datasets')).toBeInTheDocument();
      64 |         expect(queryByText('2 Users')).toBeInTheDocument();

      at Object.getElementError (node_modules/@testing-library/dom/dist/config.js:37:19)
      at node_modules/@testing-library/dom/dist/query-helpers.js:90:38
      at node_modules/@testing-library/dom/dist/query-helpers.js:62:17
      at getByTestId (node_modules/@testing-library/dom/dist/query-helpers.js:111:19)
      at Object.<anonymous> (src/app/entity/tag/__tests__/TagProfile.test.tsx:61:16)
g
Alright- it sounds like the gradle yarn command is using a different yarn
after you ran manually, what happens if you try the gradle command again?
b
gradlew build
failed again, same error
g
can I ask you a favor?
can you try updating datahub-web-react/build.gradle
yarn version to
1.22.10
and node version to
16.4.2
and then try running yarnTest gradle command again?
b
I was able to get past the error - for some reason, two
build
directories were owned by
root
, so my previous
gradlew clean
were not successful. After I changed the ownership to my non-root user, gradle got past this error. Now I have a "sqlite3 version too old" error, but at least it's solvable. Thanks for your help!
g
sounds good!