-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Remove mocha/chai/nyc dependencies - Add jest + ts-jest dependencies - Update eslintrc for jest - Move mocha/nyc configs to jest config - Add custom environment to fix Uint8Array issues (jestjs/jest#4422) - Add custom reporters for cleaner output - Update test files - Update npm scripts - Break up e2e tests into separate files for concurrency
- Loading branch information
Showing
37 changed files
with
3,702 additions
and
16,921 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,19 @@ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: './jest/custom-environment', | ||
verbose: false, | ||
reporters: [ | ||
'./jest/log-on-fail-reporter.js', | ||
'./jest/summary-reporter.js', | ||
], | ||
setupFilesAfterEnv: ['./jest.setup.js'], | ||
collectCoverage: false, | ||
collectCoverageFrom: [ | ||
'**/src/**/*.ts', | ||
'!**/*.d.ts', | ||
'!**/index.ts', | ||
], | ||
coveragePathIgnorePatterns: [ | ||
'<rootDir>/packages/cashc/src/grammar/', | ||
], | ||
}; |
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 @@ | ||
jest.setTimeout(25000); |
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,32 @@ | ||
// my-custom-environment | ||
const NodeEnvironment = require('jest-environment-node'); | ||
|
||
class CustomEnvironment extends NodeEnvironment { | ||
constructor(config, context) { | ||
Object.assign( | ||
config.globals, | ||
{ | ||
Uint8Array, | ||
ArrayBuffer, | ||
}, | ||
); | ||
super(config, context); | ||
this.testPath = context.testPath; | ||
this.docblockPragmas = context.docblockPragmas; | ||
} | ||
|
||
|
||
async setup() { | ||
await super.setup(); | ||
} | ||
|
||
async teardown() { | ||
await super.teardown(); | ||
} | ||
|
||
runScript(script) { | ||
return super.runScript(script); | ||
} | ||
} | ||
|
||
module.exports = CustomEnvironment; |
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,29 @@ | ||
const chalk = require('chalk'); | ||
const { getConsoleOutput } = require('jest-util'); | ||
const DefaultReporter = require('@jest/reporters/build/default_reporter').default; | ||
const getResultHeader = require('@jest/reporters/build/get_result_header').default; | ||
|
||
const TITLE_BULLET = chalk.bold('\u25cf '); | ||
|
||
// This Jest reporter does not output any console.log except when the tests are | ||
// failing, see: https://github.com/mozilla/addons-frontend/issues/2980. | ||
class LogOnFailReporter extends DefaultReporter { | ||
printTestFileHeader(testPath, config, result) { | ||
this.log(getResultHeader(result, this._globalConfig, config)); | ||
|
||
const consoleBuffer = result.console; | ||
const testFailed = result.numFailingTests > 0; | ||
|
||
if (testFailed && consoleBuffer && consoleBuffer.length) { | ||
this.log( | ||
` ${TITLE_BULLET}Console\n\n${getConsoleOutput( | ||
config.cwd, | ||
!!this._globalConfig.verbose, | ||
consoleBuffer, | ||
)}`, | ||
); | ||
} | ||
} | ||
} | ||
|
||
module.exports = LogOnFailReporter; |
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,3 @@ | ||
const { SummaryReporter } = require('@jest/reporters'); | ||
|
||
module.exports = SummaryReporter; |
Oops, something went wrong.