UNPKG

1.97 kBJavaScriptView Raw
1/**
2 * The path's declared below are relative. Specifically, they are relative to the location of this file after
3 * compilation of the Stencil compiler has completed. See `scripts/bundles/testing` for the location of this file
4 * following compilation.
5 */
6const path = require('path');
7const testingDir = __dirname;
8const rootDir = path.join(testingDir, '..');
9const internalDir = path.join(rootDir, 'internal');
10
11// NOTE: if you change this, also change compiler/transpile.ts
12const moduleExtensions = ['ts', 'tsx', 'js', 'mjs', 'jsx'];
13const moduleExtensionRegexp = '(' + moduleExtensions.join('|') + ')';
14
15module.exports = {
16 moduleFileExtensions: [...moduleExtensions, 'json', 'd.ts'],
17 moduleNameMapper: {
18 '^@stencil/core/cli$': path.join(rootDir, 'cli', 'index.js'),
19 '^@stencil/core/compiler$': path.join(rootDir, 'compiler', 'stencil.js'),
20 '^@stencil/core/internal$': path.join(internalDir, 'testing', 'index.js'),
21 '^@stencil/core/internal/app-data$': path.join(internalDir, 'app-data', 'index.cjs'),
22 '^@stencil/core/internal/app-globals$': path.join(internalDir, 'app-globals', 'index.js'),
23 '^@stencil/core/internal/testing$': path.join(internalDir, 'testing', 'index.js'),
24 '^@stencil/core/mock-doc$': path.join(rootDir, 'mock-doc', 'index.cjs'),
25 '^@stencil/core/sys$': path.join(rootDir, 'sys', 'node', 'index.js'),
26 '^@stencil/core/testing$': path.join(testingDir, 'index.js'),
27 '^@stencil/core$': path.join(internalDir, 'testing', 'index.js'),
28 },
29 setupFilesAfterEnv: [path.join(testingDir, 'jest-setuptestframework.js')],
30 testEnvironment: path.join(testingDir, 'jest-environment.js'),
31 testPathIgnorePatterns: ['/.cache', '/.stencil', '/.vscode', '/dist', '/node_modules', '/www'],
32 testRegex: '(/__tests__/.*|\\.?(test|spec))\\.' + moduleExtensionRegexp + '$',
33 transform: {
34 '^.+\\.(ts|tsx|jsx|css)$': path.join(testingDir, 'jest-preprocessor.js'),
35 },
36 watchPathIgnorePatterns: ['^.+\\.d\\.ts$'],
37};