Socket
Book a DemoInstallSign in
Socket

concordialang-plugin

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

concordialang-plugin

Concordia Compiler Plug-in

latest
Source
npmnpm
Version
1.3.2
Version published
Maintainers
1
Created
Source

Build Status npm version GitHub last commit

concordialang-plugin

🔌 Concordia Compiler plug-in interface

How to create a plug-in

👉 The following procedure requires Concordia Compiler 2.0.0-alpha-19 or later

  • Choose wisely your plug-in name, making sure that it starts with concordialang-. We recommend that it contains the target frameworks - e.g. concordialang-foo-bar if you will use the (hypothetical) frameworks "foo" and "bar".
  • Create a new repository and clone it.
  • Create a new file package.json (e.g., npm init).
  • Install the packages concordialang-types and concordialang-plugin as dependencies (e.g., npm i concordialang-types concordialang-plugin).
  • Add the property "concordiaPlugin": true to your package.json.
  • Create a file (e.g., src/index.ts) with a class that implements the interface Plugin (see API).
  • Make sure that the created class has a default export (i.e, export default class).
  • Set the property "main" from your package.json to the JS file that contains the created class (e.g., "dist/index.js").
  • Check your plug-in execution (see some tips below).
  • Publish your package if you desire to install it by name.

Note: You can use JavaScript instead of TypeScript.

How to check your plug-in execution

  • Create a new project with the file package.json (e.g., npm init --yes).
  • Create a simple Concordia feature file (e.g., features/example.feature).
  • Install Concordia Compiler (npm i -D concordialang) and run the init command (npx concordia --init).
  • Install your plug-in from its directory (e.g., npm i -D /path/to/your-plugin)
  • Run Concordia with your plug-in (e.g., npx concordia -p your-plugin) and see with it is executed correctly.

How to publish your plug-in

  • Make sure you have an NPM account.
  • Enter your project folder and run npm login.
  • Create a property "files" into your package.json that indicates the (source code) files to distribute.
  • Make sure the property "version" of your package file was set correctly.
  • Run npm publish --dry-run to simulate the publishing.
  • Make sure its all correct and then run npm publish.

Example

See fake-plugin for a simple example.

API

export interface Plugin {

    //
    // Test Generation and Execution
    //

    /**
     * Multi-platform command to start a testing server, if needed.
     *
     * 👉 Set its value only if the testing framework does need a testing server.
     *
     * @example
     *      "selenium-standalone start"
     */
    serveCommand?: string;

    /**
     * Generates source code from abstract test scripts, according to the given options.
     *
     * @param abstractTestScripts Abstract test scripts
     * @param options Options
     * @return Generation results.
     */
    generateCode?: (
        abstractTestScripts: AbstractTestScript[],
        options: TestScriptGenerationOptions
    ) => Promise< TestScriptGenerationResult >;

    /**
     * Executes test scripts, according to the given options.
     *
     * @param options Execution options.
     * @return Execution results.
     */
    executeCode?: ( options: TestScriptExecutionOptions ) => Promise< TestScriptExecutionResult >;

    /**
     * Converts a file produced by the execution of test scripts (e.g. a JSON or a XML file).
     *
     * @param filePath Input file.
     * @return Execution results.
     */
    convertReportFile?: ( filePath: string ) => Promise< TestScriptExecutionResult >;

    //
    // Events
    //

    /**
     * Event that happens before the compiler reports the test script results.
     *
     * @param result Test script execution result.
     * @param options Test script execution options.
     */
	beforeReporting?: ( result?: TestScriptExecutionResult, options?: TestScriptExecutionOptions ) => Promise< void >;

    /**
     * Event that happens after the compiler reports the test script results.
     *
     * @param result Test script execution result.
     * @param options Test script execution options.
     */
    afterReporting?: ( result?: TestScriptExecutionResult, options?: TestScriptExecutionOptions ) => Promise< void >;

}

Please see the src folder for more information about the used types.

License

AGPL © Thiago Delgado Pinto

GNU Affero General Public License version 3

Keywords

concordialang

FAQs

Package last updated on 11 Jan 2022

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