-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Change tools mocha + nyc -> jest
- Loading branch information
Showing
9 changed files
with
128 additions
and
429 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module.exports = { | ||
presets: [ | ||
[ | ||
'@babel/preset-env', | ||
{ | ||
targets: { | ||
node: true, | ||
}, | ||
}, | ||
], | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,10 +19,9 @@ | |
}, | ||
"scripts": { | ||
"build": "rollup -c", | ||
"test": "npm run lint && nyc mocha test/*", | ||
"prettier:watch": "onchange '**/*.js' -- prettier --write {{changed}}", | ||
"lint": "eslint --ext .js src/", | ||
"coverage": "nyc report --reporter=text-lcov | coveralls" | ||
"test": "jest --config=./test/unit/jest.config.cjs --coverage=true --coverage-reporters=text", | ||
"prettier:watch": "onchange '**/*.js' -- prettier --write {{changed}}" | ||
}, | ||
"author": "Pazams <[email protected]>", | ||
"license": "MIT", | ||
|
@@ -39,14 +38,13 @@ | |
"@rollup/plugin-commonjs": "^25.0.4", | ||
"@rollup/plugin-node-resolve": "^15.2.1", | ||
"babel-eslint": "^8.0.1", | ||
"babel-jest": "^29.7.0", | ||
"babel-plugin-istanbul": "^6.1.1", | ||
"coveralls": "^3.0.0", | ||
"eslint": "^8.42.0", | ||
"eslint-config-prettier": "^2.9.0", | ||
"eslint-plugin-prettier": "^2.6.0", | ||
"mocha": "^10.2.0", | ||
"mocha-lcov-reporter": "^1.3.0", | ||
"nyc": "^15.1.0", | ||
"jest": "^29.7.0", | ||
"onchange": "^7.1.0", | ||
"prettier": "^1.14.3", | ||
"rollup": "^3.29.1", | ||
|
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
packages/dappauth/test/test.js → packages/dappauth/test/unit/index.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
globals: { | ||
'ts-jest': { | ||
tsconfig: './test/tsconfig.json', | ||
}, | ||
}, | ||
rootDir: '../..', | ||
transform: { | ||
'^.+\\.(ts|tsx)?$': 'ts-jest', | ||
'^.+\\.(js|jsx)$': 'babel-jest', | ||
}, | ||
moduleNameMapper: { | ||
'^(\\.{1,2}/.*)\\.js$': '$1', | ||
}, | ||
verbose: false, | ||
/** | ||
* restoreMocks [boolean] | ||
* | ||
* Default: false | ||
* | ||
* Automatically restore mock state between every test. | ||
* Equivalent to calling jest.restoreAllMocks() between each test. | ||
* This will lead to any mocks having their fake implementations removed | ||
* and restores their initial implementation. | ||
*/ | ||
restoreMocks: true, | ||
/** | ||
* resetModules [boolean] | ||
* | ||
* Default: false | ||
* | ||
* By default, each test file gets its own independent module registry. | ||
* Enabling resetModules goes a step further and resets the module registry before running each individual test. | ||
* This is useful to isolate modules for every test so that local module state doesn't conflict between tests. | ||
* This can be done programmatically using jest.resetModules(). | ||
*/ | ||
resetModules: true, | ||
testMatch: ['<rootDir>/test/unit/**/*.(spec|test).(js|ts)'], | ||
coverageDirectory: '../../.coverage/unit', | ||
collectCoverageFrom: ['src/**'], | ||
collectCoverage: true, | ||
coverageReporters: [ | ||
[ | ||
'json', | ||
{ | ||
file: 'dappauth-unit-coverage.json', | ||
}, | ||
], | ||
], | ||
}; |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.