GMOD / cram-js

Read CRAM v3 and v2 in node or in the browser
MIT License
18 stars 9 forks source link

Failed tests #113

Closed 0xorial closed 2 years ago

0xorial commented 2 years ago

If I run yarn run tests I get 3 tests failed. Is that normal?

cmdcolin commented 2 years ago

Which tests fail? Can you paste a complete log files?

0xorial commented 2 years ago
PS C:\Users\user\repos\cram-js> yarn run test
yarn run v1.22.17
$ jest

 PASS  test/binary-parser.test.ts

 PASS  test/crai.test.ts           

 PASS  test/util.test.ts           

 PASS  test/example-code.test.ts (5.614 s)
  ● Console

    console.log
      C:\Users\user\repos\cram-js

      at Object.<anonymous> (test/example-code.test.ts:4:9)

 PASS  test/retry.test.ts (5.711 s)     
 PASS  test/lossy-names.test.ts
 FAIL  test/parse.test.ts (5.812 s)       
  ● CRAM reader › can read a bigger cram file

    CRAM version 114 not supported

      90 |     const definition = cramFileDefinitionParser.parser.parse(headbytes).result
      91 |     if (definition.majorVersion !== 2 && definition.majorVersion !== 3) {
    > 92 |       throw new CramUnimplementedError(
         |             ^
      93 |         `CRAM version ${definition.majorVersion} not supported`,
      94 |       )
      95 |     }

      at CramFile.<anonymous> (src/cramFile/file.js:92:13)
      at fulfilled (src/cramFile/file.js:5:58)

  ● CRAM reader › can read an even bigger cram file

    CRAM version 114 not supported

      90 |     const definition = cramFileDefinitionParser.parser.parse(headbytes).result
      91 |     if (definition.majorVersion !== 2 && definition.majorVersion !== 3) {
    > 92 |       throw new CramUnimplementedError(
         |             ^
      93 |         `CRAM version ${definition.majorVersion} not supported`,
      at fulfilled (src/cramFile/file.js:5:58)

 FAIL  test/indexedfile.test.ts (13.768 s)
  ● .crai indexed cram file › can fetch some regions of tomato example data correctly

    invalid .crai index file

      107 |             // if there are other characters in the file besides
      108 |             // space and \r, something is wrong.
    > 109 |             throw new CramMalformedError('invalid .crai index file')
          |                   ^
      110 |           }
      111 |         }
      112 |

      at src/craiIndex.js:109:19

         |               ^
      84 |         `${this.file}: container header at ${position} indicates that the container has length ${header1.length}, which extends beyond the length of the file. Skipping this container.`,
      85 |       )
      86 |       return undefined

      at CramContainer.<anonymous> (src/cramFile/container/index.js:83:15)
      at fulfilled (src/cramFile/container/index.js:5:58)

Test Suites: 2 failed, 7 passed, 9 total
Tests:       3 failed, 259 passed, 262 total
Snapshots:   1 passed, 1 total
Time:        28.882 s
Ran all test suites.
error Command failed with exit code 1.
cmdcolin commented 2 years ago

odd! have not seen any failing tests like that before.

this happens with a clean repo e.g. just after cloning the repo, ran yarn, then yarn test?

the only difference i can see from my test environment is that you are using windows and i have linux but not sure why that would change anything

cmdcolin commented 2 years ago

can confirm that booting up a windows VM from modern.ie (MSEdge on Win10) https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/ and testing on that platform has the same errors posted by @0xorial

rbuels commented 2 years ago

is there any potential to get our CI on windows?

cmdcolin commented 2 years ago

might be able to do CI on windows. random note: wsl on windows works ok, it is just plain old windows that has the issue

cmdcolin commented 2 years ago

looks like the failed tests are three so-called 'extended' tests which reference test data that is not in the main repo using symlinks (see arrow icons here) https://github.com/GMOD/cram-js/tree/master/test/data/extended that are only valid on dev machines, they were only used during early library development i think

the reason these tests fail on windows is because git on windows clones the symlinks wrong by default, and then the logic in the tests for detecting the symlinks gets confused and thinks that they are valid, and then fails to interpret them

there are about 3 failed tests corresponding to the 3 extended tests

maybe we can probably remove the extended data tests or reduce them in size. alternatively, you can use wsl, as mentioned above, or

git clone -c core.symlinks=true https://github.com/GMOD/cram-js

This helps preserve the symlinks. Requires administrative console in windows

cmdcolin commented 2 years ago

should be able to just use normal clone and test now on master branch, the extended tests are removed now

cmdcolin commented 2 years ago

thanks for reporting :)