Skip to content

Commit

Permalink
Merge pull request #530 from MindscapeHQ/js/fix-jquery-isfunction-dep…
Browse files Browse the repository at this point in the history
…recation

Resolve jQuery isFunction warning
  • Loading branch information
redJ4y authored Aug 20, 2024
2 parents 2d0eeb3 + a5fadcd commit e0349ce
Show file tree
Hide file tree
Showing 6 changed files with 151 additions and 53 deletions.
133 changes: 90 additions & 43 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,100 @@
name: Build & Publish Raygun4JS to the pre-release environment
name: Publish Raygun4JS to the pre-release environment

on:
push:
branches: [ master ]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x]
node-version: [ 20.x ]

steps:
- uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install Grunt
run: npm install -g grunt

- name: Install node modules
run: npm install

- name: Build
run: grunt build

- name: Complete
run: echo Build successfully completed!

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_ID }}
aws-secret-access-key: ${{ secrets.AWS_ACCESS_SECRET }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Publish to S3 Pre-release
run: aws s3 sync ./dist ${{ secrets.AWS_PUBLISH_TARGET }}

- name: Deployment Complete
run: echo A new version of Raygun4JS has been deployed to pre-release!

- name: Notify Slack
id: slack
uses: slackapi/[email protected]
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install Grunt
run: npm install -g grunt

- name: Install node modules
run: npm install

- name: Build
id: build_step
run: grunt build

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_ID }}
aws-secret-access-key: ${{ secrets.AWS_ACCESS_SECRET }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Publish to S3 Pre-release
id: publish_s3
run: aws s3 sync ./dist ${{ secrets.AWS_PUBLISH_TARGET }}

- name: Create CloudFront Cache Invalidation
id: cache_invalidation
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }} \
--paths "${{ secrets.AWS_CLOUDFRONT_INVALIDATION_PATH }}"
- name: Notify Slack
id: slack
uses: slackapi/[email protected]
with:
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "A new pre-release version of Raygun4JS has been published"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "<https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|View this action run in GitHub>"
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Branch:*\n`${{ github.ref_name }}`"
},
{
"type": "mrkdwn",
"text": "*Node version:*\n`${{ matrix.node-version }}`"
},
{
"type": "mrkdwn",
"text": "*Build status:*\n_${{ steps.build_step.outcome }}_"
},
{
"type": "mrkdwn",
"text": "*S3 publish status:*\n_${{ steps.publish_s3.outcome }}_"
},
{
"type": "mrkdwn",
"text": "*CloudFront cache invalidation status:*\n_${{ steps.cache_invalidation.outcome }}_"
}
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
20 changes: 17 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,28 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Use Node.js 20.x
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20.x
- uses: browser-actions/setup-chrome@latest

- name: Setup Chrome
id: setup-chrome
uses: browser-actions/setup-chrome@latest
with:
chrome-version: latest
install-chromedriver: true

- name: Set Chrome and ChromeDriver paths
run: |
echo "CHROME_BIN=${{ steps.setup-chrome.outputs.chrome-path }}" >> $GITHUB_ENV
echo "CHROMEDRIVER_PATH=${{ steps.setup-chrome.outputs.chromedriver-path }}" >> $GITHUB_ENV
- run: npm ci
- run: npx grunt
- run: npm test
env:
CHROME_BIN: ${{ env.CHROME_BIN }}
CHROMEDRIVER_PATH: ${{ env.CHROMEDRIVER_PATH }}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Unused normalize.css file
-->

## [3.1.1]

### Fixed
- Resolved jQuery `isFunction` deprecation warnings. As of jQuery 3.3, `jQuery.isFunction()` is deprecated. It is replaced by `typeof x === "function"` - [source](https://api.jquery.com/jQuery.isFunction/).

## [3.1.0]

### Added
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
],
"title": "Raygun4js",
"description": "Raygun.com plugin for JavaScript",
"version": "3.1.0",
"version": "3.1.1",
"homepage": "https://github.com/MindscapeHQ/raygun4js",
"author": {
"name": "MindscapeHQ",
Expand Down
2 changes: 1 addition & 1 deletion src/raygun.tracekit.jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

var keys = ['complete', 'error', 'success'], key;
while(key = keys.pop()) {
if ($.isFunction(options[key])) {
if (typeof options[key] === "function") {
options[key] = TraceKit.wrap(options[key]);
}
}
Expand Down
41 changes: 36 additions & 5 deletions wdio.conf.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
const fs = require('fs');
const path = require('path');

const chromeDriverExists = (path) => {
return fs.existsSync(path);
};

const githubActionsChromeDriver = process.env.CHROMEDRIVER_PATH;
const localChromeDriver = path.join(__dirname, 'node_modules', 'chromedriver', 'bin', 'chromedriver');

// If we are on a Continuous Integration server, use the ChromeDriver installed by browser-actions/setup-chrome.
// Otherwise, use the ChromeDriver installed as a devDependency.
let chromeDriverPath;
if (githubActionsChromeDriver && chromeDriverExists(githubActionsChromeDriver)) {
chromeDriverPath = githubActionsChromeDriver;
} else if (chromeDriverExists(localChromeDriver)) {
chromeDriverPath = localChromeDriver;
} else {
console.warn('ChromeDriver not found in expected locations. Using default.');
}

exports.config = {
//
// ====================
Expand Down Expand Up @@ -48,9 +69,16 @@ exports.config = {
capabilities: [{
maxInstances: 4,
browserName: 'chrome',
'goog:chromeOptions': {
args: ['headless', 'disable-gpu', 'no-sandbox']
},
'goog:chromeOptions': (function() {
const options = {
args: ['headless', 'disable-gpu', 'no-sandbox'],
};
// Use the CHROME_BIN environment variable if present.
if (process.env.CHROME_BIN) {
options.binary = process.env.CHROME_BIN;
}
return options;
})(),
}],
//
// ===================
Expand Down Expand Up @@ -112,8 +140,11 @@ exports.config = {
{ mount: '/fixtures', path: './tests/fixtures' },
{ mount: '/dist', path: './dist' },
]
}
], 'chromedriver'],
}],
['chromedriver', {
chromedriverCustomPath: chromeDriverPath
}]
],
chromeDriverArgs: ['--headless', '--disable-gpu'],

// Framework you want to run your specs with.
Expand Down

0 comments on commit e0349ce

Please sign in to comment.