nx: Bug(testing): unsupported .js extension
I had checked the new angular 5 with nx workspace. When I run ng test, the following error has occurred:
ERROR in error TS6054: File '.../Angular/mdb-admin/test.js' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'.
Any fix on this?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 2
- Comments: 21 (7 by maintainers)
Commits related to this issue
- update to latest version of nx (#82) — committed to FrozenPandaz/nx by FrozenPandaz 4 years ago
@Silthus
In the root of your project, rename
test.jstotest.ts.Here’s the updated TypeScript version for that file and NX:
Update
tsconfig.spec.jsonso that thefilessection referencestest.tsinstead oftest.js.Lastly, update your
.angular-cli.jsonso that all references of:are updated to:
If you are moving your existing project into the workspace, by making it an app, you should do without
test.tsbecause it is shared between all the apps. So your existing project and the workspace won’t have the same test.ts.Agree. We generate test.js because we had an issue with an earlier version of the CLI. The issue might be fixed right now. If you submit a PR changing the application schematic to generate test.ts, I’ll merge it.
@vsavkin Sorry for misunderstood. I thought the generated file should be test.ts, not test.js, and the issue is nx/schematics should generate test.ts like angular/cli. Then when I create a new project and test.js still appears, I thought the issue was not solved.