Sha256: 0c0b642b71354df13b6574ccfab9d5044f8f9c2ec481b0aded3862aeb962b8f6
Contents?: true
Size: 1.67 KB
Versions: 15
Compression:
Stored size: 1.67 KB
Contents
const path = require("path"); const { app_javascript, node_modules, node_modules_included, createTestCompiler, createTrackLoader, } = require("./__utils__/webpack"); const esbuildConfig = require("../esbuild"); jest.mock("../../config", () => { const original = jest.requireActual("../../config"); return { ...original, webpack_loader: "esbuild", additional_paths: [...original.additional_paths, "node_modules/included"], }; }); const createWebpackConfig = (file, use) => { return { entry: { file }, module: { rules: [ { ...esbuildConfig, use, }, ], }, output: { path: "/", filename: "scripts-bundled.js", }, }; }; describe("swc", () => { test("process source path", async () => { const normalPath = `${app_javascript}/a.js`; const [tracked, loader] = createTrackLoader(); const compiler = createTestCompiler( createWebpackConfig(normalPath, loader) ); await compiler.run(); expect(tracked[normalPath]).toBeTruthy(); }); test("exclude node_modules", async () => { const ignored = `${node_modules}/a.js`; const [tracked, loader] = createTrackLoader(); const compiler = createTestCompiler(createWebpackConfig(ignored, loader)); await compiler.run(); expect(tracked[ignored]).toBeUndefined(); }); test("explicitly included node_modules should be transpiled", async () => { const included = `${node_modules_included}/a.js`; const [tracked, loader] = createTrackLoader(); const compiler = createTestCompiler(createWebpackConfig(included, loader)); await compiler.run(); expect(tracked[included]).toBeTruthy(); }); });
Version data entries
15 entries across 15 versions & 1 rubygems