marmelab / greenframe-cli

Estimate the carbon footprint of a user scenario on a web application
https://greenframe.io
Other
228 stars 11 forks source link

Unexpected token 'const' #64

Closed mgifford closed 11 months ago

mgifford commented 12 months ago

Just trying to follow the usage model https://github.com/marmelab/greenframe-cli/tree/main#usage

in greenframe-cli/1.6.8 darwin-arm64 node-v16.20.1

I'm getting this error with % greenframe open https://marmelab.com ./my-scenario.js

Running 1 scenarios...
❌ Error : main scenario
Unexpected token 'const'

I'm just using the basic scenario provided % cat my-scenario.js                            

// in my-scenario.js
const scenario = async (page) => {
    await page.goto('', { waitUntil: 'networkidle' }); // Go to the baseUrl
    await page.waitForTimeout(3000); // Wait for 3 seconds
    await page.scrollToElement('footer'); // Scroll to the footer (if present)
    await page.waitForNetworkIdle(); // Wait every request has been answered as a normal user.
};

module.exports = scenario;
erwanMarmelab commented 11 months ago

Hello,

Sorry for the confusion. The current README has been updated and corresponds to a future version of greenframe-cli which has not been released yet. The README has been updated and can now be found on the MAIN branch by doing a git pull. Here is the actual and official documentation website corresponding to the current released version : https://docs.greenframe.io/scenario

Kind regards.