diff --git a/.github/labels.yml b/.github/labels.yml new file mode 100644 index 0000000..48965d8 --- /dev/null +++ b/.github/labels.yml @@ -0,0 +1,126 @@ +# EDITS SHOULD BE SUBMITTED TO DevExpress/testcafe-build-system/config/labels.yml +# Configuration for Label Actions - https://github.com/dessant/label-actions + +? 'TYPE: question' +: + # Post a comment + comment: | + Thank you for your inquiry. This issue looks like a question that would be best [asked on StackOverflow](https://stackoverflow.com/questions/ask?tags=testcafe) - an amazing platform for users to ask and answer questions. We try to keep the GitHub issues tracker for bugs and feature requests only (see [Contributing](https://github.com/DevExpress/testcafe#contributing)). + + If you think that this issue is a bug, feel free to [open a new issue](https://github.com/DevExpress/testcafe/issues/new?template=bug-report.md), but please make sure to follow the issue template. Thank you in advance. + unlabel: 'STATE: Need response' + close: true + +? 'STATE: Non-latest version' +: + # Post a comment + comment: | + Thank you for submitting this issue. Since you are using an outdated version of TestCafe, we recommend you update TestCafe to the [latest version](https://github.com/DevExpress/testcafe/releases/latest) to check if this issue has been addressed. We constantly improve our tools, and there is a chance that this issue has been already resolved and/or is no longer reproducible in the latest version. We look forward to your response. + label: 'STATE: Need clarification' + unlabel: + - 'STATE: Non-latest version' + - 'STATE: Need response' + +? 'STATE: Need simple sample' +: + # Post a comment + comment: | + Thank you for submitting this issue. We would love to assist you and diagnose it. However, we need a simple sample that we can easily run on our side in order to replicate the issue and research its cause. Without a sample, we are not able to figure out what's going on and why this issue occurs. Refer to this article to create the best example: [How To: Create a Minimal Working Example When You Submit an Issue](https://testcafe.io/402636/faq#how-to-create-a-minimal-working-example-when-you-submit-an-issue). We look forward to your response. + label: 'STATE: Need clarification' + unlabel: + - 'STATE: Need simple sample' + - 'STATE: Need response' + +? 'STATE: Need access confirmation' +: + # Post a comment + comment: | + Thank you for submitting this issue. We would love to assist you and diagnose this issue. However, since your website sits behind a proxy and/or requires authentication, I will not be able to access it. Our policy prevents us from accessing a customer's internal resources without prior written approval from the entity that owns the server/web resource. + + If you want us to research the problem further, we'll need access to the server/web resource. Please ask the website owner to send us ([support@devexpress.com](mailto:support@devexpress.com)) written confirmation. It must permit DevExpress personnel to remotely access the website and its internal resources for research/testing and debugging purposes. + label: 'STATE: Need clarification' + unlabel: + - 'STATE: Need access confirmation' + - 'STATE: Need response' + +? 'STATE: Incomplete template' +: + # Post a comment + comment: | + Thank you for submitting this issue. However, the information you shared is insufficient to determine its cause. Please submit a new issue and fill the issue template completely - specify your TestCafe version and share a sample application with a test case that we can run on our side to reproduce and research the issue. + unlabel: + - 'STATE: Incomplete template' + - 'STATE: Need response' + close: true + +? 'STATE: No updates' +: + # Post a comment + comment: | + No updates yet. Once we get any results, we will post them in this thread. + unlabel: + - 'STATE: No updates' + - 'STATE: Need response' + +? 'STATE: No estimations' +: + # Post a comment + comment: | + Any personal estimate may be misleading, so we cannot currently tell it at the moment. Once we get any results, we will post them in this thread. + unlabel: + - 'STATE: No estimations' + - 'STATE: Need response' + +? 'STATE: Outdated proposal' +: + # Post a comment + comment: | + We are focused on implementing features from our [Roadmap](https://devexpress.github.io/testcafe/roadmap/). Since this enhancement is not there, we cannot tell you any time frames on when we will be able to address it. If this feature is important for you, please submit a Pull Request with its implementation. See the [Сontribution guide](https://github.com/DevExpress/testcafe/blob/master/CONTRIBUTING.md) for more information. + unlabel: + - 'STATE: Outdated proposal' + - 'STATE: Need response' + +? 'STATE: Outdated issue' +: + # Post a comment + comment: | + We address issues according to their severity, priority, and other factors. It appears that this issue is an edge case. If this issue is important for you, please submit a Pull Request with a fix. See the [Сontribution guide](https://github.com/DevExpress/testcafe/blob/master/CONTRIBUTING.md) for more information. + unlabel: + - 'STATE: Outdated issue' + - 'STATE: Need response' + +? 'STATE: No workarounds' +: + # Post a comment + comment: | + There are no workarounds. Once we get any updates, we will post them in this thread. + unlabel: + - 'STATE: No workarounds' + - 'STATE: Need response' + +? 'STATE: PR Review Pending' +: + # Post a comment + comment: | + Thank you for your contribution to TestCafe. We will review this PR. + unlabel: + - 'STATE: PR Review Pending' + - 'STATE: Need response' + +? 'STATE: Issue accepted' +: + # Post a comment + comment: | + We appreciate you taking the time to share the information about this issue. We replicated it, and it is currently in our internal queue. Please note that the research may take time. We'll update this thread once we have news. + unlabel: + - 'STATE: Issue accepted' + - 'STATE: Need response' + +? 'STATE: Enhancement accepted' +: + # Post a comment + comment: | + Thank you for bringing this to our attention. We will be happy to look into this enhancement. We'll update this thread once we have news to share. In the absence of communication from us, it's safe to assume that there are no updates. + unlabel: + - 'STATE: Enhancement accepted' + - 'STATE: Need response' \ No newline at end of file diff --git a/.github/workflows/check-security-alerts.yml b/.github/workflows/check-security-alerts.yml new file mode 100644 index 0000000..2c0c022 --- /dev/null +++ b/.github/workflows/check-security-alerts.yml @@ -0,0 +1,109 @@ +name: Check security alerts + +on: + schedule: + - cron: "30 1 * * *" + workflow_dispatch: + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v6 + with: + github-token: ${{ secrets.ACTIVE_TOKEN }} + script: | + if (!'${{secrets.SECURITY_ISSUE_REPO}}') + return; + + const { owner, repo } = context.repo; + const state = 'open'; + const dependabotLabel = 'dependabot'; + const codeqlLabel = 'codeql'; + const securityLabel = 'security notification'; + + async function getDependabotAlerts () { + const dependabotListAlertsUrl = `https://api.github.com/repos/${ owner }/${ repo }/dependabot/alerts?state=${ state }`; + const dependabotRequestOptions = { + headers: { 'Authorization': 'Bearer ${{ secrets.ACTIVE_TOKEN }}' } + } + + const response = await fetch(dependabotListAlertsUrl, dependabotRequestOptions); + const data = await response.json(); + + // If data isn't arry somethig goes wrong + if (Array.isArray(data)) + return data; + + return []; + } + + async function getCodeqlAlerts () { + // When CodeQL is turned of it throws error + try { + const { data } = await github.rest.codeScanning.listAlertsForRepo({ owner, repo, state }); + + return data; + } catch (_) { + return []; + } + } + + async function createIssue ({owner, repo, labels, originRepo, summary, description, link, package = ''}) { + const title = `[${originRepo}] ${summary}`; + const body = '' + + `#### Repository: \`${ originRepo }\`\n` + + (!!package ? `#### Package: \`${ package }\`\n` : '') + + `#### Description:\n` + + `${ description }\n` + + `#### Link: ${ link }` + + return github.rest.issues.create({ owner, repo, title, body, labels }); + } + + function needCreateIssue (alert) { + return !issueDictionary[alert.html_url] + && Date.now() - new Date(alert.created_at) <= 1000 * 60 * 60 * 24; + } + + const dependabotAlerts = await getDependabotAlerts(); + const codeqlAlerts = await getCodeqlAlerts(); + const {data: existedIssues} = await github.rest.issues.listForRepo({ owner, repo, labels: [securityLabel], state }); + + const issueDictionary = existedIssues.reduce((res, issue) => { + const alertUrl = issue.body.match(/Link:\s*(https.*\d*)/)?.[1]; + + if (alertUrl) + res[alertUrl] = issue; + + return res; + }, {}) + + dependabotAlerts.forEach(alert => { + if (!needCreateIssue(alert)) + return; + + createIssue({ owner, + repo: '${{ secrets.SECURITY_ISSUE_REPO }}', + labels: [dependabotLabel, securityLabel], + originRepo: repo, + summary: alert.security_advisory.summary, + description: alert.security_advisory.description, + link: alert.html_url, + package: alert.dependency.package.name + }) + }); + + codeqlAlerts.forEach(alert => { + if (!needCreateIssue(alert)) + return; + + createIssue({ owner, + repo: '${{ secrets.SECURITY_ISSUE_REPO }}', + labels: [codeqlLabel, securityLabel], + originRepo: repo, + summary: alert.rule.description, + description: alert.most_recent_instance.message.text, + link: alert.html_url, + }) + }); \ No newline at end of file diff --git a/.github/workflows/handle-labels.yml b/.github/workflows/handle-labels.yml new file mode 100644 index 0000000..92d9279 --- /dev/null +++ b/.github/workflows/handle-labels.yml @@ -0,0 +1,13 @@ +name: 'Label Actions' + +on: + issues: + types: [labeled, unlabeled] + pull_request_target: + types: [labeled, unlabeled] + +jobs: + reaction: + runs-on: ubuntu-latest + steps: + - uses: DevExpress/testcafe-build-system/actions/handle-labels@main diff --git a/.github/workflows/handle-stale.yml b/.github/workflows/handle-stale.yml new file mode 100644 index 0000000..ebc2418 --- /dev/null +++ b/.github/workflows/handle-stale.yml @@ -0,0 +1,21 @@ +name: "Mark stale issues and pull requests" +on: + schedule: + - cron: "30 1 * * *" + workflow_dispatch: +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v3 + with: + stale-issue-message: "This issue has been automatically marked as stale because it has not had any activity for a long period. It will be closed and archived if no further activity occurs. However, we may return to this issue in the future. If it still affects you or you have any additional information regarding it, please leave a comment and we will keep it open." + stale-pr-message: "This pull request has been automatically marked as stale because it has not had any activity for a long period. It will be closed and archived if no further activity occurs. However, we may return to this pull request in the future. If it is still relevant or you have any additional information regarding it, please leave a comment and we will keep it open." + close-issue-message: "We're closing this issue after a prolonged period of inactivity. If it still affects you, please add a comment to this issue with up-to-date information. Thank you." + close-pr-message: "We're closing this pull request after a prolonged period of inactivity. If it is still relevant, please ask for this pull request to be reopened. Thank you." + stale-issue-label: "STATE: Stale" + stale-pr-label: "STATE: Stale" + days-before-stale: 365 + days-before-close: 10 + exempt-issue-labels: "AREA: docs,FREQUENCY: critical,FREQUENCY: level 2,HELP WANTED,!IMPORTANT!,STATE: Need clarification,STATE: Need response,STATE: won't fix,support center" + exempt-pr-labels: "AREA: docs,FREQUENCY: critical,FREQUENCY: level 2,HELP WANTED,!IMPORTANT!,STATE: Need clarification,STATE: Need response,STATE: won't fix,support center" \ No newline at end of file diff --git a/README.md b/README.md index cafa853..e383ad9 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +# DEPREDCATED +The TestCafe team no longer maintains the `DevExpress/error-stack-parser` repository. + error-stack-parser.js - Extract meaning from JS Errors =============== [![Build Status](https://img.shields.io/travis/stacktracejs/error-stack-parser/master.svg?style=flat-square)](https://travis-ci.org/stacktracejs/error-stack-parser) diff --git a/error-stack-parser.js b/error-stack-parser.js index 9de504a..5231091 100644 --- a/error-stack-parser.js +++ b/error-stack-parser.js @@ -56,21 +56,21 @@ return filtered.map(function(line) { if (line.indexOf('(eval ') > -1) { // Throw away eval information until we implement stacktrace.js/stackframe#8 - line = line.replace(/eval code/g, 'eval').replace(/(\(eval at [^()]*)|(\),.*$)/g, ''); + line = line.replace(/eval code/g, 'eval').replace(/(\(eval at [^()]*)|(,.*$)/g, ''); } - var sanitizedLine = line.replace(/^\s+/, '').replace(/\(eval code/g, '('); + var sanitizedLine = line.replace(/^\s+/, '').replace(/\(eval code/g, '(').replace(/^.*?\s+/, ''); // capture and preseve the parenthesized location "(/foo/my bar.js:12:87)" in // case it has spaces in it, as the string is split on \s+ later on - var location = sanitizedLine.match(/ (\((.+):(\d+):(\d+)\)$)/); + var location = sanitizedLine.match(/ (\(.+\)$)/); // remove the parenthesized location from the line, if it was matched sanitizedLine = location ? sanitizedLine.replace(location[0], '') : sanitizedLine; - var tokens = sanitizedLine.split(/\s+/).slice(1); - // if a location was matched, pass it to extractLocation() otherwise pop the last token - var locationParts = this.extractLocation(location ? location[1] : tokens.pop()); - var functionName = tokens.join(' ') || undefined; + // if a location was matched, pass it to extractLocation() otherwise pass all sanitizedLine + // because this line doesn't have function name + var locationParts = this.extractLocation(location ? location[1] : sanitizedLine); + var functionName = location && sanitizedLine || undefined; var fileName = ['eval', ''].indexOf(locationParts[0]) > -1 ? undefined : locationParts[0]; return new StackFrame({ diff --git a/package.json b/package.json index bfa1e68..64af1af 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "error-stack-parser", + "name": "@devexpress/error-stack-parser", "description": "Extract meaning from JS Errors", "maintainers": [ "Eric Wendelin (https://www.eriwen.com)", @@ -21,7 +21,7 @@ }, "repository": { "type": "git", - "url": "git://github.com/stacktracejs/error-stack-parser.git" + "url": "git://github.com/DevExpress/error-stack-parser.git" }, "devDependencies": { "eslint": "^6.8.0", diff --git a/spec/error-stack-parser-spec.js b/spec/error-stack-parser-spec.js index 0244a12..8177b16 100644 --- a/spec/error-stack-parser-spec.js +++ b/spec/error-stack-parser-spec.js @@ -225,10 +225,13 @@ describe('ErrorStackParser', function() { it('should handle spaces in Node.js stacks', function() { var stackframes = unit.parse(CapturedExceptions.NODE_WITH_SPACES); - expect(stackframes.length).toBe(7); + expect(stackframes.length).toBe(8); expect(stackframes[0].fileName).toEqual('/var/app/scratch/my project/index.js'); expect(stackframes[0].lineNumber).toBe(2); expect(stackframes[0].columnNumber).toBe(9); + expect(stackframes[1].fileName).toEqual('/var/app/scratch/my project/index.js'); + expect(stackframes[1].lineNumber).toBe(2); + expect(stackframes[1].columnNumber).toBe(9); }); }); }); diff --git a/spec/fixtures/captured-errors.js b/spec/fixtures/captured-errors.js index 36c6856..f7ff703 100644 --- a/spec/fixtures/captured-errors.js +++ b/spec/fixtures/captured-errors.js @@ -387,7 +387,8 @@ CapturedExceptions.EDGE_20_NESTED_EVAL = { CapturedExceptions.NODE_WITH_SPACES = { name: 'Error', message: '', - stack: 'Error\n at Object. ' + + stack: 'Error\n at /var/app/scratch/my '+ + 'project/index.js:2:9\n at Object. ' + '(/var/app/scratch/my ' + 'project/index.js:2:9)\n at Module._compile ' + '(internal/modules/cjs/loader.js:774:30)\n at ' +