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

npm run benchamark doesn't work in local #313

Closed
Eithea opened this issue Jun 17, 2022 · 4 comments
Closed

npm run benchamark doesn't work in local #313

Eithea opened this issue Jun 17, 2022 · 4 comments
Assignees
Labels
bug 🐞 Something isn't working good first issue 🐤 Good for newcomers

Comments

@Eithea
Copy link
Contributor

Eithea commented Jun 17, 2022

What happened:
npm run benchamark doesn't work in local (verified in Windows and Mac)

$ npm run benchmark

> [email protected] benchmark
> ts-node-script ./test/bench/**.ts

node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module './**.ts'

What you expected to happen:

I expected it works normally like in CI but it returns error.

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

The other commands that run ts-node running a single script work normally.

If someone needs to test all bench in local, try ./node_modules/ts-node/dist/bin-script.js ./test/bench/**.ts instead of npm run benchmark.

Environment:

  • Operating system: Windows, Mac
  • Browser and version:
  • Yorkie version (use yorkie version):
  • Yorkie JS SDK version: latest
@hackerwins hackerwins added the bug 🐞 Something isn't working label Jun 17, 2022
@mojosoeun mojosoeun added the good first issue 🐤 Good for newcomers label Jul 5, 2022
@taenykim
Copy link
Contributor

I found this issue while looking at the GFI 🐤 but it works well for me.
It's still not working?
If it doesn't work, I would appreciate it if you could share the error reproduction environment in more detail. @Eithea

@Eithea
Copy link
Contributor Author

Eithea commented Jul 20, 2022

@taenykim

both of my laptops use windows10 without WSL and the problem arises.

  1. clone the repository
  2. set all dependancy (npm i, docker ...)
  3. npm run benchmark
$ npm run benchmark

> [email protected] benchmark   
> ts-node-script ./test/bench/**.ts

node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module './**.ts' 
Require stack:
- ~\yorkie-js-sdk\test\bench\imaginaryUncacheableRequireResolveScript
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.resolve (node:internal/modules/cjs/helpers:108:19)
    at requireResolveNonCached (~\yorkie-js-sdk\node_modules\ts-node\dist\bin.js:257:16)
    at getProjectSearchDir (~\yorkie-js-sdk\node_modules\ts-node\dist\bin.js:227:35)
    at Object.main (~\yorkie-js-sdk\node_modules\ts-node\dist\bin.js:131:27)       
    at Object.<anonymous> (~\yorkie-js-sdk\node_modules\ts-node\dist\bin-script.js:5:7)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '~\\yorkie-js-sdk\\test\\bench\\imaginaryUncacheableRequireResolveScript'  
  ]
}

(~ is installed path)

@taenykim
Copy link
Contributor

This issue seems to be caused by using the glob pattern as argv of ts-node. "ts-node-script test/bench/**.ts"

I think it will be resolved by setting only one path as the entry point without using the glob pattern.

Cause

After testing, some console environments did not support the glob pattern.

case 1 (macOS, zsh) - is working

  1. npm run benchmark
  2. console.log(process.argv)
[
  '/usr/local/bin/node',
  '/Users/user/Desktop/yorkie-js-sdk/node_modules/.bin/ts-node-script',
  'test/bench/document_test.ts'
]

case 2 (Windows, cmd) - is not working

  1. npm run benchmark
  2. console.log(process.argv)
[
    'C:\\Program Files\\nodejs\\node.exe',
    'C:\\Users\\user\\Desktop\\test\\node_modules\\ts-node\\dist\\bin.js',
    './**.ts' # 🚨 do not support glob
]

Reference


Could I try this issue? @mojosoeun @blurfx

@blurfx
Copy link
Member

blurfx commented Jul 21, 2022

@taenykim Sure :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working good first issue 🐤 Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants