Closed bmz1 closed 3 years ago
hm. I am using it within github-ci which i believe is docker/osi based. could you provide a repro?
@betaboon There you go: https://github.com/bmz1/vite-wtr-plugin-repro
@bmz1
adapted from here
diff --git a/Dockerfile b/Dockerfile
index 28b322d..d25fb95 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -14,12 +14,6 @@ RUN apt-get update \
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
ENV DOCKER=true
-COPY package.json yarn.lock /app/
+RUN npm i puppeteer
-RUN yarn install
-
-COPY . /app/
-
-RUN yarn test
-
-ENTRYPOINT [ "" ]
+CMD ["google-chrome-stable"]
diff --git a/package.json b/package.json
index a6a4067..25f8f0e 100644
--- a/package.json
+++ b/package.json
@@ -12,7 +12,9 @@
"scripts": {
"dev": "vite",
"build": "vite build",
- "test": "web-test-runner --coverage"
+ "test": "web-test-runner --coverage",
+ "docker-build": "docker build -t wtr:v1 .",
+ "docker-test": "docker run -i --init --rm -v $(pwd):/app wtr:v1 yarn test"
},
"dependencies": {
"lit-element": "^2.4.0"
@betaboon My problem is not running puppeteer, but the following:
When I run the tests with the same Dockerfile without the plugin, it waits for the tests to finish. But somehow it does not wait with the plugin.
tbh I'm not sure if it's the right approach to run the tests in the build-phase of a docker image oO
Edit: i think the main issue here is that during docker build
the RUN
commands are not run in an interactive-shell, which web-test-runner doesnt seem to like. tbh i think this has nothing to do with this plugin.
Edit2: i just tried to apply the same approach with snowpack. there it somehow works.
I'm having this same problem as well, in Github actions.
@betaboon if it's working for you, what versions of web-test-runner and vite are you using?
@IanVS that issue/codepath is a nice find. that would completly explain the behavior. I'm perplexed why it works in my github-actions tho.
"@web/test-runner": "^0.13.3",
"chai": "^4.3.4",
"vite": "^2.2.3",
But i currently don't have the time to look into it. so thank you very much for spending the time and working on a solution :)
@bmz1 after a new version of vite is released, it would be great if you could check that it solves your issue.
vite@2.4.0-beta.0
has been released with the referenced PR. Does it solve your problem, @bmz1?
@IanVS Yes it does 🍾 . Setting ENV CI=true
in the Dockerfile solves it. Thanks for your cooperation.
🎉 should this issue be closed, then?
perfect. thank you guys for following up :)
Hi! First of all, thank you for creating this plugin.
From the command line it works great, but I've tried running the tests with docker, and it actually doesn't wait for the tests to complete. I think this is because the vite dev server startup gives back a 0 exit code. This is just a guess though.
Have you tried this plugin in docker? If so, have you faced the same problem?