mocha-headless-chrome
Advanced tools
Comparing version 2.0.3 to 3.0.0
@@ -10,6 +10,20 @@ # Changelog | ||
## 3.0.0 - 2020-05-01 | ||
### Added | ||
- issue [#39](https://github.com/direct-adv-interfaces/mocha-headless-chrome/issues/39): Added `polling` parameter that can specify puppeteer polling mechanism. | ||
### Changed | ||
- Update [puppeteer](https://www.npmjs.com/package/puppeteer) package. | ||
- issue [#44](https://github.com/direct-adv-interfaces/mocha-headless-chrome/issues/44): Empty messages are ignored when output to the console. | ||
### Fixed | ||
- PR [#50](https://github.com/direct-adv-interfaces/mocha-headless-chrome/pull/50): Fix the error when console output arguments is not serializable. | ||
### BREAKING CHANGES | ||
- Update [puppeteer](https://www.npmjs.com/package/puppeteer) package to 3.0.2 version. It means that Node versions before 10.18.1 are not supported. | ||
## 2.0.1 - 2018-06-29 | ||
@@ -16,0 +30,0 @@ |
@@ -18,2 +18,3 @@ 'use strict'; | ||
.option('visible', 'Show Chrome window', undefined, Boolean) | ||
.option('polling', 'Puppeteer polling mechanism', undefined, String) | ||
.example('mocha-headless-chrome -f test.html', 'Run tests on the "test.html" page') | ||
@@ -20,0 +21,0 @@ .example('mocha-headless-chrome -f http://localhost:8080', 'Run tests on the remote page') |
@@ -44,2 +44,7 @@ /** | ||
visible?: boolean; | ||
/** | ||
* Puppeteer polling mechanism. | ||
*/ | ||
polling?: string; | ||
} | ||
@@ -46,0 +51,0 @@ |
@@ -131,3 +131,3 @@ 'use strict'; | ||
Promise.all(args.map(a => a.jsonValue())) | ||
Promise.all(args.map(a => a.jsonValue().catch(() => ''))) | ||
.then(args => { | ||
@@ -137,5 +137,5 @@ // process stdout stub | ||
isStdout && (args = args.slice(1)); | ||
// | ||
let msg = util.format(...args); | ||
!isStdout && (msg += '\n'); | ||
!isStdout && msg && (msg += '\n'); | ||
process.stdout.write(msg); | ||
@@ -156,3 +156,3 @@ }); | ||
exports.runner = function ({ file, reporter, timeout, width, height, args, executablePath, visible }) { | ||
exports.runner = function ({ file, reporter, timeout, width, height, args, executablePath, visible, polling }) { | ||
return new Promise(resolve => { | ||
@@ -167,2 +167,3 @@ | ||
!timeout && (timeout = 60000); | ||
/^\d+$/.test(polling) && (polling = parseInt(polling)); | ||
@@ -190,3 +191,3 @@ const url = prepareUrl(file); | ||
.then(() => page.goto(url)) | ||
.then(() => page.waitForFunction(() => window.__mochaResult__, { timeout: timeout })) | ||
.then(() => page.waitForFunction(() => window.__mochaResult__, { timeout, polling })) | ||
.then(() => page.evaluate(() => window.__mochaResult__)) | ||
@@ -193,0 +194,0 @@ .then(obj => { |
{ | ||
"name": "mocha-headless-chrome", | ||
"version": "2.0.3", | ||
"version": "3.0.0", | ||
"description": "Run client-side mocha tests in the command line through headless Chrome", | ||
@@ -9,7 +9,8 @@ "main": "./lib/runner.js", | ||
"engines": { | ||
"node": ">=6.4.0" | ||
"node": ">=10.18.1" | ||
}, | ||
"scripts": { | ||
"test": "node lib/cli -f ./example/example-page.html -o ./result/result.json -c ./result/coverage.json -w 801 -H 501 -a incognito", | ||
"ts": "tsc ./example/example.ts && node ./example/example.js" | ||
"ts": "tsc ./example/example.ts && node ./example/example.js", | ||
"help": "node lib/cli -h" | ||
}, | ||
@@ -34,11 +35,11 @@ "repository": { | ||
"dependencies": { | ||
"args": "^5.0.0", | ||
"mkdirp": "^0.5.1", | ||
"puppeteer": "^1.17.0" | ||
"args": "^5.0.1", | ||
"mkdirp": "^1.0.4", | ||
"puppeteer": "^3.0.2" | ||
}, | ||
"devDependencies": { | ||
"chai": "^4.1.2", | ||
"mocha": "^5.0.0", | ||
"mocha-teamcity-reporter": "^2.4.0" | ||
"chai": "^4.2.0", | ||
"mocha": "^7.1.2", | ||
"mocha-teamcity-reporter": "^3.0.0" | ||
} | ||
} |
@@ -10,3 +10,3 @@ # mocha-headless-chrome | ||
Node 6.4.0+ and Mocha 2.3.0+ are supported. | ||
Node 10.18.1+ and Mocha 2.3.0+ are supported. | ||
@@ -17,3 +17,3 @@ ## Getting Started | ||
``` | ||
```sh | ||
npm i mocha-headless-chrome | ||
@@ -28,3 +28,3 @@ ``` | ||
``` | ||
```sh | ||
mocha-headless-chrome -f test-page.html | ||
@@ -45,2 +45,3 @@ ``` | ||
- **-t, --timeout** - Timeout in ms (defaults to 60000) | ||
- **-p, --polling** - Puppeteer polling mechanism | ||
- **-h, --help** - Output usage information | ||
@@ -52,23 +53,23 @@ | ||
```sh | ||
mocha-headless-chrome -f test.html | ||
``` | ||
$ mocha-headless-chrome -f test.html | ||
``` | ||
Run tests on the remote page: | ||
```sh | ||
mocha-headless-chrome -f http://localhost:8080 | ||
``` | ||
$ mocha-headless-chrome -f http://localhost:8080 | ||
``` | ||
Output test results using "nyan" reporter: | ||
```sh | ||
mocha-headless-chrome -f test.html -r nyan | ||
``` | ||
$ mocha-headless-chrome -f test.html -r nyan | ||
``` | ||
Pass the Chrome **--no-sandbox** and **--disable-setuid-sandbox** arguments: | ||
```sh | ||
mocha-headless-chrome -f test.html -a no-sandbox -a disable-setuid-sandbox | ||
``` | ||
$ mocha-headless-chrome -f test.html -a no-sandbox -a disable-setuid-sandbox | ||
``` | ||
@@ -83,3 +84,2 @@ ## Mocha reporters | ||
## Programmatically usage | ||
@@ -111,2 +111,1 @@ | ||
See also the [TypeScript example](./example/example.ts). | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18967
352
105
+ Added@types/node@22.7.7(transitive)
+ Added@types/yauzl@2.10.3(transitive)
+ Addedagent-base@5.1.1(transitive)
+ Addedbase64-js@1.5.1(transitive)
+ Addedbl@4.1.0(transitive)
+ Addedbuffer@5.7.1(transitive)
+ Addedchownr@1.1.4(transitive)
+ Addedend-of-stream@1.4.4(transitive)
+ Addedextract-zip@2.0.1(transitive)
+ Addedfs-constants@1.0.0(transitive)
+ Addedget-stream@5.2.0(transitive)
+ Addedhttps-proxy-agent@4.0.0(transitive)
+ Addedieee754@1.2.1(transitive)
+ Addedmkdirp@1.0.4(transitive)
+ Addedmkdirp-classic@0.5.3(transitive)
+ Addedpump@3.0.2(transitive)
+ Addedpuppeteer@3.3.0(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedrimraf@3.0.2(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedstring_decoder@1.3.0(transitive)
+ Addedtar-fs@2.1.1(transitive)
+ Addedtar-stream@2.2.0(transitive)
+ Addedthrough@2.3.8(transitive)
+ Addedunbzip2-stream@1.4.3(transitive)
+ Addedundici-types@6.19.8(transitive)
+ Addedws@7.5.10(transitive)
- Removedagent-base@4.3.0(transitive)
- Removedasync-limiter@1.0.1(transitive)
- Removedbuffer-from@1.1.2(transitive)
- Removedconcat-stream@1.6.2(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removeddebug@2.6.93.2.7(transitive)
- Removedes6-promise@4.2.8(transitive)
- Removedes6-promisify@5.0.0(transitive)
- Removedextract-zip@1.7.0(transitive)
- Removedhttps-proxy-agent@2.2.4(transitive)
- Removedisarray@1.0.0(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removedms@2.0.0(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedpuppeteer@1.20.0(transitive)
- Removedreadable-stream@2.3.8(transitive)
- Removedrimraf@2.7.1(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedtypedarray@0.0.6(transitive)
- Removedws@6.2.3(transitive)
Updatedargs@^5.0.1
Updatedmkdirp@^1.0.4
Updatedpuppeteer@^3.0.2