Skip to content

Commit

Permalink
Fixed --require
Browse files Browse the repository at this point in the history
Fixes #208
  • Loading branch information
sgravrock committed Jun 14, 2023
1 parent d0b93c4 commit 5f7b19b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/runner_base.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class RunnerBase {
* @type string[] | undefined
*/
if(config.requires) {
this.addRequires_(config.requires);
this.addRequires(config.requires);
}

/**
Expand Down Expand Up @@ -334,7 +334,7 @@ class RunnerBase {
this.helperFiles.push(filePath);
}

addRequires_(requires) {
addRequires(requires) {
const jasmineRunner = this;
requires.forEach(function(r) {
jasmineRunner.requires.push(r);
Expand Down
1 change: 1 addition & 0 deletions spec/fixtures/noisy_require.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log('noisy require was loaded');
10 changes: 10 additions & 0 deletions spec/integration_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,16 @@ describe('Integration', function () {
});
}
});

it('supports --require', async function() {
const {exitCode, output} = await runJasmine(
'spec/fixtures/sample_project',
'spec/support/jasmine.json',
['--require=../noisy_require.js']
);
expect(exitCode).toEqual(2); // because no specs
expect(output).toContain('noisy require was loaded');
});
});

async function runJasmine(cwd, config="jasmine.json", extraArgs = []) {
Expand Down

0 comments on commit 5f7b19b

Please sign in to comment.