chore: Allow development under Windows platform (#992)
This patch improves life of puppeteer contributor on Windows: - Setting environment variables using cross-env since Windows requires the SET command. - Calling Jasmine in the script debug-unit using jasmine's JavaScript binary instead of shell. - Add /test/test-user-data-dir* to .gitignore since temporary user data directories, in case of test fails, remains in the test directory.
This commit is contained in:
parent
ff08e45785
commit
9ecf20fc03
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,5 +1,6 @@
|
||||
/node_modules/
|
||||
/test/output
|
||||
/test/test-user-data-dir*
|
||||
/.local-chromium/
|
||||
/.dev_profile*
|
||||
.DS_Store
|
||||
|
@ -9,13 +9,13 @@
|
||||
},
|
||||
"scripts": {
|
||||
"unit": "jasmine test/test.js",
|
||||
"debug-unit": "DEBUG_TEST=true node --inspect-brk ./node_modules/.bin/jasmine test/test.js",
|
||||
"debug-unit": "cross-env DEBUG_TEST=true node --inspect-brk ./node_modules/jasmine/bin/jasmine.js test/test.js",
|
||||
"test-doclint": "jasmine utils/doclint/check_public_api/test/test.js && jasmine utils/doclint/preprocessor/test.js",
|
||||
"test": "npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer",
|
||||
"install": "node install.js",
|
||||
"lint": "([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc",
|
||||
"doc": "node utils/doclint/cli.js",
|
||||
"coverage": "COVERAGE=true npm run unit",
|
||||
"coverage": "cross-env COVERAGE=true npm run unit",
|
||||
"test-node6-transformer": "jasmine utils/node6-transform/test/test.js",
|
||||
"build": "node utils/node6-transform/index.js",
|
||||
"unit-node6": "jasmine node6-test/test.js",
|
||||
@ -44,6 +44,7 @@
|
||||
"@types/rimraf": "^2.0.2",
|
||||
"@types/ws": "^3.0.2",
|
||||
"commonmark": "^0.27.0",
|
||||
"cross-env": "^5.0.5",
|
||||
"eslint": "^4.0.0",
|
||||
"esprima": "^4.0.0",
|
||||
"jasmine": "^2.6.0",
|
||||
|
@ -38,6 +38,7 @@ const EMPTY_PAGE = PREFIX + '/empty.html';
|
||||
const HTTPS_PORT = 8908;
|
||||
const HTTPS_PREFIX = 'https://localhost:' + HTTPS_PORT;
|
||||
|
||||
const windows = /^win/.test(process.platform);
|
||||
const headless = (process.env.HEADLESS || 'true').trim().toLowerCase() === 'true';
|
||||
const slowMo = parseInt((process.env.SLOW_MO || '0').trim(), 10);
|
||||
const executablePath = process.env.CHROME;
|
||||
@ -108,7 +109,9 @@ describe('Puppeteer', function() {
|
||||
await puppeteer.launch(options).catch(e => waitError = e);
|
||||
expect(waitError.message.startsWith('Failed to launch chrome! spawn random-invalid-path ENOENT')).toBe(true);
|
||||
}));
|
||||
it('userDataDir option', SX(async function() {
|
||||
// Windows has issues running Chromium using a custom user data dir. It hangs when closing the browser.
|
||||
// @see https://github.com/GoogleChrome/puppeteer/issues/918
|
||||
(windows ? xit : it)('userDataDir option', SX(async function() {
|
||||
const userDataDir = fs.mkdtempSync(path.join(__dirname, 'test-user-data-dir'));
|
||||
const options = Object.assign({userDataDir}, defaultBrowserOptions);
|
||||
const browser = await puppeteer.launch(options);
|
||||
@ -117,7 +120,9 @@ describe('Puppeteer', function() {
|
||||
expect(fs.readdirSync(userDataDir).length).toBeGreaterThan(0);
|
||||
rm(userDataDir);
|
||||
}));
|
||||
it('userDataDir argument', SX(async function() {
|
||||
// Windows has issues running Chromium using a custom user data dir. It hangs when closing the browser.
|
||||
// @see https://github.com/GoogleChrome/puppeteer/issues/918
|
||||
(windows ? xit : it)('userDataDir argument', SX(async function() {
|
||||
const userDataDir = fs.mkdtempSync(path.join(__dirname, 'test-user-data-dir'));
|
||||
const options = Object.assign({}, defaultBrowserOptions);
|
||||
options.args = [`--user-data-dir=${userDataDir}`].concat(options.args);
|
||||
|
Loading…
Reference in New Issue
Block a user