Skip to content

Commit

Permalink
Add babel transpiling and ts
Browse files Browse the repository at this point in the history
  • Loading branch information
omrilotan committed May 11, 2022
1 parent d357846 commit 4380d9a
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 11 deletions.
12 changes: 6 additions & 6 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
*.md
LICENSE

scripts/*
page/*
docs/*
fixtures/*
jest/*
page/*
scripts/*
src/*
tests/*

babel.config.json
tsconfig.json

fixtures/*
tests/*
src/*
6 changes: 6 additions & 0 deletions jest/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
presets: [
['@babel/preset-env', { targets: { node: 'current' } }],
'@babel/preset-typescript'
]
}
1 change: 1 addition & 0 deletions jest/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {}
7 changes: 7 additions & 0 deletions jest/jest.config.ts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
transformIgnorePatterns: [
'node_modules'
]
}
17 changes: 12 additions & 5 deletions jest/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
{
"type": "module",
"type": "commonjs",
"scripts": {
"cjs": "jest cjs",
"esm": "node --experimental-vm-modules ./node_modules/.bin/jest esm",
"cjs": "jest cjs -c jest.config.js",
"esm": "jest esm -c jest.config.js",
"ts": "jest ts -c jest.config.ts.js",
"pretest": "which jest || npm i",
"test": "npm run esm && npm run cjs"
"test": "npm run esm && npm run cjs && npm run ts"
},
"dependencies": {
"isbot": "../"
},
"devDependencies": {
"jest": "^28.1.0"
"@babel/core": "^7.17.10",
"@babel/preset-env": "^7.17.10",
"@babel/preset-typescript": "^7.16.7",
"@types/jest": "^27.5.0",
"babel-jest": "^28.1.0",
"jest": "^28.1.0",
"ts-jest": "^28.0.2"
}
}
10 changes: 10 additions & 0 deletions jest/ts/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* eslint-env jest */

import isbot from 'isbot'
import { strict as assert } from 'assert'

describe('jest test', (): void => {
test('should pass', (): void => {
assert(isbot('Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)'))
})
})
5 changes: 5 additions & 0 deletions jest/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"compilerOptions": {
"esModuleInterop": true
}
}

0 comments on commit 4380d9a

Please sign in to comment.