Skip to content

Commit 2b52f3e

Browse files
committed
add simple end-to-end tests
1 parent 0c626c5 commit 2b52f3e

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

Makefile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,43 @@ node-unref-tests: | scripts/node_modules
8787
lib-typecheck: | lib/node_modules
8888
cd lib && node_modules/.bin/tsc -noEmit -p .
8989

90+
# End-to-end tests
91+
test-e2e: test-e2e-npm
92+
93+
test-e2e-npm:
94+
# Test normal install
95+
rm -fr e2e-npm && mkdir e2e-npm && cd e2e-npm && echo {} > package.json && npm i esbuild
96+
cd e2e-npm && echo "1+2" | node_modules/.bin/esbuild && node -p "require('esbuild').transformSync('1+2').code"
97+
# Test CI reinstall
98+
cd e2e-npm && npm ci
99+
cd e2e-npm && echo "1+2" | node_modules/.bin/esbuild && node -p "require('esbuild').transformSync('1+2').code"
100+
# Test rebuild
101+
cd e2e-npm && npm rebuild && npm rebuild
102+
cd e2e-npm && echo "1+2" | node_modules/.bin/esbuild && node -p "require('esbuild').transformSync('1+2').code"
103+
104+
# Test install without scripts
105+
rm -fr e2e-npm && mkdir e2e-npm && cd e2e-npm && echo {} > package.json && npm i --ignore-scripts esbuild
106+
cd e2e-npm && echo "1+2" | node_modules/.bin/esbuild && node -p "require('esbuild').transformSync('1+2').code"
107+
# Test CI reinstall
108+
cd e2e-npm && npm ci
109+
cd e2e-npm && echo "1+2" | node_modules/.bin/esbuild && node -p "require('esbuild').transformSync('1+2').code"
110+
# Test rebuild
111+
cd e2e-npm && npm rebuild && npm rebuild
112+
cd e2e-npm && echo "1+2" | node_modules/.bin/esbuild && node -p "require('esbuild').transformSync('1+2').code"
113+
114+
# Test install without optional dependencies
115+
rm -fr e2e-npm && mkdir e2e-npm && cd e2e-npm && echo {} > package.json && npm i --no-optional esbuild
116+
cd e2e-npm && echo "1+2" | node_modules/.bin/esbuild && node -p "require('esbuild').transformSync('1+2').code"
117+
# Test CI reinstall
118+
cd e2e-npm && npm ci
119+
cd e2e-npm && echo "1+2" | node_modules/.bin/esbuild && node -p "require('esbuild').transformSync('1+2').code"
120+
# Test rebuild
121+
cd e2e-npm && npm rebuild && npm rebuild
122+
cd e2e-npm && echo "1+2" | node_modules/.bin/esbuild && node -p "require('esbuild').transformSync('1+2').code"
123+
124+
# Clean up
125+
rm -fr e2e-npm
126+
90127
cmd/esbuild/version.go: version.txt
91128
# Update this atomically to avoid issues with this being overwritten during use
92129
node -e 'console.log(`package main\n\nconst esbuildVersion = "$(ESBUILD_VERSION)"`)' > cmd/esbuild/version.go.txt

0 commit comments

Comments
 (0)