Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rollup config and register chai global #417

Merged
merged 7 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"spec": "src/**/*.test.ts",
"require": [
"ts-node/register",
"chai/register-assert.js",
"chai/register-expect.js",
"chai/register-should.js"
],
"recursive": true
}
4 changes: 2 additions & 2 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ component_management:
target: 80%

individual_components:
- component_id: '@casper-js-sdk/types'
- component_id: 'casper-js-types'
paths:
- /packages/types/src/
- component_id: '@casper-js-sdk/keys'
- component_id: 'casper-js-keys'
paths:
- /packages/keys/src/

Expand Down
1 change: 1 addition & 0 deletions packages/keys/.mocharc.json
2 changes: 1 addition & 1 deletion packages/keys/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"license": "Apache-2.0",
"scripts": {
"build": "run -T rollup -c",
"test": "run -T cross-env NODE_ENV=test TS_NODE_FILES=true mocha -r ts-node/register \"src/**/*.test.ts\"",
"test": "run -T cross-env NODE_ENV=test TS_NODE_FILES=true mocha",
"test:coverage": "run -T nyc --reporter=lcov yarn test",
"coverage": "run -T codecov"
},
Expand Down
1 change: 0 additions & 1 deletion packages/keys/src/Ed25519.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
decodeBase16,
decodeBase64
} from 'casper-js-types';
import { expect } from 'chai';
import sinon from 'sinon';

import { Ed25519 } from './Ed25519';
Expand Down
1 change: 0 additions & 1 deletion packages/keys/src/Secp256k1.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { CLPublicKey, byteHash, decodeBase16 } from 'casper-js-types';
import { expect } from 'chai';

import { Secp256K1 } from './Secp256k1';

Expand Down
2 changes: 2 additions & 0 deletions packages/keys/src/typings/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare const expect: Chai.ExpectStatic;
declare const assert: Chai.AssertStatic;
1 change: 0 additions & 1 deletion packages/keys/src/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { SignatureAlgorithm } from 'casper-js-types';
import { expect } from 'chai';

import { accountHashHelper } from './utils';

Expand Down
8 changes: 8 additions & 0 deletions packages/keys/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./dist/"
},
"include": ["src"],
"exclude": ["*/**/*.test.ts"]
}
6 changes: 1 addition & 5 deletions packages/keys/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./dist/",
},
"include": ["src"],
"exclude": ["*/**/*.test.ts"]
"include": ["src"]
}
1 change: 1 addition & 0 deletions packages/types/.mocharc.json
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"license": "Apache-2.0",
"scripts": {
"build": "run -T rollup -c",
"test": "run -T cross-env NODE_ENV=test TS_NODE_FILES=true mocha -r ts-node/register \"src/**/*.test.ts\"",
"test": "run -T cross-env NODE_ENV=test TS_NODE_FILES=true mocha",
"test:coverage": "run -T nyc --reporter=lcov yarn test",
"coverage": "run -T codecov"
}
Expand Down
1 change: 0 additions & 1 deletion packages/types/src/ByteConverters.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { expect } from 'chai';
import { Some } from 'ts-results';

import {
Expand Down
2 changes: 0 additions & 2 deletions packages/types/src/CLValue/AccountHash.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { expect } from 'chai';

import { CLAccountHash } from './AccountHash';
import { CLAccountHashType, CLValueParsers } from './index';

Expand Down
2 changes: 0 additions & 2 deletions packages/types/src/CLValue/Bool.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { expect } from 'chai';

import {
CLBool,
CLBoolType,
Expand Down
2 changes: 0 additions & 2 deletions packages/types/src/CLValue/ByteArray.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { expect } from 'chai';

import { CLByteArray, CLByteArrayType, CLValueParsers } from './index';

describe('CLByteArray', () => {
Expand Down
2 changes: 0 additions & 2 deletions packages/types/src/CLValue/Key.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { expect } from 'chai';

import { decodeBase16 } from '../Conversions';
import {
AccessRights,
Expand Down
2 changes: 0 additions & 2 deletions packages/types/src/CLValue/List.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { expect } from 'chai';

import {
CLBool,
CLBoolType,
Expand Down
2 changes: 0 additions & 2 deletions packages/types/src/CLValue/Map.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { expect } from 'chai';

import {
CLBool,
CLI32,
Expand Down
2 changes: 0 additions & 2 deletions packages/types/src/CLValue/Numeric.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { expect } from 'chai';

import {
CLI32,
CLI32Type,
Expand Down
1 change: 0 additions & 1 deletion packages/types/src/CLValue/Option.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { expect } from 'chai';
import { None, Some } from 'ts-results';

import {
Expand Down
2 changes: 0 additions & 2 deletions packages/types/src/CLValue/PublicKey.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { expect } from 'chai';

import { SignatureAlgorithm } from '../types';
import {
CLPublicKey,
Expand Down
1 change: 0 additions & 1 deletion packages/types/src/CLValue/Result.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { expect } from 'chai';
import { Err, Ok, Some } from 'ts-results';

import {
Expand Down
2 changes: 0 additions & 2 deletions packages/types/src/CLValue/String.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { expect } from 'chai';

import { CLString, CLStringType, CLValueParsers } from './index';

describe('CLString', () => {
Expand Down
2 changes: 0 additions & 2 deletions packages/types/src/CLValue/Tuple.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { expect } from 'chai';

import {
CLBool,
CLBoolType,
Expand Down
2 changes: 0 additions & 2 deletions packages/types/src/CLValue/URef.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { expect } from 'chai';

import { decodeBase16 } from '../Conversions';
import { AccessRights, CLURef, CLURefType, CLValueParsers } from './index';

Expand Down
2 changes: 0 additions & 2 deletions packages/types/src/CLValue/Unit.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { expect } from 'chai';

import { CLUnit, CLValueParsers } from './index';

describe('Unit implementation tests', () => {
Expand Down
6 changes: 0 additions & 6 deletions packages/types/src/ChecksummedHex.test.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
import chai from 'chai';

import {
encode,
isChecksummed,
isSamecase,
SMALL_BYTES_COUNT
} from './ChecksummedHex';

chai.should();

const { assert } = chai;

describe('ChecksumedHex', () => {
it('should decode empty input', () => {
const empty = '';
Expand Down
1 change: 0 additions & 1 deletion packages/types/src/StoredValue.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { expect } from 'chai';
import camelCase from 'lodash/camelCase';
import mapKeys from 'lodash/mapKeys';
import { TypedJSON } from 'typedjson';
Expand Down
2 changes: 2 additions & 0 deletions packages/types/src/typings/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare const expect: Chai.ExpectStatic;
declare const assert: Chai.AssertStatic;
8 changes: 8 additions & 0 deletions packages/types/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./dist/"
},
"include": ["src"],
"exclude": ["*/**/*.test.ts"]
}
6 changes: 1 addition & 5 deletions packages/types/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./dist/",
},
"include": ["src"],
"exclude": ["*/**/*.test.ts"]
"include": ["src"]
}
4 changes: 3 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const typescript = require('@rollup/plugin-typescript');
const commonjs = require('@rollup/plugin-commonjs');
const { nodeResolve } = require('@rollup/plugin-node-resolve');
const json = require('@rollup/plugin-json');
const nodePolyfills = require('rollup-plugin-polyfill-node');
Expand Down Expand Up @@ -30,7 +31,8 @@ function getConfig(opts) {

const plugins = [
json(),
typescript({ tsconfig: './tsconfig.json' }),
commonjs(),
typescript({ tsconfig: './tsconfig.build.json' }),
nodeResolve({
exportConditions,
mainFields,
Expand Down
4 changes: 3 additions & 1 deletion tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@
"target": "ES6",
"lib": ["es2015", "dom"],
"skipLibCheck": true
}
},
"typeRoots": ["node_modules/@types", "./typings"],
"types": ["mocha", "chai", "node", "global"]
}
Loading