environment_tests/README.md
This directory contains tests that verify LangChain packages work correctly in different JavaScript/TypeScript environments.
The environment tests create isolated Docker containers that mimic real user environments, ensuring our packages work correctly with:
scripts/test-runner.ts)The TypeScript test runner:
/app in the Docker container/app/libs/workspace:* dependencies with published versions for unavailable packagespnpm install --prod to install dependenciesEach test environment runs in its own Docker container with:
/package/scripts/app directory as the test sandboxdocker compose -f environment_tests/docker-compose.yml run <environment>
# e.g. for test-exports-esbuild
docker compose -f environment_tests/docker-compose.yml run test-exports-esbuild
test-exports-{name}/package.json with:
workspace:* for local packagesbuild script (if needed)test script that runs your testssrc/docker-compose.yml:
test-exports-{name}:
image: node:20
environment:
PUPPETEER_SKIP_DOWNLOAD: "true"
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "true"
working_dir: /app
volumes:
- ../pnpm-workspace.yaml:/pnpm-workspace.yaml
- ../turbo.json:/turbo.json
- ../environment_tests/test-exports-{name}:/package
- ../environment_tests/scripts:/scripts
- ../langchain:/langchain
- ../langchain-core:/langchain-core
# ... other packages
command: bash /scripts/docker-entrypoint.sh
tsx (or uses Bun directly) and runs the test runnerThis approach ensures we test against real package installations, not source code, providing confidence that our published packages work correctly in user environments.