Skip to content

Latest commit

 

History

History
117 lines (106 loc) · 3.43 KB

local-development.md

File metadata and controls

117 lines (106 loc) · 3.43 KB

Local Development

Contents

Setup

NodeJS is required. It can be installed here.

This project uses yarn in place of npm. Follow these instructions to install yarn globally.

Warning: Windows users should not install yarn via NPM, instead use the downloadable MSI executable.

Once installed, yarn is used to install all dependencies.

yarn install

Running Locally

yarn build
yarn start <command>

Testing

Tests can be run with

yarn test

Additionally, code coverage can be printed at the end of test execution by running

yarn test:coverage

VSCode Configuration

File Explorer

To ignore folders generated by the test:coverage script, add this to .vscode/settings.json:

"files.exclude": {
    ".nyc_output/": true,
    "coverage/": true
}

Debugging

Debugging for the main program and unit tests can be accomplished with the following launch.json:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Launch Program",
            "program": "${workspaceFolder}/bin/marco",
            "sourceMapPathOverrides": {
                "webpack://marco/./~/*": "${workspaceRoot}/node_modules/*",
                "webpack://marco/./*": "${workspaceRoot}/*",
                "webpack://marco/*": "*"
            },
            "smartStep": true,
            "cwd": "${workspaceFolder}",
            "sourceMaps": true,
            "showAsyncStacks": true,
            "outputCapture": "std",
            "console": "externalTerminal",
            "args": [
                "list"
            ]
        },
        {
            "type": "node",
            "request": "launch",
            "name": "Launch Tests",
            "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
            "sourceMapPathOverrides": {
                "webpack://marco/./~/*": "${workspaceRoot}/node_modules/*",
                "webpack://marco/./*": "${workspaceRoot}/*",
                "webpack://marco/*": "*"
            },
            "smartStep": true,
            "cwd": "${workspaceFolder}",
            "sourceMaps": true,
            "showAsyncStacks": true,
            "outputCapture": "std",
            "args": [
                "-r",
                "ts-node/register",
                "-r",
                "reflect-metadata",
                "--no-timeouts",
                "--colors",
                "spec/**/*.spec.ts"
            ]
        }
    ]
}

The given marco command can be changed by changing the "args" value in the first configuration.

Extensions

If using Mocha Sidebar for VSCode, add this to .vscode/settings.json:

"mocha.files.glob": "spec/**/*.ts",
"mocha.requires": [
    "ts-node/register",
    "reflect-metadata",
    "spec/support/setup.ts"
]