@smallstack/testing
functionality for testing smallstack projects/packages
Last updated a year ago by maxfriedmann .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install @smallstack/testing 
SYNC missed versions from official npm registry.

@smallstack/testing

To test your smallstack package, follow these steps:

  • add these packages as dev dependencies: npm install @smallstack/testing @types/chai @types/mocha chai jsdom karma karma-cli karma-jsdom-launcher karma-mocha karma-typescript mocha typescript --save-dev
  • add these two scripts to your package.json:
    • "test:ci": "karma start --single-run",
    • "test": "karma start"
  • (optional) add the test execution to your gitlab-ci.yml: - npm run test:ci
  • call npm install
  • (optional) create a /tests folder (you can also put the tests next to your source code)
  • create tests with the name SOMETHING.spec.ts and fill with mocha/chai testing code, see https://gitlab.com/smallstack/products/smallstack-common/tree/develop/tests
  • add a karma.conf.js file in your package root with this exemplary content:
module.exports = function (config) {
    config.set({
        frameworks: ["mocha", "karma-typescript"],
        files: [{
            pattern: "src/**/*.ts"
        }, {
            pattern: "tests/**/*.ts"
        }],
        preprocessors: {
            "**/*.ts": ["karma-typescript"]
        },
        reporters: ["dots", "karma-typescript"],
        browsers: ["jsdom"],
        karmaTypescriptConfig: {
            reports: {
                "text-summary": ""
            },
            compilerOptions: {
                "lib": [
                    "es2015",
                    "dom"
                ],
                "baseUrl": ".",
                "paths": {
                    "YOUR_PACKAGE_NAME": [
                        "./src/index.ts"
                    ]
                }
            }
        }
    });
};
  • call npm test, happy testing!

Current Tags

  • 0.1.16                                ...           latest (a year ago)

16 Versions

  • 0.1.16                                ...           a year ago
  • 0.1.15                                ...           a year ago
  • 0.1.14                                ...           a year ago
  • 0.1.13                                ...           a year ago
  • 0.1.12                                ...           a year ago
  • 0.1.11                                ...           2 years ago
  • 0.1.10                                ...           2 years ago
  • 0.1.9                                ...           2 years ago
  • 0.1.8                                ...           2 years ago
  • 0.1.7                                ...           2 years ago
  • 0.1.6                                ...           2 years ago
  • 0.1.5                                ...           2 years ago
  • 0.1.4                                ...           2 years ago
  • 0.1.3                                ...           2 years ago
  • 0.1.2                                ...           2 years ago
  • 0.1.1                                ...           2 years ago
Downloads
Today 0
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 20
Dependencies (21)
Dev Dependencies (1)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |