Registry /
testing / nutra-jasmine-coverage-babel-preset
Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
nutra.config.js (module.exports = function config) { config.set({...}) })
✓ // nutra.config.js
module.exports = function(config) {
config.set({
frameworks: ['nutra-jasmine'],
files: ['test/specs/**/*.js', 'src/**/*.js'],
preprocessors: {
'test/specs/**/*.js': ['nutra-babel'],
'src/**/*.js': ['nutra-babel', 'nutra-coverage']
},
reporters: ['nutra-coverage']
});
};
This preset is configured via nutra.config.js, not by direct imports. No symbols are imported in test files.
Installs the preset, creates a basic nutra.config.js configuration with Jasmine, Babel, and Istanbul coverage, writes a sample spec, and runs the test suite.
// Install preset
npm install --save-dev nutra nutra-jasmine-coverage-babel-preset
// Create nutra.config.js
module.exports = function(config) {
config.set({
frameworks: ['nutra-jasmine'],
files: ['test/specs/**/*.js', 'src/**/*.js'],
preprocessors: {
'test/specs/**/*.js': ['nutra-babel'],
'src/**/*.js': ['nutra-babel', 'nutra-coverage']
},
reporters: ['nutra-coverage'],
babelOptions: {
configFile: './.babelrc'
},
coverageOptions: {
reporters: [{ type: 'html', subdir: '.' }]
}
});
};
// Write a sample spec
// test/specs/exampleSpec.js
describe('Sample', function() {
it('should pass', function() {
expect(1 + 1).toBe(2);
});
});
// Run tests
npx nutra run
Errors
Common errors & fixes
Cannot find module 'nutra'
nutra is not installed or not in package.json devDependencies.
fixRun: npm install --save-dev nutra
Error: No provider for "framework:nutra-jasmine"
nutra-jasmine-coverage-babel-preset is not installed or not registered.
fixRun: npm install --save-dev nutra-jasmine-coverage-babel-preset
TypeError: config.set is not a function
nutra.config.js does not export a function that accepts a config object.
fixEnsure module.exports = function(config) { ... }; Audit
Dependencies
nutrarequiredRequired host test runner framework