Skip to content
This repository was archived by the owner on Oct 16, 2024. It is now read-only.

Commit 39d7672

Browse files
authored
Merge pull request #66 from agile-ts/develop
Develop
2 parents 4dd4b97 + 76f9eca commit 39d7672

File tree

3 files changed

+58
-29
lines changed

3 files changed

+58
-29
lines changed

.circleci/config.yml

Lines changed: 44 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1+
# Following this caching concept https://circleci.com/docs/2.0/persist-data/
2+
13
version: 2.1
24

5+
orbs:
6+
node: circleci/node@4.1.0
7+
38
executors:
49
node-executor:
510
docker:
611
- image: circleci/node:14
712

8-
orbs:
9-
node: circleci/node@4.1.0
10-
1113
jobs:
1214

1315
build:
1416
executor: node-executor
1517
steps:
16-
# Checkout Project
18+
# Checkout Project from Github
1719
- checkout
1820

1921
- run: node --version
@@ -22,20 +24,30 @@ jobs:
2224
- node/install-packages:
2325
pkg-manager: yarn
2426

25-
- restore_cache:
26-
keys:
27-
- v1-dependencies-{{ checksum "yarn.lock" }}
28-
- v1-dependencies-
27+
# Not necessary because of auto caching of circleci/node@4.1.0
28+
# - restore_cache:
29+
# keys:
30+
# - v1-dependencies-{{ checksum "yarn.lock" }}
31+
# # fallback to using the latest cache if no exact match is found
32+
# - v1-dependencies-
33+
34+
- run:
35+
name: ⏳ Install
36+
command: yarn install & npm run package-install
2937

30-
- run: yarn install & npm run package-install
38+
# Not necessary because of auto caching of circleci/node@4.1.0
39+
# - save_cache:
40+
# key: v1-dependencies-{{ checksum "yarn.lock" }}
41+
# paths:
42+
# - ./node_modules
3143

32-
- save_cache:
33-
key: v1-dependencies-{{ checksum "yarn.lock" }}
34-
paths:
35-
- ./node_modules
44+
- run:
45+
name: 🤖 Lint Project
46+
command: yarn run lint
3647

37-
- run: yarn run lint
38-
- run: yarn run build
48+
- run:
49+
name: 🔨 Build Packages
50+
command: yarn run build
3951

4052
# https://circleci.com/docs/2.0/configuration-reference/#persist_to_workspace
4153
- persist_to_workspace:
@@ -49,7 +61,9 @@ jobs:
4961
- attach_workspace:
5062
at: .
5163

52-
- run: yarn run test
64+
- run:
65+
name: 🤔 Test
66+
command: yarn run test
5367

5468
test-coverage:
5569
executor: node-executor
@@ -58,16 +72,18 @@ jobs:
5872
- attach_workspace:
5973
at: .
6074

61-
- run: yarn run test:coverage
75+
- run:
76+
name: 🤔 Test Coverage
77+
command: yarn run test:coverage
6278

6379
# https://circleci.com/docs/2.0/configuration-reference/#store_test_results
6480
- store_test_results:
6581
path: ./test-results
6682

6783
# https://circleci.com/docs/2.0/configuration-reference/#persist_to_workspace
68-
- persist_to_workspace:
69-
root: .
70-
paths: [./*]
84+
# - persist_to_workspace:
85+
# root: .
86+
# paths: [./*]
7187

7288
workflows:
7389
build-and-test:
@@ -76,12 +92,14 @@ workflows:
7692
# Run Build Job
7793
- build
7894

95+
# Not working properly yet see https://discuss.circleci.com/t/command-jest-doesnt-get-executed-runs-endless/38731
7996
# Run Test Job if Build Job has finished
80-
- test:
81-
requires:
82-
- build
97+
# - test:
98+
# requires:
99+
# - build
83100

101+
# Not working properly yet
84102
# Run Test-Coverage Job if Build Job has finished
85-
- test-coverage:
86-
requires:
87-
- build
103+
# - test-coverage:
104+
# requires:
105+
# - build

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"scripts": {
1818
"build": "lerna run build",
1919
"watch": "lerna run watch",
20-
"test": "jest",
20+
"test": "jest --passWithNoTests",
2121
"test:coverage": "jest -i coverage --passWithNoTests",
2222
"dev-publish": "lerna run build && lerna run dev-publish",
2323
"dev-push": "lerna run build && lerna run dev-push",

packages/core/tests/unit/event/event.job.test.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,26 @@ describe('EventJob Tests', () => {
55
const eventJob = new EventJob('myPayload');
66

77
expect(eventJob.payload).toBe('myPayload');
8-
expect(eventJob.creationTimestamp).toBeCloseTo(new Date().getTime(), -1);
8+
expect(eventJob.creationTimestamp).toBeCloseTo(
9+
new Date().getTime(),
10+
calculatePrecision(100)
11+
);
912
expect(eventJob.keys).toBeUndefined();
1013
});
1114

1215
it('should create EventJob (with keys)', () => {
1316
const eventJob = new EventJob('myPayload', ['dummyKey1', 'dummyKey2']);
1417

1518
expect(eventJob.payload).toBe('myPayload');
16-
expect(eventJob.creationTimestamp).toBeCloseTo(new Date().getTime(), -1);
19+
expect(eventJob.creationTimestamp).toBeCloseTo(
20+
new Date().getTime(),
21+
calculatePrecision(100)
22+
);
1723
expect(eventJob.keys).toStrictEqual(['dummyKey1', 'dummyKey2']);
1824
});
1925
});
26+
27+
// https://github.com/facebook/jest/issues/5218
28+
function calculatePrecision(deviation) {
29+
return -Math.log10(2 * deviation);
30+
}

0 commit comments

Comments
 (0)