Giter Club home page Giter Club logo

nextjs-http-supertest's People

Contributors

almontasser avatar justin-caldicott avatar mnahkies avatar mrcwbr avatar mtbrault avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

nextjs-http-supertest's Issues

Doesn't work with ESM

I tried to use this library, but apparently, it can't handle ES Modules (ie. "type": "module" in package.json),.

When I tried to run it, it immediately failed after trying to require one of my (ESM) API endpoints (feedback.js).

Error [ERR_REQUIRE_ESM]: require() of ES Module /home/me/project/next/pages/api/feedback.js from /home/me/project/next/node_modules/nextjs-http-supertest/index.js not supported.
Instead change the require of feedback.js in /home/me/project/next/node_modules/nextjs-http-supertest/index.js to a dynamic import() which is available in all CommonJS modules.

No tests

There are currently no tests of this implementation. Ideally, a simple nextjs app would be tested via supertest.

I believe this would have caught the latest regression. It would also be nice to be able to extend the tests for regressions as issues are resolved.

Isn't compatible with monorepos

I've just tried to implement this in a project that makes use of a monorepo. Only one of my packages requires this test. I run into the following issue:
Error handling request in nextjs-http-supertest: TypeError: Cannot destructure property 'route' of 'getDynamicRoute(...)' as it is undefined.

Upon further inspection, I find out that rootPath and thus nextPagesDirectory don't take in account mono repos. Logging them gives:

{
  rootPath: '/Users/vashiru/Workspaces/my-project',
  nextPagesDirectory: '/Users/vashiru/Workspaces/my-project/src/pages'
}

It should however be looking in /Users/vashiru/Workspaces/my-project/apps/web/pages (as web is my workspace name).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.