Add a test to keep artifact sizes down
This commit is contained in:
parent
7cf60fa927
commit
fa1db64a8e
@ -12,6 +12,8 @@
|
||||
"scripts": {
|
||||
"build": "yarn tsc -b",
|
||||
"build:ci": "yarn build",
|
||||
"test": "yarn run_mocha",
|
||||
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --bail --exit",
|
||||
"clean": "shx rm -rf lib"
|
||||
},
|
||||
"repository": {
|
||||
@ -25,7 +27,12 @@
|
||||
"homepage": "https://github.com/0xProject/0x-monorepo/packages/contract-artifacts/README.md",
|
||||
"devDependencies": {
|
||||
"shx": "^0.2.2",
|
||||
"typescript": "3.0.1"
|
||||
"typescript": "3.0.1",
|
||||
"chai": "^4.0.1",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"make-promises-safe": "^1.1.0",
|
||||
"mocha": "^4.1.0",
|
||||
"lodash": "^4.17.11"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
35
packages/contract-artifacts/test/contract_artifacts_test.ts
Normal file
35
packages/contract-artifacts/test/contract_artifacts_test.ts
Normal file
@ -0,0 +1,35 @@
|
||||
import * as chai from 'chai';
|
||||
import * as dirtyChai from 'dirty-chai';
|
||||
import { get } from 'lodash';
|
||||
import 'mocha';
|
||||
|
||||
import * as artifacts from '../src/index';
|
||||
|
||||
chai.use(dirtyChai);
|
||||
|
||||
const expect = chai.expect;
|
||||
|
||||
describe('Contract Artifacts', () => {
|
||||
const forbiddenProperties = [
|
||||
'compilerOutput.evm.bytecode.sourceMap',
|
||||
'compilerOutput.evm.bytecode.opcodes',
|
||||
'sourceCodes',
|
||||
'sources',
|
||||
'compiler',
|
||||
];
|
||||
it('should not include forbidden attributes', () => {
|
||||
const forbiddenPropertiesByArtifact: { [name: string]: string[] } = {};
|
||||
for (const [artifactName, artifact] of Object.entries(artifacts)) {
|
||||
for (const forbiddenProperty of forbiddenProperties) {
|
||||
const rejectedValue = get(artifact, forbiddenProperty);
|
||||
if (rejectedValue) {
|
||||
const previousForbidden = forbiddenPropertiesByArtifact[artifactName];
|
||||
forbiddenPropertiesByArtifact[artifactName] = previousForbidden
|
||||
? [...previousForbidden, forbiddenProperty]
|
||||
: [forbiddenProperty];
|
||||
}
|
||||
}
|
||||
}
|
||||
expect(forbiddenPropertiesByArtifact).to.be.eq({});
|
||||
});
|
||||
});
|
@ -5,7 +5,7 @@
|
||||
"rootDir": ".",
|
||||
"resolveJsonModule": true
|
||||
},
|
||||
"include": ["./src/**/*"],
|
||||
"include": ["./src/**/*", "./test/**/*"],
|
||||
"files": [
|
||||
"./artifacts/AssetProxyOwner.json",
|
||||
"./artifacts/DutchAuction.json",
|
||||
|
Loading…
x
Reference in New Issue
Block a user