Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
jest-environment-lambdatest
Advanced tools
Use Jest as test-runner for running your visual-tests and more using LambdaTest.
For using this environment, run first the following command in your terminal:
npm install --save-dev jest-environment-lambdatest
Once it's done, configure your Jest config.
Assuming your configuration is defined in your package.json
, add the following lines to your globals
definition:
{
"jest": {
"preset": "ts-jest",
"testEnvironment": "lambdatest",
"globals": {
"lambdatest": {
"capabilities": {
"build": "jest and lambdatest with tunnel",
"name": "jest demo",
"platform": "Windows 10",
"browserName": "Chrome",
"version": "80.0"
}
}
}
}
}
Assuming here also your configuration is defined in your package.json
, add the following lines to your globals
definition:
{
"jest": {
"preset": "ts-jest",
"testEnvironment": "lambdatest",
"globals": {
"lambdatest": {
"capabilities": {
"build": "jest and lambdatest with tunnel",
"name": "jest demo",
"platform": "Windows 10",
"browserName": "Chrome",
"version": "80.0",
"tunnel": true
},
"tunnelOpts": {}
}
}
}
}
If you are running all your tests with JSDom as main environment, you can load the LambdaTest environment for a specific file by adding a Jest annotation at the beginning of your file.
Here is an example:
my-visual-test.spec.js:
/**
* @jest-environment-lambdatest
*/
import { By } from 'selenium-webdriver';
describe('my visual test', () => {
let driver;
beforeAll(async () => {
// you can override the default configuration
driver = await global.__driver__({
build: 'jest and lambdatest',
name: 'jest demo',
platform: 'Windows 10',
browserName: 'Chrome',
version: '80.0',
});
driver.get('https://www.lambdatest.com');
}, 20000); // this timeout is required because starting a session in LambdaTest can take ages
afterAll(async () => {
// can be omitted
await driver.quit();
});
it('test title', async () => {
const title = await driver.getTitle();
expect(title).toBe('Cross Browser Testing Tools | Free Automated Website Testing | LambdaTest');
});
});
If you aren't willing to put your credentials in your package.json
file, you can export in your environment LT_USERNAME
and LT_ACCESS_KEY
. If you do so, userName
and accessKey
can be omitted.
In the examples
folder, you can find an example using react-create-app
.
To run the test, type the following commands in your terminal:
cd examples/with-lambdatest-tunnel
yarn install
yarn test
The test
script will run a basic e2e tests, a visual tests making a snapshot of the web-app and the unit-tests.
Feel free to open an issue on GitHub or to contribute by opening a pull-request.
FAQs
an environment for using LambdaTest with Jest
The npm package jest-environment-lambdatest receives a total of 12 weekly downloads. As such, jest-environment-lambdatest popularity was classified as not popular.
We found that jest-environment-lambdatest demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.