Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
y-nk committed Dec 21, 2022
0 parents commit 2c4e473
Show file tree
Hide file tree
Showing 14 changed files with 7,498 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .codesandbox/workspace.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"responsive-preview": {
"Mobile": [
320,
675
],
"Tablet": [
1024,
765
],
"Desktop": [
1400,
800
],
"Desktop HD": [
1920,
1080
]
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
12 changes: 12 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "all",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"fluid": false,
"arrowParens": "always"
}
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# ts-jest code sandbox

Here's a ready to go code-sandbox to do ts-jest testing for interviews. Fork it with your account and invite the candidate to a live coding session (from the menu on the left, on codesandbox)

[![sandbox](./sandbox.svg)](https://codesandbox.io/s/github/y-nk/ts-jest-codesandbox/tree/main)
1 change: 1 addition & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = { presets: ['@babel/preset-env'] };
12 changes: 12 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<html>
<head>
<title>Sandbox</title>
<meta charset="UTF-8" />
</head>

<body>
<div id="app"></div>

<script src="src/index.ts"></script>
</body>
</html>
7 changes: 7 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
preset: 'ts-jest',
transform: {
'^.+\\.(ts|tsx)?$': 'ts-jest',
'^.+\\.(js|jsx)$': 'babel-jest',
},
};
1 change: 1 addition & 0 deletions lib/patch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log('hello world');
27 changes: 27 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "@y_nk/ts-jest-codesandbox",
"version": "1.0.0",
"description": "",
"main": "index.html",
"scripts": {
"start": "parcel index.html --open",
"build": "parcel build index.html",
"test": "NODE_OPTIONS='-r ./lib/patch.js' jest"
},
"dependencies": {
"babel-jest": "^27.4.6",
"jest": "27.4.7",
"parcel-bundler": "^1.6.1",
"ts-jest": "^27.1.3"
},
"devDependencies": {
"@jest/types": "27.4.2",
"@types/jest": "^29.2.4",
"jest": "27.4.7",
"typescript": "4.4.4"
},
"resolutions": {
"@babel/preset-env": "7.13.8"
},
"keywords": []
}
14 changes: 14 additions & 0 deletions sandbox.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { main } from "./index";

test("validate main function", () => {
expect(main([0])).toMatchObject([0]);
});
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function main(arr: number[]): number[] {
return arr;
}
20 changes: 20 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"strict": true,
"module": "commonjs",
"jsx": "preserve",
"esModuleInterop": true,
"sourceMap": true,
"allowJs": true,
"lib": [
"es6",
"dom"
],
"rootDir": "src",
"moduleResolution": "node",
"types": [
"jest",
"node"
]
}
}
Loading

0 comments on commit 2c4e473

Please sign in to comment.