function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Vladimir BessonovVladimir Bessonov 

@salesforce/sfdx-lwc-jest - expected API?

I have an issue with API versions

when I run locally "lwc-jest" I have not issue. API 50 

 PASS  force-app/main/default/lwc/hello/__tests__/hello.test.js
  c-hello
    ✓ displays greeting (18ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        1.86s, estimated 2s

But when I push the code to git, I receive the message that version 47 is required and pipeline fails. 
"error Invalid sourceApiVersion found in sfdx-project.json. Expected 47.0, found 50.0"

Can some explain, please?

sfdx-project.json is below 
{
"packageDirectories": [
{
"path": "force-app",
"default": true,
"package": "CoManagerApp",
"versionName": "Version 1.0",
"versionNumber": "1.0.0.NEXT"
}
],
"namespace": "",
"sfdcLoginUrl": "https://login.salesforce.com",
"sourceApiVersion": "50.0",
"packageAliases": {
"CoManagerApp": "xxxxxxxxxxxxxx"
}
}


package.json 
"scripts": {
"test:lwc": "sfdx-lwc-jest",
"test:scratch": "sfdx force:apex:test:run --codecoverage --resultformat human --wait 10"
},
"devDependencies": {
"@salesforce/sfdx-lwc-jest": "^0.10.1"
}
}
AnudeepAnudeep (Salesforce Developers) 
Can you try running the following commands?
npm cache clean --force 
npm install

Similar issue was discussed here

Let me know if this helps, if it does, please close the query by marking it as solved. It may help others in the community. Thank You!

 

Vladimir BessonovVladimir Bessonov
I propably need to clean cache in Pipeline. 
but  "clean runners cache" in gitlab did not help. I still get the same error. Expected 47.0, found 50.0 
AnudeepAnudeep (Salesforce Developers) 
I recommend reporting this issue on github - https://github.com/salesforce/sfdx-lwc-jest/issues