Skip to content

Commit

Permalink
chore: update jest config
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdbradley committed Jul 17, 2021
1 parent c96a555 commit 428db48
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 9 additions & 7 deletions src/testing/jest/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,26 @@ import { join } from 'path';
const testingDir = __dirname;
const packageRootDir = join(testingDir, '..');

const ext = '.' + (globalThis as any)._MODULE_EXT_;

const moduleExtensions = ['ts', 'tsx', 'js', 'mjs', 'jsx'];
const moduleExtensionRegexp = '(' + moduleExtensions.join('|') + ')';

const jestPreset = {
moduleFileExtensions: [...moduleExtensions, 'json', 'd.ts'],
moduleNameMapper: {
'^@builder.io/qwik/jsx-runtime$': join(packageRootDir, 'jsx-runtime._MODULE_EXT_'),
'^@builder.io/qwik/optimizer$': join(packageRootDir, 'optimizer._MODULE_EXT_'),
'^@builder.io/qwik/server$': join(testingDir, 'index._MODULE_EXT_'),
'^@builder.io/qwik/testing$': join(testingDir, 'index._MODULE_EXT_'),
'^@builder.io/qwik$': join(packageRootDir, 'core._MODULE_EXT_'),
'^@builder.io/qwik/jsx-runtime$': join(packageRootDir, 'jsx-runtime' + ext),
'^@builder.io/qwik/optimizer$': join(packageRootDir, 'optimizer' + ext),
'^@builder.io/qwik/server$': join(packageRootDir, 'server', 'index' + ext),
'^@builder.io/qwik/testing$': join(testingDir, 'index' + ext),
'^@builder.io/qwik$': join(packageRootDir, 'core' + ext),
},
modulePathIgnorePatterns: ['<rootDir>/build', '<rootDir>/dist'],
setupFilesAfterEnv: [join(testingDir, 'jest-setuptestframework._MODULE_EXT_')],
setupFilesAfterEnv: [join(testingDir, 'jest-setuptestframework' + ext)],
testPathIgnorePatterns: ['/.cache', '/.github', '/.vscode', '/build', '/dist', '/node_modules'],
testRegex: '(/__tests__/.*|\\.?(test|spec|unit))\\.' + moduleExtensionRegexp + '$',
transform: {
'^.+\\.(ts|tsx|jsx)$': join(__dirname, 'jest-preprocessor._MODULE_EXT_'),
'^.+\\.(ts|tsx|jsx)$': join(__dirname, 'jest-preprocessor' + ext),
},
watchPathIgnorePatterns: ['^.+\\.d\\.ts$'],
};
Expand Down
4 changes: 1 addition & 3 deletions src/testing/jest/setuptestframework.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
function jestSetupTestFramework() {
beforeEach(() => {});
}
function jestSetupTestFramework() {}

jestSetupTestFramework();

0 comments on commit 428db48

Please sign in to comment.