Skip to content

Commit

Permalink
fix prettier settings to include test/integration dir
Browse files Browse the repository at this point in the history
  • Loading branch information
krzkaczor committed Dec 15, 2019
1 parent f0e94df commit 076f214
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 48 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"build": "rm -rf ./dist && tsc -p ./tsconfig.prod.json && (cd packages/core/ && yarn build) && (cd packages/typechain-target-ethers/ && yarn build) && (cd packages/typechain-target-truffle/ && yarn build) && (cd packages/typechain-target-web3-v1/ && yarn build) && (cd packages/typechain-target-web3-v2/ && yarn build)",
"tslint": "tslint -p ./tsconfig.json -e 'node_modules/**/*' -e '**/node_modules/**/*' 'packages/**/*.ts'",
"tslint:fix": "tslint --fix --format stylish -p ./tsconfig.json -e 'node_modules/**/*' -e '**/node_modules/**/*' 'packages/**/*.ts'",
"format": "prettier --list-different 'packages/**/*.{ts,tsx,json,md,gql}' README.md",
"format:fix": "prettier --write 'packages/**/*.{ts,tsx,json,md,gql}' README.md",
"format": "prettier --list-different 'packages/**/*.{ts,tsx,json,md,gql}' README.md 'test/integration/**/*.{ts,tsx,json,md,gql}'",
"format:fix": "prettier --write 'packages/**/*.{ts,tsx,json,md,gql}' README.md 'test/integration/**/*.{ts,tsx,json,md,gql}'",
"tsc": "tsc --noEmit",
"tsc:truffle": "tsc --noEmit --project ./test/integration/targets/truffle/tsconfig.json",
"prepublishOnly": "yarn test && yarn build",
Expand Down
12 changes: 6 additions & 6 deletions test/integration/before.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const prepare = require("mocha-prepare");
import { readFileSync } from 'fs';
import { removeSync } from 'fs-extra';
import { join } from 'path';
import { tsGenerator } from 'ts-generator';
import { TPluginCfg } from 'ts-generator/dist/parseConfigFile';
import { readFileSync } from "fs";
import { removeSync } from "fs-extra";
import { join } from "path";
import { tsGenerator } from "ts-generator";
import { TPluginCfg } from "ts-generator/dist/parseConfigFile";

import { ITypeChainCfg, TypeChain } from '../../packages/core/lib/TypeChain';
import { ITypeChainCfg, TypeChain } from "../../packages/core/lib/TypeChain";

/**
* NOTE: this is done here only to easily count code coverage.
Expand Down
20 changes: 9 additions & 11 deletions test/integration/targets/ethers/ContractWithLibrary.spec.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import { expect } from 'chai';
import { expect } from "chai";

import { getTestSigner } from './ethers';
import { ContractWithLibrary } from './types/ethers-contracts/ContractWithLibrary';
import { getTestSigner } from "./ethers";
import { ContractWithLibrary } from "./types/ethers-contracts/ContractWithLibrary";
import {
ContractWithLibraryFactory,
ContractWithLibraryLibraryAddresses,
} from './types/ethers-contracts/ContractWithLibraryFactory';
import { TestLibrary } from './types/ethers-contracts/TestLibrary';
import { TestLibraryFactory } from './types/ethers-contracts/TestLibraryFactory';
ContractWithLibraryFactory,
ContractWithLibraryLibraryAddresses,
} from "./types/ethers-contracts/ContractWithLibraryFactory";
import { TestLibrary } from "./types/ethers-contracts/TestLibrary";
import { TestLibraryFactory } from "./types/ethers-contracts/TestLibraryFactory";

describe("ContractWithLibrary", () => {

let testLibrary: TestLibrary;
let contract: ContractWithLibrary;

Expand All @@ -28,7 +27,7 @@ describe("ContractWithLibrary", () => {
const linkedBytecode = ContractWithLibraryFactory.linkBytecode({
"__./ContractWithLibrary.sol:TestLibrar__": testLibrary.address,
});
expect(linkedBytecode).to.match(/^0x[0-9a-f]{100,}$/); // no more link placeholders
expect(linkedBytecode).to.match(/^0x[0-9a-f]{100,}$/); // no more link placeholders
const trimmedLibraryAddress = testLibrary.address.replace(/^0x/, "").toLowerCase();
const matchedAddresses = linkedBytecode.match(new RegExp(trimmedLibraryAddress, "g"));
expect(matchedAddresses).not.to.be.undefined;
Expand All @@ -48,5 +47,4 @@ describe("ContractWithLibrary", () => {
await contract.setVal(336);
expect((await contract.val()).toNumber()).to.eq(420);
});

});
10 changes: 2 additions & 8 deletions test/integration/targets/ethers/DumbContract.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,9 @@ describe("DumbContract", () => {

it("should allow connecting to an existing contract instance with signer or provider", async () => {
const contract1 = await new DumbContractFactory(getTestSigner()).deploy(42);
const contract2 = DumbContractFactory.connect(
contract1.address,
getTestSigner(),
);
const contract2 = DumbContractFactory.connect(contract1.address, getTestSigner());
expect(await contract2.functions.counter()).to.be.deep.eq(new BigNumber("42"));
const contract3 = DumbContractFactory.connect(
contract1.address,
getTestSigner().provider!,
);
const contract3 = DumbContractFactory.connect(contract1.address, getTestSigner().provider!);
expect(await contract3.functions.counter()).to.be.deep.eq(new BigNumber("42"));
});

Expand Down
4 changes: 1 addition & 3 deletions test/integration/targets/ethers/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,5 @@
"declaration": true,
"skipLibCheck": true
},
"include": [
"./**/*.ts"
]
"include": ["./**/*.ts"]
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from 'chai';
import { expect } from "chai";

import { ContractWithOverloads } from './types/web3-v1-contracts/ContractWithOverloads';
import { accounts, deployContract, isBigNumber } from './web3';
import { ContractWithOverloads } from "./types/web3-v1-contracts/ContractWithOverloads";
import { accounts, deployContract, isBigNumber } from "./web3";

describe("ContractWithOverloads", () => {
it("should work", async () => {
Expand Down
6 changes: 3 additions & 3 deletions test/integration/targets/web3-v1/DumbContract.spec.web3.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from 'chai';
import { expect } from "chai";

import { DumbContract } from './types/web3-v1-contracts/DumbContract';
import { accounts, deployContract, isBigNumber } from './web3';
import { DumbContract } from "./types/web3-v1-contracts/DumbContract";
import { accounts, deployContract, isBigNumber } from "./web3";

describe("DumbContract", () => {
function deployDumbContract(): Promise<DumbContract> {
Expand Down
4 changes: 1 addition & 3 deletions test/integration/targets/web3-v1/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,5 @@
"esModuleInterop": true,
"skipLibCheck": true
},
"include": [
"./**/*.ts"
]
"include": ["./**/*.ts"]
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from 'chai';
import { expect } from "chai";

import { ContractWithOverloads } from './types/web3-v2-contracts/ContractWithOverloads';
import { accounts, deployContract, isBigNumber } from './web3';
import { ContractWithOverloads } from "./types/web3-v2-contracts/ContractWithOverloads";
import { accounts, deployContract, isBigNumber } from "./web3";

describe("ContractWithOverloads", () => {
it("should work", async () => {
Expand Down
6 changes: 3 additions & 3 deletions test/integration/targets/web3-v2/DumbContract.spec.web3.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from 'chai';
import { expect } from "chai";

import { DumbContract } from './types/web3-v2-contracts/DumbContract';
import { accounts, deployContract, isBigNumber } from './web3';
import { DumbContract } from "./types/web3-v2-contracts/DumbContract";
import { accounts, deployContract, isBigNumber } from "./web3";

describe("DumbContract", () => {
function deployDumbContract(): Promise<DumbContract> {
Expand Down
4 changes: 1 addition & 3 deletions test/integration/targets/web3-v2/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,5 @@
"skipLibCheck": true,
"types": ["node", "mocha"]
},
"include": [
"./**/*.ts"
]
"include": ["./**/*.ts"]
}

0 comments on commit 076f214

Please sign in to comment.