power-assert-js/espower-typescript

How to set espower-typescript/guess in tsconfig.json

lygstate opened this issue · 4 comments

How to set espower-typescript/guess in tsconfig.json

You don't have to set espower-typescript/guess in tsconfig.json.
Just run mocha --compilers ts:espower-typescript/guess test/**/*.ts.

@teppeis, I am not using mocha directly, I am using it in protractor, how to do that?

// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/docs/referenceConf.js

exports.config = {
  allScriptsTimeout: 11000,
  specs: [
    './e2e/**/*.e2e-spec.ts'
  ],
  capabilities: {
    'browserName': 'chrome'
  },
  directConnect: true,
  baseUrl: 'http://localhost:4200/',
  framework: 'mocha',
  mochaOpts: {
    reporter: 'spec',
    timeout: 10000 /* The default timeout for mocha */
  },
  useAllAngular2AppRoots: true,
  beforeLaunch: function () {
    require('ts-node').register({
      project: 'e2e'
    })
  },
  onPrepare: function () {
  }
}

@lygstate sorry I don't know protractor and ts-node...
ts-node transpiles TS to JS on the fly, so it would not work with espower-typescript that does the same task.

Also you can specify tsconfig.json path manually, instead of using guess.js.
See the code in https://github.com/power-assert-js/espower-typescript/blob/master/guess.js

I will close this. Please report if you need.