MCPcopy Create free account
hub / github.com/stenciljs/core / buildTesting

Function buildTesting

scripts/esbuild/testing.ts:26–89  ·  view source on GitHub ↗
(opts: BuildOptions)

Source from the content-addressed store, hash-verified

24];
25
26export async function buildTesting(opts: BuildOptions) {
27 const inputDir = path.join(opts.buildDir, 'testing');
28 const sourceDir = path.join(opts.srcDir, 'testing');
29 await fs.emptyDir(opts.output.testingDir);
30
31 await Promise.all([
32 // copy jest testing entry files
33 fs.copy(path.join(opts.scriptsBundlesDir, 'helpers', 'jest'), opts.output.testingDir),
34 copyTestingInternalDts(opts, inputDir),
35 ]);
36
37 // write package.json
38 writePkgJson(opts, opts.output.testingDir, {
39 name: '@stencil/core/testing',
40 description: 'Stencil testing suite.',
41 main: 'index.js',
42 types: 'index.d.ts',
43 });
44
45 const external = [
46 ...EXTERNAL_TESTING_MODULES,
47 ...externalNodeModules,
48 '../internal/testing/*',
49 '../cli/index.cjs',
50 '../sys/node/index.js',
51 '../compiler/stencil.js',
52 ];
53
54 const aliases = getEsbuildAliases();
55 const testingEsbuildOptions: ESBuildOptions = {
56 ...getBaseEsbuildOptions(),
57 entryPoints: [path.join(sourceDir, 'index.ts')],
58 bundle: true,
59 format: 'cjs',
60 outfile: path.join(opts.output.testingDir, 'index.js'),
61 platform: 'node',
62 logLevel: 'info',
63 external,
64 /**
65 * set `write: false` so that we can run the `onEnd` hook
66 * in `lazyRequirePlugin` and modify the imports
67 */
68 write: false,
69 alias: aliases,
70 banner: { js: getBanner(opts, `Stencil Testing`, true) },
71 plugins: [
72 externalAlias('@app-data', '@stencil/core/internal/app-data'),
73 externalAlias('@platform', '@stencil/core/internal/testing'),
74 externalAlias('../internal/testing/index.js', '@stencil/core/internal/testing'),
75 externalAlias('@stencil/core/dev-server', '../dev-server/index.js'),
76 externalAlias('@stencil/core/mock-doc', '../mock-doc/index.cjs'),
77 lazyRequirePlugin(opts, [
78 '@stencil/core/internal/app-data',
79 '@stencil/core/internal/testing',
80 '../dev-server/index.js',
81 '../internal/testing/index.js',
82 '../mock-doc/index.cjs',
83 ]),

Callers 1

buildAllFunction · 0.90

Calls 11

writePkgJsonFunction · 0.90
getEsbuildAliasesFunction · 0.90
getBaseEsbuildOptionsFunction · 0.90
getBannerFunction · 0.90
externalAliasFunction · 0.90
runBuildsFunction · 0.90
copyTestingInternalDtsFunction · 0.85
lazyRequirePluginFunction · 0.85
joinMethod · 0.80
copyMethod · 0.80

Tested by

no test coverage detected