Skip to content

testing package.json and impliedNodeFormat #48955

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

Conversation

craigphicks
Copy link

@craigphicks craigphicks commented May 4, 2022

@sheetalkamat -

Re your pull #48889

I created a test to check the value of impliedNodeFormat from inside a transformer when

  • tsconfig:module is set to "Node12", and
  • package.json exists and type is "commonjs"

I expected that impliedNodeFormat would be ModuleKind.CommonJS. However it is currently undefined,
so the test will not pass.

I know there a good chance that I am misunderstanding how it should work.
If you can help me I would greatly appreciate it.

I created a new test borrowing from src/testRunner/unittests/tsbuildWatch/publicApi.ts
It is src/testRunner/unittests/tsbuildWatch/publicApiImpliedNodeFormat.ts

I has additional file shared/package.json:

{
                name:"shared",
                version:"1.0.0",
                type:"commonjs",
}

that is added to the list passed to createWatchedSystem.

I also added internal getModuleResolutionCache() to SolutionBuilder just to see what was in it, and it is just an empty object {}. Is that correct?

@typescript-bot
Copy link
Collaborator

This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise.

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label May 4, 2022
@craigphicks craigphicks closed this May 4, 2022
@craigphicks craigphicks reopened this May 4, 2022
@craigphicks
Copy link
Author

Compiler options not set correctly. Closing.

@craigphicks craigphicks closed this May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants