Skip to content

Commit

Permalink
added --allow-file-access-from-files tag issue 298
Browse files Browse the repository at this point in the history
  • Loading branch information
vatsala-glory authored and steveoh committed Jun 6, 2019
1 parent e52e8bf commit f9b99fd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ Default: `false`

Display a list of all failed tests and their failure messages

#### options.allowFileAccess
Type: `Boolean`
Default: `false`

Launches puppeteer with --allow-file-access-from-files (Fix Issue https://github.com/gruntjs/grunt-contrib-jasmine/issues/298)

### Flags

Name: `build`
Expand Down
9 changes: 9 additions & 0 deletions tasks/jasmine.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,15 @@ module.exports = function(grunt) {
delete options.noSandbox;
}

if (options.hasOwnProperty('allowFileAccess') && options.allowFileAccess) {
if (puppeteerLaunchSetting && puppeteerLaunchSetting.args.length > 0) {
puppeteerLaunchSetting.args.push('--allow-file-access-from-files');
} else {
puppeteerLaunchSetting = { args: ['--allow-file-access-from-files'] };
}
delete options.allowFileAccess;
}

const browser = await puppeteer.launch(puppeteerLaunchSetting);
grunt.log.subhead(`Testing specs with Jasmine/${options.version} via ${await browser.version()}`);
const page = await browser.newPage();
Expand Down

0 comments on commit f9b99fd

Please sign in to comment.