Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hermione-gemini-migrator

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hermione-gemini-migrator

Plugin for hermione for migration gemini tests.

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

hermione-gemini-migrator

Plugin for hermione for migration gemini tests.

Install

npm i -D hermione-gemini-migrator

Usage

Set options for the plugin in your hermione config:

module.exports = {
    // ...

    plugins: {
        'hermione-gemini-migrator': {
            enabled: false,
            filePathReplacer: filePath =>
                filePath
                    .replace('gemini.js', 'hermione.js')
                    .replace('gemini/test-suites', 'features'),
            browserIdReplacer: browserId => {
                switch(browserId) {
                    case 'ie11':
                        return 'edge-desktop'
                    default:
                        return browserId;
                }
            }
            commandReplacers: {
                url: code => code.replace(/url\((.*?)\);/, (match, p1) => {
                    return `customUrl(${JSON.stringify(qs.parse(url.parse(p1.replace(/\"/g, '')).query))})`;
                })
            },
            afterEach: (hermione) => {
                const {
                    inputSuite,
                    outputTestCollection,
                    inputFilePath,
                    outputFilePath,
                    inputScreenPaths,
                    outputScreenPaths,
                    config,
                    utils
                } = hermione.geminiMigrator;

                // Pring filepathh
                console.log(outputFilePath);

                // Print input test names
                utils.suiteWalker(inputSuite, suite => {
                    if (suite.url && !(suite.children && suite.children.length)) console.log(suite.fullName);
                });

                // Print output test names
                const testDict = {};

                outputTestCollection.eachTest(test => {
                    const fullName = test.fullTitle();

                    if (testDict[fullName]) return;
                    
                    testDict[fullName] = true;
                    console.log(fullName);
                });
            }
        }
    },

    // ...
}

Run hermione with cli option (if enabled: false):

npx hermione --gemini-migrate

Options

OptionDefaultDescription
enabledfalseOption for enable/disable the plugin.
geminiConfig'.gemini.js'Path to Gemini config.
inputPatterns'**/*.gemini.js'Patterns for searching gemini files. Read more: fast-glob
filePathReplacerfilePath => filePath.replace(/gemini/g, 'hermione')Function for replacing substring in test filePath.
browserIdReplacerbrowserId => browserIdFunction for replacing substring in browserId.
commandReplacers{}Object with functions for replacing default command to custom in hermione tests.
codeFormattercode => codeFunction for formatting code before writting. For example: prettier
beforehermione => {}Async or sync function that is called before writting all test files.
beforeEachhermione => {}Async or sync function that is called before writting each test file.
afterEachhermione => {}Async or sync function that is called after writting each test file.
afterhermione => {}Async or sync function that is called after writting all test files.

Licence

MIT

Keywords

FAQs

Package last updated on 06 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc