Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Superagent-proxy integration Failed #291

Open
jovmilan95 opened this issue May 31, 2021 · 0 comments
Open

Superagent-proxy integration Failed #291

jovmilan95 opened this issue May 31, 2021 · 0 comments

Comments

@jovmilan95
Copy link

const data = require("./test_data");
const faker = require("faker");
const chai = require("chai");
const chaiHttp = require("chai-http");
const jwtDecode = require("jwt-decode");
const dayjs = require("dayjs");
const sleep = require('sleep');

const server = process.env.JETWEB_TEST_INSTANCE;
const should = chai.should();

chai.use(chaiHttp);
chai.request.Request = chai.request.Test;
require('superagent-proxy')(chai.request.Test);

let sessionCookie = "";

describe("Users", () => {
describe("Shows the UI of the application", () => {
it("it should get home API url", done => {
chai
.request(server)
.get("/app")
.proxy("http://127.0.0.1:9999")
.end((err, res) => {
res.should.have.status(200, res.text);
// console.log(res)
done();
});
});
});

Got error

D:\jetweb\frontend\node_modules\superagent-proxy\index.js:92
if (desc.get == getUrl && desc.set == setUrl) return; // already patched
^

TypeError: Cannot read property 'get' of undefined
at setupUrl (D:\jetweb\frontend\node_modules\superagent-proxy\index.js:92:12)
at Function.proxy (D:\jetweb\frontend\node_modules\superagent-proxy\index.js:68:3)
at setup (D:\jetweb\frontend\node_modules\superagent-proxy\index.js:50:18)
at Object. (D:\jetweb\frontend\tests\api\users.js:14:28)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:973:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Module.require (node:internal/modules/cjs/loader:997:19)
at require (node:internal/modules/cjs/helpers:92:18)

No way from this issue was helpful
Any suggestions?

├── chai-http@4.3.0
├── chai@4.3.4
├── superagent-proxy@1.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant