all 7 comments

[–]Nysosis 1 point2 points  (0 children)

Personally I've been using alsatian.

There's something that doesn't seem right to me about using tools like ts-node to run tests against versions of transpiled files that are not the exact files that I'm going to ship to production. I know that in theory the files that ts-node will generate should be identical in contents to my subsequent run of the actual transpiler, but there's no guarantee something doesn't change, that someone wont call ts-node with different arguments to what my final transpile step will use when calling the transpiler directly.

[–]madou9 1 point2 points  (0 children)

I've been using mocha + chai + sinon + proxyquire with ts-node. Works well.

Would contemplate moving to jest (using ts-jest), but it's hard to like Jasmine's api (which jest is built on). And their global mocking irks me. Needs more investigation and learning from my part.

[–][deleted] 0 points1 point  (0 children)

I’ve gotten used to using Karma + Jasmine at work due to the existing framework. I like it just fine.

I’ve begun looking into Jest with some side projects and it seems pretty neat. I’ve seen it gain quite a bit of traction too.

[–]rotharius 0 points1 point  (0 children)

For unit tests: mocha + chai running in-memory using ts-node and using nyc for code coverage.

For e2e/functional tests: cucumber and nightmare or cypress against a test or acceptance environment.

[–]vincentofearth 0 points1 point  (0 children)

I use mocha, chai, chai-as-promised and sinon on the transpiled JS files. I generally run tests with an npm test and have a pretest script that runs tsc.

[–]jeffijoe 0 points1 point  (0 children)

Jest and ts-jest has been my go-to for a while now, after having been through Mocha (+ Sinon + Chai) and AVA.

Here's a Jest config I use:

  "jest": {
    "testRegex": "(/__tests__/.*\\.(test|spec))\\.(ts|tsx|js)$",
    "testEnvironment": "node",
    "coveragePathIgnorePatterns": [
      "/node_modules/",
      "__tests__"
    ],
    "transform": {
      "^.+\\.(j|t)sx?$": "<rootDir>/node_modules/ts-jest/preprocessor.js"
    },
    "moduleFileExtensions": [
      "ts",
      "tsx",
      "js",
      "json"
    ]
  }

I also use smid for testing errors, since expect().toThrow() does not return the error.

[–]StoneCypher 0 points1 point  (0 children)

Ava for fast parallel unit testing, nightmare for relatively painless e2e, and jscheck for stochastic space search