2

I am using vscode-extension-tester and getting below error. Please find package.json and .mochrc.js file also.

Extension 'helloworld-sample-0.0.1.vsix' was successfully installed. Loading mocha configuration from .mocharc.js

  1. "before all" hook in "{root}"
  2. "after all" hook in "{root}"

0 passing (45s) 2 failing

  1. "before all" hook in "{root}": Error: Timeout of 45000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. at listOnTimeout (internal/timers.js:557:17)

Below is package.json

enter code here`{
"name": "helloworld-sample",
"displayName": "helloworld-sample",
"description": "HelloWorld example for VS Code",
"version": "0.0.1",
"publisher": "ajinkya",
"repository": "https://github.com/Microsoft/vscode-extension-samples/helloworld-sample",
"engines": {
    "vscode": "^1.37.0"
},
"categories": [
    "Other"
],
"activationEvents": [
    "onCommand:extension.helloWorld"
],
"main": "./out/extension.js",
"contributes": {
    "commands": [
        {
            "command": "extension.helloWorld",
            "title": "Hello World"
        }
    ]
},
"scripts": {
    "vscode:prepublish": "npm run compile",
    "compile": "tsc -p ./",
    "lint": "eslint . --ext .ts,.tsx",
    "watch": "tsc -watch -p ./",
    "test": "mocha --timeout 10000",
    "ui-test": "MOCHAWESOME_REPORTFILENAME=AutomationReport MOCHAWESOME_REPORTTITLE=MyReport extest setup-and-run out/ui-test/final-demo.js -m .mocharc.js"
},
"devDependencies": {
    "@types/chai": "^4.3.1",
    "@types/mocha": "^9.1.1",
    "@types/node": "^16.11.7",
    "@types/vscode": "^1.34.0",
    "@typescript-eslint/eslint-plugin": "^5.30.0",
    "@typescript-eslint/parser": "^5.30.0",
    "chai": "^4.3.6",
    "eslint": "^8.13.0",
    "mocha": "^10.0.0",
    "mochawesome": "^7.1.3",
    "mochawesome-screenshots": "^1.7.3",
    "typescript": "^4.7.2",
    "vscode-extension-tester": "^4.3.0"
},
"dependencies": {
    "clipboardy": "^2.3.0",
    "copy-paste": "^1.3.0",
    "copy-to-clipboard": "^3.3.1",
    "glob": "^7.1.6",
    "robotjs": "^0.6.0",
    "wdio-mochawesome-reporter": "^4.0.0"
}

} `

Below is .mocharc.js

`module.exports = {
reporter: 'node_modules/mochawesome',
'reporter-option': [
    'overwrite=false',
    'reportTitle=MYAUTOMATIOn',
    'showPassed=false',
    'reportFilename=automationrepo',
    'reportPageTitle=majhareport',
    "code=false",
    "--timeout 50000"

],

};`

mochaOpts = {
    reporter: 'mochawesome-screenshots',
    'reporter-option': [
         'reportDir: Report',
        'reportName: myreport',
        'reportTitle: mytitle',
        'reportPageTitle: customReportPageTitle',
        'takePassedScreenshot: true',
        'clearOldScreenshots: false',
        'shortScrFileNames: false',
        'jsonReport: false',
        'multiReport: false',
        '--timeout 50000'
    ],
};

Below is my testcase file

describe('Create CC and deploy on local instance', function () {

    // let browser: VSBrowser;
    let driver: WebDriver
    let folderPath: string;

    before(function () {
       

        // this.timeout(50000);
        driver = VSBrowser.instance.driver;
        folderPath = createScreenshotFolder();
        
    });
Ajinkya
  • 413
  • 2
  • 5
  • 18

0 Answers0