-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update integration tests and package versions (#211)
* Update gas-types-detailed package * Update LICENSE * update node versions and macos versions in workflows * add NODE_OPTIONS env: max_old_space_size=4096 * support new log-in flow
- Loading branch information
Showing
9 changed files
with
111 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* eslint-disable */ | ||
|
||
/** | ||
* Reference: https://github.com/americanexpress/jest-image-snapshot/blob/main/examples/image-reporter.js | ||
* | ||
* To enable this image reporter, add it to your `jest.config.js` "reporters" definition: | ||
* "reporters": [ "default", "<rootDir>/image-reporter.js" ] | ||
* | ||
* Note: Image Reporter may not work with jest's --forceExit flag | ||
* | ||
* Note: If image reporter doesn't work in pipeline can try running as standalone script | ||
* by creating a separate script file and running like this: | ||
* "test:integration": "jest test/local-development.test || node test/utils/image-reporter-standalone.js" | ||
*/ | ||
|
||
const fs = require('fs'); | ||
const AWS = require('aws-sdk/global'); | ||
const S3 = require('aws-sdk/clients/s3'); // this is needed | ||
require('dotenv').config(); | ||
|
||
const UPLOAD_BUCKET = process.env.S3_BUCKET_NAME; | ||
|
||
if ( | ||
!process.env.S3_BUCKET_NAME || | ||
!process.env.AWS_SECRET_ACCESS_KEY || | ||
!process.env.AWS_ACCESS_KEY_ID | ||
) { | ||
console.log('Missing env variables. Skipping upload of image diff files.'); | ||
} | ||
|
||
AWS.config.update({ | ||
accessKeyId: process.env.AWS_ACCESS_KEY_ID, | ||
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY, | ||
}); | ||
|
||
const s3 = new AWS.S3({ apiVersion: '2006-03-01' }); | ||
|
||
const targetDirectories = [ | ||
'./test/__image_snapshots__/', | ||
'./test/__image_snapshots__/__diff_output__/', | ||
]; | ||
targetDirectories.forEach((targetDirectory) => { | ||
fs.readdirSync(targetDirectory, { withFileTypes: true }).forEach((dirent) => { | ||
if (!dirent.isFile()) return; | ||
const path = `images/${dirent.name}`; | ||
const params = { | ||
Body: fs.readFileSync(`${targetDirectory}/${dirent.name}`), | ||
Bucket: UPLOAD_BUCKET, | ||
Key: path, | ||
ContentType: 'image/png', | ||
}; | ||
s3.putObject(params, (err) => { | ||
if (err) { | ||
console.log(err, err.stack); | ||
} else { | ||
console.log( | ||
`Uploaded file to https://${UPLOAD_BUCKET}.s3.amazonaws.com/${path}` | ||
); | ||
} | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters