Error running tests for Express app when library imports from 3rd party
Current Behavior
I have configured a very simple monorepo with an express app and 2 JS libraries (using the 3 commands below).
The first library has a function that takes a string and converts it to lowercase using javascript's toLowerCase() function.
The second library also converts to lowercase but the library function imports the lowerCase function from lodash.
A basic test is setup in the express app for both library functions, without-import.test.ts (native JS function) and with-import.test.ts (lodash).
The without-import.test.ts runs without any problems, but the with-import.test.ts fails with the error `SyntaxError: Unexpected token 'export'
Commands to re-create the repo
npx create-nx-workspace --preset=express
npx nx g @nx/js:lib libs/lowercase
npx nx g @nx/js:lib libs/lowercase-import
Expected Behavior
I would expect that I could run tests that call a library that with it's own imports.
When running nx run sample-api:test, all tests should pass
GitHub Repo
https://github.com/richmondp/nx-express-app-test-failures
Steps to Reproduce
- Run
nx run sample-api:test. 1 test will pass, 1 test will fail.
Nx Report
Node : 18.18.0
OS : darwin-arm64
npm : 9.8.1
nx (global) : 18.0.2
nx : 18.0.2
@nx/js : 18.0.2
@nx/jest : 18.0.2
@nx/linter : 18.0.2
@nx/eslint : 18.0.2
@nx/workspace : 18.0.2
@nx/devkit : 18.0.2
@nx/eslint-plugin : 18.0.2
@nx/express : 18.0.2
@nx/node : 18.0.2
@nrwl/tao : 18.0.2
@nx/vite : 18.0.2
@nx/web : 18.0.2
@nx/webpack : 18.0.2
typescript : 5.3.3
Failure Logs
No response
Package Manager Version
No response
Operating System
- [X] macOS
- [ ] Linux
- [ ] Windows
- [ ] Other (Please specify)
Additional Information
No response