Skip to content

Commit

Permalink
Migrate to modern standards, part 32
Browse files Browse the repository at this point in the history
  • Loading branch information
adanski committed Jan 6, 2023
1 parent 697f9ec commit 25c3f1b
Show file tree
Hide file tree
Showing 23 changed files with 926 additions and 7,931 deletions.
23 changes: 4 additions & 19 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
dist/
target/

# Dependency directories
# Dependencies
node_modules/
jspm_packages/
package-lock.json

# Logs
logs
logs/
*.log
npm-debug.log*
yarn-debug.log*
Expand All @@ -19,21 +20,11 @@ lerna-debug.log*
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
pids/
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

Expand All @@ -49,12 +40,6 @@ build/Release
# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

Expand Down
58 changes: 58 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import {JestConfigWithTsJest} from 'ts-jest';

/*
* For a detailed explanation regarding each configuration property and type check, visit:
* https://jestjs.io/docs/configuration
*/
const jestConfig: JestConfigWithTsJest = {
// The directory where Jest should store its cached dependency information
cacheDirectory: './dist/test/jest',
// Indicates whether the coverage information should be collected while executing the test
collectCoverage: true,
// The directory where Jest should output its coverage files
coverageDirectory: './dist/test/coverage',
// An array of regexp pattern strings used to skip coverage collection
coveragePathIgnorePatterns: [
'\\.idea\\',
'\\dist\\',
'\\node_modules\\',
'\\test\\',
],
// Indicates which provider should be used to instrument code for coverage
coverageProvider: 'v8',
// An object that configures minimum threshold enforcement for coverage results
coverageThreshold: {
global: {
branches: 80,
functions: 80
},
},
// The default configuration for fake timers
fakeTimers: {
enableGlobally: true
},
// A preset that is used as a base for Jest's configuration
preset: 'ts-jest/presets/js-with-ts-esm-legacy',
// A list of paths to modules that run some code to configure or set up the testing framework before each test
setupFilesAfterEnv: ['./test/fake/polyfill-fake.js'],
// The test environment that will be used for testing
testEnvironment: 'jsdom',
// A map from regular expressions to paths to transformers
transform: {
'^.+\\.[tj]sx?$': [
'ts-jest',
{
useESM: true,
tsconfig: './test/tsconfig.json'
},
],
},
// A list of additional extensions to treat as native ESM (besides .js)
extensionsToTreatAsEsm: ['.ts'],
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources, like images or styles with a single module.
moduleNameMapper: {
'^(\\.{1,2}/.+)\\.js$': '$1',
},
};

export default jestConfig;
Loading

0 comments on commit 25c3f1b

Please sign in to comment.