Supertest: Add ES6 support

Created on 5 May 2015  路  5Comments  路  Source: visionmedia/supertest

Most helpful comment

why this has been closed?

I was able to use it with import * as request from 'supertest'; but with the ts esModuleInterop to true import request from 'supertest'; does not work, giving TypeError: request is not a function.

For now I'm doing import * as request = require('supertest'); so I get also the type definitions

All 5 comments

what I did is create a test_helper.js:

import sinon from 'sinon'
import chai from 'chai'
import sinonChai from 'sinon-chai'
var expect = chai.expect
chai.use(sinonChai)

var supertest = require("supertest");

module.exports = {
  sinon: sinon,
  chai: chai,
  expect: expect,
  supertest: supertest
} 

Then in your testing file:

import {sinon, chai, expect, supertest} from '../test_helper'

thanks @foxgaocn I'll using that. I dont know if this issue can remaind open until that supertest add ES6 support without using workarounds

Any updates on this?

Any updates on this?

why this has been closed?

I was able to use it with import * as request from 'supertest'; but with the ts esModuleInterop to true import request from 'supertest'; does not work, giving TypeError: request is not a function.

For now I'm doing import * as request = require('supertest'); so I get also the type definitions

Was this page helpful?
0 / 5 - 0 ratings

Related issues

EverettQuebral picture EverettQuebral  路  3Comments

Shingaz picture Shingaz  路  5Comments

peterjuras picture peterjuras  路  3Comments

ghost picture ghost  路  5Comments

nareshbhatia picture nareshbhatia  路  6Comments