Skip to content

Commit dc4e33e

Browse files
Merge pull request #12 from wimpyprogrammer/feature/test-release
Test package before npm publish
2 parents 9b7f7cd + 8be810c commit dc4e33e

File tree

7 files changed

+39
-12
lines changed

7 files changed

+39
-12
lines changed

.babelrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"presets": ["@babel/env", "@babel/preset-typescript"]
2+
"presets": ["@babel/env", "@babel/preset-typescript"],
3+
"ignore": ["**/*.spec.js", "**/*.spec.ts"]
34
}

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ end_of_line = lf
99
insert_final_newline = true
1010
indent_style = tab
1111

12+
[*.yml]
13+
indent_style = space
14+
indent_size = 2
15+
1216
[package.json]
1317
indent_style = space
1418
indent_size = 2

.github/workflows/tests.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,9 @@ jobs:
3333

3434
- run: npm install
3535
- run: npm run lint
36-
- run: npm run lint-demo
3736
- run: npm run build
38-
- run: npm run build-demo
39-
- run: npm run build-types
4037
- run: npm run test
38+
- run: npx testpack-cli --keep={ts-jest,typescript} src/e2e.spec.ts
4139

4240
- name: Upload test coverage report to Codecov
4341
uses: codecov/codecov-action@v1

demo/src/demo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { condense, condenseIgnoreCase } from '../../src/index';
1+
import { condense, condenseIgnoreCase } from '../../src';
22
import { autoExpandTextarea } from './utils/auto-expand-field';
33
import { parseString, WhitespaceHandling } from './utils/wordList';
44

package.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,19 @@
1818
"node": ">=10"
1919
},
2020
"scripts": {
21-
"build": "npm run clean && babel src -d lib --extensions '.js,.ts' --ignore '**/*.spec.js','**/*.spec.ts' && npm run build-types",
22-
"build-demo": "wp --config demo/webpack.config.js",
23-
"build-types": "tsc -p ./tsconfig.types.json",
21+
"build": "run-s clean build:*",
22+
"build:src": "babel src -d lib --extensions '.js,.ts'",
23+
"build:demo": "wp --config demo/webpack.config.js",
24+
"build:types": "tsc -p ./tsconfig.types.json",
2425
"clean": "rimraf lib/*",
2526
"format": "prettier --write 'src/**'",
26-
"lint": "tsc -p ./tsconfig.json && eslint ./src --report-unused-disable-directives --ext .js,.ts --parser-options=project:./tsconfig.json",
27-
"lint-demo": "tsc -p ./demo/tsconfig.json && eslint ./demo --report-unused-disable-directives --ext .js,.ts --parser-options=project:./demo/tsconfig.json",
27+
"lint": "run-s lint:*",
28+
"lint:src": "tsc -p ./tsconfig.json && eslint ./src --report-unused-disable-directives --ext .js,.ts --parser-options=project:./tsconfig.json",
29+
"lint:demo": "tsc -p ./demo/tsconfig.json && eslint ./demo --report-unused-disable-directives --ext .js,.ts --parser-options=project:./demo/tsconfig.json",
2830
"precommit": "pretty-quick --staged",
2931
"prepublish": "npx publish-please guard",
3032
"publish-please": "npx publish-please",
31-
"publish-please-prereqs": "npm run lint && npm run test && npm run build",
33+
"publish-please-prereqs": "run-s lint test build",
3234
"test": "jest --coverage"
3335
},
3436
"jest": {
@@ -60,6 +62,7 @@
6062
"husky": "^0.14.3",
6163
"jest": "^26.0.0",
6264
"jest-when": "^2.7.0",
65+
"npm-run-all": "^4.1.5",
6366
"prettier": "^1.13.7",
6467
"pretty-quick": "^1.6.0",
6568
"regenerator-runtime": "^0.13.3",

src/e2e.spec.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { condense, condenseIgnoreCase } from '.';
2+
3+
describe('condense end-to-end', () => {
4+
it('builds a case-sensitive RegEx to match strings', () => {
5+
const stringsToMatch = ['foo', 'foobar', 'Foo', 'fooBarBaz'];
6+
const matcher = condense(stringsToMatch);
7+
8+
expect(matcher).toHaveProperty('flags', '');
9+
expect(matcher).toHaveProperty('source', '(foo(|bar|BarBaz)|Foo)');
10+
});
11+
});
12+
13+
describe('condenseIgnoreCase end-to-end', () => {
14+
it('builds a case-insensitive RegEx to match strings', () => {
15+
const stringsToMatch = ['foo', 'foobar', 'Foo', 'fooBarBaz'];
16+
const matcher = condenseIgnoreCase(stringsToMatch);
17+
18+
expect(matcher).toHaveProperty('flags', 'i');
19+
expect(matcher).toHaveProperty('source', 'foo(|bar(|baz))');
20+
});
21+
});

src/index.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { when } from 'jest-when';
22
import { CharTrie } from './types/charTrie';
33
import * as patternUtils from './utils/pattern';
44
import * as trieUtils from './utils/trie';
5-
import { condense, condenseIgnoreCase } from './index';
5+
import { condense, condenseIgnoreCase } from '.';
66

77
describe('condense', () => {
88
it('builds pattern from trie of words', () => {

0 commit comments

Comments
 (0)