From b224849eb9e66cf8bde017dbcf8658f982b185f2 Mon Sep 17 00:00:00 2001 From: Pierre de la Martiniere Date: Tue, 1 Nov 2022 14:22:21 +0100 Subject: [PATCH] Add with-app-dir integration test --- .github/workflows/ci.yml | 3 + jest-puppeteer.config.js | 6 + package.json | 3 +- scripts/next-update.sh | 3 + src/__tests__/.gitignore | 9 + src/__tests__/__apps__/pnpm/package.json | 2 +- .../__apps__/with-app-dir/app/.gitignore | 1 + .../__apps__/with-app-dir/app/app/layout.tsx | 12 + .../__apps__/with-app-dir/app/app/page.tsx | 14 + .../__apps__/with-app-dir/app/next-env.d.ts | 5 + .../__apps__/with-app-dir/app/next.config.js | 10 + .../__apps__/with-app-dir/app/package.json | 29 ++ .../__apps__/with-app-dir/app/tsconfig.json | 36 ++ .../__apps__/with-app-dir/package.json | 9 + src/__tests__/__apps__/with-app-dir/yarn.lock | 401 ++++++++++++++++++ src/__tests__/integrations.test.js | 18 + src/__tests__/setup.js | 6 +- src/next-transpile-modules.js | 2 +- 18 files changed, 565 insertions(+), 4 deletions(-) create mode 100644 src/__tests__/__apps__/with-app-dir/app/.gitignore create mode 100644 src/__tests__/__apps__/with-app-dir/app/app/layout.tsx create mode 100644 src/__tests__/__apps__/with-app-dir/app/app/page.tsx create mode 100644 src/__tests__/__apps__/with-app-dir/app/next-env.d.ts create mode 100644 src/__tests__/__apps__/with-app-dir/app/next.config.js create mode 100644 src/__tests__/__apps__/with-app-dir/app/package.json create mode 100644 src/__tests__/__apps__/with-app-dir/app/tsconfig.json create mode 100644 src/__tests__/__apps__/with-app-dir/package.json create mode 100644 src/__tests__/__apps__/with-app-dir/yarn.lock diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e534cfc2..d82322d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,6 +64,9 @@ jobs: - name: Install tests apps dependencies (swc) run: yarn --frozen-lockfile --cwd src/__tests__/__apps__/swc + - name: Install tests apps dependencies (with-app-dir) + run: yarn --frozen-lockfile --cwd src/__tests__/__apps__/with-app-dir + - name: Build test apps run: npm run test:prepare diff --git a/jest-puppeteer.config.js b/jest-puppeteer.config.js index e6880b18..93a1ac06 100644 --- a/jest-puppeteer.config.js +++ b/jest-puppeteer.config.js @@ -3,6 +3,7 @@ const yarnWorkspacesAppPath = 'src/__tests__/__apps__/yarn-workspaces/app'; const yarnWorkspacesSymlinksAppPath = 'src/__tests__/__apps__/yarn-workspaces-symlinks/app'; const pnpmAppPath = 'src/__tests__/__apps__/pnpm'; const swcAppPath = 'src/__tests__/__apps__/swc/app'; +const withAppDirAppPath = 'src/__tests__/__apps__/with-app-dir/app'; module.exports = { launch: { @@ -36,5 +37,10 @@ module.exports = { launchTimeout: 20000, port: 3506, }, + { + command: `yarn --cwd ${withAppDirAppPath} run start --port 3507`, + launchTimeout: 20000, + port: 3507, + }, ], }; diff --git a/package.json b/package.json index 0506b762..c66fa45b 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,8 @@ "test:prepare:yarn-workspaces-symlinks": "yarn --cwd src/__tests__/__apps__/yarn-workspaces-symlinks/app run build", "test:prepare:pnpm": "npm run build --prefix=src/__tests__/__apps__/pnpm", "test:prepare:swc": "yarn --cwd src/__tests__/__apps__/swc/app run build", - "test:prepare": "npm run test:prepare:npm-basic && npm run test:prepare:yarn-workspaces && npm run test:prepare:yarn-workspaces-symlinks && npm run test:prepare:pnpm && npm run test:prepare:swc" + "test:prepare:with-app-dir": "yarn --cwd src/__tests__/__apps__/with-app-dir/app run build", + "test:prepare": "npm run test:prepare:npm-basic && npm run test:prepare:yarn-workspaces && npm run test:prepare:yarn-workspaces-symlinks && npm run test:prepare:pnpm && npm run test:prepare:swc && npm run test:prepare:with-app-dir" }, "repository": { "type": "git", diff --git a/scripts/next-update.sh b/scripts/next-update.sh index 1e9322d2..94646001 100644 --- a/scripts/next-update.sh +++ b/scripts/next-update.sh @@ -18,3 +18,6 @@ yarn --cwd "$ROOT/src/__tests__/__apps__/yarn-workspaces-symlinks/app" add "next echo "==================== SWC ====================" yarn --cwd "$ROOT/src/__tests__/__apps__/swc/app" add "next@$NEXT_VERSION" + +echo "==================== WITH-APP-DIR ====================" +yarn --cwd "$ROOT/src/__tests__/__apps__/with-app-dir/app" add "next@$NEXT_VERSION" diff --git a/src/__tests__/.gitignore b/src/__tests__/.gitignore index ec6b1f82..8887e51b 100644 --- a/src/__tests__/.gitignore +++ b/src/__tests__/.gitignore @@ -7,6 +7,9 @@ __apps__/yarn-workspaces-symlinks/shared-ui __apps__/swc/shared __apps__/swc/shared-ts __apps__/swc/shared-ui +__apps__/with-app-dir/shared +__apps__/with-app-dir/shared-ts +__apps__/with-app-dir/shared-ui __apps__/shared __apps__/shared-ts __apps__/shared-ui @@ -40,3 +43,9 @@ __apps__/swc/app/components __apps__/swc/app/pages !__apps__/swc/app/pages/.keep __apps__/swc/app/next-transpile-modules.js + +__apps__/with-app-dir/app/components +!__apps__/with-app-dir/app/components/.keep +__apps__/with-app-dir/app/pages +!__apps__/with-app-dir/app/pages/.keep +__apps__/with-app-dir/app/next-transpile-modules.js diff --git a/src/__tests__/__apps__/pnpm/package.json b/src/__tests__/__apps__/pnpm/package.json index cd1b98d4..a0650b5b 100644 --- a/src/__tests__/__apps__/pnpm/package.json +++ b/src/__tests__/__apps__/pnpm/package.json @@ -1,5 +1,5 @@ { - "name": "test-npm-basic", + "name": "test-pnpm", "version": "1.0.0", "description": "", "private": "true", diff --git a/src/__tests__/__apps__/with-app-dir/app/.gitignore b/src/__tests__/__apps__/with-app-dir/app/.gitignore new file mode 100644 index 00000000..722d5e71 --- /dev/null +++ b/src/__tests__/__apps__/with-app-dir/app/.gitignore @@ -0,0 +1 @@ +.vscode diff --git a/src/__tests__/__apps__/with-app-dir/app/app/layout.tsx b/src/__tests__/__apps__/with-app-dir/app/app/layout.tsx new file mode 100644 index 00000000..7f2b6717 --- /dev/null +++ b/src/__tests__/__apps__/with-app-dir/app/app/layout.tsx @@ -0,0 +1,12 @@ +export default function RootLayout({ + children, +}: { + children: React.ReactNode +}) { + return ( + + + {children} + + ) +} diff --git a/src/__tests__/__apps__/with-app-dir/app/app/page.tsx b/src/__tests__/__apps__/with-app-dir/app/app/page.tsx new file mode 100644 index 00000000..5a835388 --- /dev/null +++ b/src/__tests__/__apps__/with-app-dir/app/app/page.tsx @@ -0,0 +1,14 @@ +import React from 'react'; +import { add } from 'shared-ts/utils/calc'; +import { Subtitle } from 'shared-ts/components/Subtitle'; + +const HomePage: React.FC = () => { + return ( + <> +

The answer is {add(40, 3)}

+ And this is a subtitle + + ); +}; + +export default HomePage; diff --git a/src/__tests__/__apps__/with-app-dir/app/next-env.d.ts b/src/__tests__/__apps__/with-app-dir/app/next-env.d.ts new file mode 100644 index 00000000..4f11a03d --- /dev/null +++ b/src/__tests__/__apps__/with-app-dir/app/next-env.d.ts @@ -0,0 +1,5 @@ +/// +/// + +// NOTE: This file should not be edited +// see https://nextjs.org/docs/basic-features/typescript for more information. diff --git a/src/__tests__/__apps__/with-app-dir/app/next.config.js b/src/__tests__/__apps__/with-app-dir/app/next.config.js new file mode 100644 index 00000000..44936132 --- /dev/null +++ b/src/__tests__/__apps__/with-app-dir/app/next.config.js @@ -0,0 +1,10 @@ +const withTM = require('./next-transpile-modules')(['shared', 'shared-ts', 'shared-ui', 'lodash-es'], { debug: true }); + +module.exports = withTM({ + eslint: { + ignoreDuringBuilds: true, + }, + experimental: { + appDir: true, + }, +}); diff --git a/src/__tests__/__apps__/with-app-dir/app/package.json b/src/__tests__/__apps__/with-app-dir/app/package.json new file mode 100644 index 00000000..f9072501 --- /dev/null +++ b/src/__tests__/__apps__/with-app-dir/app/package.json @@ -0,0 +1,29 @@ +{ + "name": "test-yarn-workspaces", + "version": "1.0.0", + "description": "", + "private": "true", + "scripts": { + "dev": "next", + "build": "next build", + "start": "next start" + }, + "author": "Pierre de la Martinière ", + "license": "MIT", + "dependencies": { + "lodash-es": "^4.17.21", + "next": "13.0.0", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "sass": "^1.43.4", + "shared": "^1.0.0", + "shared-ts": "^1.0.0", + "shared-ui": "^1.0.0" + }, + "devDependencies": { + "@types/node": "^18.11.7", + "@types/react": "^18.0.24", + "@types/react-dom": "^18.0.8", + "typescript": "^4.8.4" + } +} diff --git a/src/__tests__/__apps__/with-app-dir/app/tsconfig.json b/src/__tests__/__apps__/with-app-dir/app/tsconfig.json new file mode 100644 index 00000000..0375707b --- /dev/null +++ b/src/__tests__/__apps__/with-app-dir/app/tsconfig.json @@ -0,0 +1,36 @@ +{ + "compilerOptions": { + "target": "es5", + "lib": [ + "dom", + "dom.iterable", + "esnext" + ], + "allowJs": true, + "skipLibCheck": true, + "strict": false, + "forceConsistentCasingInFileNames": true, + "noEmit": true, + "esModuleInterop": true, + "module": "esnext", + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "preserve", + "incremental": true, + "plugins": [ + { + "name": "next" + } + ] + }, + "exclude": [ + "node_modules" + ], + "include": [ + "next-env.d.ts", + "**/*.ts", + "**/*.tsx", + ".next/types/**/*.ts" + ] +} diff --git a/src/__tests__/__apps__/with-app-dir/package.json b/src/__tests__/__apps__/with-app-dir/package.json new file mode 100644 index 00000000..c57c781c --- /dev/null +++ b/src/__tests__/__apps__/with-app-dir/package.json @@ -0,0 +1,9 @@ +{ + "private": true, + "workspaces": [ + "shared", + "shared-ts", + "shared-ui", + "app" + ] +} diff --git a/src/__tests__/__apps__/with-app-dir/yarn.lock b/src/__tests__/__apps__/with-app-dir/yarn.lock new file mode 100644 index 00000000..aafb9590 --- /dev/null +++ b/src/__tests__/__apps__/with-app-dir/yarn.lock @@ -0,0 +1,401 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@next/env@13.0.0": + version "13.0.0" + resolved "https://registry.yarnpkg.com/@next/env/-/env-13.0.0.tgz#38527956680693c90b4522ab4ab9a2fbe3a17f67" + integrity sha512-65v9BVuah2Mplohm4+efsKEnoEuhmlGm8B2w6vD1geeEP2wXtlSJCvR/cCRJ3fD8wzCQBV41VcMBQeYET6MRkg== + +"@next/swc-android-arm-eabi@13.0.0": + version "13.0.0" + resolved "https://registry.yarnpkg.com/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-13.0.0.tgz#15cd89d19d3c00d123fdfe367bab38c362f6c515" + integrity sha512-+DUQkYF93gxFjWY+CYWE1QDX6gTgnUiWf+W4UqZjM1Jcef8U97fS6xYh+i+8rH4MM0AXHm7OSakvfOMzmjU6VA== + +"@next/swc-android-arm64@13.0.0": + version "13.0.0" + resolved "https://registry.yarnpkg.com/@next/swc-android-arm64/-/swc-android-arm64-13.0.0.tgz#9410365bb07097268d4773a46b02cfe6b3fe3ab7" + integrity sha512-RW9Uy3bMSc0zVGCa11klFuwfP/jdcdkhdruqnrJ7v+7XHm6OFKkSRzX6ee7yGR1rdDZvTnP4GZSRSpzjLv/N0g== + +"@next/swc-darwin-arm64@13.0.0": + version "13.0.0" + resolved "https://registry.yarnpkg.com/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.0.0.tgz#caf262fb5cb8bb335f6f344fd67a44dc8bf6a084" + integrity sha512-APA26nps1j4qyhOIzkclW/OmgotVHj1jBxebSpMCPw2rXfiNvKNY9FA0TcuwPmUCNqaTnm703h6oW4dvp73A4Q== + +"@next/swc-darwin-x64@13.0.0": + version "13.0.0" + resolved "https://registry.yarnpkg.com/@next/swc-darwin-x64/-/swc-darwin-x64-13.0.0.tgz#6b214753410e1d8512a1491045acea1e188df7d6" + integrity sha512-qsUhUdoFuRJiaJ7LnvTQ6GZv1QnMDcRXCIjxaN0FNVXwrjkq++U7KjBUaxXkRzLV4C7u0NHLNOp0iZwNNE7ypw== + +"@next/swc-freebsd-x64@13.0.0": + version "13.0.0" + resolved "https://registry.yarnpkg.com/@next/swc-freebsd-x64/-/swc-freebsd-x64-13.0.0.tgz#eeb176bdb585f48882bdac1d04271b918ca87590" + integrity sha512-sCdyCbboS7CwdnevKH9J6hkJI76LUw1jVWt4eV7kISuLiPba3JmehZSWm80oa4ADChRVAwzhLAo2zJaYRrInbg== + +"@next/swc-linux-arm-gnueabihf@13.0.0": + version "13.0.0" + resolved "https://registry.yarnpkg.com/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-13.0.0.tgz#2c2a9622c93f87a8baca94e068f674da4cae6018" + integrity sha512-/X/VxfFA41C9jrEv+sUsPLQ5vbDPVIgG0CJrzKvrcc+b+4zIgPgtfsaWq9ockjHFQi3ycvlZK4TALOXO8ovQ6Q== + +"@next/swc-linux-arm64-gnu@13.0.0": + version "13.0.0" + resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.0.0.tgz#69505827e2928fb18034150fd4d754d54c4a1c4b" + integrity sha512-x6Oxr1GIi0ZtNiT6jbw+JVcbEi3UQgF7mMmkrgfL4mfchOwXtWSHKTSSPnwoJWJfXYa0Vy1n8NElWNTGAqoWFw== + +"@next/swc-linux-arm64-musl@13.0.0": + version "13.0.0" + resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.0.0.tgz#487a88f2583a046e882328fe0665b37eca4fd0f6" + integrity sha512-SnMH9ngI+ipGh3kqQ8+mDtWunirwmhQnQeZkEq9e/9Xsgjf04OetqrqRHKM1HmJtG2qMUJbyXFJ0F81TPuT+3g== + +"@next/swc-linux-x64-gnu@13.0.0": + version "13.0.0" + resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.0.0.tgz#29e89c7e4fd2e2b16ad059076f6261998aee53df" + integrity sha512-VSQwTX9EmdbotArtA1J67X8964oQfe0xHb32x4tu+JqTR+wOHyG6wGzPMdXH2oKAp6rdd7BzqxUXXf0J+ypHlw== + +"@next/swc-linux-x64-musl@13.0.0": + version "13.0.0" + resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.0.0.tgz#2f63aae922d2b2829aec21bf8f9adda8b6c16365" + integrity sha512-xBCP0nnpO0q4tsytXkvIwWFINtbFRyVY5gxa1zB0vlFtqYR9lNhrOwH3CBrks3kkeaePOXd611+8sjdUtrLnXA== + +"@next/swc-win32-arm64-msvc@13.0.0": + version "13.0.0" + resolved "https://registry.yarnpkg.com/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.0.0.tgz#4117bad96c2a6775f70294fba45c63951a8a21ac" + integrity sha512-NutwDafqhGxqPj/eiUixJq9ImS/0sgx6gqlD7jRndCvQ2Q8AvDdu1+xKcGWGNnhcDsNM/n1avf1e62OG1GaqJg== + +"@next/swc-win32-ia32-msvc@13.0.0": + version "13.0.0" + resolved "https://registry.yarnpkg.com/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.0.0.tgz#5914eb86f9ea92a00d76cb094dd9734b3bf2012c" + integrity sha512-zNaxaO+Kl/xNz02E9QlcVz0pT4MjkXGDLb25qxtAzyJL15aU0+VjjbIZAYWctG59dvggNIUNDWgoBeVTKB9xLg== + +"@next/swc-win32-x64-msvc@13.0.0": + version "13.0.0" + resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.0.0.tgz#c54a5a739dee04b20338d305226a2acdf701f67f" + integrity sha512-FFOGGWwTCRMu9W7MF496Urefxtuo2lttxF1vwS+1rIRsKvuLrWhVaVTj3T8sf2EBL6gtJbmh4TYlizS+obnGKA== + +"@swc/helpers@0.4.11": + version "0.4.11" + resolved "https://registry.yarnpkg.com/@swc/helpers/-/helpers-0.4.11.tgz#db23a376761b3d31c26502122f349a21b592c8de" + integrity sha512-rEUrBSGIoSFuYxwBYtlUFMlE2CwGhmW+w9355/5oduSw8e5h2+Tj4UrAGNNgP9915++wj5vkQo0UuOBqOAq4nw== + dependencies: + tslib "^2.4.0" + +"@types/node@^18.11.7": + version "18.11.7" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.7.tgz#8ccef136f240770c1379d50100796a6952f01f94" + integrity sha512-LhFTglglr63mNXUSRYD8A+ZAIu5sFqNJ4Y2fPuY7UlrySJH87rRRlhtVmMHplmfk5WkoJGmDjE9oiTfyX94CpQ== + +"@types/prop-types@*": + version "15.7.3" + resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.3.tgz#2ab0d5da2e5815f94b0b9d4b95d1e5f243ab2ca7" + integrity sha512-KfRL3PuHmqQLOG+2tGpRO26Ctg+Cq1E01D2DMriKEATHgWLfeNDmq9e29Q9WIky0dQ3NPkd1mzYH8Lm936Z9qw== + +"@types/react-dom@^18.0.8": + version "18.0.8" + resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.0.8.tgz#d2606d855186cd42cc1b11e63a71c39525441685" + integrity sha512-C3GYO0HLaOkk9dDAz3Dl4sbe4AKUGTCfFIZsz3n/82dPNN8Du533HzKatDxeUYWu24wJgMP1xICqkWk1YOLOIw== + dependencies: + "@types/react" "*" + +"@types/react@*": + version "17.0.33" + resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.33.tgz#e01ae3de7613dac1094569880bb3792732203ad5" + integrity sha512-pLWntxXpDPaU+RTAuSGWGSEL2FRTNyRQOjSWDke/rxRg14ncsZvx8AKWMWZqvc1UOaJIAoObdZhAWvRaHFi5rw== + dependencies: + "@types/prop-types" "*" + "@types/scheduler" "*" + csstype "^3.0.2" + +"@types/react@^18.0.24": + version "18.0.24" + resolved "https://registry.yarnpkg.com/@types/react/-/react-18.0.24.tgz#2f79ed5b27f08d05107aab45c17919754cc44c20" + integrity sha512-wRJWT6ouziGUy+9uX0aW4YOJxAY0bG6/AOk5AW5QSvZqI7dk6VBIbXvcVgIw/W5Jrl24f77df98GEKTJGOLx7Q== + dependencies: + "@types/prop-types" "*" + "@types/scheduler" "*" + csstype "^3.0.2" + +"@types/scheduler@*": + version "0.16.1" + resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.1.tgz#18845205e86ff0038517aab7a18a62a6b9f71275" + integrity sha512-EaCxbanVeyxDRTQBkdLb3Bvl/HK7PBK6UJjsSixB0iHKoWxE5uu2Q/DgtpOhPIojN0Zl1whvOd7PoHs2P0s5eA== + +anymatch@~3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.2.tgz#c0557c096af32f106198f4f4e2a383537e378716" + integrity sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg== + dependencies: + normalize-path "^3.0.0" + picomatch "^2.0.4" + +binary-extensions@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" + integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== + +braces@~3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" + integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== + dependencies: + fill-range "^7.0.1" + +caniuse-lite@^1.0.30001406: + version "1.0.30001426" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001426.tgz#58da20446ccd0cb1dfebd11d2350c907ee7c2eaa" + integrity sha512-n7cosrHLl8AWt0wwZw/PJZgUg3lV0gk9LMI7ikGJwhyhgsd2Nb65vKvmSexCqq/J7rbH3mFG6yZZiPR5dLPW5A== + +"chokidar@>=3.0.0 <4.0.0": + version "3.5.2" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.2.tgz#dba3976fcadb016f66fd365021d91600d01c1e75" + integrity sha512-ekGhOnNVPgT77r4K/U3GDhu+FQ2S8TnK/s2KbIGXi0SZWuwkZ2QNyfWdZW+TVfn84DpEP7rLeCt2UI6bJ8GwbQ== + dependencies: + anymatch "~3.1.2" + braces "~3.0.2" + glob-parent "~5.1.2" + is-binary-path "~2.1.0" + is-glob "~4.0.1" + normalize-path "~3.0.0" + readdirp "~3.6.0" + optionalDependencies: + fsevents "~2.3.2" + +client-only@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/client-only/-/client-only-0.0.1.tgz#38bba5d403c41ab150bff64a95c85013cf73bca1" + integrity sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA== + +csstype@^3.0.2: + version "3.0.8" + resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.0.8.tgz#d2266a792729fb227cd216fb572f43728e1ad340" + integrity sha512-jXKhWqXPmlUeoQnF/EhTtTl4C9SnrxSH/jZUih3jmO6lBKr99rP3/+FmrMj4EFpOXzMtXHAZkd3x0E6h6Fgflw== + +fill-range@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" + integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== + dependencies: + to-regex-range "^5.0.1" + +fsevents@~2.3.2: + version "2.3.2" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" + integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== + +glob-parent@~5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" + integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== + dependencies: + is-glob "^4.0.1" + +is-binary-path@~2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" + integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== + dependencies: + binary-extensions "^2.0.0" + +is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= + +is-glob@^4.0.1, is-glob@~4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" + integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== + dependencies: + is-extglob "^2.1.1" + +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + +"js-tokens@^3.0.0 || ^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + +lodash-es@^4.17.21: + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee" + integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw== + +loose-envify@^1.1.0, loose-envify@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" + integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== + dependencies: + js-tokens "^3.0.0 || ^4.0.0" + +nanoid@^3.3.4: + version "3.3.4" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab" + integrity sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw== + +next@13.0.0: + version "13.0.0" + resolved "https://registry.yarnpkg.com/next/-/next-13.0.0.tgz#6f07064a4f374562cf58677bef4dd06326ca648b" + integrity sha512-puH1WGM6rGeFOoFdXXYfUxN9Sgi4LMytCV5HkQJvVUOhHfC1DoVqOfvzaEteyp6P04IW+gbtK2Q9pInVSrltPA== + dependencies: + "@next/env" "13.0.0" + "@swc/helpers" "0.4.11" + caniuse-lite "^1.0.30001406" + postcss "8.4.14" + styled-jsx "5.1.0" + use-sync-external-store "1.2.0" + optionalDependencies: + "@next/swc-android-arm-eabi" "13.0.0" + "@next/swc-android-arm64" "13.0.0" + "@next/swc-darwin-arm64" "13.0.0" + "@next/swc-darwin-x64" "13.0.0" + "@next/swc-freebsd-x64" "13.0.0" + "@next/swc-linux-arm-gnueabihf" "13.0.0" + "@next/swc-linux-arm64-gnu" "13.0.0" + "@next/swc-linux-arm64-musl" "13.0.0" + "@next/swc-linux-x64-gnu" "13.0.0" + "@next/swc-linux-x64-musl" "13.0.0" + "@next/swc-win32-arm64-msvc" "13.0.0" + "@next/swc-win32-ia32-msvc" "13.0.0" + "@next/swc-win32-x64-msvc" "13.0.0" + +normalize-path@^3.0.0, normalize-path@~3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" + integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== + +object-assign@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= + +picocolors@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" + integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== + +picomatch@^2.0.4, picomatch@^2.2.1: + version "2.3.0" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972" + integrity sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw== + +postcss@8.4.14: + version "8.4.14" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.14.tgz#ee9274d5622b4858c1007a74d76e42e56fd21caf" + integrity sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig== + dependencies: + nanoid "^3.3.4" + picocolors "^1.0.0" + source-map-js "^1.0.2" + +prop-types@^15.6.2: + version "15.7.2" + resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5" + integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ== + dependencies: + loose-envify "^1.4.0" + object-assign "^4.1.1" + react-is "^16.8.1" + +react-dom@^16.12.0: + version "16.14.0" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.14.0.tgz#7ad838ec29a777fb3c75c3a190f661cf92ab8b89" + integrity sha512-1gCeQXDLoIqMgqD3IO2Ah9bnf0w9kzhwN5q4FGnHZ67hBm9yePzB5JJAIQCc8x3pFnNlwFq4RidZggNAAkzWWw== + dependencies: + loose-envify "^1.1.0" + object-assign "^4.1.1" + prop-types "^15.6.2" + scheduler "^0.19.1" + +react-dom@^18.2.0: + version "18.2.0" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.2.0.tgz#22aaf38708db2674ed9ada224ca4aa708d821e3d" + integrity sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g== + dependencies: + loose-envify "^1.1.0" + scheduler "^0.23.0" + +react-is@^16.8.1: + version "16.13.1" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" + integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== + +react@^16.12.0: + version "16.14.0" + resolved "https://registry.yarnpkg.com/react/-/react-16.14.0.tgz#94d776ddd0aaa37da3eda8fc5b6b18a4c9a3114d" + integrity sha512-0X2CImDkJGApiAlcf0ODKIneSwBPhqJawOa5wCtKbu7ZECrmS26NvtSILynQ66cgkT/RJ4LidJOc3bUESwmU8g== + dependencies: + loose-envify "^1.1.0" + object-assign "^4.1.1" + prop-types "^15.6.2" + +react@^18.2.0: + version "18.2.0" + resolved "https://registry.yarnpkg.com/react/-/react-18.2.0.tgz#555bd98592883255fa00de14f1151a917b5d77d5" + integrity sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ== + dependencies: + loose-envify "^1.1.0" + +readdirp@~3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" + integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA== + dependencies: + picomatch "^2.2.1" + +sass@^1.43.4: + version "1.43.4" + resolved "https://registry.yarnpkg.com/sass/-/sass-1.43.4.tgz#68c7d6a1b004bef49af0d9caf750e9b252105d1f" + integrity sha512-/ptG7KE9lxpGSYiXn7Ar+lKOv37xfWsZRtFYal2QHNigyVQDx685VFT/h7ejVr+R8w7H4tmUgtulsKl5YpveOg== + dependencies: + chokidar ">=3.0.0 <4.0.0" + +scheduler@^0.19.1: + version "0.19.1" + resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.19.1.tgz#4f3e2ed2c1a7d65681f4c854fa8c5a1ccb40f196" + integrity sha512-n/zwRWRYSUj0/3g/otKDRPMh6qv2SYMWNq85IEa8iZyAv8od9zDYpGSnpBEjNgcMNq6Scbu5KfIPxNF72R/2EA== + dependencies: + loose-envify "^1.1.0" + object-assign "^4.1.1" + +scheduler@^0.23.0: + version "0.23.0" + resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.23.0.tgz#ba8041afc3d30eb206a487b6b384002e4e61fdfe" + integrity sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw== + dependencies: + loose-envify "^1.1.0" + +source-map-js@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c" + integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw== + +styled-jsx@5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/styled-jsx/-/styled-jsx-5.1.0.tgz#4a5622ab9714bd3fcfaeec292aa555871f057563" + integrity sha512-/iHaRJt9U7T+5tp6TRelLnqBqiaIT0HsO0+vgyj8hK2KUk7aejFqRrumqPUlAqDwAj8IbS/1hk3IhBAAK/FCUQ== + dependencies: + client-only "0.0.1" + +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + +tslib@^2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" + integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== + +typescript@^4.8.4: + version "4.8.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.4.tgz#c464abca159669597be5f96b8943500b238e60e6" + integrity sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ== + +use-sync-external-store@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz#7dbefd6ef3fe4e767a0cf5d7287aacfb5846928a" + integrity sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA== diff --git a/src/__tests__/integrations.test.js b/src/__tests__/integrations.test.js index f4719eb7..0053e5f6 100644 --- a/src/__tests__/integrations.test.js +++ b/src/__tests__/integrations.test.js @@ -137,3 +137,21 @@ describe.each([ }); }); }); + +describe.each([['with-app-dir', 3507]])('%s integration', (name, port) => { + const BASE_URL = `http://localhost:${port}`; + + describe('homepage access', () => { + test('homepage should be correctly displayed', async () => { + const page = await browser.newPage(); + const response = await page.goto(`${BASE_URL}/`); + + if (!response) throw new Error('Could not access the page'); + + expect(response.status()).toBe(200); + + const content = await page.$eval('h1', (e) => e.textContent); + expect(content).toBe('The answer is 43'); + }); + }); +}); diff --git a/src/__tests__/setup.js b/src/__tests__/setup.js index 4f6aa835..cc5fbfa6 100644 --- a/src/__tests__/setup.js +++ b/src/__tests__/setup.js @@ -5,6 +5,7 @@ fse.copySync('src/__tests__/__packages__', 'src/__tests__/__apps__'); fse.copySync('src/__tests__/__packages__', 'src/__tests__/__apps__/yarn-workspaces'); fse.copySync('src/__tests__/__packages__', 'src/__tests__/__apps__/yarn-workspaces-symlinks'); fse.copySync('src/__tests__/__packages__', 'src/__tests__/__apps__/swc'); +fse.copySync('src/__tests__/__packages__', 'src/__tests__/__apps__/with-app-dir'); // Setup pages for each test fse.copySync('src/__tests__/__files__', 'src/__tests__/__apps__/npm-basic'); @@ -12,8 +13,10 @@ fse.copySync('src/__tests__/__files__', 'src/__tests__/__apps__/yarn-workspaces/ fse.copySync('src/__tests__/__files__', 'src/__tests__/__apps__/yarn-workspaces-symlinks/app'); fse.copySync('src/__tests__/__files__', 'src/__tests__/__apps__/pnpm'); fse.copySync('src/__tests__/__files__', 'src/__tests__/__apps__/swc/app'); +// INTENTIONAL, this test has its own special pages +// fse.copySync('src/__tests__/__files__', 'src/__tests__/__apps__/with-app-dir/app'); -// Setup pages for each test +// Setup plugin for each test fse.copySync('./src/next-transpile-modules.js', 'src/__tests__/__apps__/npm-basic/next-transpile-modules.js'); fse.copySync('./src/next-transpile-modules.js', 'src/__tests__/__apps__/yarn-workspaces/app/next-transpile-modules.js'); fse.copySync( @@ -22,3 +25,4 @@ fse.copySync( ); fse.copySync('./src/next-transpile-modules.js', 'src/__tests__/__apps__/pnpm/next-transpile-modules.js'); fse.copySync('./src/next-transpile-modules.js', 'src/__tests__/__apps__/swc/app/next-transpile-modules.js'); +fse.copySync('./src/next-transpile-modules.js', 'src/__tests__/__apps__/with-app-dir/app/next-transpile-modules.js'); diff --git a/src/next-transpile-modules.js b/src/next-transpile-modules.js index fd026da8..4d6550d7 100644 --- a/src/next-transpile-modules.js +++ b/src/next-transpile-modules.js @@ -18,7 +18,7 @@ const process = require('process'); const enhancedResolve = require('enhanced-resolve'); // Use me when needed -const util = require('util'); +// const util = require('util'); // const inspect = (object) => { // console.log(util.inspect(object, { showHidden: false, depth: null })); // };