test-progress-tracker 2.0.6 → 2.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,38 +3,25 @@
3
3
  [![NPM version][npm-image]][npm-url]
4
4
  [![NPM downloads][downloads-image]][downloads-url]
5
5
 
6
- [![Circle CI][circleci-image]][circleci-url]
7
- [![Travis CI][travis-image]][travis-url]
6
+ [![GitHub Actions][github-action-image]][github-action-url]
8
7
  [![Codecov][codecov-image]][codecov-url]
9
- [![Coveralls Status][coveralls-image]][coveralls-url]
10
8
  [![Codacy Badge][codacy-image]][codacy-url]
11
9
 
12
- [![Greenkeeper badge][green-keeper-image]][green-keeper-url]
13
- [![semantic-release][semantic-release-image]][semantic-release-url]
14
-
15
10
  [![Visual Studio Code][vscode-image]][vscode-url]
16
11
  [![Wallaby.js][wallaby-image]][wallaby-url]
17
12
 
18
13
  Test Progress Tracker.
19
14
 
20
- [circleci-image]: https://circleci.com/gh/unional/test-progress-tracker/tree/master.svg?style=shield
21
- [circleci-url]: https://circleci.com/gh/unional/test-progress-tracker/tree/master
22
15
  [codacy-image]: https://api.codacy.com/project/badge/Grade/b2b1880f3ecd4f2caaeb169a3121e6e9
23
- [codacy-url]: https://www.codacy.com/app/homawong/test-progress-tracker?utm_source=github.com&utm_medium=referral&utm_content=unional/test-progress-tracker&utm_campaign=Badge_Grade
24
- [codecov-image]: https://codecov.io/gh/unional/test-progress-tracker/branch/master/graph/badge.svg
25
- [codecov-url]: https://codecov.io/gh/unional/test-progress-tracker
26
- [coveralls-image]: https://coveralls.io/repos/github/unional/test-progress-tracker/badge.svg
27
- [coveralls-url]: https://coveralls.io/github/unional/test-progress-tracker
16
+ [codacy-url]: https://www.codacy.com/app/homawong/test-progress-tracker?utm_source=github.com&utm_medium=referral&utm_content=cyberuni/test-progress-tracker&utm_campaign=Badge_Grade
17
+ [codecov-image]: https://codecov.io/gh/cyberuni/test-progress-tracker/branch/main/graph/badge.svg
18
+ [codecov-url]: https://codecov.io/gh/cyberuni/test-progress-tracker
28
19
  [downloads-image]: https://img.shields.io/npm/dm/test-progress-tracker.svg?style=flat
29
20
  [downloads-url]: https://npmjs.org/package/test-progress-tracker
30
- [green-keeper-image]: https://badges.greenkeeper.io/unional/test-progress-tracker.svg
31
- [green-keeper-url]: https://greenkeeper.io/
21
+ [github-action-image]: https://github.com/cyberuni/test-progress-tracker/workflows/release/badge.svg
22
+ [github-action-url]: https://github.com/cyberuni/test-progress-tracker/actions?query=workflow%3Arelease
32
23
  [npm-image]: https://img.shields.io/npm/v/test-progress-tracker.svg?style=flat
33
24
  [npm-url]: https://npmjs.org/package/test-progress-tracker
34
- [semantic-release-image]:https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
35
- [semantic-release-url]:https://github.com/semantic-release/semantic-release
36
- [travis-image]: https://img.shields.io/travis/unional/test-progress-tracker/master.svg?style=flat
37
- [travis-url]: https://travis-ci.org/unional/test-progress-tracker?branch=master
38
25
  [vscode-image]: https://img.shields.io/badge/vscode-ready-green.svg
39
26
  [vscode-url]: https://code.visualstudio.com/
40
27
  [wallaby-image]: https://img.shields.io/badge/wallaby.js-configured-green.svg
package/cjs/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../ts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAwB;AACxB,yCAAsB;AACtB,8CAA2B;AAC3B,yCAAsB;AACtB,4CAAyB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../ts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,yCAAsB;AACtB,8CAA2B;AAC3B,yCAAsB;AACtB,4CAAyB"}
package/cjs/monitor.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
2
3
  import fs from 'fs';
3
4
  import readline from 'readline';
4
5
  import { TestResults } from './interface';
package/package.json CHANGED
@@ -1,42 +1,23 @@
1
1
  {
2
2
  "name": "test-progress-tracker",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "description": "Keep track of test progress over time",
5
- "homepage": "https://github.com/unional/test-progress-tracker",
5
+ "homepage": "https://github.com/cyberuni/test-progress-tracker",
6
6
  "bugs": {
7
- "url": "https://github.com/unional/test-progress-tracker/issues"
7
+ "url": "https://github.com/cyberuni/test-progress-tracker/issues"
8
8
  },
9
9
  "repository": {
10
10
  "type": "git",
11
- "url": "https://github.com/unional/test-progress-tracker.git"
11
+ "url": "https://github.com/cyberuni/test-progress-tracker.git"
12
12
  },
13
13
  "license": "MIT",
14
14
  "main": "cjs/index.js",
15
15
  "typings": "cjs/index.d.ts",
16
16
  "files": [
17
17
  "cjs",
18
- "ts"
18
+ "ts",
19
+ "!**/*.{spec,test,unit,accept,integrate,system,perf,stress,study,stories}.*"
19
20
  ],
20
- "scripts": {
21
- "build": "tsc -p tsconfig.cjs.json",
22
- "clean": "rimraf cjs",
23
- "coverage": "jest --coverage",
24
- "dependency-check": "run-p dependency-check:unused dependency-check:missing",
25
- "dependency-check:missing": "dependency-check . --missing --no-dev",
26
- "dependency-check:unused": "dependency-check . --unused --no-dev",
27
- "lint": "eslint --ext=ts,js .",
28
- "size-limit": "echo no size-limit",
29
- "test": "jest",
30
- "release": "npx semantic-release",
31
- "verify": "run-p verify:build lint coverage",
32
- "verify:build": "run-s build dependency-check size-limit",
33
- "watch": "jest --watch"
34
- },
35
- "husky": {
36
- "hooks": {
37
- "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
38
- }
39
- },
40
21
  "dependencies": {
41
22
  "chokidar": "^3.5.2",
42
23
  "global-store": "^1.0.0-beta.19",
@@ -50,8 +31,10 @@
50
31
  "@babel/plugin-proposal-optional-chaining": "^7.16.0",
51
32
  "@babel/preset-env": "^7.16.4",
52
33
  "@babel/preset-typescript": "^7.16.0",
34
+ "@changesets/cli": "^3.0.0",
53
35
  "@commitlint/cli": "^16.0.0",
54
36
  "@commitlint/config-conventional": "^16.0.0",
37
+ "@types/glob": "^8.1.0",
55
38
  "@types/jest": "^27.0.3",
56
39
  "@types/mkdirp": "^1.0.2",
57
40
  "@types/node": "^16.11.11",
@@ -61,7 +44,6 @@
61
44
  "dependency-check": "^4.1.0",
62
45
  "eslint": "^8.4.0",
63
46
  "eslint-plugin-harmony": "^6.0.0",
64
- "husky": "^7.0.4",
65
47
  "is-ci": "^3.0.1",
66
48
  "jest": "^27.4.3",
67
49
  "jest-junit": "^13.0.0",
@@ -73,5 +55,22 @@
73
55
  "npm-run-all": "^4.1.5",
74
56
  "rimraf": "^3.0.0",
75
57
  "typescript": "^4.5.2"
58
+ },
59
+ "scripts": {
60
+ "build": "tsc -p tsconfig.cjs.json",
61
+ "clean": "rimraf cjs",
62
+ "coverage": "jest --coverage",
63
+ "cs": "changeset",
64
+ "dependency-check": "run-p dependency-check:unused dependency-check:missing",
65
+ "dependency-check:missing": "dependency-check . --missing --no-dev",
66
+ "dependency-check:unused": "dependency-check . --unused --no-dev",
67
+ "lint": "eslint --ext=ts,js .",
68
+ "release": "changeset publish",
69
+ "size-limit": "echo no size-limit",
70
+ "test": "jest",
71
+ "verify": "run-p verify:build lint coverage",
72
+ "verify:build": "run-s build dependency-check size-limit",
73
+ "version": "changeset version",
74
+ "watch": "jest --watch"
76
75
  }
77
- }
76
+ }
package/ts/append.spec.ts DELETED
@@ -1,36 +0,0 @@
1
- import rimraf from 'rimraf'
2
- import { append, init, load } from '.'
3
- import { noCoverage } from './testResultsExamples'
4
-
5
- test('create new file', async () => {
6
- const rootDir = 'fixtures/new_file'
7
-
8
- try {
9
- init({ rootDir })
10
- await append(undefined, noCoverage)
11
-
12
- const entries = await load(undefined)
13
- expect(entries.length).toBe(1)
14
- }
15
- finally {
16
- init()
17
- rimraf.sync(rootDir)
18
- }
19
- })
20
-
21
- test('append to file', async () => {
22
- const rootDir = 'fixtures/append_file'
23
-
24
- try {
25
- init({ rootDir })
26
- await append(undefined, noCoverage)
27
- await append(undefined, noCoverage)
28
-
29
- const entries = await load(undefined)
30
- expect(entries.length).toBe(2)
31
- }
32
- finally {
33
- init()
34
- rimraf.sync(rootDir)
35
- }
36
- })
package/ts/init.spec.ts DELETED
@@ -1,30 +0,0 @@
1
- import t from 'assert'
2
- import fs from 'fs'
3
- import rimraf from 'rimraf'
4
- import { init } from '.'
5
- import { PROGRESS_FOLDER } from './constants'
6
-
7
- test('create folder if not exist', () => {
8
- try {
9
- t.strictEqual(fs.existsSync('fixtures/init/create-if-not-exist'), false)
10
- init({ rootDir: 'fixtures/init/create-if-not-exist' })
11
- }
12
- finally {
13
- rimraf.sync('fixtures/init/create-if-not-exist')
14
- }
15
- })
16
-
17
- test('ok if folder already existed', () => {
18
- try {
19
- fs.mkdirSync('fixtures/init/exist')
20
- init({ rootDir: 'fixtures/init/exist' })
21
- }
22
- finally {
23
- rimraf.sync('fixtures/init/exist')
24
- }
25
- })
26
-
27
- test('by default init will create .progress', () => {
28
- init()
29
- t.strictEqual(fs.existsSync(PROGRESS_FOLDER), true)
30
- })
package/ts/load.spec.ts DELETED
@@ -1,9 +0,0 @@
1
- import t from 'assert'
2
- import { load } from '.'
3
- import { store } from './store'
4
-
5
- test('not exist', async () => {
6
- store.value.rootDir = 'fixtures/not-exist'
7
- const actual = await load(undefined)
8
- t.strictEqual(actual.length, 0)
9
- })
package/ts/minify.spec.ts DELETED
@@ -1,44 +0,0 @@
1
- import t from 'assert'
2
- import { minify, unminify } from './minify'
3
- import {
4
- noCoverage,
5
- noCoverageMinified,
6
- coverageNoPercentage,
7
- coverageNoPercentageMinified,
8
- coverageWithPercentage,
9
- coverageWithPercentageMinified,
10
- filtered,
11
- filteredMinified
12
- } from './testResultsExamples'
13
-
14
- test('no coverage', () => {
15
- const minified = minify(noCoverage)
16
- t.deepStrictEqual(minified, noCoverageMinified)
17
-
18
- const unminified = unminify(minified)
19
- t.deepStrictEqual(unminified, noCoverage)
20
- })
21
-
22
- test('filtered', () => {
23
- const minified = minify(filtered)
24
- t.deepStrictEqual(minified, filteredMinified)
25
-
26
- const unminified = unminify(minified)
27
- t.deepStrictEqual(unminified, filtered)
28
- })
29
-
30
- test('with coverage no percentage', () => {
31
- const minified = minify(coverageNoPercentage)
32
- t.deepStrictEqual(minified, coverageNoPercentageMinified)
33
-
34
- const unminified = unminify(minified)
35
- t.deepStrictEqual(unminified, coverageNoPercentage)
36
- })
37
-
38
- test('with coverage with percentage', () => {
39
- const minified = minify(coverageWithPercentage)
40
- t.deepStrictEqual(minified, coverageWithPercentageMinified)
41
-
42
- const unminified = unminify(minified)
43
- t.deepStrictEqual(unminified, coverageWithPercentage)
44
- })
@@ -1,171 +0,0 @@
1
- import t from 'assert'
2
- import { AssertOrder } from 'assertron'
3
- import delay from 'delay'
4
- import fs from 'fs'
5
- import path from 'path'
6
- import rimraf from 'rimraf'
7
- import { append, init, monitor, MonitorSubscription, TestResults } from '.'
8
- import { PROGRESS_FOLDER, TEST_RESULT_FILENAME } from './constants'
9
- import { store } from './store'
10
- import { filtered, noCoverage } from './testResultsExamples'
11
-
12
- test('callback invoked with last save entry initially', async () => {
13
- const rootDir = 'fixtures/monitor/monitor-first'
14
- let sub: MonitorSubscription | undefined
15
- try {
16
- init({ rootDir })
17
- await append({ rootDir }, filtered)
18
- await append({ rootDir }, noCoverage)
19
-
20
- const actual = await new Promise(a => {
21
- sub = monitor({ rootDir, awaitWriteFinish: { pollInterval: 10, stabilityThreshold: 50 } }, (_, testResults) => a(testResults))
22
- })
23
-
24
-
25
- t.deepStrictEqual(actual, noCoverage)
26
- }
27
- finally {
28
- if (sub) await sub.close()
29
- init()
30
- // chokidar seems to have lock issue in Windows
31
- await delay(100)
32
- rimraf.sync(rootDir, {})
33
- }
34
- })
35
-
36
- test('extra empty line in the file is ignored', async () => {
37
- const rootDir = 'fixtures/monitor/monitor-extra-empty-line'
38
- let sub: MonitorSubscription | undefined
39
- try {
40
- init({ rootDir })
41
- await append({ rootDir }, noCoverage)
42
- const filepath = path.join(rootDir, PROGRESS_FOLDER, TEST_RESULT_FILENAME)
43
- fs.appendFileSync(filepath, '\n')
44
-
45
- const actual = await new Promise(a => {
46
- sub = monitor({ rootDir, awaitWriteFinish: { pollInterval: 10, stabilityThreshold: 50 } }, (_, testResults) => a(testResults))
47
- })
48
-
49
-
50
- t.deepStrictEqual(actual, noCoverage)
51
- }
52
- finally {
53
- if (sub) await sub.close()
54
- init()
55
- // chokidar seems to have lock issue in Windows
56
- await delay(100)
57
- rimraf.sync(rootDir)
58
- }
59
- })
60
-
61
- test('callback not invoked when root directory not exist', async () => {
62
- let sub: MonitorSubscription | undefined
63
- try {
64
- store.value.rootDir = 'fixtures/monitor/not-exist'
65
- sub = monitor(undefined, () => { throw new Error('should not call') })
66
- }
67
- finally {
68
- if (sub) await sub.close()
69
- }
70
- })
71
-
72
- test('callback not invoked when result file not exist', async () => {
73
- const rootDir = 'fixtures/monitor/monitor-no-file'
74
- let sub: MonitorSubscription | undefined
75
- try {
76
- init({ rootDir })
77
- sub = monitor({ rootDir }, () => { throw new Error('should not call') })
78
- }
79
- finally {
80
- if (sub) await sub.close()
81
- init()
82
- // chokidar seems to have lock issue in Windows
83
- await delay(100)
84
- rimraf.sync(rootDir)
85
- }
86
- })
87
-
88
- test('delete result file should not trigger', async () => {
89
- const rootDir = 'fixtures/monitor/monitor-delete'
90
-
91
- let sub: MonitorSubscription | undefined
92
- try {
93
- init({ rootDir })
94
- await append({ rootDir }, noCoverage)
95
-
96
- const o = new AssertOrder()
97
- sub = monitor({ rootDir, awaitWriteFinish: { pollInterval: 10, stabilityThreshold: 50 } }, () => o.once(1))
98
- const filePath = path.join(rootDir, TEST_RESULT_FILENAME)
99
- rimraf.sync(filePath)
100
- }
101
- finally {
102
- if (sub) await sub.close()
103
- init()
104
- // chokidar seems to have lock issue in Windows
105
- await delay(100)
106
- rimraf.sync(rootDir)
107
- }
108
- })
109
-
110
- test('trigger on change', async () => {
111
- const rootDir = 'fixtures/monitor/monitor-change'
112
- let sub: MonitorSubscription | undefined
113
- try {
114
- init({ rootDir })
115
- await append({ rootDir }, noCoverage)
116
- const o = new AssertOrder(2)
117
- sub = monitor({ rootDir, awaitWriteFinish: { pollInterval: 10, stabilityThreshold: 50 } }, () => o.any([1, 2]))
118
- await delay(10)
119
- await append({ rootDir }, noCoverage)
120
- await delay(1000)
121
- o.end()
122
- }
123
- finally {
124
- if (sub) await sub.close()
125
- init()
126
- // chokidar seems to have lock issue in Windows
127
- await delay(100)
128
- rimraf.sync(rootDir)
129
- }
130
- })
131
-
132
- test('trigger on new file', async () => {
133
- const rootDir = 'fixtures/monitor/monitor-new'
134
- let sub: MonitorSubscription | undefined
135
- try {
136
- init({ rootDir })
137
-
138
- let accept: (v?: TestResults) => void
139
- const p = new Promise<TestResults | undefined>(a => accept = a)
140
- sub = monitor(
141
- { rootDir, awaitWriteFinish: { pollInterval: 10, stabilityThreshold: 50 } },
142
- (_, testResults) => accept(testResults)
143
- )
144
- // Add a small delay because in circleCI it seems like chokidar can't pick up the next append (new file).
145
- await delay(10)
146
- await append({ rootDir }, noCoverage)
147
- const actual = await p
148
- t.deepStrictEqual(actual, noCoverage)
149
- }
150
- finally {
151
- if (sub) await sub.close()
152
- init()
153
- // chokidar seems to have lock issue in Windows
154
- await delay(100)
155
- rimraf.sync(rootDir)
156
- }
157
- })
158
-
159
- test('file already exists will call once', async () => {
160
- const rootDir = 'fixtures/monitor/exist'
161
- let sub: MonitorSubscription | undefined
162
- try {
163
- let count = 0
164
- sub = monitor({ rootDir, awaitWriteFinish: { pollInterval: 10, stabilityThreshold: 50 } }, () => count++)
165
- await delay(10)
166
- t.strictEqual(count, 1)
167
- }
168
- finally {
169
- if (sub) await sub.close()
170
- }
171
- })