Skip to content

Commit c70baf1

Browse files
author
Tian Feng
authored
build: Use node 22 (#27)
* build: Use node 22 * adjust lint rule * add husky * move @eslint/js to dev dependencies
1 parent 9c4ae20 commit c70baf1

File tree

16 files changed

+6004
-12250
lines changed

16 files changed

+6004
-12250
lines changed

.eslintignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.eslintrc

Lines changed: 0 additions & 22 deletions
This file was deleted.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## Description
2+
3+
<!--
4+
Describe the big picture of your changes here to communicate to the maintainers
5+
why we should accept this pull request. If it fixes a bug or resolves a feature
6+
request, be sure to link to that issue.
7+
-->

.github/workflows/release.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ on:
44
workflow_dispatch:
55
inputs:
66
releaseType:
7-
description: 'Release type - major, minor or patch'
7+
description: "Release type - major, minor or patch"
88
required: false
9-
default: 'patch'
9+
default: "patch"
1010

1111
jobs:
1212
publish-release:
@@ -19,10 +19,10 @@ jobs:
1919
fetch-depth: 0
2020

2121
- name: Setup Node
22-
uses: actions/setup-node@v3
22+
uses: actions/setup-node@v4
2323
with:
24-
node-version-file: '.nvmrc'
25-
cache: 'npm'
24+
node-version-file: ".nvmrc"
25+
cache: "npm"
2626

2727
- name: Install Dependencies
2828
run: npm ci
@@ -33,10 +33,10 @@ jobs:
3333
git config --global user.email "devx.bot@saucelabs.com"
3434
3535
- name: Login to NPM
36-
run: npm set "//registry.npmjs.org/:_authToken" ${{ secrets.NPM_TOKEN }}
36+
run: npm set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}"
3737

3838
- name: Release
3939
run: npm run release:ci -- ${{ github.event.inputs.releaseType }}
4040
env:
41-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
42-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
41+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/tests.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313
uses: actions/checkout@v4
1414

1515
- name: Setup Node
16-
uses: actions/setup-node@v3
16+
uses: actions/setup-node@v4
1717
with:
18-
node-version-file: '.nvmrc'
19-
cache: 'npm'
18+
node-version-file: ".nvmrc"
19+
cache: "npm"
2020

2121
- name: Install Dependencies
2222
run: npm ci
@@ -35,16 +35,16 @@ jobs:
3535
uses: actions/checkout@v4
3636

3737
- name: Setup Node
38-
uses: actions/setup-node@v3
38+
uses: actions/setup-node@v4
3939
with:
40-
node-version-file: '.nvmrc'
41-
cache: 'npm'
40+
node-version-file: ".nvmrc"
41+
cache: "npm"
4242

4343
- name: Install Dependencies
4444
run: npm ci
4545

4646
- name: Integration Tests
4747
env:
48-
SAUCE_USERNAME: ${{secrets.SAUCE_USERNAME}}
49-
SAUCE_ACCESS_KEY: ${{secrets.SAUCE_ACCESS_KEY}}
48+
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
49+
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
5050
run: npm test tests/integration

.husky/pre-commit

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
npx pretty-quick --staged
2+
npm run lint

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v20
1+
v22

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,31 @@ Sauce Labs SDK for the Test-Composer API.
55
# Usage
66

77
## Initialize TestComposer Client
8+
89
```javascript
910
const { TestComposer } = require('@saucelabs/testcomposer');
1011

1112
const client = new TestComposer({
1213
region: 'us-west-1',
1314
username: process.env.SAUCE_USERNAME,
1415
accessKey: process.env.SAUCE_ACCESS_KEY,
15-
headers: {'User-Agent': `your-fancy-reporter/1.2.3`}
16+
headers: { 'User-Agent': `your-fancy-reporter/1.2.3` },
1617
});
1718
```
1819

1920
## Create Reports
2021

2122
```javascript
2223
const job = await client.createReport({
23-
name: "My Fancy Job!",
24+
name: 'My Fancy Job!',
2425
passed: true,
2526
startTime: new Date().toISOString(),
2627
endTime: new Date().toISOString(),
27-
browserName: "Chrome",
28-
browserVersion: "105",
29-
framework: "playwright",
30-
frameworkVersion: "1.25.0",
31-
platformName: "Windows 11"
28+
browserName: 'Chrome',
29+
browserVersion: '105',
30+
framework: 'playwright',
31+
frameworkVersion: '1.25.0',
32+
platformName: 'Windows 11',
3233
});
3334
console.log(job.id); // the job ID
3435
console.log(job.url); // the full URL of the job
@@ -44,7 +45,9 @@ const Readable = require('stream').Readable;
4445
const s = new Readable();
4546
s.push('hello!');
4647
s.push(null);
47-
const uploads = await client.uploadAssets(job.id, [{filename: "console.log", data: s}]);
48+
const uploads = await client.uploadAssets(job.id, [
49+
{ filename: 'console.log', data: s },
50+
]);
4851
```
4952

5053
## Explore More Examples

docs/espresso.md

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
```javascript
66
const job = await client.createReport({
7-
name: "My Fancy Espresso Job!",
7+
name: 'My Fancy Espresso Job!',
88
passed: true,
99
startTime: new Date().toISOString(),
1010
endTime: new Date().toISOString(),
11-
framework: "espresso",
12-
platformName: "Linux",
13-
deviceName: "Android GoogleAPI Emulator",
14-
platformVersion: "12.0."
11+
framework: 'espresso',
12+
platformName: 'Linux',
13+
deviceName: 'Android GoogleAPI Emulator',
14+
platformVersion: '12.0.',
1515
});
1616

1717
console.log(job.id); // the job ID
@@ -26,9 +26,7 @@ The minimum `native-log.json` file to populate the command list on Sauce Labs we
2626

2727
```json
2828
{
29-
"filters": [
30-
31-
],
29+
"filters": [],
3230
"package_name": "com.saucelabs.mydemoapp.android",
3331
"status": "success",
3432
"stdout": "I am output",
@@ -49,13 +47,12 @@ The minimum `native-log.json` file to populate the command list on Sauce Labs we
4947
To upload `native-log.json`:
5048

5149
```javascript
52-
const uploads = await client.uploadAssets(
53-
job.id,
54-
[{
55-
filename: "native-log.json",
56-
data: fs.createReadStream("native-log.json")
57-
}]
58-
);
50+
const uploads = await client.uploadAssets(job.id, [
51+
{
52+
filename: 'native-log.json',
53+
data: fs.createReadStream('native-log.json'),
54+
},
55+
]);
5956
// Upon success, the array `uploads.uploaded` will equal in length to the number of assets you intended to upload.
6057
// Individual assets that fail to upload will be reported via `uploads.errors`.
6158
```

docs/javascript_frameworks.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ Learn how to generate reports for JavaScript frameworks like Cypress, Playwright
66

77
```javascript
88
const job = await client.createReport({
9-
name: "My Fancy Playwright Job!",
9+
name: 'My Fancy Playwright Job!',
1010
passed: true,
1111
startTime: new Date().toISOString(),
1212
endTime: new Date().toISOString(),
13-
browserName: "Chrome",
14-
browserVersion: "105",
15-
framework: "playwright", // alternatives: cypress, playwright, testcafe
16-
frameworkVersion: "1.25.0",
17-
platformName: "Windows 11"
13+
browserName: 'Chrome',
14+
browserVersion: '105',
15+
framework: 'playwright', // alternatives: cypress, playwright, testcafe
16+
frameworkVersion: '1.25.0',
17+
platformName: 'Windows 11',
1818
});
1919

2020
console.log(job.id); // the job ID
@@ -60,16 +60,16 @@ In order to view your test results in the SauceLabs web app, you must upload a t
6060
"metadata": {}
6161
}
6262
```
63+
6364
To upload `sauce-test-report.json`:
6465

6566
```javascript
66-
const uploads = await client.uploadAssets(
67-
job.id,
68-
[{
69-
filename: "sauce-test-report.json",
70-
data: fs.createReadStream("sauce-test-report.json")
71-
}]
72-
);
67+
const uploads = await client.uploadAssets(job.id, [
68+
{
69+
filename: 'sauce-test-report.json',
70+
data: fs.createReadStream('sauce-test-report.json'),
71+
},
72+
]);
7373
// Upon success, the array `uploads.uploaded` will equal in length to the number of assets you intended to upload.
7474
// Individual assets that fail to upload will be reported via `uploads.errors`.
7575
```

0 commit comments

Comments
 (0)