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

Detect node sass and react version #13968

Closed
wants to merge 3 commits into from
Closed

Detect node sass and react version #13968

wants to merge 3 commits into from

Conversation

todortotev
Copy link
Contributor

@todortotev todortotev commented Jun 9, 2020

Closes 13961
Closes 13953

@Timer @timneutkens Will cc you when done.

@ijjk
Copy link
Member

ijjk commented Jun 9, 2020

Failing test suites

test/integration/app-functional/test/index.test.js

  • Document and App > should not have any missing key warnings
Expand output

● Document and App › should not have any missing key warnings

FetchError: request to http://localhost:40677/ failed, reason: connect ECONNREFUSED 127.0.0.1:40677

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● Test suite failed to run

TypeError: Cannot read property 'pid' of undefined

  263 | export async function killApp(instance) {
  264 |   await new Promise((resolve, reject) => {
> 265 |     treeKill(instance.pid, (err) => {
      |                       ^
  266 |       if (err) {
  267 |         if (
  268 |           process.platform === 'win32' &&

  at lib/next-test-utils.js:265:23
  at killApp (lib/next-test-utils.js:264:9)
  at integration/app-functional/test/index.test.js:26:18

test/integration/app-document/test/index.test.js

  • Document and App > should not have any missing key warnings
  • Document and App > Client side > should detect the changes to pages/_app.js and display it
  • Document and App > Client side > should detect the changes to pages/_document.js and display it
  • Document and App > Client side > should keep state between page navigations
  • Document and App > Client side > It should share module state with pages
  • Document and App > Rendering via HTTP > _app > It shows a custom tag
  • Document and App > Rendering via HTTP > _app > It should share module state with pages
  • Document and App > Rendering via HTTP > _app > It should show valid error when thrown in _app getInitialProps
  • Document and App > Rendering via HTTP > _document > It has a custom html class
  • Document and App > Rendering via HTTP > _document > It has a custom body class
  • Document and App > Rendering via HTTP > _document > It injects custom head tags
  • Document and App > Rendering via HTTP > _document > It passes props from Document.getInitialProps to Document
  • Document and App > Rendering via HTTP > _document > It adds nonces to all scripts and preload links
  • Document and App > Rendering via HTTP > _document > It adds crossOrigin to all scripts and preload links
  • Document and App > Rendering via HTTP > _document > It renders ctx.renderPage with enhancer correctly
  • Document and App > Rendering via HTTP > _document > It renders ctx.renderPage with enhanceComponent correctly
  • Document and App > Rendering via HTTP > _document > It renders ctx.renderPage with enhanceApp correctly
  • Document and App > Rendering via HTTP > _document > It renders ctx.renderPage with enhanceApp and enhanceComponent correctly
  • Document and App > Rendering via HTTP > _document > It adds a timestamp to link tags with preload attribute to invalidate the cache (DEV only)
  • Document and App > With CSP enabled > should load inline script by hash
  • Document and App > With CSP enabled > should load inline script by nonce
Expand output

● Document and App › should not have any missing key warnings

FetchError: request to http://localhost:42819/ failed, reason: connect ECONNREFUSED 127.0.0.1:42819

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● Document and App › Rendering via HTTP › _document › It has a custom html class

FetchError: request to http://localhost:42819/ failed, reason: connect ECONNREFUSED 127.0.0.1:42819

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● Document and App › Rendering via HTTP › _document › It has a custom body class

FetchError: request to http://localhost:42819/ failed, reason: connect ECONNREFUSED 127.0.0.1:42819

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● Document and App › Rendering via HTTP › _document › It injects custom head tags

FetchError: request to http://localhost:42819/ failed, reason: connect ECONNREFUSED 127.0.0.1:42819

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● Document and App › Rendering via HTTP › _document › It passes props from Document.getInitialProps to Document

FetchError: request to http://localhost:42819/ failed, reason: connect ECONNREFUSED 127.0.0.1:42819

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● Document and App › Rendering via HTTP › _document › It adds nonces to all scripts and preload links

FetchError: request to http://localhost:42819/ failed, reason: connect ECONNREFUSED 127.0.0.1:42819

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● Document and App › Rendering via HTTP › _document › It adds crossOrigin to all scripts and preload links

FetchError: request to http://localhost:42819/ failed, reason: connect ECONNREFUSED 127.0.0.1:42819

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● Document and App › Rendering via HTTP › _document › It renders ctx.renderPage with enhancer correctly

FetchError: request to http://localhost:42819/ failed, reason: connect ECONNREFUSED 127.0.0.1:42819

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● Document and App › Rendering via HTTP › _document › It renders ctx.renderPage with enhanceComponent correctly

FetchError: request to http://localhost:42819/ failed, reason: connect ECONNREFUSED 127.0.0.1:42819

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● Document and App › Rendering via HTTP › _document › It renders ctx.renderPage with enhanceApp correctly

FetchError: request to http://localhost:42819/ failed, reason: connect ECONNREFUSED 127.0.0.1:42819

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● Document and App › Rendering via HTTP › _document › It renders ctx.renderPage with enhanceApp and enhanceComponent correctly

FetchError: request to http://localhost:42819/ failed, reason: connect ECONNREFUSED 127.0.0.1:42819

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● Document and App › Rendering via HTTP › _document › It adds a timestamp to link tags with preload attribute to invalidate the cache (DEV only)

FetchError: request to http://localhost:42819/ failed, reason: connect ECONNREFUSED 127.0.0.1:42819

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● Document and App › Rendering via HTTP › _app › It shows a custom tag

FetchError: request to http://localhost:42819/ failed, reason: connect ECONNREFUSED 127.0.0.1:42819

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● Document and App › Rendering via HTTP › _app › It should share module state with pages

FetchError: request to http://localhost:42819/ failed, reason: connect ECONNREFUSED 127.0.0.1:42819

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● Document and App › Rendering via HTTP › _app › It should show valid error when thrown in _app getInitialProps

FetchError: request to http://localhost:42819/ failed, reason: connect ECONNREFUSED 127.0.0.1:42819

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● Document and App › Client side › should detect the changes to pages/_app.js and display it

FetchError: request to http://localhost:42819/ failed, reason: connect ECONNREFUSED 127.0.0.1:42819

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● Document and App › Client side › should detect the changes to pages/_document.js and display it

FetchError: request to http://localhost:42819/ failed, reason: connect ECONNREFUSED 127.0.0.1:42819

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● Document and App › Client side › should keep state between page navigations

FetchError: request to http://localhost:42819/ failed, reason: connect ECONNREFUSED 127.0.0.1:42819

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● Document and App › Client side › It should share module state with pages

FetchError: request to http://localhost:42819/ failed, reason: connect ECONNREFUSED 127.0.0.1:42819

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● Document and App › With CSP enabled › should load inline script by hash

FetchError: request to http://localhost:42819/ failed, reason: connect ECONNREFUSED 127.0.0.1:42819

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● Document and App › With CSP enabled › should load inline script by nonce

FetchError: request to http://localhost:42819/ failed, reason: connect ECONNREFUSED 127.0.0.1:42819

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● Test suite failed to run

TypeError: Cannot read property 'pid' of undefined

  263 | export async function killApp(instance) {
  264 |   await new Promise((resolve, reject) => {
> 265 |     treeKill(instance.pid, (err) => {
      |                       ^
  266 |       if (err) {
  267 |         if (
  268 |           process.platform === 'win32' &&

  at lib/next-test-utils.js:265:23
  at killApp (lib/next-test-utils.js:264:9)
  at integration/app-document/test/index.test.js:37:18

test/integration/amphtml-fragment-style/test/index.test.js

  • AMP Fragment Styles > adds styles from fragment in AMP mode correctly
Expand output

● AMP Fragment Styles › adds styles from fragment in AMP mode correctly

Could not find a valid build in the '/home/runner/work/next.js/next.js/test/integration/amphtml-fragment-style/.next' directory! Try building your app with 'next build' before starting the server.

  1444 |     } catch (err) {
  1445 |       if (!fs.existsSync(buildIdFile)) {
> 1446 |         throw new Error(
       |               ^
  1447 |           `Could not find a valid build in the '${this.distDir}' directory! Try building your app with 'next build' before starting the server.`
  1448 |         )
  1449 |       }

  at Server.readBuildId (../packages/next/next-server/server/next-server.ts:1446:15)
  at new Server (../packages/next/next-server/server/next-server.ts:166:5)
  at createServer (../packages/next/server/next.ts:41:10)
  at integration/amphtml-fragment-style/test/index.test.js:23:11

● Test suite failed to run

TypeError: Cannot read property '__app' of undefined

  297 | 
  298 | export async function stopApp(server) {
> 299 |   if (server.__app) {
      |              ^
  300 |     await server.__app.close()
  301 |   }
  302 |   await promiseCall(server, 'close')

  at stopApp (lib/next-test-utils.js:299:14)
  at integration/amphtml-fragment-style/test/index.test.js:32:18

test/integration/amphtml-custom-optimizer/test/index.test.js

  • AMP Custom Optimizer > should build and start for static page
  • AMP Custom Optimizer > should build and start for dynamic page
Expand output

● AMP Custom Optimizer › should build and start for static page

expect(received).toBe(expected) // Object.is equality

Expected: 0
Received: 1

  19 |   it('should build and start for static page', async () => {
  20 |     const { code } = await nextBuild(appDir, undefined)
> 21 |     expect(code).toBe(0)
     |                  ^
  22 | 
  23 |     appPort = await findPort()
  24 |     app = await nextStart(appDir, appPort)

  at Object.<anonymous> (integration/amphtml-custom-optimizer/test/index.test.js:21:18)

● AMP Custom Optimizer › should build and start for dynamic page

expect(received).toBe(expected) // Object.is equality

Expected: 0
Received: 1

  38 |   it('should build and start for dynamic page', async () => {
  39 |     const { code } = await nextBuild(appDir, undefined)
> 40 |     expect(code).toBe(0)
     |                  ^
  41 | 
  42 |     appPort = await findPort()
  43 |     app = await nextStart(appDir, appPort)

  at Object.<anonymous> (integration/amphtml-custom-optimizer/test/index.test.js:40:18)

test/integration/amphtml-ssg/test/index.test.js

  • AMP SSG Support > dev mode > should load an amp first page correctly
  • AMP SSG Support > dev mode > should load a hybrid amp page without query correctly
  • AMP SSG Support > dev mode > should load dynamic hybrid SSG/AMP page
  • AMP SSG Support > dev mode > should load dynamic hybrid SSG/AMP page with query
  • AMP SSG Support > dev mode > should load a hybrid amp page with query correctly
  • AMP SSG Support > export mode > should have copied SSG files correctly
  • AMP SSG Support > server mode > should load an amp first page correctly
  • AMP SSG Support > server mode > should load a hybrid amp page without query correctly
  • AMP SSG Support > server mode > should load dynamic hybrid SSG/AMP page
  • AMP SSG Support > server mode > should load dynamic hybrid SSG/AMP page with query
  • AMP SSG Support > server mode > should load a hybrid amp page with query correctly
  • AMP SSG Support > server mode > should output prerendered files correctly during build
  • AMP SSG Support > serverless mode > should load an amp first page correctly
  • AMP SSG Support > serverless mode > should load a hybrid amp page without query correctly
  • AMP SSG Support > serverless mode > should load dynamic hybrid SSG/AMP page
  • AMP SSG Support > serverless mode > should load dynamic hybrid SSG/AMP page with query
  • AMP SSG Support > serverless mode > should load a hybrid amp page with query correctly
  • AMP SSG Support > serverless mode > should output prerendered files correctly during build
Expand output

● AMP SSG Support › serverless mode › should load an amp first page correctly

FetchError: request to http://localhost:43675/amp failed, reason: connect ECONNREFUSED 127.0.0.1:43675

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● AMP SSG Support › serverless mode › should load a hybrid amp page without query correctly

FetchError: request to http://localhost:43675/hybrid failed, reason: connect ECONNREFUSED 127.0.0.1:43675

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● AMP SSG Support › serverless mode › should load dynamic hybrid SSG/AMP page

FetchError: request to http://localhost:43675/blog/post-1 failed, reason: connect ECONNREFUSED 127.0.0.1:43675

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● AMP SSG Support › serverless mode › should load dynamic hybrid SSG/AMP page with query

FetchError: request to http://localhost:43675/blog/post-1?amp=1 failed, reason: connect ECONNREFUSED 127.0.0.1:43675

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● AMP SSG Support › serverless mode › should load a hybrid amp page with query correctly

FetchError: request to http://localhost:43675/hybrid?amp=1 failed, reason: connect ECONNREFUSED 127.0.0.1:43675

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● AMP SSG Support › serverless mode › should output prerendered files correctly during build

expect(received).toBe(expected) // Object.is equality

Expected: true
Received: false

  76 | 
  77 |     it('should output prerendered files correctly during build', async () => {
> 78 |       expect(await fsExists(builtPage('amp.js'))).toBe(true)
     |                                                   ^
  79 |       expect(await fsExists(builtPage('amp.html'))).toBe(true)
  80 |       expect(await fsExists(builtPage('amp.json'))).toBe(true)
  81 | 

  at Object.<anonymous> (integration/amphtml-ssg/test/index.test.js:78:51)

● AMP SSG Support › server mode › should load an amp first page correctly

ENOENT: no such file or directory, open '/home/runner/work/next.js/next.js/test/integration/amphtml-ssg/.next/BUILD_ID'

● AMP SSG Support › server mode › should load a hybrid amp page without query correctly

ENOENT: no such file or directory, open '/home/runner/work/next.js/next.js/test/integration/amphtml-ssg/.next/BUILD_ID'

● AMP SSG Support › server mode › should load dynamic hybrid SSG/AMP page

ENOENT: no such file or directory, open '/home/runner/work/next.js/next.js/test/integration/amphtml-ssg/.next/BUILD_ID'

● AMP SSG Support › server mode › should load dynamic hybrid SSG/AMP page with query

ENOENT: no such file or directory, open '/home/runner/work/next.js/next.js/test/integration/amphtml-ssg/.next/BUILD_ID'

● AMP SSG Support › server mode › should load a hybrid amp page with query correctly

ENOENT: no such file or directory, open '/home/runner/work/next.js/next.js/test/integration/amphtml-ssg/.next/BUILD_ID'

● AMP SSG Support › server mode › should output prerendered files correctly during build

ENOENT: no such file or directory, open '/home/runner/work/next.js/next.js/test/integration/amphtml-ssg/.next/BUILD_ID'

● AMP SSG Support › dev mode › should load an amp first page correctly

FetchError: request to http://localhost:33929/amp failed, reason: connect ECONNREFUSED 127.0.0.1:33929

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● AMP SSG Support › dev mode › should load a hybrid amp page without query correctly

FetchError: request to http://localhost:33929/hybrid failed, reason: connect ECONNREFUSED 127.0.0.1:33929

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● AMP SSG Support › dev mode › should load dynamic hybrid SSG/AMP page

FetchError: request to http://localhost:33929/blog/post-1 failed, reason: connect ECONNREFUSED 127.0.0.1:33929

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● AMP SSG Support › dev mode › should load dynamic hybrid SSG/AMP page with query

FetchError: request to http://localhost:33929/blog/post-1?amp=1 failed, reason: connect ECONNREFUSED 127.0.0.1:33929

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● AMP SSG Support › dev mode › should load a hybrid amp page with query correctly

FetchError: request to http://localhost:33929/hybrid?amp=1 failed, reason: connect ECONNREFUSED 127.0.0.1:33929

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● AMP SSG Support › export mode › should have copied SSG files correctly

ENOENT: no such file or directory, open '/home/runner/work/next.js/next.js/test/integration/amphtml-ssg/.next/BUILD_ID'

● Test suite failed to run

TypeError: Cannot read property 'pid' of undefined

  263 | export async function killApp(instance) {
  264 |   await new Promise((resolve, reject) => {
> 265 |     treeKill(instance.pid, (err) => {
      |                       ^
  266 |       if (err) {
  267 |         if (
  268 |           process.platform === 'win32' &&

  at lib/next-test-utils.js:265:23
  at killApp (lib/next-test-utils.js:264:9)
  at integration/amphtml-ssg/test/index.test.js:111:13

● Test suite failed to run

TypeError: Cannot read property 'pid' of undefined

  263 | export async function killApp(instance) {
  264 |   await new Promise((resolve, reject) => {
> 265 |     treeKill(instance.pid, (err) => {
      |                       ^
  266 |       if (err) {
  267 |         if (
  268 |           process.platform === 'win32' &&

  at lib/next-test-utils.js:265:23
  at killApp (lib/next-test-utils.js:264:9)
  at integration/amphtml-ssg/test/index.test.js:128:20

● Test suite failed to run

TypeError: Cannot read property 'pid' of undefined

  263 | export async function killApp(instance) {
  264 |   await new Promise((resolve, reject) => {
> 265 |     treeKill(instance.pid, (err) => {
      |                       ^
  266 |       if (err) {
  267 |         if (
  268 |           process.platform === 'win32' &&

  at lib/next-test-utils.js:265:23
  at killApp (lib/next-test-utils.js:264:9)
  at integration/amphtml-ssg/test/index.test.js:136:20

test/integration/catches-missing-getStaticProps/test/index.test.js

  • Catches Missing getStaticProps > should catch it in dev mode
  • Catches Missing getStaticProps > should catch it in server build mode
  • Catches Missing getStaticProps > should catch it in serverless mode
Expand output

● Catches Missing getStaticProps › should catch it in dev mode

FetchError: request to http://localhost:37935/hello failed, reason: connect ECONNREFUSED 127.0.0.1:37935

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● Catches Missing getStaticProps › should catch it in server build mode

expect(received).toMatch(expected)

Expected pattern: /getStaticPaths was added without a getStaticProps in/
Received string:  "
> Build error occurred
Error: ENOENT: no such file or directory, open '/home/runner/work/next.js/next.js/test/integration/catches-missing-getStaticProps/package.json'

> 1 | "use strict";exports.__esModule=true;exports.default=getBaseWebpackConfig;var _ReactRefreshWebpackPlugin=_interopRequireDefault(require("@next/react-refresh-utils/ReactRefreshWebpackPlugin"));var _crypto=_interopRequireDefault(require("crypto"));var _fs=require("fs");var _chalk=_interopRequireDefault(require("next/dist/compiled/chalk"));var _terserWebpackPlugin=_interopRequireDefault(require("next/dist/compiled/terser-webpack-plugin"));var _path=_interopRequireDefault(require("path"));var _pnpWebpackPlugin=_interopRequireDefault(require("pnp-webpack-plugin"));var _webpack=_interopRequireDefault(require("webpack"));var _constants=require("../lib/constants");var _fileExists=require("../lib/file-exists");var _resolveRequest=require("../lib/resolve-request");var _constants2=require("../next-server/lib/constants");var _findPageFile=require("../server/lib/find-page-file");var _collectPlugins=require("./plugins/collect-plugins");var _config=require("./webpack/config");var _overrideCssConfiguration=require("./webpack/config/blocks/css/overrideCssConfiguration");var _nextPluginLoader=require("./webpack/loaders/next-plugin-loader");var _buildManifestPlugin=_interopRequireDefault(require("./webpack/plugins/build-manifest-plugin"));var _chunkNamesPlugin=_interopRequireDefault(require("./webpack/plugins/chunk-names-plugin"));var _cssMinimizerPlugin=require("./webpack/plugins/css-minimizer-plugin");var _jsconfigPathsPlugin=require("./webpack/plugins/jsconfig-paths-plugin");var _nextDropClientPagePlugin=require("./webpack/plugins/next-drop-client-page-plugin");var _nextEsmPlugin=_interopRequireDefault(require("./webpack/plugins/next-esm-plugin"));var _nextjsSsrImport=_interopRequireDefault(require("./webpack/plugins/nextjs-ssr-import"));var _nextjsSsrModuleCache=_interopRequireDefault(require("./webpack/plugins/nextjs-ssr-module-cache"));var _pagesManifestPlugin=_interopRequireDefault(require("./webpack/plugins/pages-manifest-plugin"));var _profilingPlugin=require("./webpack/plugins/profiling-plugin");var _reactLoadablePlugin=require("./webpack/plugins/react-loadable-plugin");var _serverlessPlugin=require("./webpack/plugins/serverless-plugin");var _webpackConformancePlugin=_interopRequireWildcard(require("./webpack/plugins/webpack-conformance-plugin"));var _wellknownErrorsPlugin=require("./webpack/plugins/wellknown-errors-plugin");var _codeFrame=require("@babel/code-frame");function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var cache=new WeakMap();_getRequireWildcardCache=function(){return cache;};return cache;}function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache();if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}const isWebpack5=parseInt(_webpack.default.version)===5;const escapePathVariables=value=>{return typeof value==='string'?value.replace(/\[(\\*[\w:]+\\*)\]/gi,'[\\$1\\]'):value;};function parseJsonFile(filePath){const JSON5=require('next/dist/compiled/json5');const contents=(0,_fs.readFileSync)(filePath,'utf8');// Special case an empty file
    |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ^
  2 | if(contents.trim()===''){return{};}try{return JSON5.parse(contents);}catch(err){const codeFrame=(0,_codeFrame.codeFrameColumns)(String(contents),{start:{line:err.lineNumber,column:err.columnNumber}},{message:err.message,highlightCode:true});throw new Error(`Failed to parse "${filePath}":\n${codeFrame}`);}}function getOptimizedAliases(isServer){if(isServer){return{};}const stubWindowFetch=_path.default.join(__dirname,'polyfills','fetch','index.js');const stubObjectAssign=_path.default.join(__dirname,'polyfills','object-assign.js');const shimAssign=_path.default.join(__dirname,'polyfills','object.assign');return Object.assign({},{unfetch$:stubWindowFetch,'isomorphic-unfetch$':stubWindowFetch,'whatwg-fetch$':_path.default.join(__dirname,'polyfills','fetch','whatwg-fetch.js')},{'object-assign$':stubObjectAssign,// Stub Package: object.assign
  3 | 'object.assign/auto':_path.default.join(shimAssign,'auto.js'),'object.assign/implementation':_path.default.join(shimAssign,'implementation.js'),'object.assign$':_path.default.join(shimAssign,'index.js'),'object.assign/polyfill':_path.default.join(shimAssign,'polyfill.js'),'object.assign/shim':_path.default.join(shimAssign,'shim.js'),// Replace: full URL polyfill with platform-based polyfill
  4 | url:require.resolve('native-url')});}async function getBaseWebpackConfig(dir,{buildId,config,dev=false,isServer=false,pagesDir,tracer,target='server',entrypoints}){var _jsConfig,_jsConfig$compilerOpt,_config$conformance,_config$conformance$D,_jsConfig2,_jsConfig2$compilerOp,_webpackConfig$module,_webpackConfig$module2;const productionBrowserSourceMaps=config.experimental.productionBrowserSourceMaps&&!isServer;let plugins=[];let babelPresetPlugins=[];if(config.experimental.plugins){plugins=await(0,_collectPlugins.collectPlugins)(dir,config.env,config.plugins);_nextPluginLoader.pluginLoaderOptions.plugins=plugins;for(const plugin of plugins){if(plugin.middleware.includes('babel-preset-build')){babelPresetPlugins.push({dir:plugin.directory,config:plugin.config});}}}const hasReactRefresh=dev&&!isServer;const distDir=_path.default.join(dir,config.distDir);const defaultLoaders={babel:{loader:'next-babel-loader',options:{isServer,distDir,pagesDir,cwd:dir,cache:true,babelPresetPlugins,hasModern:!!config.experimental.modern,development:dev,hasReactRefresh}},// Backwards compat

  at parseJsonFile (../packages/next/dist/build/webpack-config.js:1:3601)
  at getBaseWebpackConfig (../packages/next/dist/build/webpack-config.js:9:605)
      at async Promise.all (index 1)
  at async build (../packages/next/dist/build/index.js:9:102) {
    errno: -2,
    syscall: 'open',
    code: 'ENOENT',
    path: '/home/runner/work/next.js/next.js/test/integration/catches-missing-getStaticProps/package.json'
  }
  "
  at Object.<anonymous> (integration/catches-missing-getStaticProps/test/index.test.js:36:20)

● Catches Missing getStaticProps › should catch it in serverless mode

expect(received).toMatch(expected)

Expected pattern: /getStaticPaths was added without a getStaticProps in/
Received string:  "
> Build error occurred
Error: ENOENT: no such file or directory, open '/home/runner/work/next.js/next.js/test/integration/catches-missing-getStaticProps/package.json'

> 1 | "use strict";exports.__esModule=true;exports.default=getBaseWebpackConfig;var _ReactRefreshWebpackPlugin=_interopRequireDefault(require("@next/react-refresh-utils/ReactRefreshWebpackPlugin"));var _crypto=_interopRequireDefault(require("crypto"));var _fs=require("fs");var _chalk=_interopRequireDefault(require("next/dist/compiled/chalk"));var _terserWebpackPlugin=_interopRequireDefault(require("next/dist/compiled/terser-webpack-plugin"));var _path=_interopRequireDefault(require("path"));var _pnpWebpackPlugin=_interopRequireDefault(require("pnp-webpack-plugin"));var _webpack=_interopRequireDefault(require("webpack"));var _constants=require("../lib/constants");var _fileExists=require("../lib/file-exists");var _resolveRequest=require("../lib/resolve-request");var _constants2=require("../next-server/lib/constants");var _findPageFile=require("../server/lib/find-page-file");var _collectPlugins=require("./plugins/collect-plugins");var _config=require("./webpack/config");var _overrideCssConfiguration=require("./webpack/config/blocks/css/overrideCssConfiguration");var _nextPluginLoader=require("./webpack/loaders/next-plugin-loader");var _buildManifestPlugin=_interopRequireDefault(require("./webpack/plugins/build-manifest-plugin"));var _chunkNamesPlugin=_interopRequireDefault(require("./webpack/plugins/chunk-names-plugin"));var _cssMinimizerPlugin=require("./webpack/plugins/css-minimizer-plugin");var _jsconfigPathsPlugin=require("./webpack/plugins/jsconfig-paths-plugin");var _nextDropClientPagePlugin=require("./webpack/plugins/next-drop-client-page-plugin");var _nextEsmPlugin=_interopRequireDefault(require("./webpack/plugins/next-esm-plugin"));var _nextjsSsrImport=_interopRequireDefault(require("./webpack/plugins/nextjs-ssr-import"));var _nextjsSsrModuleCache=_interopRequireDefault(require("./webpack/plugins/nextjs-ssr-module-cache"));var _pagesManifestPlugin=_interopRequireDefault(require("./webpack/plugins/pages-manifest-plugin"));var _profilingPlugin=require("./webpack/plugins/profiling-plugin");var _reactLoadablePlugin=require("./webpack/plugins/react-loadable-plugin");var _serverlessPlugin=require("./webpack/plugins/serverless-plugin");var _webpackConformancePlugin=_interopRequireWildcard(require("./webpack/plugins/webpack-conformance-plugin"));var _wellknownErrorsPlugin=require("./webpack/plugins/wellknown-errors-plugin");var _codeFrame=require("@babel/code-frame");function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var cache=new WeakMap();_getRequireWildcardCache=function(){return cache;};return cache;}function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache();if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}const isWebpack5=parseInt(_webpack.default.version)===5;const escapePathVariables=value=>{return typeof value==='string'?value.replace(/\[(\\*[\w:]+\\*)\]/gi,'[\\$1\\]'):value;};function parseJsonFile(filePath){const JSON5=require('next/dist/compiled/json5');const contents=(0,_fs.readFileSync)(filePath,'utf8');// Special case an empty file
    |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ^
  2 | if(contents.trim()===''){return{};}try{return JSON5.parse(contents);}catch(err){const codeFrame=(0,_codeFrame.codeFrameColumns)(String(contents),{start:{line:err.lineNumber,column:err.columnNumber}},{message:err.message,highlightCode:true});throw new Error(`Failed to parse "${filePath}":\n${codeFrame}`);}}function getOptimizedAliases(isServer){if(isServer){return{};}const stubWindowFetch=_path.default.join(__dirname,'polyfills','fetch','index.js');const stubObjectAssign=_path.default.join(__dirname,'polyfills','object-assign.js');const shimAssign=_path.default.join(__dirname,'polyfills','object.assign');return Object.assign({},{unfetch$:stubWindowFetch,'isomorphic-unfetch$':stubWindowFetch,'whatwg-fetch$':_path.default.join(__dirname,'polyfills','fetch','whatwg-fetch.js')},{'object-assign$':stubObjectAssign,// Stub Package: object.assign
  3 | 'object.assign/auto':_path.default.join(shimAssign,'auto.js'),'object.assign/implementation':_path.default.join(shimAssign,'implementation.js'),'object.assign$':_path.default.join(shimAssign,'index.js'),'object.assign/polyfill':_path.default.join(shimAssign,'polyfill.js'),'object.assign/shim':_path.default.join(shimAssign,'shim.js'),// Replace: full URL polyfill with platform-based polyfill
  4 | url:require.resolve('native-url')});}async function getBaseWebpackConfig(dir,{buildId,config,dev=false,isServer=false,pagesDir,tracer,target='server',entrypoints}){var _jsConfig,_jsConfig$compilerOpt,_config$conformance,_config$conformance$D,_jsConfig2,_jsConfig2$compilerOp,_webpackConfig$module,_webpackConfig$module2;const productionBrowserSourceMaps=config.experimental.productionBrowserSourceMaps&&!isServer;let plugins=[];let babelPresetPlugins=[];if(config.experimental.plugins){plugins=await(0,_collectPlugins.collectPlugins)(dir,config.env,config.plugins);_nextPluginLoader.pluginLoaderOptions.plugins=plugins;for(const plugin of plugins){if(plugin.middleware.includes('babel-preset-build')){babelPresetPlugins.push({dir:plugin.directory,config:plugin.config});}}}const hasReactRefresh=dev&&!isServer;const distDir=_path.default.join(dir,config.distDir);const defaultLoaders={babel:{loader:'next-babel-loader',options:{isServer,distDir,pagesDir,cwd:dir,cache:true,babelPresetPlugins,hasModern:!!config.experimental.modern,development:dev,hasReactRefresh}},// Backwards compat

  at parseJsonFile (../packages/next/dist/build/webpack-config.js:1:3601)
  at getBaseWebpackConfig (../packages/next/dist/build/webpack-config.js:9:605)
      at async Promise.all (index 1)
  at async build (../packages/next/dist/build/index.js:9:102) {
    errno: -2,
    syscall: 'open',
    code: 'ENOENT',
    path: '/home/runner/work/next.js/next.js/test/integration/catches-missing-getStaticProps/package.json'
  }
  "
  at Object.<anonymous> (integration/catches-missing-getStaticProps/test/index.test.js:48:20)

@ijjk
Copy link
Member

ijjk commented Jun 9, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary TodorTotev/next.js detect-node-sass-and-react-version Change
buildDuration 11.1s 11.1s ⚠️ +15ms
nodeModulesSize 64.9 MB 64.9 MB ⚠️ +1.9 kB
Page Load Tests Overall increase ✓
vercel/next.js canary TodorTotev/next.js detect-node-sass-and-react-version Change
/ failed reqs 0 0
/ total time (seconds) 1.998 1.888 -0.11
/ avg req/sec 1251.23 1324.5 ⚠️ +73.27
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.357 1.211 -0.15
/error-in-render avg req/sec 1842.79 2065.15 ⚠️ +222.36
Client Bundles (main, webpack, commons)
vercel/next.js canary TodorTotev/next.js detect-node-sass-and-react-version Change
main-HASH.js gzip 6.49 kB 6.49 kB
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..ec24.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 56.9 kB 56.9 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary TodorTotev/next.js detect-node-sass-and-react-version Change
main-HASH.module.js gzip 5.58 kB 5.58 kB
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.92 kB 6.92 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.4 kB 52.4 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary TodorTotev/next.js detect-node-sass-and-react-version Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
vercel/next.js canary TodorTotev/next.js detect-node-sass-and-react-version Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.05 kB 2.05 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.22 kB 8.22 kB
Client Pages Modern
vercel/next.js canary TodorTotev/next.js detect-node-sass-and-react-version Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.52 kB 1.52 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.33 kB 5.33 kB
Client Build Manifests
vercel/next.js canary TodorTotev/next.js detect-node-sass-and-react-version Change
_buildManifest.js gzip 171 B 171 B
_buildManife..dule.js gzip 180 B 180 B
Overall change 351 B 351 B
Rendered Page Sizes
vercel/next.js canary TodorTotev/next.js detect-node-sass-and-react-version Change
index.html gzip 901 B 901 B
link.html gzip 906 B 906 B
withRouter.html gzip 894 B 894 B
Overall change 2.7 kB 2.7 kB

Serverless Mode
General Overall increase ⚠️
vercel/next.js canary TodorTotev/next.js detect-node-sass-and-react-version Change
buildDuration 13.1s 11.7s -1.3s
nodeModulesSize 64.9 MB 64.9 MB ⚠️ +1.9 kB
Client Bundles (main, webpack, commons)
vercel/next.js canary TodorTotev/next.js detect-node-sass-and-react-version Change
main-HASH.js gzip 6.49 kB 6.49 kB
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..ec24.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 56.9 kB 56.9 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary TodorTotev/next.js detect-node-sass-and-react-version Change
main-HASH.module.js gzip 5.58 kB 5.58 kB
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.92 kB 6.92 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.4 kB 52.4 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary TodorTotev/next.js detect-node-sass-and-react-version Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
vercel/next.js canary TodorTotev/next.js detect-node-sass-and-react-version Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.05 kB 2.05 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.22 kB 8.22 kB
Client Pages Modern
vercel/next.js canary TodorTotev/next.js detect-node-sass-and-react-version Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.52 kB 1.52 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.33 kB 5.33 kB
Client Build Manifests
vercel/next.js canary TodorTotev/next.js detect-node-sass-and-react-version Change
_buildManifest.js gzip 171 B 171 B
_buildManife..dule.js gzip 180 B 180 B
Overall change 351 B 351 B
Serverless bundles
vercel/next.js canary TodorTotev/next.js detect-node-sass-and-react-version Change
_error.js 874 kB 874 kB
404.html 4.13 kB 4.13 kB
hooks.html 3.71 kB 3.71 kB
index.js 875 kB 875 kB
link.js 913 kB 913 kB
routerDirect.js 905 kB 905 kB
withRouter.js 905 kB 905 kB
Overall change 4.48 MB 4.48 MB

@todortotev
Copy link
Contributor Author

@Timer I believe this is ready for review. If you have the time to give me some directions on how I could check with different dependencies @ integration tests I would love to create the required tests!

@ijjk
Copy link
Member

ijjk commented Jun 11, 2020

Failing test suites

test/integration/api-catch-all/test/index.test.js

  • API routes > Server support > should return data when catch-all
  • API routes > Server support > should 404 when catch-all with index and trailing slash
  • API routes > Server support > should return data when catch-all with index and no trailing slash
  • API routes > Serverless support > should return data when catch-all
  • API routes > Serverless support > should 404 when catch-all with index and trailing slash
  • API routes > Serverless support > should return data when catch-all with index and no trailing slash
  • API routes > dev support > should return data when catch-all
  • API routes > dev support > should 404 when catch-all with index and trailing slash
  • API routes > dev support > should return data when catch-all with index and no trailing slash
Expand output

● API routes › dev support › should return data when catch-all

FetchError: request to http://localhost:45729/api/users/1 failed, reason: connect ECONNREFUSED 127.0.0.1:45729

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● API routes › dev support › should 404 when catch-all with index and trailing slash

FetchError: request to http://localhost:45729/api/users/ failed, reason: connect ECONNREFUSED 127.0.0.1:45729

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● API routes › dev support › should return data when catch-all with index and no trailing slash

FetchError: request to http://localhost:45729/api/users failed, reason: connect ECONNREFUSED 127.0.0.1:45729

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● API routes › Server support › should return data when catch-all

command failed with code 1

  133 |         code !== 0
  134 |       ) {
> 135 |         return reject(new Error(`command failed with code ${code}`))
      |                       ^
  136 |       }
  137 | 
  138 |       resolve({

  at ChildProcess.<anonymous> (lib/next-test-utils.js:135:23)

● API routes › Server support › should 404 when catch-all with index and trailing slash

command failed with code 1

  133 |         code !== 0
  134 |       ) {
> 135 |         return reject(new Error(`command failed with code ${code}`))
      |                       ^
  136 |       }
  137 | 
  138 |       resolve({

  at ChildProcess.<anonymous> (lib/next-test-utils.js:135:23)

● API routes › Server support › should return data when catch-all with index and no trailing slash

command failed with code 1

  133 |         code !== 0
  134 |       ) {
> 135 |         return reject(new Error(`command failed with code ${code}`))
      |                       ^
  136 |       }
  137 | 
  138 |       resolve({

  at ChildProcess.<anonymous> (lib/next-test-utils.js:135:23)

● API routes › Serverless support › should return data when catch-all

command failed with code 1

  133 |         code !== 0
  134 |       ) {
> 135 |         return reject(new Error(`command failed with code ${code}`))
      |                       ^
  136 |       }
  137 | 
  138 |       resolve({

  at ChildProcess.<anonymous> (lib/next-test-utils.js:135:23)

● API routes › Serverless support › should 404 when catch-all with index and trailing slash

command failed with code 1

  133 |         code !== 0
  134 |       ) {
> 135 |         return reject(new Error(`command failed with code ${code}`))
      |                       ^
  136 |       }
  137 | 
  138 |       resolve({

  at ChildProcess.<anonymous> (lib/next-test-utils.js:135:23)

● API routes › Serverless support › should return data when catch-all with index and no trailing slash

command failed with code 1

  133 |         code !== 0
  134 |       ) {
> 135 |         return reject(new Error(`command failed with code ${code}`))
      |                       ^
  136 |       }
  137 | 
  138 |       resolve({

  at ChildProcess.<anonymous> (lib/next-test-utils.js:135:23)

● Test suite failed to run

TypeError: Cannot read property 'pid' of undefined

  272 | export async function killApp(instance) {
  273 |   await new Promise((resolve, reject) => {
> 274 |     treeKill(instance.pid, (err) => {
      |                       ^
  275 |       if (err) {
  276 |         if (
  277 |           process.platform === 'win32' &&

  at lib/next-test-utils.js:274:23
  at killApp (lib/next-test-utils.js:273:9)
  at integration/api-catch-all/test/index.test.js:52:20

● Test suite failed to run

TypeError: Cannot read property 'pid' of undefined

  272 | export async function killApp(instance) {
  273 |   await new Promise((resolve, reject) => {
> 274 |     treeKill(instance.pid, (err) => {
      |                       ^
  275 |       if (err) {
  276 |         if (
  277 |           process.platform === 'win32' &&

  at lib/next-test-utils.js:274:23
  at killApp (lib/next-test-utils.js:273:9)
  at integration/api-catch-all/test/index.test.js:63:20

● Test suite failed to run

TypeError: Cannot read property 'pid' of undefined

  272 | export async function killApp(instance) {
  273 |   await new Promise((resolve, reject) => {
> 274 |     treeKill(instance.pid, (err) => {
      |                       ^
  275 |       if (err) {
  276 |         if (
  277 |           process.platform === 'win32' &&

  at lib/next-test-utils.js:274:23
  at killApp (lib/next-test-utils.js:273:9)
  at integration/api-catch-all/test/index.test.js:79:13

test/integration/app-document-import-order/test/index.test.js

  • Root components import order > root components should be imported in this order _document > _app > page in order to respect side effects
  • Root components import order > _app chunks should be attached to de dom before page chunks
  • Root components import order > on dev server > root components should be imported in this order _document > _app > page in order to respect side effects
  • Root components import order > on dev server > _app chunks should be attached to de dom before page chunks
Expand output

● Root components import order › root components should be imported in this order _document > _app > page in order to respect side effects

command failed with code 1

  133 |         code !== 0
  134 |       ) {
> 135 |         return reject(new Error(`command failed with code ${code}`))
      |                       ^
  136 |       }
  137 | 
  138 |       resolve({

  at ChildProcess.<anonymous> (lib/next-test-utils.js:135:23)

● Root components import order › _app chunks should be attached to de dom before page chunks

command failed with code 1

  133 |         code !== 0
  134 |       ) {
> 135 |         return reject(new Error(`command failed with code ${code}`))
      |                       ^
  136 |       }
  137 | 
  138 |       resolve({

  at ChildProcess.<anonymous> (lib/next-test-utils.js:135:23)

● Root components import order › on dev server › root components should be imported in this order _document > _app > page in order to respect side effects

command failed with code 1

  133 |         code !== 0
  134 |       ) {
> 135 |         return reject(new Error(`command failed with code ${code}`))
      |                       ^
  136 |       }
  137 | 
  138 |       resolve({

  at ChildProcess.<anonymous> (lib/next-test-utils.js:135:23)

● Root components import order › on dev server › _app chunks should be attached to de dom before page chunks

command failed with code 1

  133 |         code !== 0
  134 |       ) {
> 135 |         return reject(new Error(`command failed with code ${code}`))
      |                       ^
  136 |       }
  137 | 
  138 |       resolve({

  at ChildProcess.<anonymous> (lib/next-test-utils.js:135:23)

● Test suite failed to run

TypeError: Cannot read property 'pid' of undefined

  272 | export async function killApp(instance) {
  273 |   await new Promise((resolve, reject) => {
> 274 |     treeKill(instance.pid, (err) => {
      |                       ^
  275 |       if (err) {
  276 |         if (
  277 |           process.platform === 'win32' &&

  at lib/next-test-utils.js:274:23
  at killApp (lib/next-test-utils.js:273:9)
  at integration/app-document-import-order/test/index.test.js:87:20

● Test suite failed to run

TypeError: Cannot read property '__app' of undefined

  306 | 
  307 | export async function stopApp(server) {
> 308 |   if (server.__app) {
      |              ^
  309 |     await server.__app.close()
  310 |   }
  311 |   await promiseCall(server, 'close')

  at stopApp (lib/next-test-utils.js:308:14)
  at integration/app-document-import-order/test/index.test.js:34:18

test/integration/amphtml-fragment-style/test/index.test.js

  • AMP Fragment Styles > adds styles from fragment in AMP mode correctly
Expand output

● AMP Fragment Styles › adds styles from fragment in AMP mode correctly

command failed with code 1

  133 |         code !== 0
  134 |       ) {
> 135 |         return reject(new Error(`command failed with code ${code}`))
      |                       ^
  136 |       }
  137 | 
  138 |       resolve({

  at ChildProcess.<anonymous> (lib/next-test-utils.js:135:23)

● Test suite failed to run

TypeError: Cannot read property '__app' of undefined

  306 | 
  307 | export async function stopApp(server) {
> 308 |   if (server.__app) {
      |              ^
  309 |     await server.__app.close()
  310 |   }
  311 |   await promiseCall(server, 'close')

  at stopApp (lib/next-test-utils.js:308:14)
  at integration/amphtml-fragment-style/test/index.test.js:32:18

test/integration/amphtml-ssg/test/index.test.js

  • AMP SSG Support > dev mode > should load an amp first page correctly
  • AMP SSG Support > dev mode > should load a hybrid amp page without query correctly
  • AMP SSG Support > dev mode > should load dynamic hybrid SSG/AMP page
  • AMP SSG Support > dev mode > should load dynamic hybrid SSG/AMP page with query
  • AMP SSG Support > dev mode > should load a hybrid amp page with query correctly
  • AMP SSG Support > export mode > should have copied SSG files correctly
  • AMP SSG Support > server mode > should load an amp first page correctly
  • AMP SSG Support > server mode > should load a hybrid amp page without query correctly
  • AMP SSG Support > server mode > should load dynamic hybrid SSG/AMP page
  • AMP SSG Support > server mode > should load dynamic hybrid SSG/AMP page with query
  • AMP SSG Support > server mode > should load a hybrid amp page with query correctly
  • AMP SSG Support > server mode > should output prerendered files correctly during build
  • AMP SSG Support > serverless mode > should load an amp first page correctly
  • AMP SSG Support > serverless mode > should load a hybrid amp page without query correctly
  • AMP SSG Support > serverless mode > should load dynamic hybrid SSG/AMP page
  • AMP SSG Support > serverless mode > should load dynamic hybrid SSG/AMP page with query
  • AMP SSG Support > serverless mode > should load a hybrid amp page with query correctly
  • AMP SSG Support > serverless mode > should output prerendered files correctly during build
Expand output

● AMP SSG Support › serverless mode › should load an amp first page correctly

command failed with code 1

  133 |         code !== 0
  134 |       ) {
> 135 |         return reject(new Error(`command failed with code ${code}`))
      |                       ^
  136 |       }
  137 | 
  138 |       resolve({

  at ChildProcess.<anonymous> (lib/next-test-utils.js:135:23)

● AMP SSG Support › serverless mode › should load a hybrid amp page without query correctly

command failed with code 1

  133 |         code !== 0
  134 |       ) {
> 135 |         return reject(new Error(`command failed with code ${code}`))
      |                       ^
  136 |       }
  137 | 
  138 |       resolve({

  at ChildProcess.<anonymous> (lib/next-test-utils.js:135:23)

● AMP SSG Support › serverless mode › should load dynamic hybrid SSG/AMP page

command failed with code 1

  133 |         code !== 0
  134 |       ) {
> 135 |         return reject(new Error(`command failed with code ${code}`))
      |                       ^
  136 |       }
  137 | 
  138 |       resolve({

  at ChildProcess.<anonymous> (lib/next-test-utils.js:135:23)

● AMP SSG Support › serverless mode › should load dynamic hybrid SSG/AMP page with query

command failed with code 1

  133 |         code !== 0
  134 |       ) {
> 135 |         return reject(new Error(`command failed with code ${code}`))
      |                       ^
  136 |       }
  137 | 
  138 |       resolve({

  at ChildProcess.<anonymous> (lib/next-test-utils.js:135:23)

● AMP SSG Support › serverless mode › should load a hybrid amp page with query correctly

command failed with code 1

  133 |         code !== 0
  134 |       ) {
> 135 |         return reject(new Error(`command failed with code ${code}`))
      |                       ^
  136 |       }
  137 | 
  138 |       resolve({

  at ChildProcess.<anonymous> (lib/next-test-utils.js:135:23)

● AMP SSG Support › serverless mode › should output prerendered files correctly during build

command failed with code 1

  133 |         code !== 0
  134 |       ) {
> 135 |         return reject(new Error(`command failed with code ${code}`))
      |                       ^
  136 |       }
  137 | 
  138 |       resolve({

  at ChildProcess.<anonymous> (lib/next-test-utils.js:135:23)

● AMP SSG Support › server mode › should load an amp first page correctly

command failed with code 1

  133 |         code !== 0
  134 |       ) {
> 135 |         return reject(new Error(`command failed with code ${code}`))
      |                       ^
  136 |       }
  137 | 
  138 |       resolve({

  at ChildProcess.<anonymous> (lib/next-test-utils.js:135:23)

● AMP SSG Support › server mode › should load a hybrid amp page without query correctly

command failed with code 1

  133 |         code !== 0
  134 |       ) {
> 135 |         return reject(new Error(`command failed with code ${code}`))
      |                       ^
  136 |       }
  137 | 
  138 |       resolve({

  at ChildProcess.<anonymous> (lib/next-test-utils.js:135:23)

● AMP SSG Support › server mode › should load dynamic hybrid SSG/AMP page

command failed with code 1

  133 |         code !== 0
  134 |       ) {
> 135 |         return reject(new Error(`command failed with code ${code}`))
      |                       ^
  136 |       }
  137 | 
  138 |       resolve({

  at ChildProcess.<anonymous> (lib/next-test-utils.js:135:23)

● AMP SSG Support › server mode › should load dynamic hybrid SSG/AMP page with query

command failed with code 1

  133 |         code !== 0
  134 |       ) {
> 135 |         return reject(new Error(`command failed with code ${code}`))
      |                       ^
  136 |       }
  137 | 
  138 |       resolve({

  at ChildProcess.<anonymous> (lib/next-test-utils.js:135:23)

● AMP SSG Support › server mode › should load a hybrid amp page with query correctly

command failed with code 1

  133 |         code !== 0
  134 |       ) {
> 135 |         return reject(new Error(`command failed with code ${code}`))
      |                       ^
  136 |       }
  137 | 
  138 |       resolve({

  at ChildProcess.<anonymous> (lib/next-test-utils.js:135:23)

● AMP SSG Support › server mode › should output prerendered files correctly during build

command failed with code 1

  133 |         code !== 0
  134 |       ) {
> 135 |         return reject(new Error(`command failed with code ${code}`))
      |                       ^
  136 |       }
  137 | 
  138 |       resolve({

  at ChildProcess.<anonymous> (lib/next-test-utils.js:135:23)

● AMP SSG Support › dev mode › should load an amp first page correctly

FetchError: request to http://localhost:33319/amp failed, reason: connect ECONNREFUSED 127.0.0.1:33319

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● AMP SSG Support › dev mode › should load a hybrid amp page without query correctly

FetchError: request to http://localhost:33319/hybrid failed, reason: connect ECONNREFUSED 127.0.0.1:33319

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● AMP SSG Support › dev mode › should load dynamic hybrid SSG/AMP page

FetchError: request to http://localhost:33319/blog/post-1 failed, reason: connect ECONNREFUSED 127.0.0.1:33319

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● AMP SSG Support › dev mode › should load dynamic hybrid SSG/AMP page with query

FetchError: request to http://localhost:33319/blog/post-1?amp=1 failed, reason: connect ECONNREFUSED 127.0.0.1:33319

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● AMP SSG Support › dev mode › should load a hybrid amp page with query correctly

FetchError: request to http://localhost:33319/hybrid?amp=1 failed, reason: connect ECONNREFUSED 127.0.0.1:33319

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1455:11)

● AMP SSG Support › export mode › should have copied SSG files correctly

command failed with code 1

  133 |         code !== 0
  134 |       ) {
> 135 |         return reject(new Error(`command failed with code ${code}`))
      |                       ^
  136 |       }
  137 | 
  138 |       resolve({

  at ChildProcess.<anonymous> (lib/next-test-utils.js:135:23)

● Test suite failed to run

TypeError: Cannot read property 'pid' of undefined

  272 | export async function killApp(instance) {
  273 |   await new Promise((resolve, reject) => {
> 274 |     treeKill(instance.pid, (err) => {
      |                       ^
  275 |       if (err) {
  276 |         if (
  277 |           process.platform === 'win32' &&

  at lib/next-test-utils.js:274:23
  at killApp (lib/next-test-utils.js:273:9)
  at integration/amphtml-ssg/test/index.test.js:111:13

● Test suite failed to run

TypeError: Cannot read property 'pid' of undefined

  272 | export async function killApp(instance) {
  273 |   await new Promise((resolve, reject) => {
> 274 |     treeKill(instance.pid, (err) => {
      |                       ^
  275 |       if (err) {
  276 |         if (
  277 |           process.platform === 'win32' &&

  at lib/next-test-utils.js:274:23
  at killApp (lib/next-test-utils.js:273:9)
  at integration/amphtml-ssg/test/index.test.js:128:20

● Test suite failed to run

TypeError: Cannot read property 'pid' of undefined

  272 | export async function killApp(instance) {
  273 |   await new Promise((resolve, reject) => {
> 274 |     treeKill(instance.pid, (err) => {
      |                       ^
  275 |       if (err) {
  276 |         if (
  277 |           process.platform === 'win32' &&

  at lib/next-test-utils.js:274:23
  at killApp (lib/next-test-utils.js:273:9)
  at integration/amphtml-ssg/test/index.test.js:136:20

test/integration/build-warnings/test/index.test.js

  • Build warnings > should shown warning about minification for minimize
  • Build warnings > should shown warning about minification for minimizer
Expand output

● Build warnings › should shown warning about minification for minimize

expect(received).toContain(expected) // indexOf

Expected substring: "optimization has been disabled"
Received string:    "
> Build error occurred
Error: ENOENT: no such file or directory, open '/home/runner/work/next.js/next.js/test/integration/build-warnings/package.json'

> 1 | "use strict";exports.__esModule=true;exports.default=getBaseWebpackConfig;var _ReactRefreshWebpackPlugin=_interopRequireDefault(require("@next/react-refresh-utils/ReactRefreshWebpackPlugin"));var _crypto=_interopRequireDefault(require("crypto"));var _fs=require("fs");var _chalk=_interopRequireDefault(require("next/dist/compiled/chalk"));var _terserWebpackPlugin=_interopRequireDefault(require("next/dist/compiled/terser-webpack-plugin"));var _path=_interopRequireDefault(require("path"));var _pnpWebpackPlugin=_interopRequireDefault(require("pnp-webpack-plugin"));var _webpack=_interopRequireDefault(require("webpack"));var _constants=require("../lib/constants");var _fileExists=require("../lib/file-exists");var _resolveRequest=require("../lib/resolve-request");var _constants2=require("../next-server/lib/constants");var _findPageFile=require("../server/lib/find-page-file");var _collectPlugins=require("./plugins/collect-plugins");var _config=require("./webpack/config");var _overrideCssConfiguration=require("./webpack/config/blocks/css/overrideCssConfiguration");var _nextPluginLoader=require("./webpack/loaders/next-plugin-loader");var _buildManifestPlugin=_interopRequireDefault(require("./webpack/plugins/build-manifest-plugin"));var _chunkNamesPlugin=_interopRequireDefault(require("./webpack/plugins/chunk-names-plugin"));var _cssMinimizerPlugin=require("./webpack/plugins/css-minimizer-plugin");var _jsconfigPathsPlugin=require("./webpack/plugins/jsconfig-paths-plugin");var _nextDropClientPagePlugin=require("./webpack/plugins/next-drop-client-page-plugin");var _nextEsmPlugin=_interopRequireDefault(require("./webpack/plugins/next-esm-plugin"));var _nextjsSsrImport=_interopRequireDefault(require("./webpack/plugins/nextjs-ssr-import"));var _nextjsSsrModuleCache=_interopRequireDefault(require("./webpack/plugins/nextjs-ssr-module-cache"));var _pagesManifestPlugin=_interopRequireDefault(require("./webpack/plugins/pages-manifest-plugin"));var _profilingPlugin=require("./webpack/plugins/profiling-plugin");var _reactLoadablePlugin=require("./webpack/plugins/react-loadable-plugin");var _serverlessPlugin=require("./webpack/plugins/serverless-plugin");var _webpackConformancePlugin=_interopRequireWildcard(require("./webpack/plugins/webpack-conformance-plugin"));var _wellknownErrorsPlugin=require("./webpack/plugins/wellknown-errors-plugin");var _codeFrame=require("@babel/code-frame");function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var cache=new WeakMap();_getRequireWildcardCache=function(){return cache;};return cache;}function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache();if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}const isWebpack5=parseInt(_webpack.default.version)===5;const escapePathVariables=value=>{return typeof value==='string'?value.replace(/\[(\\*[\w:]+\\*)\]/gi,'[\\$1\\]'):value;};function parseJsonFile(filePath){const JSON5=require('next/dist/compiled/json5');const contents=(0,_fs.readFileSync)(filePath,'utf8');// Special case an empty file
    |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ^
  2 | if(contents.trim()===''){return{};}try{return JSON5.parse(contents);}catch(err){const codeFrame=(0,_codeFrame.codeFrameColumns)(String(contents),{start:{line:err.lineNumber,column:err.columnNumber}},{message:err.message,highlightCode:true});throw new Error(`Failed to parse "${filePath}":\n${codeFrame}`);}}function getOptimizedAliases(isServer){if(isServer){return{};}const stubWindowFetch=_path.default.join(__dirname,'polyfills','fetch','index.js');const stubObjectAssign=_path.default.join(__dirname,'polyfills','object-assign.js');const shimAssign=_path.default.join(__dirname,'polyfills','object.assign');return Object.assign({},{unfetch$:stubWindowFetch,'isomorphic-unfetch$':stubWindowFetch,'whatwg-fetch$':_path.default.join(__dirname,'polyfills','fetch','whatwg-fetch.js')},{'object-assign$':stubObjectAssign,// Stub Package: object.assign
  3 | 'object.assign/auto':_path.default.join(shimAssign,'auto.js'),'object.assign/implementation':_path.default.join(shimAssign,'implementation.js'),'object.assign$':_path.default.join(shimAssign,'index.js'),'object.assign/polyfill':_path.default.join(shimAssign,'polyfill.js'),'object.assign/shim':_path.default.join(shimAssign,'shim.js'),// Replace: full URL polyfill with platform-based polyfill
  4 | url:require.resolve('native-url')});}async function getBaseWebpackConfig(dir,{buildId,config,dev=false,isServer=false,pagesDir,tracer,target='server',entrypoints}){var _jsConfig,_jsConfig$compilerOpt,_config$conformance,_config$conformance$D,_jsConfig2,_jsConfig2$compilerOp,_webpackConfig$module,_webpackConfig$module2;const productionBrowserSourceMaps=config.experimental.productionBrowserSourceMaps&&!isServer;let plugins=[];let babelPresetPlugins=[];if(config.experimental.plugins){plugins=await(0,_collectPlugins.collectPlugins)(dir,config.env,config.plugins);_nextPluginLoader.pluginLoaderOptions.plugins=plugins;for(const plugin of plugins){if(plugin.middleware.includes('babel-preset-build')){babelPresetPlugins.push({dir:plugin.directory,config:plugin.config});}}}const hasReactRefresh=dev&&!isServer;const distDir=_path.default.join(dir,config.distDir);const defaultLoaders={babel:{loader:'next-babel-loader',options:{isServer,distDir,pagesDir,cwd:dir,cache:true,babelPresetPlugins,hasModern:!!config.experimental.modern,development:dev,hasReactRefresh}},// Backwards compat

  at parseJsonFile (../packages/next/dist/build/webpack-config.js:1:3601)
  at getBaseWebpackConfig (../packages/next/dist/build/webpack-config.js:9:605)
      at async Promise.all (index 1)
  at async build (../packages/next/dist/build/index.js:11:102) {
    errno: -2,
    syscall: 'open',
    code: 'ENOENT',
    path: '/home/runner/work/next.js/next.js/test/integration/build-warnings/package.json'
  }
  "
  at Object.<anonymous> (integration/build-warnings/test/index.test.js:25:20)

● Build warnings › should shown warning about minification for minimizer

expect(received).toContain(expected) // indexOf

Expected substring: "optimization has been disabled"
Received string:    "
> Build error occurred
Error: ENOENT: no such file or directory, open '/home/runner/work/next.js/next.js/test/integration/build-warnings/package.json'

> 1 | "use strict";exports.__esModule=true;exports.default=getBaseWebpackConfig;var _ReactRefreshWebpackPlugin=_interopRequireDefault(require("@next/react-refresh-utils/ReactRefreshWebpackPlugin"));var _crypto=_interopRequireDefault(require("crypto"));var _fs=require("fs");var _chalk=_interopRequireDefault(require("next/dist/compiled/chalk"));var _terserWebpackPlugin=_interopRequireDefault(require("next/dist/compiled/terser-webpack-plugin"));var _path=_interopRequireDefault(require("path"));var _pnpWebpackPlugin=_interopRequireDefault(require("pnp-webpack-plugin"));var _webpack=_interopRequireDefault(require("webpack"));var _constants=require("../lib/constants");var _fileExists=require("../lib/file-exists");var _resolveRequest=require("../lib/resolve-request");var _constants2=require("../next-server/lib/constants");var _findPageFile=require("../server/lib/find-page-file");var _collectPlugins=require("./plugins/collect-plugins");var _config=require("./webpack/config");var _overrideCssConfiguration=require("./webpack/config/blocks/css/overrideCssConfiguration");var _nextPluginLoader=require("./webpack/loaders/next-plugin-loader");var _buildManifestPlugin=_interopRequireDefault(require("./webpack/plugins/build-manifest-plugin"));var _chunkNamesPlugin=_interopRequireDefault(require("./webpack/plugins/chunk-names-plugin"));var _cssMinimizerPlugin=require("./webpack/plugins/css-minimizer-plugin");var _jsconfigPathsPlugin=require("./webpack/plugins/jsconfig-paths-plugin");var _nextDropClientPagePlugin=require("./webpack/plugins/next-drop-client-page-plugin");var _nextEsmPlugin=_interopRequireDefault(require("./webpack/plugins/next-esm-plugin"));var _nextjsSsrImport=_interopRequireDefault(require("./webpack/plugins/nextjs-ssr-import"));var _nextjsSsrModuleCache=_interopRequireDefault(require("./webpack/plugins/nextjs-ssr-module-cache"));var _pagesManifestPlugin=_interopRequireDefault(require("./webpack/plugins/pages-manifest-plugin"));var _profilingPlugin=require("./webpack/plugins/profiling-plugin");var _reactLoadablePlugin=require("./webpack/plugins/react-loadable-plugin");var _serverlessPlugin=require("./webpack/plugins/serverless-plugin");var _webpackConformancePlugin=_interopRequireWildcard(require("./webpack/plugins/webpack-conformance-plugin"));var _wellknownErrorsPlugin=require("./webpack/plugins/wellknown-errors-plugin");var _codeFrame=require("@babel/code-frame");function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var cache=new WeakMap();_getRequireWildcardCache=function(){return cache;};return cache;}function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache();if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}const isWebpack5=parseInt(_webpack.default.version)===5;const escapePathVariables=value=>{return typeof value==='string'?value.replace(/\[(\\*[\w:]+\\*)\]/gi,'[\\$1\\]'):value;};function parseJsonFile(filePath){const JSON5=require('next/dist/compiled/json5');const contents=(0,_fs.readFileSync)(filePath,'utf8');// Special case an empty file
    |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ^
  2 | if(contents.trim()===''){return{};}try{return JSON5.parse(contents);}catch(err){const codeFrame=(0,_codeFrame.codeFrameColumns)(String(contents),{start:{line:err.lineNumber,column:err.columnNumber}},{message:err.message,highlightCode:true});throw new Error(`Failed to parse "${filePath}":\n${codeFrame}`);}}function getOptimizedAliases(isServer){if(isServer){return{};}const stubWindowFetch=_path.default.join(__dirname,'polyfills','fetch','index.js');const stubObjectAssign=_path.default.join(__dirname,'polyfills','object-assign.js');const shimAssign=_path.default.join(__dirname,'polyfills','object.assign');return Object.assign({},{unfetch$:stubWindowFetch,'isomorphic-unfetch$':stubWindowFetch,'whatwg-fetch$':_path.default.join(__dirname,'polyfills','fetch','whatwg-fetch.js')},{'object-assign$':stubObjectAssign,// Stub Package: object.assign
  3 | 'object.assign/auto':_path.default.join(shimAssign,'auto.js'),'object.assign/implementation':_path.default.join(shimAssign,'implementation.js'),'object.assign$':_path.default.join(shimAssign,'index.js'),'object.assign/polyfill':_path.default.join(shimAssign,'polyfill.js'),'object.assign/shim':_path.default.join(shimAssign,'shim.js'),// Replace: full URL polyfill with platform-based polyfill
  4 | url:require.resolve('native-url')});}async function getBaseWebpackConfig(dir,{buildId,config,dev=false,isServer=false,pagesDir,tracer,target='server',entrypoints}){var _jsConfig,_jsConfig$compilerOpt,_config$conformance,_config$conformance$D,_jsConfig2,_jsConfig2$compilerOp,_webpackConfig$module,_webpackConfig$module2;const productionBrowserSourceMaps=config.experimental.productionBrowserSourceMaps&&!isServer;let plugins=[];let babelPresetPlugins=[];if(config.experimental.plugins){plugins=await(0,_collectPlugins.collectPlugins)(dir,config.env,config.plugins);_nextPluginLoader.pluginLoaderOptions.plugins=plugins;for(const plugin of plugins){if(plugin.middleware.includes('babel-preset-build')){babelPresetPlugins.push({dir:plugin.directory,config:plugin.config});}}}const hasReactRefresh=dev&&!isServer;const distDir=_path.default.join(dir,config.distDir);const defaultLoaders={babel:{loader:'next-babel-loader',options:{isServer,distDir,pagesDir,cwd:dir,cache:true,babelPresetPlugins,hasModern:!!config.experimental.modern,development:dev,hasReactRefresh}},// Backwards compat

  at parseJsonFile (../packages/next/dist/build/webpack-config.js:1:3601)
  at getBaseWebpackConfig (../packages/next/dist/build/webpack-config.js:9:605)
      at async Promise.all (index 1)
  at async build (../packages/next/dist/build/index.js:11:102) {
    errno: -2,
    syscall: 'open',
    code: 'ENOENT',
    path: '/home/runner/work/next.js/next.js/test/integration/build-warnings/package.json'
  }
  "
  at Object.<anonymous> (integration/build-warnings/test/index.test.js:42:20)

test/integration/build-output/test/index.test.js

  • Build Output > Basic Application Output > should not include internal pages
  • Build Output > Basic Application Output > should not deviate from snapshot
  • Build Output > Custom App Output > should not include custom error
  • Build Output > Custom Error Output > should not include custom app
  • Build Output > Custom Static Error Output > should not specify /404 as lambda when static
  • Build Output > With AMP Output > should not include custom error
Expand output

● Build Output › Basic Application Output › should not include internal pages

expect(received).toMatch(expected)

Expected pattern: /\/ [ ]* \d{1,} B/
Received string:  "Creating an optimized production build...
"

  25 |       }))
  26 | 
> 27 |       expect(stdout).toMatch(/\/ [ ]* \d{1,} B/)
     |                      ^
  28 |       expect(stdout).toMatch(/\+ First Load JS shared by all [ 0-9.]* kB/)
  29 |       expect(stdout).toMatch(/ runtime\/main\.[0-9a-z]{6}\.js [ 0-9.]* kB/)
  30 |       expect(stdout).toMatch(/ chunks\/framework\.[0-9a-z]{6}\.js [ 0-9. ]* kB/)

  at Object.<anonymous> (integration/build-output/test/index.test.js:27:22)

● Build Output › Basic Application Output › should not deviate from snapshot

TypeError: Cannot read property '1' of null

  42 | 
  43 |       const parsePageSize = (page) =>
> 44 |         stdout.match(
     |         ^
  45 |           new RegExp(` ${page} .*?((?:\\d|\\.){1,} (?:\\w{1,})) `)
  46 |         )[1]
  47 | 

  at parsePageSize (integration/build-output/test/index.test.js:44:9)
  at Object.<anonymous> (integration/build-output/test/index.test.js:60:25)

● Build Output › Custom App Output › should not include custom error

expect(received).toMatch(expected)

Expected pattern: /\/ [ ]* \d{1,} B/
Received string:  "Creating an optimized production build...
"

  135 |       })
  136 | 
> 137 |       expect(stdout).toMatch(/\/ [ ]* \d{1,} B/)
      |                      ^
  138 |       expect(stdout).toMatch(/\/_app [ ]* \d{1,} B/)
  139 |       expect(stdout).toMatch(/\+ First Load JS shared by all [ 0-9.]* kB/)
  140 |       expect(stdout).toMatch(/ runtime\/main\.[0-9a-z]{6}\.js [ 0-9.]* kB/)

  at Object.<anonymous> (integration/build-output/test/index.test.js:137:22)

● Build Output › With AMP Output › should not include custom error

expect(received).toMatch(expected)

Expected pattern: /\/ [ 0-9.]* B [ 0-9.]* kB/
Received string:  "Creating an optimized production build...
"

  162 |       })
  163 | 
> 164 |       expect(stdout).toMatch(/\/ [ 0-9.]* B [ 0-9.]* kB/)
      |                      ^
  165 |       expect(stdout).toMatch(/\/amp .* AMP/)
  166 |       expect(stdout).toMatch(/\/hybrid [ 0-9.]* B/)
  167 |       expect(stdout).toMatch(/\+ First Load JS shared by all [ 0-9.]* kB/)

  at Object.<anonymous> (integration/build-output/test/index.test.js:164:22)

● Build Output › Custom Error Output › should not include custom app

expect(received).toMatch(expected)

Expected pattern: /\/ [ ]* \d{1,} B/
Received string:  "Creating an optimized production build...
"

  189 |       })
  190 | 
> 191 |       expect(stdout).toMatch(/\/ [ ]* \d{1,} B/)
      |                      ^
  192 |       expect(stdout).toMatch(/λ \/404 [ ]* \d{1,} B/)
  193 |       expect(stdout).toMatch(/\+ First Load JS shared by all [ 0-9.]* kB/)
  194 |       expect(stdout).toMatch(/ runtime\/main\.[0-9a-z]{6}\.js [ 0-9.]* kB/)

  at Object.<anonymous> (integration/build-output/test/index.test.js:191:22)

● Build Output › Custom Static Error Output › should not specify /404 as lambda when static

expect(received).toContain(expected) // indexOf

Expected substring: "○ /404"
Received string:    "Creating an optimized production build...
"

  215 |         stdout: true,
  216 |       })
> 217 |       expect(stdout).toContain('○ /404')
      |                      ^
  218 |       expect(stdout).not.toContain('λ /_error')
  219 |       expect(stdout).not.toContain('<buildId>')
  220 |     })

  at Object.<anonymous> (integration/build-output/test/index.test.js:217:22)

@ijjk
Copy link
Member

ijjk commented Jun 11, 2020

Stats from current PR

Default Server Mode (Decrease detected ✓)
General Overall increase ⚠️
vercel/next.js canary TodorTotev/next.js detect-node-sass-and-react-version Change
buildDuration 11.1s 12.3s ⚠️ +1.3s
nodeModulesSize 64.9 MB 64.9 MB ⚠️ +1.91 kB
Page Load Tests Overall decrease ⚠️
vercel/next.js canary TodorTotev/next.js detect-node-sass-and-react-version Change
/ failed reqs 0 0
/ total time (seconds) 1.915 2.108 ⚠️ +0.19
/ avg req/sec 1305.54 1186.12 -119.42
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.226 1.414 ⚠️ +0.19
/error-in-render avg req/sec 2039.93 1767.87 -272.06
Client Bundles (main, webpack, commons)
vercel/next.js canary TodorTotev/next.js detect-node-sass-and-react-version Change
main-HASH.js gzip 6.49 kB 6.49 kB
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..f367.js gzip 10.9 kB 10.9 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57.2 kB 57.2 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary TodorTotev/next.js detect-node-sass-and-react-version Change
main-HASH.module.js gzip 5.58 kB 5.58 kB
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 7.27 kB 7.27 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.7 kB 52.7 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary TodorTotev/next.js detect-node-sass-and-react-version Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
vercel/next.js canary TodorTotev/next.js detect-node-sass-and-react-version Change
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
index.js gzip 222 B 222 B
link.js gzip 2.05 kB 2.05 kB
hooks.js gzip 881 B 881 B
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
Overall change 8.22 kB 8.22 kB
Client Pages Modern
vercel/next.js canary TodorTotev/next.js detect-node-sass-and-react-version Change
index.module.js gzip 223 B 223 B
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
link.module.js gzip 1.52 kB 1.52 kB
_app.module.js gzip 604 B 604 B
Overall change 5.33 kB 5.33 kB
Client Build Manifests
vercel/next.js canary TodorTotev/next.js detect-node-sass-and-react-version Change
_buildManifest.js gzip 270 B 270 B
_buildManife..dule.js gzip 275 B 275 B
Overall change 545 B 545 B
Rendered Page Sizes
vercel/next.js canary TodorTotev/next.js detect-node-sass-and-react-version Change
index.html gzip 955 B 955 B
link.html gzip 961 B 961 B
withRouter.html gzip 948 B 948 B
Overall change 2.86 kB 2.86 kB

Serverless Mode
General Overall increase ⚠️
vercel/next.js canary TodorTotev/next.js detect-node-sass-and-react-version Change
buildDuration 12.5s 13.1s ⚠️ +525ms
nodeModulesSize 64.9 MB 64.9 MB ⚠️ +1.91 kB
Client Bundles (main, webpack, commons)
vercel/next.js canary TodorTotev/next.js detect-node-sass-and-react-version Change
main-HASH.js gzip 6.49 kB 6.49 kB
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..f367.js gzip 10.9 kB 10.9 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57.2 kB 57.2 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary TodorTotev/next.js detect-node-sass-and-react-version Change
main-HASH.module.js gzip 5.58 kB 5.58 kB
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 7.27 kB 7.27 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.7 kB 52.7 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary TodorTotev/next.js detect-node-sass-and-react-version Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
vercel/next.js canary TodorTotev/next.js detect-node-sass-and-react-version Change
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
index.js gzip 222 B 222 B
link.js gzip 2.05 kB 2.05 kB
hooks.js gzip 881 B 881 B
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
Overall change 8.22 kB 8.22 kB
Client Pages Modern
vercel/next.js canary TodorTotev/next.js detect-node-sass-and-react-version Change
index.module.js gzip 223 B 223 B
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
link.module.js gzip 1.52 kB 1.52 kB
_app.module.js gzip 604 B 604 B
Overall change 5.33 kB 5.33 kB
Client Build Manifests
vercel/next.js canary TodorTotev/next.js detect-node-sass-and-react-version Change
_buildManifest.js gzip 270 B 270 B
_buildManife..dule.js gzip 275 B 275 B
Overall change 545 B 545 B
Serverless bundles
vercel/next.js canary TodorTotev/next.js detect-node-sass-and-react-version Change
_error.js 875 kB 875 kB
404.html 4.17 kB 4.17 kB
hooks.html 3.79 kB 3.79 kB
index.js 875 kB 875 kB
link.js 915 kB 915 kB
routerDirect.js 907 kB 907 kB
withRouter.js 907 kB 907 kB
Overall change 4.49 MB 4.49 MB

@@ -263,6 +263,26 @@ export default async function getBaseWebpackConfig(
resolvedBaseUrl = path.resolve(dir, jsConfig.compilerOptions.baseUrl)
}

if (isServer) {
Copy link
Member

@timneutkens timneutkens Jul 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check should exist in packages/next/cli/next-dev.ts

@@ -263,6 +263,26 @@ export default async function getBaseWebpackConfig(
resolvedBaseUrl = path.resolve(dir, jsConfig.compilerOptions.baseUrl)
}

if (isServer) {
const packageJsonPath = path.resolve(dir, './package.json')
const packageJsonFile = parseJsonFile(packageJsonPath)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking the version of React in their package.json might not be comprehensive enough. They could have ^16.8.6 but if they did their initial installation recently then they might actually have 16.13.1 installed as their React version (due to the version using the ^ which will bump them to the next minor version released).

I think checking their installed dependencies might give you a bit more coverage:

const packagePath = require.resolve('react/package.json')
const { version } = require(packagePath)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted! Will change it!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants