Skip to content

Commit

Permalink
Support for testing with jest
Browse files Browse the repository at this point in the history
  • Loading branch information
davazp committed Nov 13, 2018
1 parent 0bdafe4 commit 9eb116a
Show file tree
Hide file tree
Showing 8 changed files with 3,693 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
dist
yarn-error.log
coverage
8 changes: 8 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
roots: ["<rootDir>/src"],
transform: {
"^.+\\.tsx?$": "ts-jest"
},
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"]
};
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@
"license": "MIT",
"scripts": {
"build": "tsc --build packages/",
"prettier": "prettier --write '**/*.ts'"
"prettier": "prettier --write '**/*.ts'",
"test": "yarn workspaces run test"
},
"devDependencies": {
"@types/jest": "^23.3.9",
"@types/node": "^10.12.5",
"jest": "^23.6.0",
"prettier": "^1.15.2",
"ts-jest": "^23.10.4",
"typescript": "^3.1.6"
},
"workspaces": [
Expand Down
15 changes: 15 additions & 0 deletions packages/delisp-core/__tests__/reader.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { readFromString } from "../src/";

describe("Reader", () => {
it("should read basic booleans", () => {
expect(readFromString("true")).toEqual({
type: "LiteralBoolean",
value: true
});

expect(readFromString("false")).toEqual({
type: "LiteralBoolean",
value: false
});
});
});
7 changes: 7 additions & 0 deletions packages/delisp-core/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
transform: {
"^.+\\.tsx?$": "ts-jest"
},
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"]
};
3 changes: 2 additions & 1 deletion packages/delisp-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"main": "dist/src/index.js",
"license": "MIT",
"scripts": {
"build": "tsc"
"build": "tsc",
"test": "jest"
}
}
3 changes: 2 additions & 1 deletion packages/delisp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"delisp": "index.js"
},
"scripts": {
"build": "tsc --build"
"build": "tsc --build",
"test": "true"
},
"dependencies": {
"@delisp/core": "0.1.0"
Expand Down
Loading

0 comments on commit 9eb116a

Please sign in to comment.