karma-systemjs-imports

0.1.1 • Public • Published

karma-systemjs-imports

Build Status

Add system imports when unit testing with Karma.

Plays nicely along with <script> imports. Useful for gradual migration of unit tests from Javascript -> Typescript/ES6.

$ npm i karma-systemjs-imports --save-dev

Simple Usage

// karma.conf.js or grunt karma config
plugins: [
    'karma-systemjs-imports',
    // Other plugins
]
 
frameworks: ['jasmine', 'systemjs-imports'],
browsers: ['Chrome'],
files: [/* Files to import normally using scripts */],
systemjs: {
    /*
        List of files that will be imported using System.import
        before karma starts running the tests.
    */
    importFiles: grunt.file.expand([
        'app/src/**/*-spec.ts' // Or ES6 Modules.
    ])
}

Caveats

This plugin assumes:

  • SystemJS is already loaded on the global window object.
  • Your test files are already transpiled/compiled.
  • A systemJS config is defined which, enables loading the modules via System.import

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.1
    2,848
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.1
    2,848
  • 0.1.0
    0

Package Sidebar

Install

npm i karma-systemjs-imports

Weekly Downloads

2,591

Version

0.1.1

License

MIT

Last publish

Collaborators

  • ashubham