TheBrainFamily / chimpy

Develop acceptance tests & end-to-end tests with realtime feedback.
https://thebrainfamily.github.io/chimpy
MIT License
52 stars 28 forks source link

How to use chimp writing tests in TypeScript #51

Open samhatoum opened 6 years ago

samhatoum commented 6 years ago

Issue by sergeyt Thursday Sep 22, 2016 at 15:48 GMT Originally opened as https://github.com/xolvio/chimp/issues/479


Please provide examples and consider adding builtin support of TypeScript specs for mocha or jasmine testing frameworks. Or just add support for custom options passed to mocha like config from webdriverio:

mochaOpts: {
  ui: 'bdd',
  compilers: ['ts:ts-node/register'],
  requires: ['./test/helpers/common.js']
}
samhatoum commented 6 years ago

Comment by samhatoum Thursday Sep 22, 2016 at 18:32 GMT


We can do that easily. Just need to allow users to add configs to Mocha.

Note to self, this is the line: https://github.com/xolvio/chimp/blob/master/src/lib/mocha/mocha-wrapper.js#L13

samhatoum commented 6 years ago

Comment by sergeyt Friday Sep 23, 2016 at 04:27 GMT


@samhatoum great, thanks! As workaround now I run TypeScript compiler before running tests, but seamless integration is usually better for interactive development.

samhatoum commented 6 years ago

Comment by timbru31 Wednesday Mar 08, 2017 at 17:22 GMT


Well you can pass custom mocha CLI options now (e.g. via chimp --mocha --mochaCommandLineOptions '{"compilers": ["ts:./scripts/setup-ts-node"], "watch-extensions": ["ts"]}, but the problem currently is that chimp is explicitly allowing only .js files to be executed (as per https://github.com/xolvio/chimp/blob/master/src/lib/mocha/mocha-wrapper.js#L41). This checks needs to be adjusted with the passed watch-extensions from mocha with the .js fallback (and maybe use String.prototype.endsWith instead)

Haven't checked jasmine or cucumber so far.