Skip to content

Commit

Permalink
Merge pull request #320 from gruntjs/rel-pp
Browse files Browse the repository at this point in the history
v2.2.0
  • Loading branch information
vladikoff authored May 4, 2020
2 parents 607e95a + bf5f771 commit aa36400
Show file tree
Hide file tree
Showing 9 changed files with 138 additions and 65 deletions.
8 changes: 2 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
sudo: required

language: node_js

node_js:
- "8"
- "9"
- "10"
- "12"

matrix:
fast_finish: true

cache:
directories:
- node_modules
cache: npm
6 changes: 6 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
v2.2.0:
date: 2020-05-04
changes:
- Dependency updates
- set the default option timeout value to 30 secs to sync with puppeteer's default timeout value.
- options.sandboxArgs; passing options to puppeteer
v2.1.3:
date: 2019-07-31
changes:
Expand Down
71 changes: 42 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,19 @@ Default: `'full'`
* `short` only displays a success or failure character for each test (useful with large suites)
* `none` displays nothing

#### 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)

#### options.timeout
Type: `Number`
Default: `30000`

Change the puppeteer default timeout value in milliseconds (reference: https://github.com/puppeteer/puppeteer/blob/master/docs/api.md#pagesetdefaulttimeouttimeout)


#### options.sandboxArgs
Type: `Object`
Default: `{ args: [] }`
Expand All @@ -178,7 +191,6 @@ Example `sandboxArgs` object:
}
```


#### options.summary
Type: `Boolean`
Default: `false`
Expand Down Expand Up @@ -287,70 +299,70 @@ grunt.initConfig({
});
```

#### Sample RequireJS/NPM Template usage
#### Passing options to sandbox (puppeteer)

See [puppeteer launch options](https://pptr.dev/#?product=Puppeteer&version=v3.0.1&show=api-puppeteerlaunchoptions) for a complete list of arguments.

```js
// Example configuration
grunt.initConfig({
jasmine: {
yourTask: {
customTemplate: {
src: 'src/**/*.js',
options: {
specs: 'spec/*Spec.js',
template: require('grunt-template-jasmine-requirejs')
helpers: 'spec/*Helper.js',
template: 'custom.tmpl',
sandboxArgs: {
args: ['--no-sandbox'],
timeout: 3000,
defaultViewport: {
isMobile: true
}
}
}
}
}
});
```

NPM Templates are just node modules, so you can write and treat them as such.

Please see the [grunt-template-jasmine-requirejs](https://github.com/jsoverson/grunt-template-jasmine-requirejs) documentation
for more information on the RequireJS template.

#### Keeping temp files in an existing directory

Supplying a custom temp directory
#### Sample RequireJS/NPM Template usage

```js
// Example configuration
grunt.initConfig({
jasmine: {
pivotal: {
yourTask: {
src: 'src/**/*.js',
options: {
keepRunner: true,
tempDir: 'bin/jasmine/',
specs: 'spec/*Spec.js',
helpers: 'spec/*Helper.js'
template: require('grunt-template-jasmine-requirejs')
}
}
}
});
```

#### Passing options to sandbox (puppeteer)
NPM Templates are just node modules, so you can write and treat them as such.

See [puppeteer launch options](https://pptr.dev/#?product=Puppeteer&version=v3.0.1&show=api-puppeteerlaunchoptions) for a complete list of arguments.
Please see the [grunt-template-jasmine-requirejs](https://github.com/jsoverson/grunt-template-jasmine-requirejs) documentation
for more information on the RequireJS template.

#### Keeping temp files in an existing directory

Supplying a custom temp directory

```js
// Example configuration
grunt.initConfig({
jasmine: {
customTemplate: {
pivotal: {
src: 'src/**/*.js',
options: {
keepRunner: true,
tempDir: 'bin/jasmine/',
specs: 'spec/*Spec.js',
helpers: 'spec/*Helper.js',
template: 'custom.tmpl',
sandboxArgs: {
args: ['--no-sandbox'],
timeout: 3000,
defaultViewport: {
isMobile: true
}
}
helpers: 'spec/*Helper.js'
}
}
}
Expand All @@ -360,6 +372,7 @@ grunt.initConfig({

## Release History

* 2020-05-04   v2.2.0   Dependency updates set the default option timeout value to 30 secs to sync with puppeteer's default timeout value. options.sandboxArgs; passing options to puppeteer
* 2019-07-31   v2.1.3   Fix security deps Update Puppeteer
* 2018-11-14   v2.0.3   [object Object] Build only should pass if the buildSpecrunner runs without error
* 2018-08-13   v2.0.2   Fix noSandbox option. Fix startTime, and timing issues.
Expand Down Expand Up @@ -400,4 +413,4 @@ grunt.initConfig({

Task submitted by [Jarrod Overson](http://jarrodoverson.com)

*This file was generated on Wed Jul 31 2019 12:27:22.*
*This file was generated on Mon May 04 2020 15:54:00.*
29 changes: 15 additions & 14 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
clone_depth: 10
clone_depth: 5

version: "{build}"

# What combinations to test
environment:
matrix:
- nodejs_version: "8"
platform: x86
- nodejs_version: "9"
platform: x86
- nodejs_version: "10"
platform: x86
- NODEJS_VERSION: "8"
PLATFORM: x86
- NODEJS_VERSION: "8"
PLATFORM: x64
- NODEJS_VERSION: "10"
PLATFORM: x64
- NODEJS_VERSION: "12"
PLATFORM: x64

install:
- ps: Install-Product node $env:nodejs_version $env:platform
- npm install
- ps: Install-Product node $env:NODEJS_VERSION $env:PLATFORM
- npm ci

test_script:
# Output useful info for debugging
- node --version && npm --version
- node --version
- npm --version
# We test multiple Windows shells because of prior stdout buffering issues
# filed against Grunt. https://github.com/joyent/node/issues/3584
- ps: "npm test # PowerShell" # Pass comment to PS for easier debugging
- cmd: npm test
- npm test

build: off

matrix:
fast_finish: true

cache:
- node_modules -> package.json
- '%APPDATA%\npm-cache\ -> appveyor.yml,package.json,package-lock.json'
27 changes: 27 additions & 0 deletions docs/jasmine-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,33 @@ grunt.initConfig({
});
```

## Passing options to sandbox (puppeteer)

See [puppeteer launch options](https://pptr.dev/#?product=Puppeteer&version=v3.0.1&show=api-puppeteerlaunchoptions) for a complete list of arguments.

```js
// Example configuration
grunt.initConfig({
jasmine: {
customTemplate: {
src: 'src/**/*.js',
options: {
specs: 'spec/*Spec.js',
helpers: 'spec/*Helper.js',
template: 'custom.tmpl',
sandboxArgs: {
args: ['--no-sandbox'],
timeout: 3000,
defaultViewport: {
isMobile: true
}
}
}
}
}
});
```

## Sample RequireJS/NPM Template usage

```js
Expand Down
29 changes: 29 additions & 0 deletions docs/jasmine-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,35 @@ Default: `'full'`
* `short` only displays a success or failure character for each test (useful with large suites)
* `none` displays nothing

## 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)

## options.timeout
Type: `Number`
Default: `30000`

Change the puppeteer default timeout value in milliseconds (reference: https://github.com/puppeteer/puppeteer/blob/master/docs/api.md#pagesetdefaulttimeouttimeout)


## options.sandboxArgs
Type: `Object`
Default: `{ args: [] }`

Pass arugments to puppeteer launcher. For the list of available options, please look at [puppeteer launch options](https://pptr.dev/#?product=Puppeteer&version=v3.0.1&show=api-puppeteerlaunchoptions).

Example `sandboxArgs` object:
```js
{
args: {
'=-allow-file-access-from-files'
},
executeablePath: '/some/other/path/to/chrome'
}
```

## options.summary
Type: `Boolean`
Default: `false`
Expand Down
28 changes: 14 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"devDependencies": {
"grunt": "^1.0.4",
"grunt-contrib-connect": "^2.0.0",
"grunt-contrib-internal": "^3.1.0",
"grunt-contrib-internal": "^4.0.1",
"grunt-contrib-nodeunit": "^2.0.0",
"grunt-contrib-watch": "^1.1.0"
},
Expand Down
3 changes: 2 additions & 1 deletion tasks/jasmine.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ module.exports = function(grunt) {
// Merge task-specific options with these defaults.
var options = this.options({
version: 'latest',
timeout: 10000,
timeout: 30000,
styles: [],
specs: [],
helpers: [],
Expand Down Expand Up @@ -169,6 +169,7 @@ module.exports = function(grunt) {

try {
await setup(options, dispatcher, page, resolveJasmine);
page.setDefaultTimeout(options.timeout);
await page.goto(file, { waitUntil: 'domcontentloaded' });

await jasminePromise;
Expand Down

0 comments on commit aa36400

Please sign in to comment.