|
1 | 1 | const fs = require('fs');
|
2 | 2 | const path = require('path');
|
3 | 3 | const Command = require('../lib/command');
|
| 4 | +const Loader = require("../lib/loader"); |
4 | 5 |
|
5 | 6 | const projectBaseDir = 'spec/fixtures/sample_empty_project/';
|
6 | 7 | const spec = path.join(projectBaseDir, 'spec');
|
@@ -54,6 +55,7 @@ describe('command', function() {
|
54 | 55 |
|
55 | 56 | this.fakeJasmine = jasmine.createSpyObj('jasmine', ['loadConfigFile', 'addHelperFiles', 'addRequires', 'showColors', 'execute',
|
56 | 57 | 'randomizeTests', 'seed', 'coreVersion', 'clearReporters', 'addReporter']);
|
| 58 | + this.fakeJasmine.loader = new Loader(); |
57 | 59 | this.fakeJasmine.env = jasmine.createSpyObj('env', ['configure']);
|
58 | 60 | this.fakeJasmine.execute.and.returnValue(Promise.resolve());
|
59 | 61 | });
|
@@ -272,6 +274,15 @@ describe('command', function() {
|
272 | 274 | expect(this.fakeJasmine.addReporter).toHaveBeenCalledWith(jasmine.any(Reporter));
|
273 | 275 | });
|
274 | 276 |
|
| 277 | + it('uses the provided loader to load reporters', async function() { |
| 278 | + const reporterPath = path.resolve(path.join(__dirname, 'fixtures', 'customReporter.js')); |
| 279 | + spyOn(this.fakeJasmine.loader, 'load').and.callThrough(); |
| 280 | + |
| 281 | + await this.command.run(this.fakeJasmine, ['--reporter=' + reporterPath]); |
| 282 | + |
| 283 | + expect(this.fakeJasmine.loader.load).toHaveBeenCalledWith(reporterPath); |
| 284 | + }); |
| 285 | + |
275 | 286 | it('can specify a reporter that is an ES module', async function() {
|
276 | 287 | await this.command.run(this.fakeJasmine, ['--reporter=./spec/fixtures/customReporter.mjs']);
|
277 | 288 | expect(this.fakeJasmine.clearReporters).toHaveBeenCalled();
|
|
0 commit comments