Skip to content

jagreehal/stencil-how-to-test-components

Repository files navigation

Examples of how to test Stencil Components using Jest and Puppeteer

Build

Examples of how to test Stencil components... both what works and doesn't!

✅ can assert events have been raised

✅ can call methods on elements

✅ can set props on element

✅ can change prop value

Snapshots

📷 can use snapshots

Added bonus!

For VSCode users checkout launch.json for debugging tests

{
    "version": "0.2.0",
    "configurations": [{
            "type": "node",
            "request": "launch",
            "name": "E2E Test Current File",
            "cwd": "${workspaceFolder}",
            "program": "${workspaceFolder}/node_modules/.bin/stencil",
            "args": ["test", "--e2e", "${relativeFile}"],
            "console": "integratedTerminal",
            "internalConsoleOptions": "neverOpen",
            "disableOptimisticBPs": true,
            "skipFiles": [
                "${workspaceFolder}/node_modules/**/*.js",
                "<node_internals>/**/*.js"
            ]
        },
        {
            "type": "node",
            "request": "launch",
            "name": "Spec Test Current File",
            "cwd": "${workspaceFolder}",
            "program": "${workspaceFolder}/node_modules/.bin/stencil",
            "args": ["test", "--spec", "${relativeFile}"],
            "console": "integratedTerminal",
            "internalConsoleOptions": "neverOpen",
            "disableOptimisticBPs": true,
            "skipFiles": [
                "${workspaceFolder}/node_modules/**/*.js",
                "<node_internals>/**/*.js"
            ]
        }
    ]
}

About

Examples of how to test Stencil components

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published