Skip to content

Commit

Permalink
Merge pull request mrdoob#19556 from munrocket/crossenv
Browse files Browse the repository at this point in the history
Package.json: remove cross-env
  • Loading branch information
mrdoob authored Jun 4, 2020
2 parents fcca64f + 2cea5fb commit d081867
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 61 deletions.
56 changes: 2 additions & 54 deletions package-lock.json

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

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"test-unit": "npm run unit --prefix test",
"test-e2e": "node test/e2e/puppeteer.js",
"test-e2e-cov": "node test/e2e/check-coverage.js",
"make-screenshot": "cross-env MAKE=true node test/e2e/puppeteer.js"
"make-screenshot": "node test/e2e/puppeteer.js --make"
},
"keywords": [
"three",
Expand All @@ -83,7 +83,6 @@
"@typescript-eslint/eslint-plugin": "^2.26.0",
"@typescript-eslint/parser": "^2.26.0",
"concurrently": "^5.2.0",
"cross-env": "^7.0.2",
"eslint": "^7.0.0",
"eslint-config-mdcs": "^5.0.0",
"eslint-plugin-html": "^6.0.2",
Expand Down
14 changes: 9 additions & 5 deletions test/e2e/puppeteer.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,16 @@ const pup = puppeteer.launch( {

/* Find files */

const exactList = process.argv.slice( 2 ).map( f => f.replace( '.html', '' ) );
const isMakeScreenshot = process.argv[ 2 ] == '--make';
const isExactList = process.argv.length > ( 2 + isMakeScreenshot );

const exactList = process.argv.slice( isMakeScreenshot ? 3 : 2 )
.map( f => f.replace( '.html', '' ) );

const files = fs.readdirSync( './examples' )
.filter( s => s.slice( - 5 ) === '.html' )
.map( s => s.slice( 0, s.length - 5 ) )
.filter( f => ( process.argv.length > 2 ) ? exactList.includes( f ) : ! exceptionList.includes( f ) );
.filter( f => isExactList ? exactList.includes( f ) : ! exceptionList.includes( f ) );


/* Loop for each file, with CI parallelism */
Expand All @@ -129,7 +133,7 @@ const pup = puppeteer.launch( {

/* At least 3 attempts before fail */

let attemptId = process.env.MAKE ? 1.5 : 0;
let attemptId = isMakeScreenshot ? 1.5 : 0;

while ( attemptId < maxAttemptId ) {

Expand Down Expand Up @@ -218,7 +222,7 @@ const pup = puppeteer.launch( {
}


if ( process.env.MAKE ) {
if ( isMakeScreenshot ) {


/* Make screenshots */
Expand Down Expand Up @@ -315,7 +319,7 @@ const pup = puppeteer.launch( {

console.red( `TEST FAILED! ${ failedScreenshots.length } from ${ endId - beginId } screenshots not pass.` );

} else if ( ! process.env.MAKE ) {
} else if ( ! isMakeScreenshot ) {

console.green( `TEST PASSED! ${ endId - beginId } screenshots correctly rendered.` );

Expand Down

0 comments on commit d081867

Please sign in to comment.