Skip to content

Commit 140e530

Browse files
committed
test coverage and ts-jest
1 parent 16810eb commit 140e530

File tree

6 files changed

+81
-25
lines changed

6 files changed

+81
-25
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
22
build
3-
out
3+
out
4+
coverage

.vscode/launch.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
{
3+
"version": "0.2.0",
4+
"configurations": [
5+
{
6+
"name": "Debug Jest Tests",
7+
"type": "node",
8+
"request": "launch",
9+
"runtimeArgs": ["--inspect-brk", "${workspaceRoot}/node_modules/.bin/jest", "--runInBand"],
10+
"console": "integratedTerminal",
11+
"internalConsoleOptions": "neverOpen"
12+
}
13+
]
14+
}

jest.config.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
transform: {
3+
"^.+\\.tsx?$": "ts-jest",
4+
},
5+
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
6+
testPathIgnorePatterns: ["/lib/", "/node_modules/"],
7+
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
8+
collectCoverage: true,
9+
};

package-lock.json

+54-24
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"license": "ISC",
1414
"dependencies": {
1515
"@types/jest": "^26.0.20",
16+
"ts-jest": "^26.5.1",
1617
"ts-node": "^9.1.1"
1718
},
1819
"devDependencies": {

src/parser.ts

+1
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ export const parser = (filePaths: Array<string>): Array<File> => {
191191
file?.match(
192192
/import(\s+){(\s+)[A-Za-z0-9]+(\s+)}(\s+)from(\s+)[\/A-Za-z0-9."_-]+/g
193193
) || [];
194+
// TODO: Document this in notes. Notice that by using path.join(path.dirname(fullComponentClassPath), relative path of the base path from ComponentClassPath) resolves into the full path of the base path
194195
extendedClassPath = path.join(
195196
path.dirname(filePath),
196197
matchExtendedClassPath[0]

0 commit comments

Comments
 (0)