Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switching mocha karma to jest #204

Open
wants to merge 6 commits into
base: modpack/latest
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"extends": [
"standard",
"standard-react",
"plugin:chai-friendly/recommended",
"@olliecaine/eslint-config"
],
"settings": {
Expand All @@ -15,12 +14,11 @@
"plugins": [
"babel",
"react",
"promise",
"chai-friendly"
"promise"
],
"env": {
"browser" : true,
"mocha" : true,
"jest" : true,
"node": true
},
"globals": {
Expand Down
2 changes: 0 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
"titleBar.activeForeground": "#83ACCE"
},
"javascript.format.enable": false,
"mochaExplorer.files": "src/**/*.spec.ts",
"mochaExplorer.require": "ts-node/register",
"eslint.alwaysShowStatus": true,
"eslint.format.enable": true,
"eslint.lintTask.enable": true,
Expand Down
65 changes: 0 additions & 65 deletions build/karma.config.js

This file was deleted.

52 changes: 30 additions & 22 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
/*
* For a detailed explanation regarding each configuration property and type check, visit:
* https://jestjs.io/docs/configuration
*/
import type { Config } from '@jest/types'

/* eslint-disable max-len */
export default {
const config: Config.InitialOptions = {
// All imported modules in your tests should be mocked automatically
// automock: true, - TODO play around with this to see I we want to enable it

Expand All @@ -15,7 +11,7 @@ export default {
// cacheDirectory: "/private/var/folders/wz/q7jjxq4144dc1x8vytqtkbd80000gn/T/jest_dx",

// Automatically clear mock calls, instances and results before every test
clearMocks: true,
// clearMocks: true,

// Indicates whether the coverage information should be collected while executing the test
collectCoverage: true,
Expand Down Expand Up @@ -43,7 +39,14 @@ export default {
// ],

// An object that configures minimum threshold enforcement for coverage results
// coverageThreshold: undefined,
coverageThreshold: {
global: {
statements: 80,
branches: 80,
functions: 80,
lines: 80,
},
},

// A path to a custom dependency extractor
// dependencyExtractor: undefined,
Expand All @@ -63,7 +66,8 @@ export default {
// A set of global variables that need to be available in all test environments
// globals: {},

// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will
// use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
// maxWorkers: "50%",

// An array of directory names to be searched recursively up from the requiring module's location
Expand Down Expand Up @@ -103,7 +107,7 @@ export default {
// reporters: undefined,

// Automatically reset mock state before every test
// resetMocks: false,
resetMocks: true,

// Reset the module registry before running each individual test
// resetModules: false,
Expand All @@ -112,7 +116,7 @@ export default {
// resolver: undefined,

// Automatically restore mock state and implementation before every test
// restoreMocks: false,
restoreMocks: false,

// The root directory that Jest should scan for tests and modules within
// rootDir: undefined,
Expand All @@ -129,7 +133,8 @@ export default {
// setupFiles: [],

// A list of paths to modules that run some code to configure or set up the testing framework before each test
setupFilesAfterEnv: ['<rootDir>/tests/setupTests.tsx'],
// setupFilesAfterEnv: ['<rootDir>/tests/setupTests.tsx'],
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],

// The number of seconds after which a test is considered as slow and reported as such in the results.
// slowTestThreshold: 5,
Expand All @@ -142,20 +147,20 @@ export default {
testEnvironment: 'node',

// Options that will be passed to the testEnvironment
testEnvironmentOptions: {},
// testEnvironmentOptions: {},

// Adds a location field to test results
// testLocationInResults: false,

// The glob patterns Jest uses to detect test files
testMatch: [
'**/?(*.)+(test).[tj]s?(x)'
'**/?(*.)+(tests).[tj]s?(x)'
],

// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
// testPathIgnorePatterns: [
// "/node_modules/"
// ],
testPathIgnorePatterns: [
'/node_modules/'
],

// The regexp pattern or array of patterns that Jest uses to detect test files
// testRegex: [],
Expand All @@ -173,25 +178,28 @@ export default {
// timers: "real",

// A map from regular expressions to paths to transformers
transform: {
'^.+\\.(ts|tsx)?$': 'ts-jest'
},
// transform: {
// '^.+\\.(ts|tsx)?$': 'ts-jest'
// },

// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
// transformIgnorePatterns: [
// "/node_modules/",
// "\\.pnp\\.[^\\/]+$"
// ],

// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
// An array of regexp pattern strings that are matched against all modules before the module loader will
// automatically return a mock for them
// unmockedModulePathPatterns: undefined,

// Indicates whether each individual test should be reported during the run
// verbose: verbose,
verbose: true,

// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
// watchPathIgnorePatterns: [],

// Whether to use watchman for file crawling
// watchman: true,
}

export default config
7 changes: 7 additions & 0 deletions jest.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// beforeAll(async () => {
// });

// afterAll(async () => {
// });

export { }
Loading
Loading