Skip to content

build: Use node 22 #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

22 changes: 0 additions & 22 deletions .eslintrc

This file was deleted.

7 changes: 7 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Description

<!--
Describe the big picture of your changes here to communicate to the maintainers
why we should accept this pull request. If it fixes a bug or resolves a feature
request, be sure to link to that issue.
-->
19 changes: 9 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ on:
workflow_dispatch:
inputs:
releaseType:
description: 'Release type - major, minor or patch'
description: "Release type - major, minor, or patch"
required: false
default: 'patch'
default: "patch"

jobs:
publish-release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: 0

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
node-version-file: ".nvmrc"
cache: "npm"

- name: Install Dependencies
run: npm ci
Expand All @@ -33,11 +33,10 @@ jobs:
git config --global user.email "[email protected]"

- name: Login to NPM
run: npm set "//registry.npmjs.org/:_authToken" ${{ secrets.NPM_TOKEN }}
run: npm set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}"

- name: Release
run: npm run release:ci -- ${{ github.event.inputs.releaseType }}
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20 changes: 10 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
node-version-file: ".nvmrc"
cache: "npm"

- name: Install Dependencies
run: npm ci
Expand All @@ -28,19 +28,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
node-version-file: ".nvmrc"
cache: "npm"

- name: Install Dependencies
run: npm ci

- name: Test
run: npm test
env:
SAUCE_USERNAME: ${{secrets.SAUCE_USERNAME}}
SAUCE_ACCESS_KEY: ${{secrets.SAUCE_ACCESS_KEY}}
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v20
v22
64 changes: 32 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,32 @@
# sauce-playwright-plugin

This Playwright plugins reports each project to your Sauce Labs account.
This Playwright plugin reports each project to your Sauce Labs account.

## Installation

Install from npm:
```
```sh
npm install @saucelabs/playwright-reporter
```

### Sauce Labs credentials

`SAUCE_USERNAME` and `SAUCE_ACCESS_KEY` environment variables needs to be set to
allow the plugin to report your results to Sauce Labs.
Your Sauce Labs Username and Access Key are available from your
[dashboard](https://app.saucelabs.com/user-settings).
### Sauce Labs Credentials

Set the `SAUCE_USERNAME` and `SAUCE_ACCESS_KEY` environment variables to allow the plugin to report your results to Sauce Labs. Your Sauce Labs Username and Access Key are available from your [dashboard](https://app.saucelabs.com/user-settings).

## Usage

Add to default reporter:
```
npx playwright test --reporter=line,@saucelabs/playwright-reporter
Add to the default reporter:
```sh
npx playwright test --reporter=line,@saucelabs/playwright-reporter
```

Use only `@saucelabs/playwright-reporter`:
```
npx playwright test --reporter=@saucelabs/playwright-reporter
```sh
npx playwright test --reporter=@saucelabs/playwright-reporter
```

You can also configure using `playwright.config.js`. To achieve that, add `'@saucelabs/playwright-reporter'` to the reporter section of your configuration:
```
You can also configure it using `playwright.config.js`. To do that, add `'@saucelabs/playwright-reporter'` to the reporter section of your configuration:
```js
const config = {
reporter: [
['@saucelabs/playwright-reporter'],
Expand All @@ -39,12 +35,12 @@ const config = {
};
```

### Plugin configuration
### Plugin Configuration

`@saucelabs/playwright-plugin` is configurable through your `playwright.config.js` or `playwright.config.ts` file.
`@saucelabs/playwright-reporter` is configurable through your `playwright.config.js` or `playwright.config.ts` file.

Example:
```
```js
const config = {
reporter: [
['@saucelabs/playwright-reporter', {
Expand All @@ -60,32 +56,36 @@ const config = {
};
```

| Name | Description | Kind |
|----------------|--------------------------------------------------------------------------------------------------|------------------------------|
| `build` | Sets a build ID. <br> Default: `''` | `String` |
| `tags` | Tags to add to the uploaded Sauce job. <br> Default: `[]` | `String[]` |
| `region` | Sets the region. <br> Default: `us-west-1` | `us-west-1` \| `eu-central-1`|
| `upload` | Whether to upload report and assets to Sauce <br> Default: `true` | `boolean` |
| `outputFile` | The local path to write the sauce test report. Can be set in env var `SAUCE_REPORT_OUTPUT_NAME`. | `String` |
| Name | Description | Type |
|--------------|--------------------------------------------------------------------------------------------------|--------------------------------|
| `buildName` | Sets a build ID. <br> Default: `''` | `string` |
| `tags` | Tags to add to the uploaded Sauce job. <br> Default: `[]` | `string[]` |
| `region` | Sets the region. <br> Default: `us-west-1` | `us-west-1` \| `eu-central-1` |
| `upload` | Whether to upload report and assets to Sauce Labs. <br> Default: `true` | `boolean` |
| `outputFile` | The local path to write the Sauce test report. Can be set in env var `SAUCE_REPORT_OUTPUT_NAME`. | `string` |

## Limitations

Some limitations applies to `@saucelabs/playwright-reporter`:
* Before playwright@v1.16.3, Playwright version is not reported to Sauce Labs.
* Browser version is not reported to Sauce Labs.
Some limitations apply to `@saucelabs/playwright-reporter`:
* For Playwright versions before v1.16.3, the Playwright version is not reported to Sauce Labs.
* The browser version is not reported to Sauce Labs.

## Development

### Running locally
### Running Locally

In order to test the reporter, you'll need to link it to itself then run a test with the reporter set.
To test the reporter locally, link it to itself and then run a test with the reporter set.

```
```sh
$ npm link
$ npm link @saucelabs/playwright-reporter
$ npx playwright test --reporter=@saucelabs/playwright-reporter
```

### Debug

Once you `npm link`, you can run your playwright tests with the environment variable `DEBUG="@saucelabs/playwright-reporter:*"` to see additional debug output.
After linking with `npm link`, you can run your Playwright tests with the environment variable `DEBUG="@saucelabs/playwright-reporter:*"` to see additional debug output.

```sh
$ DEBUG="@saucelabs/playwright-reporter:*" npx playwright test --reporter=@saucelabs/playwright-reporter
```
39 changes: 39 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
const ts = require('typescript-eslint');
const js = require('@eslint/js');
const prettier = require('eslint-config-prettier');
const jest = require('eslint-plugin-jest');

module.exports = ts.config(
js.configs.recommended,
...ts.configs.recommended,
prettier,
{
plugins: {
jest: jest,
},
rules: {
'no-undef': 'off',
},
},
{
ignores: ['lib/**'],
},
{
files: ['**/*.js', '**/*.ts'],
rules: {
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-var-requires': 'off',
},
},
{
languageOptions: {
globals: {
__dirname: true,
console: true,
exports: true,
module: true,
require: true,
},
},
},
);
Loading
Loading