From f9b99fdbd49233e0da69fb0f0fbd7a94551a7d78 Mon Sep 17 00:00:00 2001 From: Agrawal Date: Thu, 6 Jun 2019 16:44:32 +0200 Subject: [PATCH] added --allow-file-access-from-files tag issue 298 --- README.md | 6 ++++++ tasks/jasmine.js | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/README.md b/README.md index 5bd711b..cc24e28 100644 --- a/README.md +++ b/README.md @@ -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` diff --git a/tasks/jasmine.js b/tasks/jasmine.js index 01667f2..44e8402 100644 --- a/tasks/jasmine.js +++ b/tasks/jasmine.js @@ -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();