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

Add docs on how to run on project in subdirectory? #27

Open
fatso83 opened this issue Nov 3, 2021 · 1 comment
Open

Add docs on how to run on project in subdirectory? #27

fatso83 opened this issue Nov 3, 2021 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@fatso83
Copy link

fatso83 commented Nov 3, 2021

I am getting these quite cryptic error message when trying your mocha runner and I assume it might be due to the file directory layout of my project.

The relevant bits of my NPM scripts look like this:

  dev:app1
    vite -c code/app1/vite.config.ts code/app1
  dev:app2
    vite -c code/app2/vite.config.ts code/app2
  test
    mocha -- --reporter mocha-teamcity-reporter --recursive code/app1/test/ --timeout 5000

So I have basically two apps sharing the same node_modules folder, with their separate setups. If I try to launch your tool from a sub-directory like code/app1 I just get this error:

$ npx mocha-vite-puppeteer
✔ Install the following package: mocha-vite-puppeteer@latest? (Y/n) · true
Packages: +186
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Packages are hard linked from the content-addressable store to the virtual store.
  Content-addressable store is at: /home/my-user/.pnpm-store/v3
  Virtual store is at:             node_modules/.pnpm
Progress: resolved 202, reused 162, downloaded 34, added 186, done
node_modules/.pnpm/[email protected]/node_modules/esbuild: Running postinstall script, done in 48ms
node_modules/.pnpm/[email protected]/node_modules/puppeteer: Running install script, done in 92ms

/home/my-user/.pnpm-store/v3/tmp/_npx/29559/5:
+ mocha-vite-puppeteer 2.0.0
Pre-bundling dependencies:
  dayjs/locale/nb
  dayjs
  react
  react-dom
  tcomb/lib/installTypeFormatter
  (...and 192 more)
(this will be run only when your dependencies or config have changed)
[vite] connecting...
[vite] connected.
16:04:07 [vite] new dependencies found: chai, proxyquire, sinon, sinon-chai, @sinonjs/fake-timers, enzyme-to-json, redux-mock-store, tcomb-validation, @testing-library/react, @testing-library/dom, enzyme, updating...
16:04:08 [vite] Failed to load source map for /@fs/home/my-user/dev/my-project/frontend/node_modules/.vite/chunk-6MRIKF33.js?v=54d1b7f1.
16:04:08 [vite] Failed to load source map for /@fs/home/my-user/dev/my-project/frontend/node_modules/.vite/chunk-I3LIQQ36.js?v=54d1b7f1.
16:04:08 [vite] Failed to load source map for /@fs/home/my-user/dev/my-project/frontend/node_modules/.vite/chunk-CUDBNUXQ.js?v=54d1b7f1.
16:04:08 [vite] Failed to load source map for /@fs/home/my-user/dev/my-project/frontend/node_modules/.vite/chunk-APW4DFJS.js?v=54d1b7f1.
Sourcemap for "/home/my-user/dev/my-project/frontend/node_modules/.pnpm/[email protected]/node_modules/tcomb-additional-types/lib/string/index.js" points to missing source files
Sourcemap for "/home/my-user/dev/my-project/frontend/node_modules/.pnpm/[email protected]/node_modules/ts-is-present/lib/index.js" points to missing source files
16:04:10 [vite] ✨ dependencies updated, reloading page...
file:///home/my-user/.pnpm-store/v3/tmp/_npx/29559/5/node_modules/.pnpm/[email protected]/node_modules/mocha-vite-puppeteer/cli.js:126
    throw new Error(request.url() + ' ' + request.failure().errorText);
          ^

Error: http://localhost:3001/test/utils/examinations-logic/summaries/weight-summary.test.js net::ERR_ABORTED
    at file:///home/my-user/.pnpm-store/v3/tmp/_npx/29559/5/node_modules/.pnpm/[email protected]/node_modules/mocha-vite-puppeteer/cli.js:126:11
    at /home/my-user/.pnpm-store/v3/tmp/_npx/29559/5/node_modules/.pnpm/[email protected]/node_modules/puppeteer/lib/cjs/vendor/mitt/src/index.js:51:62
    at Array.map (<anonymous>)
    at Object.emit (/home/my-user/.pnpm-store/v3/tmp/_npx/29559/5/node_modules/.pnpm/[email protected]/node_modules/puppeteer/lib/cjs/vendor/mitt/src/index.js:51:43)
    at Page.emit (/home/my-user/.pnpm-store/v3/tmp/_npx/29559/5/node_modules/.pnpm/[email protected]/node_modules/puppeteer/lib/cjs/puppeteer/common/EventEmitter.js:72:22)
    at /home/my-user/.pnpm-store/v3/tmp/_npx/29559/5/node_modules/.pnpm/[email protected]/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:153:106
    at /home/my-user/.pnpm-store/v3/tmp/_npx/29559/5/node_modules/.pnpm/[email protected]/node_modules/puppeteer/lib/cjs/vendor/mitt/src/index.js:51:62
    at Array.map (<anonymous>)
    at Object.emit (/home/my-user/.pnpm-store/v3/tmp/_npx/29559/5/node_modules/.pnpm/[email protected]/node_modules/puppeteer/lib/cjs/vendor/mitt/src/index.js:51:43)
    at NetworkManager.emit (/home/my-user/.pnpm-store/v3/tmp/_npx/29559/5/node_modules/.pnpm/[email protected]/node_modules/puppeteer/lib/cjs/puppeteer/common/EventEmitter.js:72:22)

I seem to recollect that I got this working the last time I tried in August, but then I was deep into Vite internals (to figure out how to do module mocking), all of which is long gone. Any pointers?

@larsthorup
Copy link
Owner

In https://github.com/larsthorup/mocha-vite-puppeteer/blob/main/package.json we have this npm script:
"test:app": "cd test/app && npm test",
which works just fine.

I am not sure I understand from your description above how your setup differs from that?

What's in your code/app1/vite.config.ts?

Would you have time to create a small public repo that reproduces your issue?

@larsthorup larsthorup added the documentation Improvements or additions to documentation label Nov 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants