cenfun / nextjs-with-playwright-istanbul

nextjs-with-playwright-istanbul
MIT License
3 stars 1 forks source link

TypeError [ERR_INVALID_ARG_TYPE] #3

Closed ogous closed 2 months ago

ogous commented 3 months ago

After clone the repo and npm run test encountered with this error: Next.js version is 14.2.4

[WebServer] TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at validateString (node:internal/validators:162:11)
    at Object.dirname (node:path:1279:5)
    at getBabelLoader (/Users/oguzhanali/Development/nextjs-with-playwright-istanbul/node_modules/next/dist/build/webpack-config.js:359:39)
    at getBaseWebpackConfig (/Users/oguzhanali/Development/nextjs-with-playwright-istanbul/node_modules/next/dist/build/webpack-config.js:366:6)
    at HotReloaderWebpack.buildFallbackError (/Users/oguzhanali/Development/nextjs-with-playwright-istanbul/node_modules/next/dist/server/dev/hot-reloader-webpack.js:549:65)
    at async DevBundlerService.getFallbackErrorComponents (/Users/oguzhanali/Development/nextjs-with-playwright-istanbul/node_modules/next/dist/server/lib/dev-bundler-service.js:25:9)
    at async DevServer.getFallbackErrorComponents (/Users/oguzhanali/Development/nextjs-with-playwright-istanbul/node_modules/next/dist/server/dev/next-dev-server.js:593:9)
    at async DevServer.renderErrorToResponseImpl (/Users/oguzhanali/Development/nextjs-with-playwright-istanbul/node_modules/next/dist/server/base-server.js:2210:40)
    at async pipe.req.req (/Users/oguzhanali/Development/nextjs-with-playwright-istanbul/node_modules/next/dist/server/base-server.js:2063:30)
    at async DevServer.pipeImpl (/Users/oguzhanali/Development/nextjs-with-playwright-istanbul/node_modules/next/dist/server/base-server.js:920:25)
    at async /Users/oguzhanali/Development/nextjs-with-playwright-istanbul/node_modules/next/dist/server/dev/next-dev-server.js:339:20
    at async Span.traceAsyncFn (/Users/oguzhanali/Development/nextjs-with-playwright-istanbul/node_modules/next/dist/trace/trace.js:154:20)
    at async DevServer.handleRequest (/Users/oguzhanali/Development/nextjs-with-playwright-istanbul/node_modules/next/dist/server/dev/next-dev-server.js:336:24)
    at async invokeRender (/Users/oguzhanali/Development/nextjs-with-playwright-istanbul/node_modules/next/dist/server/lib/router-server.js:174:21)
    at async requestHandlerImpl (/Users/oguzhanali/Development/nextjs-with-playwright-istanbul/node_modules/next/dist/server/lib/router-server.js:389:24)
    at async Server.requestListener (/Users/oguzhanali/Development/nextjs-with-playwright-istanbul/node_modules/next/dist/server/lib/start-server.js:141:13) {
  code: 'ERR_INVALID_ARG_TYPE'
}
cenfun commented 3 months ago

Yes, I can reproduce this issue after updated nextjs to latest version. see nextjs issue: https://github.com/vercel/next.js/issues/66997 Could you please try previous version of Nextjs?

ogous commented 3 months ago

@cenfun tried with next@14.2.3 but other errors are occured:

[WebServer] Starting inspector on 127.0.0.1:9230 failed: address already in use
[WebServer]  ⨯ ./node_modules/next/dist/client/app-call-server.js
Error: Failed to resolve "@babel/runtime/regenerator" relative to "/Users/oguzhanali/Development/nextjs-with-playwright-istanbul"
Import trace for requested module:
./node_modules/next/dist/client/app-call-server.js
./node_modules/next/dist/client/app-index.js
[WebServer]  ⨯ ./node_modules/next/dist/client/components/react-dev-overlay/internal/helpers/getErrorByType.js
Error: Failed to resolve "@babel/runtime/regenerator" relative to "/Users/oguzhanali/Development/nextjs-with-playwright-istanbul"
Import trace for requested module:
./node_modules/next/dist/client/components/react-dev-overlay/internal/helpers/getErrorByType.js
./node_modules/next/dist/client/components/react-dev-overlay/pages/client.js
./node_modules/next/dist/client/components/react-dev-overlay/pages/hot-reloader-client.js
./node_modules/next/dist/client/dev/hot-middleware-client.js
[WebServer]  ⨯ Error: ENOENT: no such file or directory, open '/Users/oguzhanali/Development/nextjs-with-playwright-istanbul/.next/fallback-build-manifest.json'
    at readFileSync (node:fs:453:20)
    at loadManifest (/Users/oguzhanali/Development/nextjs-with-playwright-istanbul/node_modules/next/dist/server/load-manifest.js:35:54)
    at loadManifestWithRetries (/Users/oguzhanali/Development/nextjs-with-playwright-istanbul/node_modules/next/dist/server/load-components.js:40:51)
    at async loadDefaultErrorComponentsImpl (/Users/oguzhanali/Development/nextjs-with-playwright-istanbul/node_modules/next/dist/server/load-default-error-components.js:30:24)
    at async DevServer.getFallbackErrorComponents (/Users/oguzhanali/Development/nextjs-with-playwright-istanbul/node_modules/next/dist/server/dev/next-dev-server.js:594:16)
    at async DevServer.renderErrorToResponseImpl (/Users/oguzhanali/Development/nextjs-with-playwright-istanbul/node_modules/next/dist/server/base-server.js:2203:40)
    at async DevServer.renderToResponseImpl (/Users/oguzhanali/Development/nextjs-with-playwright-istanbul/node_modules/next/dist/server/base-server.js:2019:30)
    at async DevServer.pipeImpl (/Users/oguzhanali/Development/nextjs-with-playwright-istanbul/node_modules/next/dist/server/base-server.js:920:25)
    at async NextNodeServer.handleCatchallRenderRequest (/Users/oguzhanali/Development/nextjs-with-playwright-istanbul/node_modules/next/dist/server/next-server.js:272:17)
    at async DevServer.handleRequestImpl (/Users/oguzhanali/Development/nextjs-with-playwright-istanbul/node_modules/next/dist/server/base-server.js:816:17)
    at async /Users/oguzhanali/Development/nextjs-with-playwright-istanbul/node_modules/next/dist/server/dev/next-dev-server.js:339:20
    at async Span.traceAsyncFn (/Users/oguzhanali/Development/nextjs-with-playwright-istanbul/node_modules/next/dist/trace/trace.js:154:20)
    at async DevServer.handleRequest (/Users/oguzhanali/Development/nextjs-with-playwright-istanbul/node_modules/next/dist/server/dev/next-dev-server.js:336:24)
    at async invokeRender (/Users/oguzhanali/Development/nextjs-with-playwright-istanbul/node_modules/next/dist/server/lib/router-server.js:174:21)
    at async handleRequest (/Users/oguzhanali/Development/nextjs-with-playwright-istanbul/node_modules/next/dist/server/lib/router-server.js:353:24)
    at async requestHandlerImpl (/Users/oguzhanali/Development/nextjs-with-playwright-istanbul/node_modules/next/dist/server/lib/router-server.js:377:13)
    at async Server.requestListener (/Users/oguzhanali/Development/nextjs-with-playwright-istanbul/node_modules/next/dist/server/lib/start-server.js:141:13) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/oguzhanali/Development/nextjs-with-playwright-istanbul/.next/fallback-build-manifest.json'
}

9230 is free but do not know why it says already in use. Your nextjs-with-playwrite works fine when I tried the repo.

cenfun commented 3 months ago

Yes, I personally recommend using V8 coverage. see here: https://github.com/cenfun/nextjs-with-playwright I test it with next@14.1.4 and got same error The "path" argument must be of type string. It seems that Next.js no longer has perfect support for Babel, However, Istanbul's coverage depends on babel-plugin-istanbul. I'm not sure if Next.js will fix it, but please try V8 coverage instead of Istanbul.

ogous commented 2 months ago

@cenfun yes thanks used mentioned library instead. Thanks for these examples and libraries, great work!