MatrixAI / js-encryptedfs

Encrypted Filesystem for TypeScript/JavaScript Applications
https://polykey.com
Apache License 2.0
10 stars 3 forks source link

Update jest test configuration #29

Closed robert-cronin closed 3 years ago

robert-cronin commented 4 years ago

This applies to EncryptedFS aswell. We should alter the jest configuration to setup module name mapper.

const { pathsToModuleNameMapper } = require('ts-jest/utils');
const { compilerOptions } = require('./tsconfig');
module.exports = {
  "roots": [
    "<rootDir>/tests"
  ],
  "testMatch": [
    "**/?(*.)+(spec|test|unit.test).+(ts|tsx|js)"
  ],
  "transform": {
    "^.+\\.tsx?$": "ts-jest"
  },
  globalSetup : "<rootDir>/tests/setup.ts",
  globalTeardown: "<rootDir>/tests/teardown.ts",
  moduleNameMapper: pathsToModuleNameMapper(
    compilerOptions.paths,
    { prefix: "<rootDir>/src/" }
  )
};

The global set up and teardown might be useful for polykey to set the daemons running or other stateful setup. Tests that aren't unit tests should also be renamed from ...unit.test.ts to ...test.ts

robert-cronin commented 3 years ago

Closing on account of migration to gitlab