mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
Test node6 on travis (#551)
This patch starts running all puppeteer tests with node6 on travis-ci.
This commit is contained in:
parent
bd5b4fe963
commit
cd81944e66
@ -1,3 +1,4 @@
|
|||||||
third_party/*
|
third_party/*
|
||||||
utils/doclint/check_public_api/test/
|
utils/doclint/check_public_api/test/
|
||||||
node6/*
|
node6/*
|
||||||
|
node6-test/*
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,3 +8,4 @@
|
|||||||
.vscode
|
.vscode
|
||||||
package-lock.json
|
package-lock.json
|
||||||
/node6
|
/node6
|
||||||
|
/node6-test
|
||||||
|
@ -11,3 +11,4 @@ node_modules
|
|||||||
*.pyc
|
*.pyc
|
||||||
.vscode
|
.vscode
|
||||||
package-lock.json
|
package-lock.json
|
||||||
|
/node6-test
|
||||||
|
@ -15,9 +15,8 @@ install:
|
|||||||
script:
|
script:
|
||||||
- 'if [ "$NODE7" = "true" ]; then yarn run lint; fi'
|
- 'if [ "$NODE7" = "true" ]; then yarn run lint; fi'
|
||||||
- 'if [ "$NODE7" = "true" ]; then yarn run coverage; fi'
|
- 'if [ "$NODE7" = "true" ]; then yarn run coverage; fi'
|
||||||
- 'if [ "$NODE6" = "true" ]; then yarn run node6; fi'
|
- 'if [ "$NODE6" = "true" ]; then yarn run test-node6-transformer; fi'
|
||||||
- 'if [ "$NODE6" = "true" ]; then yarn run test-node6; fi'
|
- 'if [ "$NODE6" = "true" ]; then yarn run unit-node6; fi'
|
||||||
- 'if [ "$NODE6" = "true" ]; then yarn run node6-sanity; fi'
|
|
||||||
jobs:
|
jobs:
|
||||||
include:
|
include:
|
||||||
- node_js: "7"
|
- node_js: "7"
|
||||||
|
@ -11,15 +11,14 @@
|
|||||||
"unit": "jasmine test/test.js",
|
"unit": "jasmine test/test.js",
|
||||||
"debug-unit": "DEBUG_TEST=true node --inspect-brk ./node_modules/.bin/jasmine test/test.js",
|
"debug-unit": "DEBUG_TEST=true node --inspect-brk ./node_modules/.bin/jasmine test/test.js",
|
||||||
"test-doclint": "jasmine utils/doclint/check_public_api/test/test.js && jasmine utils/doclint/preprocessor/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",
|
"test": "npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer",
|
||||||
"install": "node install.js",
|
"install": "node install.js",
|
||||||
"lint": "([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run doc",
|
"lint": "([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run doc",
|
||||||
"doc": "node utils/doclint/cli.js",
|
"doc": "node utils/doclint/cli.js",
|
||||||
"coverage": "COVERAGE=true npm run unit",
|
"coverage": "COVERAGE=true npm run unit",
|
||||||
"node6": "node utils/node6-transform/index.js",
|
"test-node6-transformer": "jasmine utils/node6-transform/test/test.js",
|
||||||
"test-node6": "jasmine utils/node6-transform/test/test.js",
|
"build": "node utils/node6-transform/index.js",
|
||||||
"build": "npm run node6",
|
"unit-node6": "jasmine node6-test/test.js"
|
||||||
"node6-sanity": "jasmine test/sanity.js"
|
|
||||||
},
|
},
|
||||||
"author": "The Chromium Authors",
|
"author": "The Chromium Authors",
|
||||||
"license": "SEE LICENSE IN LICENSE",
|
"license": "SEE LICENSE IN LICENSE",
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright 2017 Google Inc. All rights reserved.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
console.log(process.version);
|
|
||||||
|
|
||||||
describe('Puppeteer Sanity', function() {
|
|
||||||
it('should not be insane', function(done) {
|
|
||||||
const puppeteer = require('..');
|
|
||||||
puppeteer.launch().then(browser => {
|
|
||||||
browser.newPage().then(page => {
|
|
||||||
page.goto('data:text/html,hello').then(() => {
|
|
||||||
page.evaluate(() => document.body.textContent).then(content => {
|
|
||||||
expect(content).toBe('hello');
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
@ -20,6 +20,7 @@ const path = require('path');
|
|||||||
const helper = require('../lib/helper');
|
const helper = require('../lib/helper');
|
||||||
if (process.env.COVERAGE)
|
if (process.env.COVERAGE)
|
||||||
helper.recordPublicAPICoverage();
|
helper.recordPublicAPICoverage();
|
||||||
|
console.log('Testing on Node', process.version);
|
||||||
const puppeteer = require('..');
|
const puppeteer = require('..');
|
||||||
const SimpleServer = require('./server/SimpleServer');
|
const SimpleServer = require('./server/SimpleServer');
|
||||||
const GoldenUtils = require('./golden-utils');
|
const GoldenUtils = require('./golden-utils');
|
||||||
|
@ -49,6 +49,7 @@ const asyncToGenerator = fn => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} text
|
* @param {string} text
|
||||||
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
function transformAsyncFunctions(text) {
|
function transformAsyncFunctions(text) {
|
||||||
const edits = [];
|
const edits = [];
|
||||||
|
@ -19,18 +19,25 @@ const path = require('path');
|
|||||||
const removeRecursive = require('rimraf').sync;
|
const removeRecursive = require('rimraf').sync;
|
||||||
const transformAsyncFunctions = require('./TransformAsyncFunctions');
|
const transformAsyncFunctions = require('./TransformAsyncFunctions');
|
||||||
|
|
||||||
const dirPath = path.join(__dirname, '..', '..', 'lib');
|
copyFolder(path.join(__dirname, '..', '..', 'lib'), path.join(__dirname, '..', '..', 'node6'));
|
||||||
const outPath = path.join(__dirname, '..', '..', 'node6');
|
copyFolder(path.join(__dirname, '..', '..', 'test'), path.join(__dirname, '..', '..', 'node6-test'));
|
||||||
const fileNames = fs.readdirSync(dirPath);
|
|
||||||
const filePaths = fileNames.filter(fileName => fileName.endsWith('.js'));
|
|
||||||
|
|
||||||
if (fs.existsSync(outPath))
|
|
||||||
removeRecursive(outPath);
|
|
||||||
fs.mkdirSync(outPath);
|
|
||||||
|
|
||||||
filePaths.forEach(filePath => {
|
function copyFolder(source, target) {
|
||||||
const content = fs.readFileSync(path.join(dirPath, filePath), 'utf8');
|
if (fs.existsSync(target))
|
||||||
const output = transformAsyncFunctions(content);
|
removeRecursive(target);
|
||||||
fs.writeFileSync(path.resolve(outPath, filePath), output);
|
fs.mkdirSync(target);
|
||||||
});
|
|
||||||
|
|
||||||
|
fs.readdirSync(source).forEach(file => {
|
||||||
|
const from = path.join(source, file);
|
||||||
|
const to = path.join(target, file);
|
||||||
|
if (fs.lstatSync(from).isDirectory()) {
|
||||||
|
copyFolder(from, to);
|
||||||
|
} else {
|
||||||
|
let text = fs.readFileSync(from);
|
||||||
|
if (file.endsWith('.js'))
|
||||||
|
text = transformAsyncFunctions(text.toString()).replace(/require\('\.\.\/lib\//g, `require('../node6/`);
|
||||||
|
fs.writeFileSync(to, text);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user