Skip to content

Commit

Permalink
cjs e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
abernier committed Nov 15, 2024
1 parent 373e486 commit 5e2bc8d
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions test/e2e/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,50 @@ cp App.tsx $appdir/app/page.tsx
npx playwright test snapshot.test.js
kill_app

# β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—
# β–ˆβ–ˆβ•”β•β•β•β•β• β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β•
# β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—
# β–ˆβ–ˆβ•‘ β–ˆβ–ˆ β–ˆβ–ˆβ•‘β•šβ•β•β•β•β–ˆβ–ˆβ•‘
# β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘
# β•šβ•β•β•β•β•β• β•šβ•β•β•β•β• β•šβ•β•β•β•β•β•β•
#
# (using Next.js)
#

appname=nextapp
appdir="$tmp/$appname"

# create app
(cd $tmp; npx -y create-next-app@14 $appname --ts --no-eslint --no-tailwind --no-src-dir --app --import-alias "@/*")

# drei
(cd $appdir; npm i $TGZ)

# App.tsx
cp App.tsx $appdir/app/page.tsx

# next.config.mjs
cat <<EOF >$appdir/next.config.mjs
console.log('πŸ¦† CJS override (next.config.mjs)')
import path from 'path'
/** @type {import('next').NextConfig} */
export default {
//
// We force Next to use drei's CJS version here
//
webpack: (config) => {
config.resolve.alias['@react-three/drei'] = path.resolve('node_modules/@react-three/drei/index.cjs.js')
return config
},
}
EOF

# build+start+playwright
(cd $appdir; npm run build; npm start -- -p $PORT &)
npx playwright test snapshot.test.js
kill_app

#
# β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—
# β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—
Expand Down

0 comments on commit 5e2bc8d

Please sign in to comment.