turbo
turbo copied to clipboard
Flags passed to a yarn script with `--` are considered as file globs by `jest`
What version of Turborepo are you using?
1.3.1
What package manager are you using / does the bug impact?
Yarn v2/v3 (node_modules linker only)
What operating system are you using?
Mac
Describe the Bug
When we pass the --colors
flag thru turbo
, to a test:unit
npm script that runs jest
, that flag ends up being interpreted as a file glob (cf Pattern --colors - 0 matches
below):
▶ yarn turbo run test:unit -- --colors
[...]
@choose/types-helpers:test:unit: No tests found, exiting with code 1
@choose/types-helpers:test:unit: Run with `--passWithNoTests` to exit with code 0
@choose/types-helpers:test:unit: In /Users/adrienjoly/dev/choose/backend/packages/types-helpers
@choose/types-helpers:test:unit: 10 files checked.
@choose/types-helpers:test:unit: testMatch: /Users/adrienjoly/dev/choose/backend/packages/types-helpers/src/**/*.test.ts - 1 match
@choose/types-helpers:test:unit: testPathIgnorePatterns: /node_modules/ - 10 matches
@choose/types-helpers:test:unit: testRegex: - 0 matches
@choose/types-helpers:test:unit: Pattern: --colors - 0 matches
@choose/types-helpers:test:unit: ERROR: command finished with error: command (packages/types-helpers) yarn run test:unit -- --colors exited (1)
command (packages/types-helpers) yarn run test:unit -- --colors exited (1)
Expected Behavior
The behavior should be the same as when we had not added test:unit
in our turbo.json
file, or as when we run the tests using yarn directly in the package's directory (instead of going thru turborepo):
▶ (cd packages/types-helpers/ && yarn run test:unit --colors)
PASS src/index.test.ts
types-helpers
isErrorLike()
✓ returns true for an empty Error object
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 0.181 s, estimated 1 s
Ran all test suites.
To Reproduce
/package.json
:
{
"name": "@choose/backend",
"version": "8.10.5",
"private": true,
"workspaces": [
"configs/*",
"packages/*",
"servers/*"
],
"scripts": {
"test:unit": "turbo run test:unit --parallel",
},
"engines": {
"npm": ">=7.0.0",
"node": ">=16.0.0"
},
"packageManager": "[email protected]",
"devDependencies": {
"jest": "^28.1.1",
"turbo": "^1.3.1"
}
}
/turbo.json
:
{
"pipeline": {
"test:unit": {},
}
}
/packages/legacy-helpers/package.json
:
{
"name": "@choose/types-helpers",
"version": "0.0.0",
"packageManager": "[email protected]",
"private": true,
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
"test:unit": "$(npm bin)/jest --config=jest.config.js"
}
}
I have same problem. And it may be related with #1477
I believe that this has been fixed. Can you please retest to confirm?
This is still broken for us.
@m7kvqbe1 please file a new issue with detailed reproduction steps.
If you're getting failures for this we believe it is likely a separate issue in configuration for your application. We have tests ensuring that this behaves as expected.
I'm going to close this issue, if you are encountering it please file a new issue with detailed reproduction steps.