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

Not able to use tsconfig paths in tests #38

Closed
shashikiran797 opened this issue Jan 21, 2020 · 3 comments
Closed

Not able to use tsconfig paths in tests #38

shashikiran797 opened this issue Jan 21, 2020 · 3 comments

Comments

@shashikiran797
Copy link

shashikiran797 commented Jan 21, 2020

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Create a starter project for gauge with vscode extension
  2. Go to tsconfig.json
  3. Add baseUrl and paths parameter
  "compilerOptions": {
    "baseUrl": ".", // This must be specified if "paths" is.
    "paths": {
      "jquery": ["node_modules/jquery/dist/jquery"] // This mapping is relative to "baseUrl"
    }
  }
}
  1. Try to import the name declared in paths like
import * as jq from 'jquery'

Throws error:

{ Error: Cannot find module 'jquery'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)

Expected behavior
Should not throw any error

Desktop (please complete the following information):

  • OS: Mac
  • Gauge and plugin version :
Gauge version: 1.0.6

Plugins
-------
html-report (4.0.8)
screenshot (0.0.1)
ts (0.0.2)
  • Node version: v10.15.3
  • Npm version : (I am using yarn instead of npm)
    yarn version: 1.21.1

Additional context
Add any other context about the problem here.
For example if you are facing an issue with editor (vscode)

  • VS Code Version : 1.41.1
BugDiver pushed a commit that referenced this issue Feb 26, 2020
Fix for issue #38

Co-authored-by: Vinay Shankar Shukla <[email protected]>
@BugDiver
Copy link
Member

@shashikiran797 Merged your PR. But when you run a project a project and the tsconfig-paths is not installed it creates an error. tough this case is handled but it creates some unnecessary logs (exception). It can mislead users.

To avoid this I was thinking of doing one of the following

  • Remove the error logging
  • Add config-paths as a required dependencies

What would you prefer?

@shashikiran797
Copy link
Author

@pocketcowboy

FYI for @BugDiver 's comment

@BugDiver
Copy link
Member

BugDiver commented Mar 4, 2020

The Fix is available in v0.0.4

@BugDiver BugDiver closed this as completed Mar 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants