Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with tests scanning postgres-data directory #28

Closed
Tymek opened this issue Mar 20, 2022 · 4 comments
Closed

Issue with tests scanning postgres-data directory #28

Tymek opened this issue Mar 20, 2022 · 4 comments

Comments

@Tymek
Copy link

Tymek commented Mar 20, 2022

I had issues running rootless Docker in WSL2. Running postgress with user=root, postgres-data folder is created with root access, and npm run setup fails.

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Error ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Error: EACCES: permission denied, scandir '/src/█████/postgres-data/'
    at Object.readdirSync (node:fs:1392:3)
    at Object.readdir (/src/█████/node_modules/recrawl-sync/lib/fs.js:6:25)
    at crawl (/src/█████/node_modules/recrawl-sync/lib/recrawl.js:46:35)
    at crawl (/src/█████/node_modules/recrawl-sync/lib/recrawl.js:67:25)
    at /src/█████/node_modules/recrawl-sync/lib/recrawl.js:85:9
    at exports.crawl (/src/█████/node_modules/recrawl-sync/lib/recrawl.js:15:51)
    at findProjects (/src/█████/node_modules/vite-tsconfig-paths/dist/index.js:210:35)
    at Object.configResolved (/src/█████/node_modules/vite-tsconfig-paths/dist/index.js:68:24)
    at /src/█████/node_modules/vite/dist/node/chunks/dep-9c153816.js:71056:127
    at Array.map (<anonymous>) {
  errno: -13,
  syscall: 'scandir',
  code: 'EACCES',
  path: '/src/█████/postgres-data/'
}

I solved it with this patch:

diff --git a/package.json b/package.json
index 3472d91..6332ca9 100644
--- a/package.json
+++ b/package.json
@@ -30,7 +30,8 @@
   "eslintIgnore": [
     "/node_modules",
     "/build",
-    "/public/build"
+    "/public/build",
+    "/postgres-data"
   ],
   "dependencies": {
     "@node-rs/bcrypt": "^1.6.0",
diff --git a/vitest.config.ts b/vitest.config.ts
index de07a32..5fa4c92 100644
--- a/vitest.config.ts
+++ b/vitest.config.ts
@@ -6,10 +6,19 @@ import react from "@vitejs/plugin-react";
 import tsconfigPaths from "vite-tsconfig-paths";
 
 export default defineConfig({
-  plugins: [react(), tsconfigPaths()],
+  plugins: [react(), tsconfigPaths({ projects: ["tsconfig.json"] })],
   test: {
     globals: true,
     environment: "happy-dom",
     setupFiles: ["./test/setup-test-env.ts"],
+    exclude: [
+      "node_modules",
+      "dist",
+      ".idea",
+      ".git",
+      ".cache",
+      "build",
+      "postgres-data",
+    ],
   },
 });

I didn't solve issues with Cypress in WSL2, but I probably will not use Cypress.

@sys13
Copy link

sys13 commented Mar 20, 2022

Had a similar issue. See my pull request: #27

For Cypress on WSL2, I went through the WSL GUI docs. Doing a WSL update seemed to be enough, and didn't need to install nvidia drivers.

@Tymek
Copy link
Author

Tymek commented Mar 21, 2022

I don't think it works on Win10, and I'm not switching to Win11 for that 😅. I'll probably run Playwright with VcXsrv.

@BenMcH
Copy link

BenMcH commented Mar 21, 2022

This worked well for me on my forked blues stack 👍 Thank you!

@kentcdodds
Copy link
Member

kentcdodds commented Mar 24, 2022

I've resolved this issue with a change to the vitest config :) Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants