Create-daml-app testing not working

I am following the tutorial here: Testing Your Web App — Daml SDK 2.5.0 documentation to test the demo, but I got following error when I did npm run test

Hi @cdfwb,

Could you please share more detailed repro steps? Here’s what I do:

  1. Make sure I have both a JDK and a NodeJS installed:
    $ java -version
    openjdk version "11.0.11" 2021-04-20 LTS
    OpenJDK Runtime Environment Zulu11.48+21-CA (build 11.0.11+9-LTS)
    OpenJDK 64-Bit Server VM Zulu11.48+21-CA (build 11.0.11+9-LTS, mixed mode)
    $ node --version
    v18.12.1
    $
    
  2. Make sure I have Daml installed:
    $ daml version
    SDK versions:
      2.5.0  (default SDK version for new projects)
    $
    
  3. Create a project:
    $ daml new --template=create-daml-app create-daml-app
    Created a new project in "create-daml-app" based on the template "create-daml-app".
    $ cd create-daml-app
    $
    
  4. Do the “Your First Feature” changes manually to daml/User.daml, ui/src/components/MessageList.tsx, ui/src/components/MessageEdit.tsx, and ui/src/components/MainView.tsx.
  5. In the ui folder, run the documented install command to add the testing dependencies:
    $ cd ui
    $ npm i --save-dev puppeteer@~10.0.0 wait-on@~6.0.1 @types/jest@~29.2.3 @types/node@~18.11.9 @types/puppeteer@~7.0.4 @types/wait-on@~5.3.1
    npm WARN deprecated @types/dotenv@8.2.0: This is a stub types definition. dotenv provides its own type definitions, so you do not need this installed.
    [...]
    added 2018 packages, and audited 2020 packages in 1m
    
    172 packages are looking for funding
      run `npm fund` for details
    
    43 vulnerabilities (2 moderate, 32 high, 9 critical)
    
    To address issues that do not require attention, run:
      npm audit fix
    
    To address all issues (including breaking changes), run:
      npm audit fix --force
    
    Run `npm audit` for details.
    npm notice
    npm notice New major version of npm available! 8.19.2 -> 9.2.0
    npm notice Changelog: https://github.com/npm/cli/releases/tag/v9.2.0
    npm notice Run npm install -g npm@9.2.0 to update!
    npm notice
    $
    
  6. In the base project folder, run daml codegen js:
    $ cd ..
    $ daml build
    
    2023-01-03 11:20:44.17 [INFO]  [build]
    Compiling create-daml-app to a DAR.
    
    2023-01-03 11:20:45.28 [INFO]  [build]
    Created .daml/dist/create-daml-app-0.1.0.dar
    $ daml codegen js
    Generating 057eed1fd48c238491b8ea06b9b5bf85a5d4c9275dd3f6183e0e6b01730cc2ba
    Generating 38e6274601b21d7202bb995bc5ec147decda5a01b68d57dda422425038772af7
    Generating 3f4deaf145a15cdcfa762c058005e2edb9baa75bb7f95a4f8f6f937378e86415
    Generating 40f452260bef3f29dede136108fc08a88d5a5250310281067087da6f0baddff7
    Generating 4416720ed0a51d089c55f9588bcfc717b9bc0185380a50f4086bcc9f7fccad65
    Generating 518032f41fd0175461b35ae0c9691e08b4aea55e62915f8360af2cc7a1f2ba6c
    Generating 6839a6d3d430c569b2425e9391717b44ca324b88ba621d597778811b2d05031d
    Generating 6c2c0667393c5f92f1885163068cd31800d2264eb088eb6fc740e11241b2bf06
    Generating 733e38d36a2759688a4b2c4cec69d48e7b55ecc8dedc8067b815926c917a182a
    Generating 76bf0fd12bd945762a01f8fc5bbcdfa4d0ff20f8762af490f8f41d6237c6524f
    Generating 86828b9843465f419db1ef8a8ee741d1eef645df02375ebf509cdc8c3ddd16cb
    Generating 8a7806365bbd98d88b4c13832ebfa305f6abaeaf32cfa2b7dd25c4fa489b79fb
    Generating 94f7c83923aa273fb90b907f57385ae951ca1195fb35806275cbd03e9e4faab6
    Generating create-daml-app-0.1.0 (hash: 95b950675e22ee0ec69032b7555542cd4f3e36cc1f45c08b34127f9400d8a267)
    Generating 97b883cd8a2b7f49f90d5d39c981cf6e110cf1f1c64427a28a6d58ec88c43657
    Generating 99a2705ed38c1c26cbb8fe7acf36bbf626668e167a33335de932599219e0a235
    Generating bfcd37bd6b84768e86e432f5f6c33e25d9e7724a9d42e33875ff74f6348e733f
    Generating c1f1f00558799eec139fb4f4c76f95fb52fa1837a5dd29600baa1c8ed1bdccfd
    Generating cb0552debf219cc909f51cbb5c3b41e9981d39f8f645b1f35e2ef5be2e0b858a
    Generating cc348d369011362a5190fe96dd1f0dfbc697fdfd10e382b9e9666f0da05961b7
    Generating d14e08374fc7197d6a0de468c968ae8ba3aadbf9315476fd39071831f5923662
    Generating d58cf9939847921b2aab78eaa7b427dc4c649d25e6bee3c749ace4c3f52f5c97
    Generating e22bce619ae24ca3b8e6519281cb5a33b64b3190cc763248b4c3f9ad5087a92c
    Generating e491352788e56ca4603acc411ffe1a49fefd76ed8b163af86cf5ee5f4c38645b
    Generating f0556456c77842ba65d56debf7d57cb52143865cad8ec84215e49bd22833acaf
    Generating f20de1e4e37b92280264c08bf15eca0be0bc5babd7a7b5e574997f154c00cb78
    $
    
  7. Add the ui/src/index.test.ts file from the documentation.
  8. Back in the ui folder, run install again to get the generate code:
    $ cd ui
    $ npm install
    
    added 4 packages, changed 1 package, and audited 2027 packages in 5s
    
    173 packages are looking for funding
      run `npm fund` for details
    
    43 vulnerabilities (2 moderate, 32 high, 9 critical)
    
    To address issues that do not require attention, run:
      npm audit fix
    
    To address all issues (including breaking changes), run:
      npm audit fix --force
    
    Run `npm audit` for details.
    $
    
  9. Finally, run the tests with npm test, which takes over my terminal so there’s no useful step-by-step for me to copy-paste here. This gives me one error, which is a bit different from yours: we’ve relaxed the constraints on user IDs a bit so the test that Alice is an invalid user name (line 427 in the test file) now fails. Uppercase letters used to be invalid, now they are accepted.
1 Like