T
T
ttm2019-10-29 17:36:53
JavaScript
ttm, 2019-10-29 17:36:53

How to add script attribute to tag in karma config?

Or how can this be done at all?
It is necessary for the script that is being tested to set an attribute (the value of which may be different), the script reads it.

module.exports = function (config) {
    config.set({
        basePath: '',
        frameworks: ['jasmine'],
        files: [
            'dist/main.js',
            'dist/tests/main.spec.js'
        ],

        reporters: ['progress'],
        port: 9876,
        colors: true,
        logLevel: config.LOG_INFO,
        autoWatch: false,
        browsers: ['ChromeHeadless'],
        singleRun: true,
        concurrency: Infinity
    });
};

In this case, the main.js script should be added to the page with the attribute
<script src="[main.js]" data-components="component1, component2"></script>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question